# TEXT_EMBEDDING

Generates dense vector embeddings from text input using a specified inference endpoint. This function is useful for creating query vectors for KNN searches against your vectorized data or for other dense vector operations.

## Syntax

`TEXT_EMBEDDING(text, inference_id)`

### Parameters

#### text

Text string to generate embeddings from. Must be a non-null literal string value.

#### inference_id

Identifier of an existing inference endpoint that will generate the embeddings. The inference endpoint must have the `text_embedding` task type and should use the same model that was used to embed your indexed data.

## Examples

Generates a dense vector embedding for the phrase "be excellent to each other" using the 'test_dense_inference' endpoint and performs a KNN search against the `text_embedding_field`.

```esql
FROM dense_vector_text METADATA _score
| WHERE KNN(text_embedding_field, TEXT_EMBEDDING("be excellent to each other", "test_dense_inference"))
```
This example generates a dense vector embedding for the phrase "be excellent to each other" using the 'test_dense_inference' endpoint and performs a KNN search against the `text_embedding_field`.
