Documentation
APIs
Embeddings

Embeddings

Embed any text with Solar Embeddings API.

The embeddings API converts text into numbers that computers can understand. Imagine converting a sentence into a list of numbers, each capturing a piece of the sentence's meaning. This makes it easier for machines to do tasks like finding similar texts, sorting information, or even answering questions.

Solar Embeddings API features dual models, solar-1-mini-embedding-query for user queries and solar-1-mini-embedding-passage for document embedding, within a unified vector space, designed to enhance text processing tasks with a focus on performance.

For developers building search engines or retrieval systems, solar-1-mini-embedding-passage is ideal for initially embedding the searchable content. Upon user query submission, leveraging solar-1-mini-embedding-query facilitates efficient and accurate matching of queries with the embedded content, thereby optimizing the information retrieval process.

Available models

ModelRelease dateContext LengthDescription
solar-1-mini-embedding-query2024-03-12 beta4096Solar-base Query Embedding model with a 4k context limit. This model is optimized for embedding user's question in information-seeking tasks such as retrieval & reranking.
solar-1-mini-embedding-passage2024-03-12 beta4096Solar-base Passage Embedding model with a 4k context limit. This model is optimized for embedding documents or texts to be searched.

Request

POST https://api.upstage.ai/v1/solar/embeddings

Parameters

Request headers

Authorization string Required
Authentication token, format: Bearer API_KEY

Request body

model string Required
Specifies the name of the model utilized to carry out the embedding.
Current available models are solar-1-mini-embedding-queryand solar-1-mini-embedding-passage.

input string Required
Input text to embed, encoded as a string. The input must not exceed the max input tokens for the model, cannot be an empty string. For best results, we advise keeping each text under 512 tokens in length.

Response

A list of embedding objects.

The embedding object

Represents an embedding vector returned by the embeddings API endpoint.

index integer
The index of the embedding in the list of embeddings.

embedding array
The embedding vector is a sequence of floating-point numbers. Currently, the models utilize vectors with a dimensionality of 4096.

object string
The object type, which is always "embedding".

Additional information

model string
A string indicating the version of the model that was utilized for the request.

usage object
Usage statistics for the completion request.

usage.prompt_tokens integer
Number of tokens in the prompt.

usage.total_tokens integer
Total number of tokens used in the request.

Example

Request

curl --location 'https://api.upstage.ai/v1/solar/embeddings' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "model": "solar-1-mini-embedding-query",
  "input": "What makes Solar LLM small yet effective?"
}'

Response

Success - HTTP Status 200 OK - Single input response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0.01850688,
        -0.0066606696,
        ...
        0.009938696,
        0.006452979
      ]
    }
  ],
  "model": "solar-1-mini-embedding-query",
  "usage": {
    "prompt_tokens": 21,
    "total_tokens": 21
  }
}