Closed kevinnayar closed 1 day ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
langchainjs-docs | ✅ Ready (Inspect) | Visit Preview | Nov 19, 2024 6:31pm |
Thanks for the PR!
How exactly does this fix the linked issue?
Oh I'm sorry, I attached the wrong issue but I cannot seem to locate the one I was viewing earlier and am trying to address. The attached issue is related to ChatGoogleGenerativeAI
and withStructuredOutput
, but the one I was referencing was related to ChatVertexAI
. I'll keep digging for it.
Without awaiting the return on this method, the response when calling model.withStructuredOutput(...)
is consistently the following error:
TypeError: Cannot read properties of undefined (reading 'text')
In this call stack sequence invoke
-> generatePrompt
-> generate
, the last method doesn't return a value which results in this error. I believe this is because generate
's return type is a promise/non-promise union and therefore, it should be awaited.
generate(...): Promise<{
generations: never[][];
llmOutput: any;
} | {
generations: any[];
llmOutput: {};
}>
Gotcha. The only difference the await
makes here after a return
is in the call stack if an error were to occur:
Yep, understand what awaits does. I did think it was weird that it resolves the issue when this minor edit of the dist file. I'll do a bit more debugging and create a more meaningful bug first. The issue does persist without it. Thanks.
Fixes #7172