Skip to content

STException '"object"' came as a complete surprise to me` #2836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anupsajjan opened this issue Apr 22, 2025 · 1 comment
Open

STException '"object"' came as a complete surprise to me` #2836

anupsajjan opened this issue Apr 22, 2025 · 1 comment

Comments

@anupsajjan
Copy link

This bug was already raised by this ticket - #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.
Image

Image

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.

@anupsajjan
Copy link
Author

I have implemented a temporary workaround based on issue

Image Image

And use it during LLM call

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant