feat: lazy load imports for language model component#11737
feat: lazy load imports for language model component#11737jordanrfrazier merged 33 commits intomainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR refactors model and embedding class discovery from collection-based retrieval (dictionary returns) to on-demand, single-class retrieval with dynamic importing and caching. The public API functions Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 2 warnings, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (20.45%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #11737 +/- ##
==========================================
+ Coverage 35.45% 35.46% +0.01%
==========================================
Files 1527 1527
Lines 73570 73597 +27
Branches 11061 11065 +4
==========================================
+ Hits 26081 26098 +17
- Misses 46074 46084 +10
Partials 1415 1415
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
||
| module_path, attr_name = import_info | ||
| module = importlib.import_module(module_path) | ||
| cls = getattr(module, attr_name) |
There was a problem hiding this comment.
if cls is None, etc, might want to surface it / raise an exception
There was a problem hiding this comment.
Since we control the mapping here, the error is developer-side and it will be surfaced as that - I think it's okay to let the natural exception propagate in this case
Ensures that only the necessary dependencies are required. For example, if OpenAI provider is used, it will now only import langchain_openai, rather than requiring langchain_anthropic, langchain_ibm, etc.
d6b9c5d to
82079b0
Compare
* change-azure-openai-default-temperature-to-1.0 * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Ensures that only the necessary dependencies are required. For example, if OpenAI provider is used, it will now only import langchain_openai, rather than requiring langchain_anthropic, langchain_ibm, etc.
Summary by CodeRabbit
Tests
Refactor