Skip to content

Fix pydantic import issue for version <2.10.2 #1356

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 3 commits into from
Mar 14, 2025

Conversation

davorrunje
Copy link
Collaborator

Why are these changes needed?

When using Pydantic version < v2.10.2, we get this error:

    from pydantic._internal._typing_extra import try_eval_type  # type: ignore[attr-defined]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: cannot import name 'try_eval_type' from 'pydantic._internal._typing_extra' (.../site-packages/pydantic/_internal/_typing_extra.py). Did you mean: '_eval_type'?

The reason is internal change in a way forward references are being evaluated.

This PR uses different functions for evaluating forwarded references, depending on the version of Pydantic installed.

Related issue number

Closes #1316

Checks

@davorrunje davorrunje enabled auto-merge March 14, 2025 12:53
@davorrunje davorrunje added this pull request to the merge queue Mar 14, 2025
Merged via the queue into main with commit e576f00 Mar 14, 2025
17 checks passed
@davorrunje davorrunje deleted the fix-pydantic-import-issue branch March 14, 2025 13:04
Copy link

codecov bot commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
autogen/tools/function_utils.py 60.00% 1 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (40014e8) and HEAD (75fca93). Click for more details.

HEAD has 1269 uploads less than BASE
Flag BASE (40014e8) HEAD (75fca93)
3.10 96 0
agent-eval 1 0
ubuntu-latest 146 1
cerebras 15 0
3.9 83 0
windows-latest 114 0
gpt-assistant-agent 3 0
3.13 85 0
lmm 4 0
ollama 15 0
swarm 14 0
3.11 64 1
teachable 4 0
3.12 36 0
macos-latest 104 0
retrievechat 15 0
retrievechat-qdrant 14 0
falkordb 2 0
retrievechat-couchbase 3 0
retrievechat-mongodb 10 0
retrievechat-pgvector 10 0
anthropic 16 0
bedrock 15 0
core-without-llm 14 1
optional-deps 141 0
commsagent-slack 9 0
integration 12 0
browser-use 7 0
core-llm 9 0
llama-index-agent 3 0
cohere 15 0
neo4j 2 0
openai-realtime 1 0
long-context 3 0
together 14 0
commsagent-telegram 9 0
gemini-realtime 1 0
groq 14 0
websurfer 15 0
commsagent-discord 9 0
deepseek 1 0
crawl4ai 13 0
jupyter-executor 9 0
interop 13 0
gemini 15 0
mistral 14 0
twilio 9 0
openai 1 0
interop-langchain 9 0
interop-pydantic-ai 9 0
interop-crewai 9 0
graph-rag-falkor-db 6 0
websockets 9 0
docs 6 0
captainagent 1 0
autobuild 1 0
Files with missing lines Coverage Δ
autogen/tools/function_utils.py 91.30% <60.00%> (-1.24%) ⬇️

... and 68 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@davorrunje davorrunje self-assigned this Mar 14, 2025
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.

[Bug]: Pydantic version compatibility
2 participants