spring-projects / spring-projects/spring-ai

BeanOutputConverter enhancement - handling unicode quotation marks in Json response

Open
#4,446 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
Sometimes response from LLMs uses mixed single-type and unicode quotation marks.
For example:

{
"reason" : "price of flour is going to shoot up”
}

Note: the last quotation mark is The UTF-8 sequence "E2 80 9D", not "34".

Which results in BeanOutputConverter failing to parse the response.
"ERROR org.springframework.ai.converter.BeanOutputConverter - Could not parse the given text to the desired target type:"

What would be best ways handle such case?

Environment
Spring AI version: 1.0.0-M7, Java: JDK21, Model: bedrock Nova micro

Steps to reproduce
Not sure when LLM would respond with such mixed quotation marks.

Expected behavior
Maybe BeanOutputConverter could be even more smarter ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting BeanOutputConverter and the parsing path it uses for structured LLM responses. Reproduce the mixed ASCII and Unicode quotation-mark example, then determine and test the expected handling so the response can be parsed into the requested target type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
ai, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.