const tool_response = await env.AI.run(
"@hf/nousresearch/hermes-2-pro-mistral-7b",
{
messages: [
{ role: "user", content: query },
],
temperature: 0.2,
tools: [
{
type: "function",
function: {
name: "get-weather",
description: "Gets weather information of a particular city",
parameters: {
type: "object",
properties: {
city: {
type: "string",
description: "The city name",
},
country: {
type: "string",
description: "The country name",
}
},
required: ["city"],
}
}
},
{
type: "function",
function: {
name: "search-google",
description: "Gets general data from Google",
parameters: {
type: "object",
properties: {
keyword: {
type: "string",
description: "The keywords for searching",
},
},
required: ["keyword"],
}
}
},
],
}
);
const selected_tool = tool_response?.tool_calls?.[0];
console.log({ selected_tool });
const tool_response = await env.AI.run(
"@hf/nousresearch/hermes-2-pro-mistral-7b",
{
messages: [
{ role: "user", content: query },
],
temperature: 0.2,
tools: [
{
type: "function",
function: {
name: "get-weather",
description: "Gets weather information of a particular city",
parameters: {
type: "object",
properties: {
city: {
type: "string",
description: "The city name",
},
country: {
type: "string",
description: "The country name",
}
},
required: ["city"],
}
}
},
{
type: "function",
function: {
name: "search-google",
description: "Gets general data from Google",
parameters: {
type: "object",
properties: {
keyword: {
type: "string",
description: "The keywords for searching",
},
},
required: ["keyword"],
}
}
},
],
}
);
const selected_tool = tool_response?.tool_calls?.[0];
console.log({ selected_tool });