Skip to content

Commit 8c786c7

Browse files
committed
docs(README): options.messages for prompt()
1 parent 40b2869 commit 8c786c7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,33 @@ const { message } = await prompt("What is the capital of France?", {
321321
console.log(message.content);
322322
```
323323
324+
In order to pass a history of messages, pass them as `options.messages`:
325+
326+
```js
327+
const { message } = await prompt("What about Spain?", {
328+
model: "gpt-4",
329+
token: process.env.TOKEN,
330+
messages: [
331+
{ role: "user", content: "What is the capital of France?" },
332+
{ role: "assistant", content: "The capital of France is Paris." },
333+
],
334+
});
335+
```
336+
337+
Alternatively, skip the `message` argument and pass all messages as `options.messages`:
338+
339+
```js
340+
const { message } = await prompt({
341+
model: "gpt-4",
342+
token: process.env.TOKEN,
343+
messages: [
344+
{ role: "user", content: "What is the capital of France?" },
345+
{ role: "assistant", content: "The capital of France is Paris." },
346+
{ role: "user", content: "What about Spain?" },
347+
],
348+
});
349+
```
350+
324351
⚠️ Not all of the arguments below are implemented yet. See [#5](https://github.com/copilot-extensions/preview-sdk.js/issues/5) sub issues for progress.
325352
326353
```js

0 commit comments

Comments
 (0)