Skip to content

Commit

Permalink
Update dataclasses.replace calls in DefaultRetryStrategy
Browse files Browse the repository at this point in the history
This commit further addresses issue #111 by updating additional `dataclasses.replace` calls to `call_args.model_copy(update={...})` in the `spice/models.py` file. This change is necessary because `SpiceCallArgs` has been converted from a dataclass to a Pydantic model. The updates ensure that the model copying mechanism is consistent across the codebase. 

Additionally, the unnecessary import of `dataclasses` has been removed from `default_strategy.py`.
  • Loading branch information
mentatai[bot] committed Sep 4, 2024
1 parent b9e2fe0 commit 31be854
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion spice/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_model_from_name(model_name: str) -> Model:
else:
input_cost = None
output_cost = None
model = dataclasses.replace(model, name=model_name, input_cost=input_cost, output_cost=output_cost)
model = model.model_copy(update={"name": model_name, "input_cost": input_cost, "output_cost": output_cost})
return model

return UnknownModel(model_name, None)
1 change: 0 additions & 1 deletion spice/retry_strategy/default_strategy.py
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
Expand Down

0 comments on commit 31be854

Please sign in to comment.