router.get('/fruitInfo2', async (req, env) => {
return runWithTools(env.AI, model, {
messages: [{
role: 'system',
content: `
The user message is a cryptic clue about a fruit.
Extract the name and shape of the fruit.
`
}, {
role: 'user',
content: 'garden of eden'
}],
tools: [{
name: 'fruitInfo',
description: 'Extract the fruit name and shape.',
parameters: {
type: 'object',
properties: {
name: {type: 'string', description: 'The name of the fruit'},
shape: {type: 'string', description: 'The shape of the fruit'}
},
required: ['name', 'shape']
},
function: ({name, shape}) => `Fruit is ${name} and shape is ${shape}`
}]
});
})
router.get('/fruitInfo2', async (req, env) => {
return runWithTools(env.AI, model, {
messages: [{
role: 'system',
content: `
The user message is a cryptic clue about a fruit.
Extract the name and shape of the fruit.
`
}, {
role: 'user',
content: 'garden of eden'
}],
tools: [{
name: 'fruitInfo',
description: 'Extract the fruit name and shape.',
parameters: {
type: 'object',
properties: {
name: {type: 'string', description: 'The name of the fruit'},
shape: {type: 'string', description: 'The shape of the fruit'}
},
required: ['name', 'shape']
},
function: ({name, shape}) => `Fruit is ${name} and shape is ${shape}`
}]
});
})