Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does the template use a JsonOutputFunctionParser? #25

Open
ishaangandhi opened this issue Mar 7, 2024 · 1 comment
Open

Why does the template use a JsonOutputFunctionParser? #25

ishaangandhi opened this issue Mar 7, 2024 · 1 comment

Comments

@ishaangandhi
Copy link

https://github.com/langchain-ai/langchain-nextjs-template/blob/03e4a849c45573812b853383f946bfa56c4cf339/app/api/chat/structured_output/route.ts#L69C23-L69C38

I can't tell why you need this. What is the benefit of this approach over StructuredOutputParser.fromZodSchema as described in https://js.langchain.com/docs/modules/model_io/output_parsers/types/structured?

@jacoblee93
Copy link
Collaborator

It's to take advantage of function calling to have greater assurance of the output matching the schema vs. prompt engineering - this could use an update though as we've updated the best way to do this!

Function calling: https://js.langchain.com/docs/modules/model_io/chat/function_calling
New withStructuredOutput method: https://js.langchain.com/docs/use_cases/extraction/quickstart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants