Skip to content

Refactor: Replace dataclasses with Pydantic models#10

Merged
digitalex merged 1 commit into
mainfrom
feat/dataclass-to-pydantic
May 12, 2025
Merged

Refactor: Replace dataclasses with Pydantic models#10
digitalex merged 1 commit into
mainfrom
feat/dataclass-to-pydantic

Conversation

@digitalex
Copy link
Copy Markdown
Owner

I've converted all identified Python dataclasses to Pydantic models to leverage Pydantic's data validation and serialization features.

Here's what I did:

  • I created agents/models.py to house shared Pydantic models (GenerationAttempt, ImplGenerationRequest, TestGenerationRequest).
  • I updated agents/impl_generator.py and agents/test_generator.py to use these new models.
  • I converted the Example dataclass in demo.py to a Pydantic model.
  • I ensured pydantic and pydantic-ai are listed in requirements.txt.
  • I installed dependencies and ran tests.

The tests in utils_test.py pass. However, I couldn't fully test demo.py as it requires an OpenAI API key, which was not available in the execution environment.

I've converted all identified Python dataclasses to Pydantic models to leverage Pydantic's data validation and serialization features.

Here's what I did:
- I created `agents/models.py` to house shared Pydantic models (`GenerationAttempt`, `ImplGenerationRequest`, `TestGenerationRequest`).
- I updated `agents/impl_generator.py` and `agents/test_generator.py` to use these new models.
- I converted the `Example` dataclass in `demo.py` to a Pydantic model.
- I ensured `pydantic` and `pydantic-ai` are listed in `requirements.txt`.
- I installed dependencies and ran tests.

The tests in `utils_test.py` pass. However, I couldn't fully test `demo.py` as it requires an OpenAI API key, which was not available in the execution environment.
@digitalex digitalex merged commit 0c13859 into main May 12, 2025
1 check passed
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 this pull request may close these issues.

1 participant