Skip to content
Snippets Groups Projects
Unverified Commit a87efb91 authored by Thuc Pham's avatar Thuc Pham Committed by GitHub
Browse files

docs: update chat engine docs (#1648)

parent 6a4a7376
No related branches found
No related tags found
No related merge requests found
---
"@llamaindex/doc": patch
---
docs: update chat engine docs
......@@ -12,9 +12,26 @@ const chatEngine = new ContextChatEngine({ retriever });
const response = await chatEngine.chat({ message: query });
```
In short, you can use the chat engine by calling `index.asChatEngine()`. It will return a `ContextChatEngine` to start chatting.
```typescript
const chatEngine = index.asChatEngine();
```
You can also pass in options to the chat engine.
```typescript
const chatEngine = index.asChatEngine({
similarityTopK: 5,
systemPrompt: "You are a helpful assistant.",
});
```
The `chat` function also supports streaming, just add `stream: true` as an option:
```typescript
const chatEngine = index.asChatEngine();
const stream = await chatEngine.chat({ message: query, stream: true });
for await (const chunk of stream) {
process.stdout.write(chunk.response);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment