Croway opened a new pull request, #30451: URL: https://github.com/apache/camel/pull/30451
[CAMEL-27247](https://issues.apache.org/jira/browse/CAMEL-27247) ## Description `CamelSpringAiChatFinishReason` holds the finish reason as the provider names it (`stop`, `end_turn`, `STOP`, `max_tokens`, `content_filter`, ...), so a route that checks for a truncated or filtered answer depends on the provider. Spring AI 2.1.0 classifies the finish reason the same way for every provider, and keeps the reasoning of a reply as message parts. - New header `CamelSpringAiChatFinishReasonCategory`: `COMPLETED`, `TRUNCATED`, `TOOL_CALL`, `FILTERED`, `OTHER` or `UNSPECIFIED`. A refusal of the SafeGuard advisor is `FILTERED`. - New header `CamelSpringAiChatReasoning`: the text of the reasoning parts of the reply (Anthropic and Bedrock thinking, Gemini thoughts, the `reasoning_content` of DeepSeek and OpenAI-compatible servers), or the summary of a part that has only a summary. It is set only when the reply has reasoning, and removed otherwise, so a header of an earlier call does not stay. - Both are also in the `CamelSpringAiChatResponseMetadata` map. - Documentation in "Response Headers and Metadata", with a `choice()` on the category. ## Tests `SpringAiChatFinishReasonReasoningTest` (4): category and reasoning of a completed reply, a truncated reply without reasoning that removes an earlier reasoning header, a reasoning part with only a summary, and the SafeGuard refusal as `FILTERED`. The module has 49 unit tests, all passing. _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
