Reproducing "Cycles" example from readme with Azure OpenAI doesn't produce structured messages #32

Closed
opened 2026-02-15 17:05:56 -05:00 by yindo · 1 comment
Owner

Originally created by @jtmarmon on GitHub (May 26, 2024).

Hi, new to langchain/langgraph so forgive me if I'm missing something obvious.

I basically copied and pasted the Cycles example from the README verbatim, swapping out the example tool for my own. I noticed the tool wasn't being called, so I added some logging and I see that callModel gets executed, but the response from model.pipe(...).invoke(...) is a string, not an AIMessage, so it's missing all structure (including any function calls that might've been present in the response). This causes the shouldContinue to return end early since lastMessage.additional_kwargs is undefined.

I'm using AzureOpenAI exported from @langchain/openai.

Is there another package I should be using? I see that invoke is documented as returning a string so it seems like that can't be the right method for this?

Versions:
"@langchain/langgraph": "^0.0.21",
"@langchain/openai": "^0.0.33",

Originally created by @jtmarmon on GitHub (May 26, 2024). Hi, new to langchain/langgraph so forgive me if I'm missing something obvious. I basically copied and pasted the Cycles example from the README verbatim, swapping out the example tool for my own. I noticed the tool wasn't being called, so I added some logging and I see that `callModel` gets executed, but the response from `model.pipe(...).invoke(...)` is a string, not an AIMessage, so it's missing all structure (including any function calls that might've been present in the response). This causes the `shouldContinue` to return `end` early since `lastMessage.additional_kwargs` is undefined. I'm using `AzureOpenAI` exported from `@langchain/openai`. Is there another package I should be using? I see that `invoke` is documented as returning a string so it seems like that can't be the right method for this? Versions: "@langchain/langgraph": "^0.0.21", "@langchain/openai": "^0.0.33",
yindo closed this issue 2026-02-15 17:05:56 -05:00
Author
Owner

@jtmarmon commented on GitHub (May 26, 2024):

The issue was that I was using AzureOpenAI instead of AzureChatOpenAI...which is mildly confusing, to say the least. I'll file a ticket on the langchain repo because the docs could use some clarification

@jtmarmon commented on GitHub (May 26, 2024): The issue was that I was using `AzureOpenAI` instead of `AzureChatOpenAI`...which is mildly confusing, to say the least. I'll file a ticket on the langchain repo because the docs could use some clarification
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#32