const inSchema: JSONSchema7 = {
title: "getWeather",
description: "Get the current weather based on a location",
type: "object",
$schema: "http://json-schema.org/draft-07/schema#",
required: ["location"],
properties: {
location: {
title: "Location",
type: "string",
description: "The location to get the current weather for",
},
},
};
const outSchema: JSONSchema7 = {
title: "getWeather",
description: "The current weather based on a location (eg city or country)",
type: "object",
$schema: "http://json-schema.org/draft-07/schema#",
required: ["location", "description"],
properties: {
location: {
title: "Location",
type: "string",
description: "The city or country to get the current weather for",
},
description: {
title: "Description",
type: "string",
description: "The current weather description",
},
},
};
const getWeather = ai.defineTool(
{
name: "getWeather",
description: "Gets the current weather in a given location",
inputJsonSchema: inSchema,
outputJsonSchema: outSchema,
},
async (input) => {
return {
location: input.location,
description: `The weather in ${input.location} is 20 celcius`,
};
}
const inSchema: JSONSchema7 = {
title: "getWeather",
description: "Get the current weather based on a location",
type: "object",
$schema: "http://json-schema.org/draft-07/schema#",
required: ["location"],
properties: {
location: {
title: "Location",
type: "string",
description: "The location to get the current weather for",
},
},
};
const outSchema: JSONSchema7 = {
title: "getWeather",
description: "The current weather based on a location (eg city or country)",
type: "object",
$schema: "http://json-schema.org/draft-07/schema#",
required: ["location", "description"],
properties: {
location: {
title: "Location",
type: "string",
description: "The city or country to get the current weather for",
},
description: {
title: "Description",
type: "string",
description: "The current weather description",
},
},
};
const getWeather = ai.defineTool(
{
name: "getWeather",
description: "Gets the current weather in a given location",
inputJsonSchema: inSchema,
outputJsonSchema: outSchema,
},
async (input) => {
return {
location: input.location,
description: `The weather in ${input.location} is 20 celcius`,
};
}