How to debug and inspect raw API calls langchain makes #6511
Replies: 4 comments
-
Thanks for the contribution; This is really helpful; |
Beta Was this translation helpful? Give feedback.
-
@bluskript THANK YOU! You are a hero. I have been at this for many hours. I've tried debug mode, callback functions, etc. Even LangChain traces do not provide all of this information. Traces include part of the raw API call in P.S. This works on |
Beta Was this translation helpful? Give feedback.
-
Thank you for this contribution! |
Beta Was this translation helpful? Give feedback.
-
For |
Beta Was this translation helpful? Give feedback.
-
NOTE: I only figured out a way for
ChatOpenAI
. Other LLMs probably have a similar structure, but read langchain's code to find what attribute needs to be overridden.if you want to be able to see exactly what raw API requests langchain is making, use the following code below.
Ideally this should be a basic Langchain functionality, being able to see raw API responses are SO important sometimes. For example, I faced a
KeyError: 'choices'
error which was impossible to debug because langchain doesn't provide a way to view raw API responses.Beta Was this translation helpful? Give feedback.
All reactions