summaryrefslogtreecommitdiffhomepage
path: root/.rules/docs/ollama/embed.md
diff options
context:
space:
mode:
Diffstat (limited to '.rules/docs/ollama/embed.md')
-rw-r--r--.rules/docs/ollama/embed.md56
1 files changed, 56 insertions, 0 deletions
diff --git a/.rules/docs/ollama/embed.md b/.rules/docs/ollama/embed.md
new file mode 100644
index 0000000..9c81ebf
--- /dev/null
+++ b/.rules/docs/ollama/embed.md
@@ -0,0 +1,56 @@
+# Generate embeddings
+
+`POST /api/embed` — Creates vector embeddings representing the input text.
+
+**Server:** `http://localhost:11434`
+
+## Request
+
+| Field | Type | Required | Description |
+|---|---|---|---|
+| `model` | string | yes | Model name (e.g. `"embeddinggemma"`) |
+| `input` | string \| string[] | yes | Text or array of texts to embed |
+| `truncate` | boolean | no | Truncate inputs exceeding context window (default: `true`). If `false`, returns an error. |
+| `dimensions` | integer | no | Number of dimensions for the embedding vectors |
+| `keep_alive` | string | no | Model keep-alive duration |
+| `options` | ModelOptions | no | Runtime options (see generate.md) |
+
+## Response
+
+| Field | Type | Description |
+|---|---|---|
+| `model` | string | Model that produced the embeddings |
+| `embeddings` | number[][] | Array of embedding vectors (one per input) |
+| `total_duration` | integer | Total time (nanoseconds) |
+| `load_duration` | integer | Model load time (nanoseconds) |
+| `prompt_eval_count` | integer | Number of input tokens processed |
+
+## Examples
+
+### Single input
+```bash
+curl http://localhost:11434/api/embed -d '{
+ "model": "embeddinggemma",
+ "input": "Why is the sky blue?"
+}'
+```
+
+### Multiple inputs (batch)
+```bash
+curl http://localhost:11434/api/embed -d '{
+ "model": "embeddinggemma",
+ "input": [
+ "Why is the sky blue?",
+ "Why is the grass green?"
+ ]
+}'
+```
+
+### Custom dimensions
+```bash
+curl http://localhost:11434/api/embed -d '{
+ "model": "embeddinggemma",
+ "input": "Generate embeddings for this text",
+ "dimensions": 128
+}'
+```