spring-ai
spring-ai copied to clipboard
STException '"object"' came as a complete surprise to me`
This bug was already raised by this ticket - https://github.com/spring-projects/spring-ai/issues/2159, but seems closed without any comment on how its resolved. Hence creating this new issue with a hope of getting a resolution.
Bug description When using Structured output converter with spring AI, I end up getting below error "object"' came as a complete surprise to me` (1.0.0-M6)
Log seen on console -
formatParam=Your response should be in JSON format.
Do not include any explanations, only provide a RFC8259 compliant JSON response following this format without deviation.
Do not include markdown code blocks in your response.
Remove the ```json markdown from the output.
Here is the JSON Schema instance your output must adhere to:```
```{
"$schema" : "https://json-schema.org/draft/2020-12/schema",
"type" : "object",
"properties" : {
"fieldValues" : {
"type" : "object",
"additionalProperties" : false
},
"summary" : {
"type" : "string"
}
},
"additionalProperties" : false
}```
, chat_memory_response_size=100, chat_memory_agent_id=f8c3de3d-1e4a-4b7c-9f2d-6e5a8b4c2d1f}, toolContext={}]
And I get an error saying 3:21: '"object"' came as a complete surprise to me`
Environment Spring AI version 1.0.0-M6, Java version - 21, which vector store - PgVectorStore, AI Model - LLama3.2 running on Ollama
Steps to reproduce
Implement a structured output code using ParameterizedTypeReference<T> as shown below and call LLM.
When you run this, the advisors linked will generate this above shown formatParam which contains these double quotes, backticks etc (guessing them to be causing the issue) and fails with error "object"' came as a complete surprise to me.
Expected behavior I expected LLM call to go through successfully and LLM to respond with the structure I had configured.