Skip to content

Conversation

@YunKuiLu
Copy link
Contributor

  • Add thinking and response_format fields to ZhiPuAiApi and ZhiPuAiChatOptions
  • Add ZhiPuAiChatOptionsTests with 16 test methods covering all aspects of the class
  • Test builder pattern with all fields including responseFormat and thinking
  • Test copy functionality, setters, default values, and equals/hashCode
  • Test tool callbacks, tool names validation, and collection handling
  • Test stop sequences alias and fluent setters
  • Add documentation for response-format.type and thinking.type properties

Official API:
https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E5%AF%B9%E8%AF%9D%E8%A1%A5%E5%85%A8#body-response-format

… support

- Add `thinking` and `response_format` fields to `ZhiPuAiApi` and `ZhiPuAiChatOptions`
- Add ZhiPuAiChatOptionsTests with 16 test methods covering all aspects of the class
- Test builder pattern with all fields including responseFormat and thinking
- Test copy functionality, setters, default values, and equals/hashCode
- Test tool callbacks, tool names validation, and collection handling
- Test stop sequences alias and fluent setters
- Add documentation for response-format.type and thinking.type properties

Signed-off-by: YunKui Lu <[email protected]>
@ilayaperumalg
Copy link
Member

@mxsl-gr Requesting your review for this PR as well. Thank you

Copy link
Contributor

@mxsl-gr mxsl-gr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.
not related to this PR's changes, with GLM-4.5 family models, the default behavior is to have thinking mode enabled.
while it does improve the output quality, I still feel it’s not ideal since it noticeably slows down the response speed

@YunKuiLu
Copy link
Contributor Author

YunKuiLu commented Sep 11, 2025

looks good.
not related to this PR's changes, with GLM-4.5 family models, the default behavior is to have thinking mode enabled. while it does improve the output quality, I still feel it’s not ideal since it noticeably slows down the response speed

@mxsl-gr Thank you for your review.

If not explicitly set, this PR will not set the thinking.type parameter. And GLM-4.5 enables CoT by default when thinking.type is missing.
That's why I marked enabled as default in the comment.

/**
* Control whether to enable the large model's chain of thought. Available options: (default) enabled, disabled.
*/
private @JsonProperty("thinking") ChatCompletionRequest.Thinking thinking;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the default value be null if it's not explicitly set?

Copy link
Contributor Author

@YunKuiLu YunKuiLu Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilayaperumalg Yes, the thinking in the request body will be null, but for models GLM-4.5 and above, setting thinking=null is equivalent to enabling chain-of-thought reasoning. Here's the English documentation: https://docs.z.ai/api-reference/llm/chat-completion#body-thinking-type

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YunKuiLu Thanks for the clarification!

@ilayaperumalg ilayaperumalg self-assigned this Sep 12, 2025
@ilayaperumalg ilayaperumalg added this to the 1.1.0.M2 milestone Sep 12, 2025
@ilayaperumalg
Copy link
Member

@mxsl-gr Thanks for the review. @YunKuiLu Thanks for the PR and following it up on the comments. Rebased and merged as cae6364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants