-
Notifications
You must be signed in to change notification settings - Fork 22
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
🚀 Feature: re-write Langchain instrumentation to use Langchain Callbacks #133
Comments
Hi, I will try to solve this issue |
Looking at the documentation about Langchain callbacks, I can see that there are 2 places where the
I don't see a way on how this mechanism could replace monkey patching, as for 1 we would need to instantiate the objects for consumers, and for 2 we would need to find a way to intercept / wrap calls. An idea would be to extend the classes that we want to instrument, and have users consume those instead of the ones from Am I missing something? |
Thanks @Xabilahu! So what I had in mind is to monkey patch the constructors of objects like |
It makes much more sense :) I will give it a try this weekend! |
Small status update. I've been trying to make this integration work, but I'm not able to. The issue is that the snippet below never gets executed (and thus, the spans are not being reflected in Traceloop), so I still need some more deep dive. I don't know if this integration has ever been tested, if so, let me know, maybe I'm missing something. openllmetry-js/packages/instrumentation-langchain/src/instrumentation.ts Lines 81 to 102 in 3688da7
|
Which component is this feature for?
Langchain Instrumentation
🔖 Feature description
Right now, we monkey-patch classes and methods in LlamaIndex which requires endless work and constant maintenance. Langchain has a system for callbacks that can potentially be used to create/end spans without being too coupled with with the framework's inner structure.
🎤 Why is this feature needed ?
Support Langchain entirely and be future-proof to internal API changes
✌️ How do you aim to achieve this?
Look into Langchain callbacks and how other frameworks are using it.
🔄️ Additional Information
No response
👀 Have you spent some time to check if this feature request has been raised before?
Are you willing to submit PR?
None
The text was updated successfully, but these errors were encountered: