---
title: "Get Sentence Similarity. Returns a 424 status code if the model is not an embedding model."
method: POST
path: "/similarity"
tags: ["Text Embeddings Inference"]
---

# Get Sentence Similarity. Returns a 424 status code if the model is not an embedding model.

`POST /similarity`

## Request body

- SimilarityRequest
  - `inputs` SimilarityInput, required
    - `sentences` string[], required — A list of strings which will be compared against the source_sentence.
    - `source_sentence` string, required — The string that you wish to compare the other strings with. This can be a phrase, sentence, or longer passage, depending on the model being used.
  - `parameters` SimilarityParameters
    - `prompt_name` string, nullable — The name of the prompt that should be used by for encoding. If not set, no prompt will be applied. Must be a key in the `sentence-transformers` configuration `prompts` dictionary. For example if ``prompt_name`` is "query" and the ``prompts`` is {"query": "query: ", ...}, then the sentence "What is the capital of France?" will be encoded as "query: What is the capital of France?" because the prompt text will be prepended before any text to encode.
    - `truncate` boolean, nullable
    - `truncation_direction` 'Left' | 'Right'

## Response `200`

Sentence Similarity

- number[]

## Other responses

- `400` — Batch is empty
- `413` — Batch size error
- `422` — Tokenization error
- `424` — Embedding Error
- `429` — Model is overloaded

---

[API](https://skmtc.net/huggingface/apis/text-embeddings-inference.md) · [All operations](https://skmtc.net/huggingface/apis/text-embeddings-inference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/huggingface/text-embeddings-inference/versions/f4c15add6d2b/schema)
