Browse Source

Bugfix/required tool call in AI agent (#8136)

Fix required tool call in AI agent
pull/8137/head
Thomas Kaul 4 days ago
committed by GitHub
parent
commit
9aaf28b00e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      apps/api/src/app/endpoints/ai/ai.service.spec.ts
  2. 10
      apps/api/src/app/endpoints/ai/ai.service.ts

3
apps/api/src/app/endpoints/ai/ai.service.spec.ts

@ -892,7 +892,7 @@ describe('AiService', () => {
}); });
}); });
it('Restricts the routing to endpoints with zero data retention, limits the number of steps, requires a tool call in the first step and allows no tool call in the last step', async () => { it('Restricts the routing to endpoints with zero data retention, disables the reasoning, limits the number of steps, requires a tool call in the first step and allows no tool call in the last step', async () => {
mockRowMatches({}); mockRowMatches({});
await aiService.getActivitiesFromRows({ await aiService.getActivitiesFromRows({
@ -905,6 +905,7 @@ describe('AiService', () => {
expect(chat).toHaveBeenCalledWith('agent-model', { expect(chat).toHaveBeenCalledWith('agent-model', {
provider: { require_parameters: true, zdr: true }, provider: { require_parameters: true, zdr: true },
reasoning: { effort: 'none' },
usage: { include: true } usage: { include: true }
}); });

10
apps/api/src/app/endpoints/ai/ai.service.ts

@ -517,10 +517,11 @@ export class AiService {
* tools search-asset-profiles and get-accounts of the server of the Model * tools search-asset-profiles and get-accounts of the server of the Model
* Context Protocol. The accounts are given without values. The first step * Context Protocol. The accounts are given without values. The first step
* requires a tool call, as a model can give the matches without any tool * requires a tool call, as a model can give the matches without any tool
* call otherwise. The last step allows no tool call, so that the model * call otherwise. The reasoning is disabled, as some models ignore a
* always gives the matches. An asset match whose asset profile no search * required tool call while they reason. The last step allows no tool call,
* gave is left out, as the import refuses a symbol which the data source * so that the model always gives the matches. An asset match whose asset
* cannot resolve. * profile no search gave is left out, as the import refuses a symbol which
* the data source cannot resolve.
*/ */
private async getRowMatches({ private async getRowMatches({
abortSignal, abortSignal,
@ -555,6 +556,7 @@ export class AiService {
modelPropertyKey: PROPERTY_OPENROUTER_MODEL_AGENT, modelPropertyKey: PROPERTY_OPENROUTER_MODEL_AGENT,
settings: { settings: {
provider: { require_parameters: true, zdr: true }, provider: { require_parameters: true, zdr: true },
reasoning: { effort: 'none' },
usage: { include: true } usage: { include: true }
} }
}), }),

Loading…
Cancel
Save