Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch 3.4
Describe the issue:
I’ve followed all the steps to configure agentic search on my local OpenSearch server to use a local LLM running under Ollama. However, my query produces the error below.
ChatGPT suggests that this is a bug with the information below. It suggests that I implement a proxy to convert the float that is causing the problem to an integer. This seems like a long way to go to address this issue.
Can anyone shed any additional light on this problem? Should I open an issue on this?
Note: It would be great of this forum included an additional category for AI-related plugins.
This is a type-compatibility bug at the OpenSearch ↔ Ollama boundary
OpenSearch’s agent framework is emitting tool-call objects where
tool_calls[*].indexis serialized as0.0(a floating-point JSON number).Ollama’s OpenAI-compatible handler defines
ToolCall.Indexas an integer and uses Go JSON unmarshalling, which rejects0.0for anint.OpenSearch documentation/examples show this “
.0numeric” pattern ("index": 0.0) in agent outputs, which strongly suggests OpenSearch is using a floating numeric type internally (e.g.,Double) and round-tripping it back into subsequent requests.What’s happening in your run
Agentic execution is multi-step:
Model returns tool calls
OpenSearch executes tools
OpenSearch calls the model again, including prior assistant messages with
tool_calls
It’s step (3) where OpenSearch sendsindex: 0.0back to Ollama, and Ollama fails.
Configuration:
OS/Hardware: MacOS: MacBook Pro M3 Max
OpenSearch: OpenSearch 3.4 running under Docker
LLM: A Qwen model running under Ollama. Ollama is running on host
Relevant Logs or Screenshots:
This is the query I issued using curl (sorry for the formatting):
curl -k -u admin:admin -X GET “``http://localhost:9200/able_chunks_v1/_search?search_pipeline=agentic-pipeline``” -H “Content-Type: application/json” -d ‘{
“query”: {
“agentic”: {
“query_text”: “How many documents are there in the index”
}
}
}’
And this is the error:
”json: cannot unmarshal number 0.0 into Go struct field ToolCall.messages.tool_calls.index of type int”
Full error:
{“error”:{“root_cause”:[{“type”:“illegal_argument_exception”,“reason”:“Agentic search failed - Agent execution error - Agent ID: [_Nh7rZsBMCptIK-aGFFT], Error: [Error from remote service: {"error":{"message":"json: cannot unmarshal number 0.0 into Go struct field ToolCall.messages.tool_calls.index of type int","type":"invalid_request_error","param":null,"code":null}}]”}],“type”:“illegal_argument_exception”,“reason”:“Agentic search failed - Agent execution error - Agent ID: [_Nh7rZsBMCptIK-aGFFT], Error: [Error from remote service: {"error":{"message":"json: cannot unmarshal number 0.0 into Go struct field ToolCall.messages.tool_calls.index of type int","type":"invalid_request_error","param":null,"code":null}}]”,“caused_by”:{“type”:“status_exception”,“reason”:“Error from remote service: {"error":{"message":"json: cannot unmarshal number 0.0 into Go struct field ToolCall.messages.tool_calls.index of type int","type":"invalid_request_error","param":null,"code":null}}”}},“status”:400