fix: Include original error message in ImportError for LLM client dependencies#7497
Open
karthik-idikuda wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: Include original error message in ImportError for LLM client dependencies#7497karthik-idikuda wants to merge 1 commit intomicrosoft:mainfrom
karthik-idikuda wants to merge 1 commit intomicrosoft:mainfrom
Conversation
2df8197 to
af55c33
Compare
…endencies Improved import error handling across autogen-ext to include the original error message, making it easier for users to diagnose dependency issues. Previously, import errors would show a generic message like: 'Dependencies for X not found. Please install ...' Now they show: 'Dependencies for X not found. Original error: No module named vertexai Please install ...' This helps users distinguish between missing packages and other issues like version conflicts or missing transitive dependencies. Files updated: - models/llama_cpp/__init__.py - agents/azure/__init__.py - agents/magentic_one/__init__.py - runtimes/grpc/__init__.py and worker runtime files - memory/chromadb/_chromadb.py - memory/redis/_redis_memory.py - tools/azure/_ai_search.py Closes microsoft#4605
af55c33 to
18485b4
Compare
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improved import error handling across
autogen-extto include the original error message in re-raisedImportErrorexceptions. This makes it significantly easier for users to diagnose dependency issues.Problem
When an import error occurs while initializing LLM clients or other extension components, the code raises a generic
ImportErrorwith a hardcoded message suggesting to install specific packages. However, the actual import error might be caused by other issues (like missing transitive dependencies or version conflicts).Before:
After:
Changes
Updated 10 files across
autogen-extto include the original exception message:models/llama_cpp/__init__.pyagents/azure/__init__.pyagents/magentic_one/__init__.pyruntimes/grpc/__init__.pyand 3 worker runtime filesmemory/chromadb/_chromadb.pymemory/redis/_redis_memory.pytools/azure/_ai_search.pyTesting
The change is minimal and only affects error message formatting. The
from echain is preserved in all cases, and the original exception object is still accessible via__cause__.Closes #4605