Skip to content

Commit

Permalink
Incorporate feedback to maintain dataclass usage for Model class
Browse files Browse the repository at this point in the history
Reverted changes in `spice/models.py` to keep using `dataclasses.replace` for the `Model` class, as it remains a dataclass. Updated only the `SpiceCallArgs`-related code in `DefaultRetryStrategy` to use `model_copy` for Pydantic model updates. This ensures correct handling of both dataclasses and Pydantic models.
  • Loading branch information
mentatai[bot] committed Sep 4, 2024
1 parent f139c96 commit 6e6d7f1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions spice/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def get_model_from_name(model_name: str) -> Model:
else:
input_cost = None
output_cost = None
model = model.model_copy(
update={"name": model_name, "input_cost": input_cost, "output_cost": output_cost}
)
model = dataclasses.replace(model, name=model_name, input_cost=input_cost, output_cost=output_cost)
return model

return UnknownModel(model_name, None)

0 comments on commit 6e6d7f1

Please sign in to comment.