mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Bugfix/Gemini Structured Output (#4713)
* fix gemini structured output * update issues templates
This commit is contained in:
@@ -71,24 +71,13 @@ export const generateFollowUpPrompts = async (
|
||||
return structuredResponse
|
||||
}
|
||||
case FollowUpPromptProvider.GOOGLE_GENAI: {
|
||||
const llm = new ChatGoogleGenerativeAI({
|
||||
const model = new ChatGoogleGenerativeAI({
|
||||
apiKey: credentialData.googleGenerativeAPIKey,
|
||||
model: providerConfig.modelName,
|
||||
temperature: parseFloat(`${providerConfig.temperature}`)
|
||||
})
|
||||
// use structured output parser because withStructuredOutput is not working
|
||||
const parser = StructuredOutputParser.fromZodSchema(FollowUpPromptType)
|
||||
const formatInstructions = parser.getFormatInstructions()
|
||||
const prompt = PromptTemplate.fromTemplate(`
|
||||
${providerConfig.prompt}
|
||||
|
||||
{format_instructions}
|
||||
`)
|
||||
const chain = prompt.pipe(llm).pipe(parser)
|
||||
const structuredResponse = await chain.invoke({
|
||||
history: apiMessageContent,
|
||||
format_instructions: formatInstructions
|
||||
})
|
||||
const structuredLLM = model.withStructuredOutput(FollowUpPromptType)
|
||||
const structuredResponse = await structuredLLM.invoke(followUpPromptsPrompt)
|
||||
return structuredResponse
|
||||
}
|
||||
case FollowUpPromptProvider.MISTRALAI: {
|
||||
|
||||
Reference in New Issue
Block a user