-
Notifications
You must be signed in to change notification settings - Fork 677
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
fix(llamaindex): support both new and legacy llama_index versions #422
Conversation
This commit fixes issues introduced in 5e5bc88 by enhancing the dynamic loading mechanism for `llama-index` modules to ensure compatibility across both `llama-index-core` and `llama-index-legacy`. Modifications include updates across various instrumentor files to correctly reference modules based on the installed `llama-index` version. These changes address errors encountered during initialization and ensure seamless operation with both versions of `llama-index`. - Dynamically set `_instruments` in `__init__.py` based on package version. - Adjust `MODULE_NAME` in instrumentor files to support new and legacy structures.
I apologize for the oversight in the previous commit. It missed some critical aspects of handling the |
This update refines the dynamic loading logic for the llama-index package, ensuring the LlamaIndexInstrumentor class correctly handles scenarios where neither the core nor legacy versions of the package are installed. It enhances error logging for clearer diagnostics, aligning with proper type expectations by returning an empty collection when necessary, thus maintaining type consistency and improving the robustness of the instrumentation setup.
It looks like everything is ok now. |
Thanks again @alex-feel! I wonder if it's too much to ask of you to write a small test for this, just to make sure it works on the latest version of |
Thank you for your feedback and the suggestion to add a test. I would be more than happy to take on this task under normal circumstances. However, I'm currently tied up with an urgent project that demands my full attention and cannot divert my focus at this moment. Regarding the issue addressed in #423, I want to add that the current fix specifically targets and resolves the problem mentioned. I have conducted manual testing on |
No worries @alex-feel, I'll add them. Tested it on |
I've updated this branch with an additional commit that reinstates the original changes which my fix addresses. To recap, the original update was designed to enhance the import logic by dynamically supporting both the new ( |
ddff887
to
9a49a2b
Compare
👍 |
This commit fixes issues introduced in 5e5bc88 by enhancing the dynamic loading mechanism for
llama-index
modules to ensure compatibility across bothllama-index-core
andllama-index-legacy
. Modifications include updates across various instrumentor files to correctly reference modules based on the installedllama-index
version. These changes address errors encountered during initialization and ensure seamless operation with both versions ofllama-index
._instruments
in__init__.py
based on package version.MODULE_NAME
in instrumentor files to support new and legacy structures.