diff --git a/x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts b/x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts index 3e7660c427be7..41beecee82245 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/client/index.test.ts @@ -1250,11 +1250,15 @@ describe('Observability AI Assistant client', () => { await requestAlertsFunctionCall(); + await requestAlertsFunctionCall(); + + await requestAlertsFunctionCall(); + await finished(stream); }); it('executed the function no more than three times', () => { - expect(functionClientMock.executeFunction).toHaveBeenCalledTimes(3); + expect(functionClientMock.executeFunction).toHaveBeenCalledTimes(5); }); it('does not give the LLM the choice to call a function anymore', () => { diff --git a/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts b/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts index 0e3927f82370d..c100cd05cd7ae 100644 --- a/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts +++ b/x-pack/plugins/observability_ai_assistant/server/service/client/index.ts @@ -175,7 +175,7 @@ export class ObservabilityAIAssistantClient { let numFunctionsCalled: number = 0; - const MAX_FUNCTION_CALLS = 3; + const MAX_FUNCTION_CALLS = 5; const MAX_FUNCTION_RESPONSE_TOKEN_COUNT = 4000; const next = async (nextMessages: Message[]): Promise => {