Arize-ai / phoenix

AI Observability & Evaluation
https://docs.arize.com/phoenix
Other
3.99k stars 294 forks source link

[ENHANCEMENT] Auto-Instrumentation for OpenAI should be Disabled Off for Auto-Instrumentation for Langchain/Llamaindex #4070

Open jlopatec opened 3 months ago

jlopatec commented 3 months ago

We have a lot of instrumentations that use both Auto-Instrumentor for LangChain / Llama and OpenAI. I would like the OpenAI Auto Instrumentor to detect if its running in LangChain / LlamaIndex files. If so disable.

Possibly you could do this by using "inspect" library / looking if we called from LangChain file in frame.filename

Check if the function is called from a specific file

for frame in inspect.stack():
    filename = frame.filename
mikeldking commented 3 months ago

Thanks Jason for the feedback. We have some ideas about making instrumentation composable but langchain itself is currently very difficult. Going to leave this parked here for now.