Skip to main content

Generate Embeddings

Generate vector embeddings for a given input string or array of strings.

POST /api/embed

Request Parameters

  • model (string, required): Model tag.
  • input (string or array of strings, required): Text content to generate embeddings for.
  • truncate (boolean, default true): Truncate input to model's context window.
  • options (object, optional): Override Modelfile parameters.
  • keep_alive (string/number, default "5m"): Cache duration in memory.

Examples

1. Generating Embeddings for a Single Text String

curl http://localhost:11434/api/embed -d '{
"model": "nomic-embed-text",
"input": "The quick brown fox jumps over the lazy dog"
}'

Response Payload

{
"model": "nomic-embed-text",
"embeddings": [
[
0.01723901,
-0.0823901,
0.1023812,
...
]
]
}

2. Generating Embeddings for Multiple Text Strings

curl http://localhost:11434/api/embed -d '{
"model": "nomic-embed-text",
"input": [
"First sentence to vectorize",
"Second sentence to vectorize"
]
}'

Response Payload

{
"model": "nomic-embed-text",
"embeddings": [
[0.01723901, -0.0823901, 0.1023812, ...],
[-0.0482901, 0.09284102, -0.002849, ...]
]
}