From be889b2f814079a15261010ca9c038190b049507 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Thu, 10 Aug 2023 15:56:59 -0700 Subject: [PATCH] add docs for `/api/embeddings` --- docs/api.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/api.md b/docs/api.md index 355bfef4..9fec79a2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -8,6 +8,7 @@ - [Copy a model](#copy-a-model) - [Delete a model](#delete-a-model) - [Pull a model](#pull-a-model) +- [Generate embeddings](#generate-embeddings) ## Conventions @@ -220,3 +221,36 @@ curl -X POST http://localhost:11434/api/pull -d '{ "total": 2142590208 } ``` + +## Generate Embeddings + +``` +POST /api/embeddings +``` + +Generate embeddings from a model + +### Parameters + +- `model`: name of model to generate embeddings from +- `prompt`: text to generate embeddings for + +### Request + +``` +curl -X POST http://localhost:11434/api/embeddings -d '{ + "model": "llama2:7b", + "prompt": "Here is an article about llamas..." +}' +``` + +### Response + +```json +{ + "embeddings": [ + 0.5670403838157654, 0.009260174818336964, 0.23178744316101074, -0.2916173040866852, -0.8924556970596313, + 0.8785552978515625, -0.34576427936553955, 0.5742510557174683, -0.04222835972905159, -0.137906014919281 + ] +} +```