Closed hyeonje-cho closed 2 days ago
Root cause: langchain-openai wrap stream code in context manager block in this PR, which is released in langchain-openai 0.1.2 on Apr 10, 2024. Which introduces such change:
with self.client.create(messages=message_dicts, **params) as response:
...
However, promptflow wraps the generator output of OpenAI api for tracing, and the wrapped generator does not implement __enter__
and __exit__
function, thus causes the error.
We will change the wrapper to align with the original context manager behavior.
Describe the bug When running the langchain AgentExecutor in a Python tool, a TypeError occurs. The function runs fine in environments without the Python tool decorator
How To Reproduce the bug Here is my code.
Expected behavior Return agent_executor's output
Screenshots
Running Information(please complete the following information):
pf -v
:python --version
: python==3.12.3Additional context Add any other context about the problem here.