Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,11 @@ const session = await LanguageModel.create({
initialPrompts: [
{
role: "system",
content: `You are a helpful assistant. You can use tools to help the user.`
}
content: `You are a helpful assistant. You can use tools to help the user.`,
},
],
expectedInputs: [{ type: "text", languages: ["en"] }],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah maybe expectedInputs should include { type: 'tool-response' }

expectedOutputs: [{ type: "tool-call" }, { type: "text", languages: ["en"] }],
tools: [
{
name: "getWeather",
Expand All @@ -194,12 +196,14 @@ const session = await LanguageModel.create({
required: ["location"],
},
async execute({ location }) {
const res = await fetch("https://weatherapi.example/?location=" + location);
const res = await fetch(
"https://weatherapi.example/?location=" + location,
);
// Returns the result as a JSON string.
return JSON.stringify(await res.json());
},
}
]
},
],
});

const result = await session.prompt("What is the weather in Seattle?");
Expand Down