You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Response streaming can be enabled by setting `stream: true`, modifying function calls to return an `AsyncGenerator` where each part is an object in the stream.
25
26
26
27
```javascript
@@ -34,6 +35,7 @@ for await (const part of response) {
The Ollama JavaScript library's API is designed around the [Ollama REST API](https://github.com/jmorganca/ollama/blob/main/docs/api.md)
49
52
50
53
### chat
@@ -61,8 +64,9 @@ ollama.chat(request)
61
64
-`content``<string>`: The content of the message.
62
65
-`images``<Uint8Array[] | string[]>`: (Optional) Images to be included in the message, either as Uint8Array or base64 encoded strings.
63
66
-`format``<string>`: (Optional) Set the expected format of the response (`json`).
64
-
-`options``<Options>`: (Optional) Options to configure the runtime.
65
67
-`stream``<boolean>`: (Optional) When true an `AsyncGenerator` is returned.
68
+
-`keep_alive``<string | number>`: (Optional) How long to keep the model loaded.
69
+
-`options``<Options>`: (Optional) Options to configure the runtime.
66
70
67
71
- Returns: `<ChatResponse>`
68
72
@@ -80,8 +84,9 @@ ollama.generate(request)
80
84
-`raw``<boolean>`: (Optional) Bypass the prompt template and pass the prompt directly to the model.
81
85
-`images``<Uint8Array[] | string[]>`: (Optional) Images to be included, either as Uint8Array or base64 encoded strings.
82
86
-`format``<string>`: (Optional) Set the expected format of the response (`json`).
83
-
-`options``<Options>`: (Optional) Options to configure the runtime.
84
87
-`stream``<boolean>`: (Optional) When true an `AsyncGenerator` is returned.
88
+
-`keep_alive``<string | number>`: (Optional) How long to keep the model loaded.
89
+
-`options``<Options>`: (Optional) Options to configure the runtime.
85
90
- Returns: `<GenerateResponse>`
86
91
87
92
### pull
@@ -176,6 +181,7 @@ ollama.embeddings(request)
176
181
-`request``<Object>`: The request object containing embedding parameters.
177
182
-`model``<string>` The name of the model used to generate the embeddings.
178
183
-`prompt``<string>`: The prompt used to generate the embedding.
184
+
-`keep_alive``<string | number>`: (Optional) How long to keep the model loaded.
179
185
-`options``<Options>`: (Optional) Options to configure the runtime.
0 commit comments