add batch embeddings

This commit is contained in:
jmorganca
2024-04-14 20:53:20 -04:00
parent 8e30eb26bd
commit ad7e641815
8 changed files with 243 additions and 72 deletions

View File

@@ -1010,7 +1010,8 @@ Generate embeddings from a model
### Parameters
- `model`: name of model to generate embeddings from
- `prompt`: text to generate embeddings for
- `prompt`: string to generate the embedding for
- `prompts`: array of strings to generate a batch of embeddings for
Advanced parameters:
@@ -1038,3 +1039,33 @@ curl http://localhost:11434/api/embeddings -d '{
]
}
```
#### Request (batch)
```shell
curl http://localhost:11434/api/embeddings -d '{
"model": "all-minilm",
"prompt_batch": [
"Here is an article about llamas...",
"Here is another article about llamas..."
]
}'
```
#### Response
```json
{
"embedding_batch": [
[
0.5670403838157654, 0.009260174818336964, 0.23178744316101074, -0.2916173040866852, -0.8924556970596313,
0.8785552978515625, -0.34576427936553955, 0.5742510557174683, -0.04222835972905159, -0.137906014919281
],
[
0.5670403838157654, 0.009260174818336964, 0.23178744316101074, -0.2916173040866852, -0.8924556970596313,
0.8785552978515625, -0.34576427936553955, 0.5742510557174683, -0.04222835972905159, -0.137906014919281
],
]
}
```