Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Expose the "store" parameter through ModelSettings #357

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

Merged
merged 7 commits into from
Mar 26, 2025

Conversation

stevenheidel
Copy link
Member

Closes #173

This will also set stored completions to True by default, encouraging a best practice.

@stevenheidel stevenheidel requested a review from rm-openai March 26, 2025 19:08
@@ -30,7 +30,7 @@ class ModelSettings:
tool_choice: Literal["auto", "required", "none"] | str | None = None
"""The tool choice to use when calling the model."""

parallel_tool_calls: bool | None = False
parallel_tool_calls: bool | None = None
Copy link
Member Author

Choose a reason for hiding this comment

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

@rm-openai this seemed like a typo, since it meant that if you tried to override a different setting at the Runner.run level it would also set this back to False

Copy link
Member Author

Choose a reason for hiding this comment

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

actually never mind since an or was used below it's fine. but we should actually not use or below because "0" is false-y in Python, so setting "temperature=0" at the Runner.run level would fail to override temperature at the agent level

@stevenheidel stevenheidel changed the title Stevenh/mar26/responses store Expose the "store" parameter through ModelSettings Mar 26, 2025
Copy link
Collaborator

@rm-openai rm-openai left a comment

Choose a reason for hiding this comment

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

some lint issues and comments inline

Comment on lines 50 to 55

new_values = {
k: getattr(override, k) if getattr(override, k) is not None else getattr(self, k)
for k in asdict(self)
}
return ModelSettings(**new_values)
Copy link
Collaborator

Choose a reason for hiding this comment

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

feels like unnecessarily expensive to do an asdict, which creates a copy. Why not just use a helper function that sets the param iff its not None?

Copy link
Member Author

Choose a reason for hiding this comment

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

switched to __dataclass_fields__ which does not create a copy, added a test

@rm-openai rm-openai merged commit aad8acc into main Mar 26, 2025
5 checks passed
@rm-openai rm-openai deleted the stevenh/mar26/responses-store branch March 26, 2025 23:01
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.

Expose responses API store parameter
2 participants