Comments (7)
Hi, I will try to solve this issue
from openllmetry-js.
It makes much more sense :) I will give it a try this weekend!
from openllmetry-js.
Looking at the documentation about Langchain callbacks, I can see that there are 2 places where the callbacks
argument is accepted:
- Constructor callback
- Request callback (a.k.a on
call
method)
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 langchain
, but I guess that defeats the purpose of auto-instrumentation...
Am I missing something?
from openllmetry-js.
Thanks @Xabilahu! So what I had in mind is to monkey patch the constructors of objects like LLMChain
, etc. and add our own callback there, and then build a callback handler that creates/ends spans accordingly. The benefit is that instead of being tightly coupled with all of Langchain implementation (which changes quite often), we need to know only the names of classes with callbacks - not that many. WDYT?
from openllmetry-js.
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
from openllmetry-js.
@Xabilahu - weird, have you change the log level to debug
?
Want to join slack to discuss?
from openllmetry-js.
Submitted the WIP PR #176, the missing piece is being able to monkey-patch JS class constructors via shimmer (as it's the library being used by OTel under the hood, source) so that we can inject the CallbackHandler
in constructor params. For the moment, I've not been able to.
from openllmetry-js.
Related Issues (19)
- Add OpenTelemetry Auto-Instrumentation for Langchain Library HOT 17
- 🚀 Feature: LlamaIndex Instrumentation HOT 6
- 🚀 Feature: VertexAI Instrumentation HOT 6
- 🚀 Feature: Pinecone Instrumentation HOT 12
- 🚀 Feature: Bedrock Instrumentation HOT 9
- Bug in OpenAI streaming instrumentation
- 🚀 Feature: Cohere Instrumentation HOT 5
- Re-enable Pinecone tests HOT 2
- Re-enable VertexAI tests
- OpenAI / Azure OpenAI tests
- API in SDK for reporting prompts and completions
- 🚀 Feature: Chroma Instrumentation HOT 6
- Question: Will this work with @opentelemetry/instrumentation-http HOT 1
- 🚀 Feature: re-write LlamaIndex instrumentation to use LlamaIndex `CallbackManager` HOT 10
- 🚀 Feature: OpenTelemetry Metrics HOT 2
- Seeing Error: Cannot find module '../package.json' when importing @traceloop/node-server-sdk HOT 3
- Cannot read properties of undefined when using vertexai HOT 2
- Feature: OpenAI Assistants API HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openllmetry-js.