AI assistant giving errors

We've set up the Azure OpenAI connector and things are looking good when testing the connector. We also see requests comming into the model on the Azure side.

However we get an error in Kibana saying

Failed to load response from the AI Assistant
Error: an error occurred while running the action - Status code: 400. Message: API Error: model_error - 'arguments' is a required property - 'messages.4.function_call

Anyone have any input on what is wrong or how to debug this further?

Thanks for reaching out, @flalar. Can you say a bit more about how you connect here?

While this isn't exactly the same issue, I did find some related Stack Overflow posts to suggest this may be related to how you are formatting your request, so if you have a code snippet, that may be helpful.

Also, what version of Elastic are you using?

Yea, we saw those stackoverflow post too .

We can trigger the error by clicking any option related to the AI Assistant within Kibana. To be specific we can do it from the Observability > Logs Explorer > Log Details > What is this message

we get this stack trace

Error: an error occurred while running the action - Status code: 400. Message: API Error: model_error - 'arguments' is a required property - 'messages.4.function_call'
    at Object.next (https://urltoelasticcluster/465f50087cd0/bundles/plugin/observabilityAIAssistant/1.0.0/observabilityAIAssistant.chunk.2.js:3:456)
    at https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:377:1543010
    at t._next (https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:46050)
    at t.next (https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:361:30508)
    at https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:361:24634
    at t._next (https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:46050)
    at t.next (https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:361:30508)
    at https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:351:64560
    at i (https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:361:239716)
    at t.next (https://urltoelasticcluster/465f50087cd0/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:351:64347)

And we find this corresponding message in the kibana logs

action execution failure: .gen-ai:f8762be4-357c-4c7a-82f6-0cff6f879399: AzOpenAI

We are on Version 8.14.3

Thanks, @flalar. Was this working at one point, or did you get errors when setting it up? How is your connector set up?

You may want to double-check our guide on setting up, too:

We did double check the guide

Our deployment had defaulted to gpt-4 turbo with api-version=2024-08-01-preview

We redeployed it with gpt-4 0613 and set the api-version=2023-07-01-preview like de documentation states, but we still get the same error

When testing the connector from the connectors page is says "test was successful"

From any other page using the AI assistant, we get the same error as mentioned above.

We also see requests comming into the model on the azure side of things.

@jessgarson , so this was strange. As looking at some other settings and tried to anable this tech preview feature

and suddenly things seem to be working as expected. When switching it of things stop working again. Is it a bug?

As this experimental feature is probably slowing things down a bit, we would prefer not to have it enabled.

Hi @flalar,

I apologize for not getting back to you sooner; I had yesterday off for a public holiday.

I suspect this was an intermittent issue. If you haven't already, it's worth filing a bug report. I appreciate the feedback you shared, too.

Best,

Jessica