You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a very descriptive title to this question.
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
Commit to Help
I commit to help with one of those options 👆
Example Code
defget_llm(temperature: float=0.0):
returnAzureChatOpenAI(
model=os.environ.get("MODEL_NAME"), temperature=temperature, streaming=True
)
llm=get_llm(0.5)
classStructuredOutput(BaseModel):
a: strb: strprompt_template=ChatPromptTemplate.from_messages(
[("system", "Pick random values and assign to a and b")]
)
runnable=prompt_template|llm.with_structured_output(StructuredOutput)
@observe()asyncdefstrategy_update_agent(state: State):
response=awaitrunnable.ainvoke({})
return {
"messages": AIMessage("done")
}
Description
After upgrading the langchain-openai package to anything greater than 0.2.14 I receive the error 'AsyncStream' object has no attribute 'aclose' when I call ainvoke on an AzureChatOpenAI instance if I am using structured outputs. If I call invoke it works fine or if I downgrade to 0.2.14 it also works fine.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
After upgrading the langchain-openai package to anything greater than 0.2.14 I receive the error 'AsyncStream' object has no attribute 'aclose' when I call ainvoke on an AzureChatOpenAI instance if I am using structured outputs. If I call invoke it works fine or if I downgrade to 0.2.14 it also works fine.
System Info
Windows
langchain-core==0.3.45
langchain-community==0.3.19
langchain-openai==0.3.0
langfuse==2.55.0
langgraph==0.3.14
langgraph-checkpoint==2.0.21
langgraph-checkpoint-postgres==2.0.18
Beta Was this translation helpful? Give feedback.
All reactions