Embeddings
Generate embeddings from text.
Create embeddings
Given a list of messages belonging to a chat history, generate a response.
Required attributes
- Name
input
- Type
- string or array
- Description
One or multiple pieces of text from which embeddings will be generated. For each piece of text, one embedding is generated.
- Name
model
- Type
- string
- Description
The model used for chat completions.
If the model name is "default", the chat model from the configuration is used (see Documentation » Configuration for details).
If the model name follows the format repo-owner/repo-name/model-name, the indicated model is used and, if it is not present, it will be downloaded from huggingface. If it cannot be downloaded, Edgen responds with an error. Example: "nomic-ai/nomic-embed-text-v1.5-GGUF/nomic-embed-text-v1.5.f16.gguf".
If the model name contains just a file name, e.g.: "my-model.bin", Edgen will try using the file of this name in the data directory as defined in the configuration. If the the file does not exist there, Edgen responds with an error.
Optional attributes
- Name
response_format
- Type
- string
- Description
The format to return the embeddings in. Can be either
float
orbase64
.
- Name
dimensions
- Type
- integer
- Description
The number of dimensions the resulting output embeddings should have. Only supported in some models.
Request
curl http://localhost:33322/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key-required" \
-d '{
"model": "default",
"input": "Hello World!"
}'
Response
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0023064255,
-0.009327292,
....
-0.0028842222,
],
"index": 0
}
],
"model": "default",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}