Open ishaangandhi opened 4 months ago
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
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?