
Embeddings are numerical representations of data (such as text, images, or audio) that capture essential features as vectors. For text, embeddings map words or sentences to vector spaces where similar items are positioned closer together, enabling comparisons and efficient searches.

Developers use embeddings in tasks such as semantic search, recommendation engines, and clustering. Embeddings let machine learning models analyze and process unstructured data by recognizing patterns in those vector representations.

## Generate text embeddings

{% tabs %}
{% tab title="NodeJS" %}
```js
const result = await modelClient.getEmbeddings([
  "Hello, world!",
  "Goodbye, world!",
]);
for (const data of result.data) {
  console.log(`Embedding: ${data.embedding}`);
}
```
{% /tab %}

{% tab title="Python" %}
```python
response = modelClient.get_embeddings(["Hello, world!", "Goodbye, world!"])

for item in response.data:
    length = len(item.embedding)
    print(
        f"data[{item.index}]: length={length}, [{item.embedding[0]}, {item.embedding[1]}, "
        f"..., {item.embedding[length-2]}, {item.embedding[length-1]}]"
    )
```
{% /tab %}

{% tab title=".NET" %}
```csharp
var embedding = await client.GetEmbeddings(["Hello, world!", "Goodbye, world!"]);
Console.WriteLine(embedding.First().ToArray());
Console.WriteLine(embedding.Last().ToArray());
```
{% /tab %}
{% /tabs %}

#### Output

```
Embedding: -0.01918462,-0.025279032,-0.0017195191,0.018848283,-0.033795066,-0.019695852,-0.020947022,0.05158053,-0.03212684,-0.03037789,-0.0021458254,-0.028978731,-0.0024737532,-0.031481072,0.01033225,0.018606123,-0.046145335,0.041463535,0.00044186175,0.041221373,0.053679265,0.001873393,0.004567446,0.01002282,0.047867376,0.0022013208,-0.009834472,0.03847687,0.00089213194,-0.052118666,0.051150016,-0.03255735,-0.0140319485,-0.01263279, .....
```
