> For the complete documentation index, see [llms.txt](https://docs.thub.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thub.tech/langchain/embeddings.md).

# 🧬Embeddings

An embedding is a vector (list) of floating-point numbers. The distance between two vectors measures their relatedness. Small distances suggest high relatedness and large distances suggest low relatedness.

They are commonly used for:

·       Search (where results are ranked by relevance to a query string)

·       Clustering (where text strings are grouped by similarity)

·       Recommendations (where items with related text strings are recommended)

·       Anomaly detection (where outliers with little relatedness are identified)

·       Diversity measurement (where similarity distributions are analyzed)

·       Classification (where text strings are classified by their most similar label)

#### 1)AWS Bedrock Embeddings

AWSBedrock embedding models to generate embeddings for a given text.

#### Setup

AWS Console

1. [Log in](https://aws.amazon.com/console/) to AWS Console
2. In the search bar, search for **Bedrock** and open [**Amazon Bedrock**](https://console.aws.amazon.com/bedrock/)

<figure><img src="/files/Aye9vzAXquo1a608xF5X" alt=""><figcaption></figcaption></figure>

3. Click [**Model access**](https://console.aws.amazon.com/bedrock/home#/modelaccess) from the left panel
4. Request access to embedding models such as

· amazon.titan-embed-text-v1\
· amazon.titan-embed-text-v2\
· cohere.embed-english-v3

<figure><img src="/files/QsWqNcLPlFG7DcicdhQk" alt=""><figcaption></figcaption></figure>

5. Go to **AWS IAM** to generate credentials

Link: <https://console.aws.amazon.com/iam/>

6. Create AWS Access Credentials

IAM → Users → Create User → Create Access Key

Copy the following details

· Access Key\
· Secret Access Key

7. Open THub Canvas
8. Go to Embeddings > drag **AWS Bedrock Embeddings** node
9. Click **Connect Credential → Create New**

Enter the credentials

· AWS Access Key\
· AWS Secret Access Key

10. Select **Region**

<figure><img src="/files/wOKK66XhjLCWUckYoTQf" alt=""><figcaption></figcaption></figure>

11. Select **Model Name**
12. Select **Cohere Input Type** (only if Cohere model is used)
13. Voila 🎉, you have successfully created **AWS Bedrock Embeddings node in THub**

<figure><img src="/files/VIHSKeQWQhFYmtoOMnYf" alt=""><figcaption></figcaption></figure>

#### 2)Azure OpenAI Embeddings

&#x20;  **Prerequisite**

1\.     [Log in](https://portal.azure.com/) or [sign up](https://azure.microsoft.com/en-us/free/) to Azure

2\.     [Create](https://portal.azure.com/#create/Microsoft.CognitiveServicesOpenAI) your Azure OpenAI and wait for approval approximately 10 business days

3\.     Your API key will be available at **Azure OpenAI** > click **name\_azure\_openai** > click **Click here to manage keys**

<figure><img src="/files/WzzZeNba0lUQCV6sKT19" alt=""><figcaption></figcaption></figure>

Setup

Azure OpenAI Embeddings

1\.     Click **Go to Azure OpenaAI Studio**

<figure><img src="/files/yyotMmAzoQCNQ9IuK8sX" alt=""><figcaption></figcaption></figure>

2\.     Click **Deployments**

<figure><img src="/files/fLDHGkVTNpLUIZXDUbKo" alt=""><figcaption></figcaption></figure>

**3.**     Click **Create new deployment**

<figure><img src="/files/dGbTiaroZxv3ktDUIW6g" alt=""><figcaption></figcaption></figure>

**4.**     Select as shown below and click **Create**

<figure><img src="/files/LNxAzWnbNQE8fPulilNk" alt=""><figcaption></figcaption></figure>

5\.     Successfully created **Azure OpenAI Embeddings**

·       Deployment name: `text-embedding-ada-002`

·       Instance name: `top right conner`

<figure><img src="/files/Vow59dQ7Hn4IJAXRrIWW" alt=""><figcaption></figcaption></figure>

**THub**

1\.     **Embeddings** > drag **Azure OpenAI Embeddings** node

2\.     **Connect Credential** > click **Create New**

3\.     Copy & Paste each details (API Key, Instance & Deployment name, [API Version](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions)) into **Azure OpenAI Embeddings** credential

<figure><img src="/files/k9nuunIvXbYKaFVYRC1Y" alt=""><figcaption></figcaption></figure>

4\.     Voila [🎉](https://emojipedia.org/party-popper/), you have created **Azure OpenAI Embeddings node** in THub

<figure><img src="/files/3bib4FHHWzVNEe9w0RQH" alt=""><figcaption></figcaption></figure>

#### 3)Google GenerativeAI Embeddings

Google Generative API to generate embeddings for a given text.

Google Generative AI Embeddings

Prerequisite

1. Go to [Google AI Studio](https://aistudio.google.com/app/apikey)
2. Sign in with your Google account
3. Click Create API Key and copy the generated API Key

Setup

THub

1. Embeddings > drag Google Generative AI Embeddings node
2. Connect Credential > click Create New
3. Paste the Google Generative AI API Key in the credential
4. Select Model Name
5. Select Task Type

Example:\
· RETRIEVAL\_DOCUMENT\
· RETRIEVAL\_QUERY

6. Voila 🎉, you have created Google Generative AI Embeddings node in THub

<figure><img src="/files/OVxVKZdrByomcgdgqBUm" alt=""><figcaption></figcaption></figure>

#### 4)Google VertexAI Embeddings

Google vertexAI API to generate embeddings for a given text.

Prerequisite

1. Go to[ Google Cloud Console](https://console.cloud.google.com/)
2. Create or select a Project
3. Enable [Vertex AI API](https://console.cloud.google.com/apis/library/aiplatform.googleapis.com)
4. Create [Service Account credentials](https://console.cloud.google.com/iam-admin/serviceaccounts)

Go to IAM & Admin → Service Accounts

5. Create a Service Account and generate a JSON Key

Setup

THub

1. Embeddings > drag Google Vertex AI Embeddings node
2. Connect Credential > click Create New
3. Upload or paste the Service Account JSON credentials
4. Select Model Name
5. Select Region
6. Voila 🎉, you have created Google Vertex AI Embeddings node in THub

<figure><img src="/files/dJ8eCiZnIelKnoq0AP4g" alt=""><figcaption></figcaption></figure>

#### 5)Ollama Embeddings

Generate embeddings for a given text using opensource model on Ollama.

Prerequisite

1. Install [Ollama](https://ollama.com/download)
2. Start [Ollama on your system](http://localhost:11434/)
3. Pull an embedding supported model

Setup

THub

1. Embeddings > drag Ollama Embeddings node
2. Enter Base URL
3. Enter Model Name
4. Voila 🎉, you have created Ollama Embeddings node in THub

<figure><img src="/files/uoqYBbJ0FRMIMQK30ImT" alt=""><figcaption></figcaption></figure>

#### 6)OpenAI Embeddings

OpenAI API to generate embeddings for a given text.

OpenAI Embeddings

Prerequisite

1. Go to [OpenAI Platform](https://platform.openai.com/)
2. Sign in or create an account
3. Generate an[ API Key](https://platform.openai.com/api-keys)

Setup

THub

1. Embeddings > drag OpenAI Embeddings node
2. Connect Credential > click Create New
3. Paste the OpenAI API Key in the credential
4. Select Model Name\
   Example: text-embedding-ada-002
5. Voila 🎉, you have created OpenAI Embeddings node in THub

<figure><img src="/files/RnaQvPPbPLY6xPE2fppk" alt=""><figcaption></figcaption></figure>

#### 11)OpenAI Embeddings Custom

OpenAI API to generate embeddings for a given text.

Prerequisite

1. Go to OpenAI Platform\
   Link: <https://platform.openai.com/>
2. Sign in or create an account
3. Generate an API Key\
   Link: <https://platform.openai.com/api-keys>

Setup

THub

1. Embeddings > drag OpenAI Embeddings Custom node
2. Connect Credential > click Create New
3. Paste the OpenAI API Key in the credential
4. Enter Model Name\
   Example: custom embedding model name
5. Voila 🎉, you have created OpenAI Embeddings Custom node in THub

<figure><img src="/files/dMGqFQKq6IfCWsZn9WAS" alt=""><figcaption></figcaption></figure>
