Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip serialization to null if field is none in CreateRunRequest #235

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

madchicken
Copy link
Contributor

Fix for issue #234

@@ -228,7 +228,8 @@ pub struct CreateRunRequest {
pub tool_choice: Option<AssistantsApiToolChoiceOption>,

/// Whether to enable [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) during tool use.
pub parallel_tool_calls: Option<bool>,
#[serde(default)]
pub parallel_tool_calls: bool,
Copy link
Owner

@64bit 64bit Jun 16, 2024

Choose a reason for hiding this comment

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

This may work, however it has a semantics of a "required" param, which in OpenAI API reference and spec - is not a required parameter. Even though it would take "default" value when not provided.

I think core of the issue is not having #[serde(skip_serializing_if = "Option::is_none")] on all the Option-al fields of CreateRunRequest - if this attribute fixes the issues its more aligned with semantics and consistency.

@64bit 64bit changed the title Make parallel_tool_calls not optional and use the default fix: skip serialization to null if field is none in CreateRunRequest Jun 17, 2024
Copy link
Owner

@64bit 64bit left a comment

Choose a reason for hiding this comment

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

Thank you for the fix and PR!

@64bit 64bit merged commit 8a9cdd8 into 64bit:main Jun 17, 2024
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.

2 participants