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-embedding-1-large-query for user queries and solar-embedding-1-large-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-embedding-1-large-passage is ideal for initially embedding the searchable content. Upon user query submission, leveraging solar-embedding-1-large-query facilitates efficient and accurate matching of queries with the embedded content, thereby optimizing the information retrieval process.


** The performance of our new model(solar-embedding-1-large) has been greatly upgraded compared to the deprecated model (solar-1-mini-embedding), so existing users of our model are recommended to switch to the new one. The old model will be deprecated on June 15, 2024. For more details, please refer to our tech blog (opens in a new tab)!

Available models

ModelRelease dateContext LengthDescription
solar-embedding-1-large-query2024-05-10 beta4000Solar-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-embedding-1-large-passage2024-05-10 beta4000Solar-base Passage Embedding model with a 4k context limit. This model is optimized for embedding documents or texts to be searched.
solar-1-mini-embedding-query2024-03-12 deprecated4000Solar-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. Will be deprecated on June 15, 2024.
solar-1-mini-embedding-passage2024-03-12 deprecated4000Solar-base Passage Embedding model with a 4k context limit. This model is optimized for embedding documents or texts to be searched. Will be deprecated on June 15, 2024.

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-embedding-1-large-query, solar-embedding-1-large-passage. solar-1-mini-embedding-query and solar-1-mini-embedding-passage are previous models and will be deprecated on June 15, 2024.

input string or array Required
Input text to embed. Available types are a single string or an array of strings.

  • The array can contain up to 100 strings, and the total number of tokens in the array(tokens per each request) should be less than 204,800.
  • Each input string must not exceed the max input tokens(4000) for the model, and cannot be an empty string.
  • We advise keeping each text under 512 tokens in length for the optimal user experience.

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 embedding 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 UPSTAGE_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "model": "solar-embedding-1-large-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-embedding-1-large-query",
  "usage": {
    "prompt_tokens": 21,
    "total_tokens": 21
  }
}