From f51584cc3a159d1522525e1ac5fecb852dd709c7 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Fri, 26 Jan 2024 12:49:45 +0100 Subject: [PATCH] [8.12] [Obs AI Assistant] Increase no of max function calls to 5 (#175588) (#175668) # Backport This will backport the following commits from `main` to `8.12`: - [[Obs AI Assistant] Increase no of max function calls to 5 (#175588)](https://github.com/elastic/kibana/pull/175588) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../server/service/client/index.test.ts | 6 +++++- .../server/service/client/index.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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 => {