Skip to content

Commit fa45f9d

Browse files
authored
Fixups to code sample
1 parent 42cf59c commit fa45f9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ Because of their special behavior of being preserved on context window overflow,
141141
A special case of the above is using the assistant role to emulate tool use or function-calling, by marking a response as coming from the assistant side of the conversation:
142142

143143
```js
144-
const session = await ai.assistant.create({
144+
const session = await ai.languageModel.create({
145145
systemPrompt: `
146146
You are a helpful assistant. You have access to the following tools:
147147
- calculator: A calculator. To use it, write "CALCULATOR: <expression>" where <expression> is a valid mathematical expression.
148148
`
149149
});
150150

151151
async function promptWithCalculator(prompt) {
152-
const result = await session.prompt("What is 2 + 2?");
152+
const result = await session.prompt(prompt);
153153

154154
// Check if the assistant wants to use the calculator tool.
155155
const match = /^CALCULATOR: (.*)$/.exec(result);

0 commit comments

Comments
 (0)