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

Update dataclasses.replace calls in DefaultRetryStrategy #111

Closed
biobootloader opened this issue Sep 4, 2024 · 2 comments · Fixed by #112
Closed

Update dataclasses.replace calls in DefaultRetryStrategy #111

biobootloader opened this issue Sep 4, 2024 · 2 comments · Fixed by #112

Comments

@biobootloader
Copy link
Member

SpiceCallArgs changed from a dataclass to a pydantic model.

So the dataclasses.replace calls need to be updated to call_args.model_copy(update={...

@biobootloader
Copy link
Member Author

@MentatBot please do

@mentatai
Copy link
Contributor

mentatai bot commented Sep 4, 2024

I will start working on this issue

mentatai bot added a commit that referenced this issue Sep 4, 2024
This pull request addresses issue #111 by updating the `dataclasses.replace` calls to `call_args.model_copy(update={...})` in the `DefaultRetryStrategy` class. This change is necessary because `SpiceCallArgs` has been converted from a dataclass to a Pydantic model. The updates ensure that the retry strategy correctly modifies the `temperature` attribute of `call_args` based on the attempt number.
mentatai bot added a commit that referenced this issue Sep 4, 2024
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`.
biobootloader pushed a commit that referenced this issue Sep 5, 2024
* Update dataclasses.replace calls in DefaultRetryStrategy

This pull request addresses issue #111 by updating the `dataclasses.replace` calls to `call_args.model_copy(update={...})` in the `DefaultRetryStrategy` class. This change is necessary because `SpiceCallArgs` has been converted from a dataclass to a Pydantic model. The updates ensure that the retry strategy correctly modifies the `temperature` attribute of `call_args` based on the attempt number.

* Update dataclasses.replace calls in DefaultRetryStrategy

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`.

* CI fix: Fix CI failure due to formatting issue

This commit addresses the CI failure in pull request #112 by reformatting the `spice/models.py` file to comply with the required code style. The `model_copy` call has been split into multiple lines to ensure proper formatting. This change should resolve the CI error and allow the pull request to pass the checks.

* CI fix: Fix CI failure due to formatting issue

This commit addresses a CI failure caused by a formatting issue in `spice/models.py`. The file has been reformatted to comply with the project's code style guidelines. This should resolve the CI failure and allow the pull request to pass all checks.

* Incorporate feedback to maintain dataclass usage for Model class

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.

* CI fix: Fix CI failure due to incorrect attribute access in models.py

This commit addresses a CI failure caused by an incorrect attribute access in `spice/models.py`. The error was due to attempting to access the `model_copy` attribute on a class that does not have it. The fix involves reverting the change to use `dataclasses.replace` for the `Model` class, which is still a dataclass, while keeping the `model_copy` usage for the `SpiceCallArgs` class, which has been converted to a Pydantic model. This ensures compatibility and correct behavior for both dataclasses and Pydantic models in our codebase.

* CI fix: Fix CI failure due to incorrect attribute access in models.py

This commit addresses a CI failure caused by an incorrect attribute access in `models.py`. The error was due to attempting to access the `model_copy` attribute on a dataclass, which does not exist. The fix involves reverting the change to use `dataclasses.replace` for the `Model` class while keeping the `model_copy` method for the `SpiceCallArgs` class, which is a Pydantic model. This ensures compatibility and correct behavior for both dataclasses and Pydantic models in our codebase.

* version

---------

Co-authored-by: mentatai <[email protected]>
Co-authored-by: scotttestbot <[email protected]>
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 a pull request may close this issue.

1 participant