xinference 工具调用返回数据中content字段为null
tool_call_message: Dict[str, Any] = {
"role": "assistant",
"content": None,
"tool_calls": [],
}
而spring ai中 解析返回结果会丢失 content字段
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public record ChatCompletionMessage(// @formatter:off
@JsonProperty("content") Object rawContent,
@JsonProperty("role") Role role,
@JsonProperty("name") String name,
@JsonProperty("tool_call_id") String toolCallId,
@JsonProperty("tool_calls")
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) List<ToolCall> toolCalls,
@JsonProperty("prefix") Boolean prefix,
@JsonProperty("reasoning_content") String reasoningContent) { // @formatter:on
会导致在次与模型交互时,没有发送 content字段,报错
org.springframework.ai.retry.TransientAiException: HTTP 500 - {"detail":"[address=0.0.0.0:33381, pid=1886] 'dict object' has no attribute 'content'"}
Comment From: Andy365-365
这个可能需要调整发送给模型的提示语,以保证模型按预期的格式返回对应的信息。
Comment From: aqisheng
这个可能需要调整发送给模型的提示语,以保证模型按预期的格式返回对应的信息。
是滴是滴 这个问题提交给xinference官方解决去了