Liam
Liam•10mo ago

Langchain, Azure OpenAI SDK changes

Hi Langfuse team & everyone, I apologise if this question doesn't make any sense but ive just been stuck on it for quite a while now. I've created a Langchain SQL Agent a while ago and use langfuse to monitor it. I use Azure for this and recently azure has changed the way its connection works. Ever since then, whenever my SQL Agent gets to the "Thought" phase i now get:
Thought:ERROR:langfuse:'engine'
Traceback (most recent call last):
File "/workspaces/chat/.venv/lib/python3.11/site-packages/langfuse/callback.py", line 498, in __on_llm_action
model_name = kwargs["invocation_params"]["engine"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'engine'
ERROR:langfuse:run not found
Traceback (most recent call last):
File "/workspaces/chat/.venv/lib/python3.11/site-packages/langfuse/callback.py", line 564, in on_llm_end
raise Exception("run not found")
Exception: run not found
Thought:ERROR:langfuse:'engine'
Traceback (most recent call last):
File "/workspaces/chat/.venv/lib/python3.11/site-packages/langfuse/callback.py", line 498, in __on_llm_action
model_name = kwargs["invocation_params"]["engine"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'engine'
ERROR:langfuse:run not found
Traceback (most recent call last):
File "/workspaces/chat/.venv/lib/python3.11/site-packages/langfuse/callback.py", line 564, in on_llm_end
raise Exception("run not found")
Exception: run not found
I don't know whats causing this but it most likely has to do with how the azure endpoint, deployment name, ... are passed differently now. Any idea? Thanks in advance!
4 Replies
Marc
Marc•10mo ago
Thanks for raising this, can you share more about your implementation? Happy to reproduce and get this fixed quickly
Liam
Liam•10mo ago
I forgot to update this, I managed to solve the issue playing around with the new implementation and im not quite sure what it was that was causing this. Most likely just an error on my side 😅
Marc
Marc•10mo ago
Thanks for confirming, we'll ship an improvement to the SDK soon which will result in logging warnings instead of throwing errors in case these problems happen (sometimes is the case when there is a version mismatch or some underlying sdk has breaking changes)
Liam
Liam•10mo ago
Sounds great appreciate it!