Skip to content

conversion from json to POJO error when use tool call in ai stream #4250

@wykeli

Description

@wykeli

Bug Report: com.fasterxml.jackson.core.JsonParseException: Unexpected close marker ']': expected '}' (for Object starting at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 235])
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 289]
Spring AI version: 1.0.1
Spring Boot version: 3.5.5
Java version: 17

Description:
the json content is
{"jobParam": {"clusterType": "xx", "noAddClusterAgain": false, "noQuitCluster": false, "receiveAccount": "xx", "noReturnMachine": true}, "borrowNodeCondition": {"nodeFromLabel": "buffer", "notBorrow": false, "weCubeKeys": [{"field": "idc", "relation": "eq", "value": "x"]}, "creator": "XXX", "rate": 6, "sourceCondition": {"weCubeKeys": [{"field": "idc", "relation": "in", "values": ["s", "a"]}, {"field": "cluster_alias", "relation": "eq", "value": "abc"}, {"field": "node_ip", "relation": "eq", "value": "127.0.0.1"]}, "taskName": ""}, "conversionId": "1"}
that is not an normal json style
Image


what the code when occur in
chatClient.prompt().toolCallbacks(ToolCallbacks.from(XXX)).user(xxx).advisors(spec -> spec.param(ChatMemory.CONVERSATION_ID, XXX)).stream().content()
the tool code is
@Tool(description = "发起k8s节点迁移任务") public String startMgrTask( @ToolParam(description = "迁移任务参数") AiMgrJobParam jobParam, @ToolParam(description = "当前会话id") String conversionId) { }
I guess this is a bug when using tool call in ai stream ,beacus no exception orrur when use the sync way

chatClient.prompt().system(SYSTEM_PROMPT).toolCallbacks(ToolCallbacks.from()).user().advisors(spec -> spec.param(ChatMemory.CONVERSATION_ID, conversionKey)).call().content()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions