Generate a chat completion
Technical Preview
Create a new chat completion by using the Observability AI Assistant.
The API returns the model's response based on the current conversation context.
It also handles any tool requests within the conversation, which may trigger multiple calls to the underlying large language model (LLM).
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
Body
-
A unique identifier for the connector.
-
A unique identifier for the conversation if you are continuing an existing conversation.
-
Flag indicating whether all function calls should be disabled for the conversation. If true, no calls to functions will be made.
-
An array of instruction objects, which can be either simple strings or detailed objects.
-
An array of message objects containing the conversation history.
-
Indicates whether the conversation should be saved to storage. If true, the conversation will be saved and will be available in Kibana.
-
A title for the conversation.
curl --request POST 'localhost:5601/api/observability_ai_assistant/chat/complete' -u <username>:<password> -H 'kbn-xsrf: true' -H "Content-Type: application/json" --data '
{
"connectorId": "<connectorId>",
"disableFunctions": false,
"messages": [
{
"@timestamp": "2025-06-25T23:45:00.000Z",
"message": {
"role": "user",
"content": "Is my Elasticsearch cluster healthy right now?"
}
}
],
"persist": false,
"actions": [
{
"name": "get_cluster_health",
"description": "Fetch the current Elasticsearch cluster-health status and key metrics.",
"parameters": {
"type": "object",
"properties": {
"includeShardStats": {
"type": "boolean",
"default": false
}
}
}
}
],
"instructions": ["When the user asks about Elasticsearch cluster health, use the get_cluster_health tool to retrieve cluster health, then summarize the response in plain English."]
}'
{
"connectorId": "<connectorId>",
"disableFunctions": false,
"messages": [
{
"@timestamp": "2025-06-25T23:45:00.000Z",
"message": {
"role": "user",
"content": "Is my Elasticsearch cluster healthy right now?"
}
}
],
"persist": false,
"actions": [
{
"name": "get_cluster_health",
"description": "Fetch the current Elasticsearch cluster-health status and key metrics.",
"parameters": {
"type": "object",
"properties": {
"includeShardStats": {
"type": "boolean",
"default": false
}
}
}
}
],
"instructions": ["When the user asks about Elasticsearch cluster health, use the get_cluster_health tool to retrieve cluster health, then summarize the response in plain English."]
}
data: {"model":"unknown","choices":[{"delta":{"content":"","function_call":{"name":"get_cluster_health","arguments":"{\"includeShardStats\":true}"}},"finish_reason":null,"index":0}],"created":1750936626911,"id":"9c8eff9b-4fd4-4203-a4ab-2e364688deff","object":"chat.completion.chunk"}
data: [DONE]