> For the complete documentation index, see [/llms.txt](/llms.txt).

> Source: /docs/capabilities/embed

# Embeddings

## What are embeddings?

Embeddings are a way to convert text into vector representations, where semantically similar texts are positioned closely together.
Embedding models can be used in various scenarios where a comparison of meaning between texts are needed, including search, classification, and clustering.

## What models does Upstage provide?

Upstage recommends using Solar Embedding 2 for new integrations. It provides improved performance and an extended 8k context limit. Solar Embedding 2 models are available now and do not yet have an alias — use the full model name to access them.

Solar Embedding 2 models are fine-tuned versions of [microsoft/harrier-oss-v1-0.6b](https://huggingface.co/microsoft/harrier-oss-v1-0.6b).

<table><thead><tr><th align="left">Model</th><th>Role</th><th>Vector dimensions</th><th>RPM / TPM</th></tr></thead><tbody><tr><td>[solar-embedding-2-query](/docs/models/history#solar-embedding-2-query)</td><td>Query</td><td>1,024</td><td>100 / 300,000</td></tr><tr><td>[solar-embedding-2-passage](/docs/models/history#solar-embedding-2-passage)</td><td>Passage</td><td>1,024</td><td>100 / 300,000</td></tr></tbody></table>

### Scheduled deprecation: Solar Embedding 1

> Solar Embedding 1 models will be fully deprecated on **December 31, 2026 (UTC)**. They remain fully available until that date, but we recommend migrating to Solar Embedding 2 well before then. For new integrations, use Solar Embedding 2 instead.

The aliases below still point to Solar Embedding 1 models. Plan your migration to Solar Embedding 2 before the deprecation date.

<table><thead><tr><th align="left" width="150px">Alias</th><th>Currently points to</th><th>RPM / TPM <a href="/docs/guides/rate-limits#embeddings">(Learn more)</a></th><th>Deprecation date</th></tr></thead><tbody><tr><td>embedding-query</td><td>[solar-embedding-1-large-query](/docs/models/history#solar-embedding-1-large-query-deprecated)</td><td>100 / 300,000</td><td><strong>December 31, 2026 (UTC)</strong></td></tr><tr><td>embedding-passage</td><td>[solar-embedding-1-large-passage](/docs/models/history#solar-embedding-1-large-passage-deprecated)</td><td>100 / 300,000</td><td><strong>December 31, 2026 (UTC)</strong></td></tr></tbody></table>

## What is the difference between passage and query models?

Both are converted into vectors to calculate similarity, but they serve different roles:

- **Passage**: Typically represents a portion of a document, a sentence, or longer text. It refers to a specific section or fragment of the text, often containing information. For example, a paragraph from a research paper or a description on a webpage can be used as a passage.
- **Query**: This is a question or search term that the user inputs to find information. It's usually shorter and more specific compared to a passage, conveying the user's intent to retrieve certain information.

## How to measure similarity between two texts

After converting text into embeddings, you can measure similarity between texts. Cosine similarity quantifies the similarity between two embedding vectors, representing the similarity between their corresponding texts. In the example below, dot products are used to calculate similarity.
Note that since Upstage's Embeddings API outputs normalized vectors with a magnitude of 1, the dot product and cosine similarity yield the same result, and
the passage corresponding to the vector with the highest similarity score is considered the most similar to the query.

```python
import numpy as np

similarity_list = []
for passage_embedding in passage_embedding_list:
  similarity = np.dot(passage_embedding, query_embedding)
  similarity_list.append(similarity)

most_similar_result = passage_list[np.argmax(similarity_list)]
print(most_similar_result)
```

## Examples

### Example 1: Single text input

**Request**

_Request/response examples: embeddings / request_

**Response**

_Example: embeddings / response-200 / default_

### Example 2: Batch processing

Upstage Embedding models support batch processing, allowing you to send an array of texts instead of a single input. This approach is typically faster and more efficient than processing texts one by one.

> A single batch request can include up to 100 texts, with a total token limit of 204,800 per request.

```python
passage_list = [
    "Korea is a beautiful country to visit in the spring.",
    "The best time to visit Korea is in the fall.",
    "Best way to find bug is using unit test.",
    "Python is a great programming language for beginners.",
]

batch_process_result = client.embeddings.create(
    model = "solar-embedding-2-passage",
    input = passage_list
).data

passage_embedding_list = [i.embedding for i in batch_process_result]
```