# 🧬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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FV0Oc1XC4wJs2AYBIUdOK%2Fimage.png?alt=media&#x26;token=4893e4bc-255c-4094-bc89-d6109fe63744" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FtkddBavvykSlSMJQSl3Q%2F16-03-2026%2014_35_17.png?alt=media&#x26;token=102511f0-ffaa-4566-aa4a-7be87614c4ca" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FXjMsuXF8fsAZG5saDSjP%2F16-03-2026%2015_03_59.png?alt=media&#x26;token=9b8f4d45-382c-48b2-9f4b-1ea1e0f930fc" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2Fv6mSIb53KV0U6dOZZv6k%2FScreenshot%202024-07-04%20164852.png?alt=media&#x26;token=492171bb-e549-4d28-a2bf-ef3ad18a6850" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FbtcuIbctNtF20dk9UTW8%2Fimage.png?alt=media&#x26;token=ee330f62-3951-4c19-996a-f18697efc502" alt=""><figcaption></figcaption></figure>

Setup

Azure OpenAI Embeddings

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

<figure><img src="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FRLBCM5kDrag0AW9kxNrm%2Fimage.png?alt=media&#x26;token=d54759fd-0372-4373-9d37-77d98b103da3" alt=""><figcaption></figcaption></figure>

2\.     Click **Deployments**

<figure><img src="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FjdRcWC2cB2th4BXnmX4A%2Fimage.png?alt=media&#x26;token=033df409-039d-4dba-b99b-12c605b40d4c" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FxI69NinQjQY4WRxjxDP6%2Fimage.png?alt=media&#x26;token=f6d1abd8-f403-4599-99fb-8719b01cdfb8" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FAA8AVI8zy2zgOxim72Ck%2Fimage.png?alt=media&#x26;token=fb6df239-c596-47d9-966f-a07dad5131ce" alt=""><figcaption></figcaption></figure>

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

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

·       Instance name: `top right conner`

<figure><img src="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FugFeqnbnnwVfQSqomc9f%2Fimage.png?alt=media&#x26;token=689217a5-bf5f-4b8f-b327-5671fefe4278" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FgE2gPhCnUSsLeaQJ6h7E%2FScreenshot%202024-07-04%20164909.png?alt=media&#x26;token=8c5f3c1c-faa6-43e2-a744-3c916d642a7e" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FQt2by1pBjUUefGpDoiJF%2Fimage.png?alt=media&#x26;token=1c390755-d8ea-4006-8121-4e0a7df909b3" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FFxA5Udv7uRpq3oOSOODC%2Fimage.png?alt=media&#x26;token=a64e309d-db67-4d04-ad90-52d45b108bcd" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2F7QwtJPxolGQMAS9ckqsS%2Fimage.png?alt=media&#x26;token=16da8c98-73c2-4018-9014-e80d099c7ba1" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FXBOmxNCcyOjQ7dHIql3N%2FScreenshot%202024-07-04%20165014.png?alt=media&#x26;token=b04e1368-ae5b-4ec9-ae23-e7b4bc09b737" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FbfRFi615QbJURkT026zS%2FScreenshot%202024-07-04%20165145.png?alt=media&#x26;token=aed66ff9-8518-4087-9156-e01339029908" 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="https://1720595571-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxWXmt1Z68dgle5JORrEw%2Fuploads%2FLoy79qSR9iGMJssxszdz%2FScreenshot%202024-07-04%20164801.png?alt=media&#x26;token=bb443732-4554-472d-99ff-9a7cbcca0339" alt=""><figcaption></figcaption></figure>
