-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update dataclasses.replace calls in DefaultRetryStrategy #112
Changes from all commits
b9e2fe0
31be854
0cdea61
f139c96
6e6d7f1
8572625
81e4434
f44adfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,3 @@ | ||||||
import dataclasses | ||||||
from typing import Any, Callable, Optional | ||||||
|
||||||
from spice.call_args import SpiceCallArgs | ||||||
|
@@ -17,9 +16,9 @@ def decide( | |||||
self, call_args: SpiceCallArgs, attempt_number: int, model_output: str, name: str | ||||||
) -> tuple[Behavior, SpiceCallArgs, Any, str]: | ||||||
if attempt_number == 1 and call_args.temperature is not None: | ||||||
call_args = dataclasses.replace(call_args, temperature=max(0.2, call_args.temperature)) | ||||||
call_args = call_args.model_copy(update={"temperature": max(0.2, call_args.temperature)}) | ||||||
elif attempt_number > 1 and call_args.temperature is not None: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's a good practice to provide a default value when using |
||||||
call_args = dataclasses.replace(call_args, temperature=max(0.5, call_args.temperature)) | ||||||
call_args = call_args.model_copy(update={"temperature": max(0.5, call_args.temperature)}) | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Similar to the previous comment, it's safer to provide a default value when |
||||||
if self.validator and not self.validator(model_output): | ||||||
if attempt_number < self.retries: | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on bumping the version number. This is important for releasing the bug fix.