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

feat(forge, agent, benchmark): Upgrade to Pydantic v2 #7280

Merged
merged 16 commits into from
Jul 2, 2024

Conversation

kcze
Copy link
Contributor

@kcze kcze commented Jun 27, 2024

Background

Agent Server is incompatible with AutoGPT&Forge because they use pydantic v2 and v1 respectively.

Changes πŸ—οΈ

Update Pydantic dependency of autogpt, forge and benchmark to ^2.7
Pydantic Migration Guide

  • Rename and update deprecated functions
  • Default values are strict and aren't inferred; None has to be specified explicitly for Optional and model fields without defaults are required (Ellipsis ... for required fields is deprecated)
  • Config class for specifying model configuration is deprecated, now model_config class attribute needs to be set to ConfigDict object with configuration
  • Custom kwargs (extra) can no longer be passed to Field
  • Forked agent-protocol and updated only client package: https://github.com/kcze/agent-protocol
  • Removed ModelContainer in BaseAgent, component configuration is now serialized using Pydantic v2 functions directly

PR Quality Scorecard ✨

  • Have you used the PR description template?   +2 pts
  • Is your pull request atomic, focusing on a single change?   +5 pts
  • Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • Have you documented your changes clearly and comprehensively?   +5 pts
  • Have you changed or added a feature?   -4 pts
    • Have you added/updated corresponding documentation?   +4 pts
    • Have you added/updated corresponding integration tests?   +5 pts
  • Have you changed the behavior of AutoGPT?   -5 pts
    • Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

@kcze kcze linked an issue Jun 27, 2024 that may be closed by this pull request
@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Jun 27, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

Copy link

netlify bot commented Jun 27, 2024

βœ… Deploy Preview for auto-gpt-docs canceled.

Name Link
πŸ”¨ Latest commit 1d26c97
πŸ” Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/6683fb4dfc24f00008937b9d

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Jun 30, 2024
Copy link
Contributor

Conflicts have been resolved! πŸŽ‰ A maintainer will review the pull request shortly.

Copy link

codecov bot commented Jun 30, 2024

Codecov Report

Attention: Patch coverage is 37.82051% with 97 lines in your changes missing coverage. Please review.

Project coverage is 28.00%. Comparing base (97e4cce) to head (1d26c97).
Report is 1 commits behind head on master.

Files Patch % Lines
forge/forge/models/config.py 20.58% 27 Missing ⚠️
forge/forge/agent/base.py 0.00% 15 Missing ⚠️
benchmark/agbenchmark/app.py 0.00% 6 Missing ⚠️
...ark/agbenchmark/reports/processing/report_types.py 44.44% 5 Missing ⚠️
benchmark/agbenchmark/challenges/builtin.py 71.42% 2 Missing and 2 partials ⚠️
benchmark/agbenchmark/challenges/webarena.py 78.94% 1 Missing and 3 partials ⚠️
forge/forge/llm/providers/openai.py 0.00% 4 Missing ⚠️
forge/forge/llm/providers/schema.py 0.00% 4 Missing ⚠️
benchmark/agbenchmark/config.py 62.50% 3 Missing ⚠️
benchmark/agbenchmark/utils/utils.py 0.00% 3 Missing ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7280      +/-   ##
==========================================
+ Coverage   25.50%   28.00%   +2.49%     
==========================================
  Files          80      102      +22     
  Lines        4662     6557    +1895     
  Branches      631      961     +330     
==========================================
+ Hits         1189     1836     +647     
- Misses       3403     4640    +1237     
- Partials       70       81      +11     
Flag Coverage Ξ”
Linux 28.00% <37.82%> (+2.49%) ⬆️
Windows 30.10% <38.57%> (+4.61%) ⬆️
agbenchmark 34.05% <54.83%> (?)
autogpt-agent 35.91% <63.15%> (ΓΈ)
forge 21.68% <17.33%> (+0.05%) ⬆️
macOS 28.00% <37.82%> (+2.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@kcze kcze changed the title feat(agent, forge): Update pydantic to v2 feat: Update pydantic to v2 Jun 30, 2024
@kcze kcze marked this pull request as ready for review June 30, 2024 19:49
@kcze kcze requested a review from a team as a code owner June 30, 2024 19:49
@kcze kcze requested review from Torantulino, aarushik93 and Pwuts and removed request for a team, Torantulino and aarushik93 June 30, 2024 19:49
forge/forge/models/config.py Outdated Show resolved Hide resolved
@kcze kcze force-pushed the kpczerwinski/open-1346-update-pydantic-to-v2 branch from 341bdf3 to 012cb15 Compare July 1, 2024 17:31
Copy link
Member

@Pwuts Pwuts left a comment

Choose a reason for hiding this comment

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

Legendary effort. Thank you very much for pulling this.

Question marks and suggestions: ⬇️ (or ⬆️ in the app)

autogpt/autogpt/app/config.py Outdated Show resolved Hide resolved
forge/pyproject.toml Outdated Show resolved Hide resolved
forge/forge/models/config.py Outdated Show resolved Hide resolved
autogpt/autogpt/app/config.py Show resolved Hide resolved
benchmark/agbenchmark/app.py Outdated Show resolved Hide resolved
forge/forge/llm/providers/schema.py Show resolved Hide resolved
forge/forge/models/config.py Outdated Show resolved Hide resolved
forge/forge/models/config.py Outdated Show resolved Hide resolved
forge/forge/models/config.py Outdated Show resolved Hide resolved
forge/forge/models/config.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Conflicts have been resolved! πŸŽ‰ A maintainer will review the pull request shortly.

forge/forge/llm/providers/openai.py Outdated Show resolved Hide resolved
@@ -9,21 +9,23 @@ packages = [{ include = "agbenchmark" }]

[tool.poetry.dependencies]
python = "^3.10"
# helicone = "^1.0.9" # incompatible with openai@^1.0.0
agent-protocol-client = "^1.1.0"
agent-protocol-client = {git = "https://github.com/Significant-Gravitas/agent-protocol.git", subdirectory = "packages/client/python"}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

This can wait until after this PR is merged

Copy link
Member

@Pwuts Pwuts left a comment

Choose a reason for hiding this comment

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

LGTM!

@Pwuts Pwuts merged commit 7cb4d4a into master Jul 2, 2024
34 of 36 checks passed
@Pwuts Pwuts deleted the kpczerwinski/open-1346-update-pydantic-to-v2 branch July 2, 2024 18:45
@Pwuts Pwuts changed the title feat: Update pydantic to v2 feat(forge, agent, benchmark): Upgrade to Pydantic v2 Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: βœ… Done
Development

Successfully merging this pull request may close these issues.

Update Pydantic to V2
2 participants