Bugfix/Enum type tools for gemini (#2766)
fix enum type tools for gemini
This commit is contained in:
parent
90558ca688
commit
3cbbd59242
|
|
@ -552,6 +552,13 @@ function zodToGeminiParameters(zodObj: any) {
|
||||||
const jsonSchema: any = zodToJsonSchema(zodObj)
|
const jsonSchema: any = zodToJsonSchema(zodObj)
|
||||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||||
const { $schema, additionalProperties, ...rest } = jsonSchema
|
const { $schema, additionalProperties, ...rest } = jsonSchema
|
||||||
|
if (rest.properties) {
|
||||||
|
Object.keys(rest.properties).forEach((key) => {
|
||||||
|
if (rest.properties[key].enum?.length) {
|
||||||
|
rest.properties[key] = { type: 'string', format: 'enum', enum: rest.properties[key].enum }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
return rest
|
return rest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,10 +273,8 @@ class Supervisor_MultiAgents implements INode {
|
||||||
* So we have to place the system + human prompt at last
|
* So we have to place the system + human prompt at last
|
||||||
*/
|
*/
|
||||||
let prompt = ChatPromptTemplate.fromMessages([
|
let prompt = ChatPromptTemplate.fromMessages([
|
||||||
['human', systemPrompt],
|
['system', systemPrompt],
|
||||||
['ai', ''],
|
|
||||||
new MessagesPlaceholder('messages'),
|
new MessagesPlaceholder('messages'),
|
||||||
['ai', ''],
|
|
||||||
['human', userPrompt]
|
['human', userPrompt]
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue