Skip to content

[fix][llm] pass pointer when unmarshalling Qwen/Qianfan response format schema - #710

Open
pcbeingused333 wants to merge 1 commit into
coze-dev:mainfrom
pcbeingused333:fix/qwen-qianfan-response-format-schema
Open

pcbeingused333 wants to merge 1 commit into
coze-dev:mainfrom
pcbeingused333:fix/qwen-qianfan-response-format-schema

Conversation

@pcbeingused333

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title

  • This PR title match the format: [<type>][<scope>] <description>. For example: [fix][backend] flaky fix
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Add documentation if the current PR requires user awareness at the usage level.
  • This PR is written in English. PRs not in English will not be reviewed.

(Optional) More detailed description for this PR(en: English/zh: Chinese)

en:
A Qwen or Qianfan model with a non-empty ResponseFormatJsonSchema cannot be built: the builder returns json: Unmarshal(non-pointer ...) (Qwen) or json: Unmarshal(nil) (Qianfan).

Root cause: in qwenBuilder and qianfanBuilder (backend/modules/llm/domain/service/llmimpl/eino/init.go), sonic.UnmarshalString(*pc.ResponseFormatJsonSchema, js) passes js by value. openAIBuilder already passes &js.

Fix: pass &js in both builders.

Test: new init_test.go with TestQwenBuilder_ResponseFormatJSONSchema and TestQianfanBuilder_ResponseFormatJSONSchema. Both fail without the change and pass with it; the rest of the package passes (go test ./modules/llm/domain/service/llmimpl/eino/).

This change was prepared with Claude Code, an AI assistant, on behalf of the contributor.

(Optional) Which issue(s) this PR fixes

None filed; found while reading the builders.

…at schema

qwenBuilder and qianfanBuilder passed the schema target by value to
sonic.UnmarshalString, so any model configured with a
ResponseFormatJsonSchema failed to build with 'Unmarshal(non-pointer ...)'.
Use &js as openAIBuilder already does, and add builder tests.
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

Successfully merging this pull request may close these issues.

1 participant