feat(agent): Enhanced structured output support for chat models

- Introduced `withStructuredOutput` function to configure structured output for LLMs.
- Added support for Groq models using 'jsonMode' method.
- Enhanced flexibility with optional parameters for naming and raw output inclusion.
This commit is contained in:
Willie Zutz 2025-07-12 15:44:17 -06:00
parent 37c93c3c9b
commit de2459a624
16 changed files with 1995 additions and 1820 deletions

View file

@ -45,13 +45,13 @@ export class URLSummarizationAgent {
);
return new Command({
goto: 'content_router',
update: {
messages: [
new AIMessage(
'No URLs found for processing, routing to content router',
),
],
},
// update: {
// messages: [
// new AIMessage(
// 'No URLs found for processing, routing to content router',
// ),
// ],
// },
});
}
@ -250,9 +250,9 @@ Provide a comprehensive summary of the above web page content, focusing on infor
return new Command({
goto: 'analyzer',
update: {
messages: [new AIMessage(errorMessage)],
},
// update: {
// messages: [new AIMessage(errorMessage)],
// },
});
}
@ -277,7 +277,7 @@ Provide a comprehensive summary of the above web page content, focusing on infor
return new Command({
goto: 'analyzer', // Route to analyzer to continue with normal workflow after URL processing
update: {
messages: [new AIMessage(responseMessage)],
// messages: [new AIMessage(responseMessage)],
relevantDocuments: documents,
},
});