Skip to content

Commit

Permalink
[Obs AI Assistant] Increase no of max function calls to 5 (elastic#17…
Browse files Browse the repository at this point in the history
…5588)

The function limit of 3 is too low, it runs into issues w/ ES|QL query
generation if the `get_dataset_info` and `execute_query` functions are
used.

(cherry picked from commit beff74e)
  • Loading branch information
dgieselaar committed Jan 26, 2024
1 parent 1f1f85f commit b8e3f18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
Expand Down

0 comments on commit b8e3f18

Please sign in to comment.