Skip to content

Implemented __deepcopy__ on all Environments #614

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 5 commits into from
Oct 19, 2024
Merged

Implemented __deepcopy__ on all Environments #614

merged 5 commits into from
Oct 19, 2024

Conversation

jamesbraza
Copy link
Collaborator

  • Implemented __deepcopy__ on PaperQAEnvironment and GradablePaperQAEnvironment, with a test
    • This needed a make_tools, so I decomposed PaperQAEnvironment.make_initial_state_and_tools for it. Note this is a breaking change
  • Documented LitQAEvaluation.from_question, as its inner workings were requiring too much thought
  • Fixed another model_config not being at the top I missed in Moved Pydantic model_config to top of each class #607

@jamesbraza jamesbraza added the enhancement New feature or request label Oct 19, 2024
@jamesbraza jamesbraza self-assigned this Oct 19, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation labels Oct 19, 2024


@pytest.mark.asyncio
async def test_deepcopy_env(agent_test_settings: Settings) -> None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This unit test should be considered really baller

Copy link
Collaborator

@mskarlin mskarlin left a comment

Choose a reason for hiding this comment

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

Looks good to me!


def __deepcopy__(self, memo) -> Self:
copy_state = deepcopy(self.state, memo)
# We don't know the side effects of deep copying a litellm.Router,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Smart

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 19, 2024
@jamesbraza jamesbraza merged commit 81f8c5f into main Oct 19, 2024
5 checks passed
@jamesbraza jamesbraza deleted the env-copying branch October 19, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants