Bugfix/Gemini Structured Output (#4713)

* fix gemini structured output

* update issues templates
This commit is contained in:
Henry Heng
2025-06-23 19:10:41 +01:00
committed by GitHub
parent f50a817bf4
commit 2e42dfb635
10 changed files with 756 additions and 790 deletions
@@ -27,7 +27,6 @@ import {
transformBracesWithColon
} from '../../../src/utils'
import {
ExtractTool,
convertStructuredSchemaToZod,
customGet,
getVM,
@@ -37,7 +36,6 @@ import {
restructureMessages,
checkMessageHistory
} from '../commonUtils'
import { ChatGoogleGenerativeAI } from '../../chatmodels/ChatGoogleGenerativeAI/FlowiseChatGoogleGenerativeAI'
const TAB_IDENTIFIER = 'selectedUpdateStateMemoryTab'
const customOutputFuncDesc = `This is only applicable when you have a custom State at the START node. After agent execution, you might want to update the State values`
@@ -513,19 +511,8 @@ async function createAgent(
try {
const structuredOutput = z.object(convertStructuredSchemaToZod(llmStructuredOutput))
if (llm instanceof ChatGoogleGenerativeAI) {
const tool = new ExtractTool({
schema: structuredOutput
})
// @ts-ignore
const modelWithTool = llm.bind({
tools: [tool]
}) as any
llm = modelWithTool
} else {
// @ts-ignore
llm = llm.withStructuredOutput(structuredOutput)
}
// @ts-ignore
llm = llm.withStructuredOutput(structuredOutput)
} catch (exception) {
console.error(exception)
}