spring-projects / spring-projects/spring-ai
STException '"object"' came as a complete surprise to me`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
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 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the structured output converter and the advisor-generated formatParam shown in the report, reproducing it with Java 21, Spring AI 1.0.0-M6, Ollama, and the provided ParameterizedTypeReference example. Check how the JSON schema and markdown delimiters are parsed before the LLM call. Done means the reproduced structured-output request succeeds and returns the configured structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100