Skip to main content

Embeddings models in Langflow

Embeddings models convert text into numerical vectors. These embeddings capture semantic meaning of the input text, and allow LLMs to understand context.

Refer to your specific component's documentation for more information on parameters.

Use an embeddings model component in a flow

In this example of a document ingestion pipeline, the OpenAI embeddings model is connected to a vector database. The component converts the text chunks into vectors and stores them in the vector database. The vectorized data can be used to inform AI workloads like chatbots, similarity searches, and agents.

This embeddings component uses an OpenAI API key for authentication. Refer to your specific embeddings component's documentation for more information on authentication.

URL component in a data ingestion pipeline

AI/ML

This component generates embeddings using the AI/ML API.

Inputs

NameTypeDescription
model_nameStringThe name of the AI/ML embedding model to use
aiml_api_keySecretStringAPI key for authenticating with the AI/ML service

Outputs

NameTypeDescription
embeddingsEmbeddingsAn instance of AIMLEmbeddingsImpl for generating embeddings

Amazon Bedrock Embeddings

This component is used to load embedding models from Amazon Bedrock.

Inputs

NameTypeDescription
credentials_profile_nameStringName of the AWS credentials profile in ~/.aws/credentials or ~/.aws/config, which has access keys or role information
model_idStringID of the model to call, e.g., amazon.titan-embed-text-v1. This is equivalent to the modelId property in the list-foundation-models API
endpoint_urlStringURL to set a specific service endpoint other than the default AWS endpoint
region_nameStringAWS region to use, e.g., us-west-2. Falls back to AWS_DEFAULT_REGION environment variable or region specified in ~/.aws/config if not provided

Outputs

NameTypeDescription
embeddingsEmbeddingsAn instance for generating embeddings using Amazon Bedrock

Astra DB vectorize

important

This component is deprecated as of Langflow version 1.1.2. Instead, use the Astra DB vector store component

Connect this component to the Embeddings port of the Astra DB vector store component to generate embeddings.

This component requires that your Astra DB database has a collection that uses a vectorize embedding provider integration. For more information and instructions, see Embedding Generation.

Inputs

NameDisplay NameInfo
providerEmbedding ProviderThe embedding provider to use
model_nameModel NameThe embedding model to use
authenticationAuthenticationThe name of the API key in Astra that stores your vectorize embedding provider credentials. (Not required if using an Astra-hosted embedding provider.)
provider_api_keyProvider API KeyAs an alternative to authentication, directly provide your embedding provider credentials.
model_parametersModel ParametersAdditional model parameters

Outputs

NameTypeDescription
embeddingsEmbeddingsAn instance for generating embeddings using Astra vectorize

Azure OpenAI Embeddings

This component generates embeddings using Azure OpenAI models.

Inputs

NameTypeDescription
ModelStringName of the model to use (default: text-embedding-3-small)
Azure EndpointStringYour Azure endpoint, including the resource. Example: https://example-resource.azure.openai.com/
Deployment NameStringThe name of the deployment
API VersionStringThe API version to use, options include various dates
API KeyStringThe API key to access the Azure OpenAI service

Outputs

NameTypeDescription
embeddingsEmbeddingsAn instance for generating embeddings using Azure OpenAI

Cloudflare Workers AI Embeddings

This component generates embeddings using Cloudflare Workers AI models.

Inputs

NameDisplay NameInfo
account_idCloudflare account IDFind your Cloudflare account ID
api_tokenCloudflare API tokenCreate an API token
model_nameModel NameList of supported models
strip_new_linesStrip New LinesWhether to strip new lines from the input text
batch_sizeBatch SizeNumber of texts to embed in each batch
api_base_urlCloudflare API base URLBase URL for the Cloudflare API
headersHeadersAdditional request headers

Outputs

NameDisplay NameInfo
embeddingsEmbeddingsAn instance for generating embeddings using Cloudflare Workers

Cohere Embeddings

This component is used to load embedding models from Cohere.

Inputs

NameTypeDescription
cohere_api_keyStringAPI key required to authenticate with the Cohere service
modelStringLanguage model used for embedding text documents and performing queries (default: embed-english-v2.0)
truncateBooleanWhether to truncate the input text to fit within the model's constraints (default: False)

Outputs

NameTypeDescription
embeddingsEmbeddingsAn instance for generating embeddings using Cohere

Embedding similarity

This component computes selected forms of similarity between two embedding vectors.

Inputs

NameDisplay NameInfo
embedding_vectorsEmbedding VectorsA list containing exactly two data objects with embedding vectors to compare.
similarity_metricSimilarity MetricSelect the similarity metric to use. Options: "Cosine Similarity", "Euclidean Distance", "Manhattan Distance".

Outputs

NameDisplay NameInfo
similarity_dataSimilarity DataData object containing the computed similarity score and additional information.

Google generative AI embeddings

This component connects to Google's generative AI embedding service using the GoogleGenerativeAIEmbeddings class from the langchain-google-genai package.

Inputs

NameDisplay NameInfo
api_keyAPI KeySecret API key for accessing Google's generative AI service (required)
model_nameModel NameName of the embedding model to use (default: "models/text-embedding-004")

Outputs

NameDisplay NameInfo
embeddingsEmbeddingsBuilt GoogleGenerativeAIEmbeddings object

Hugging Face Embeddings

note

This component is deprecated as of Langflow version 1.0.18. Instead, use the Hugging Face API Embeddings component.

This component loads embedding models from HuggingFace.

Use this component to generate embeddings using locally downloaded Hugging Face models. Ensure you have sufficient computational resources to run the models.

Inputs

NameDisplay NameInfo
Cache FolderCache FolderFolder path to cache HuggingFace models
Encode KwargsEncoding ArgumentsAdditional arguments for the encoding process
Model KwargsModel ArgumentsAdditional arguments for the model
Model NameModel NameName of the HuggingFace model to use
Multi ProcessMulti-ProcessWhether to use multiple processes

Outputs

NameDisplay NameInfo
embeddingsEmbeddingsThe generated embeddings

Hugging Face embeddings Inference API

This component generates embeddings using Hugging Face Inference API models.

Use this component to create embeddings with Hugging Face's hosted models.

Inputs

NameDisplay NameInfo
API KeyAPI KeyAPI key for accessing the Hugging Face Inference API
API URLAPI URLURL of the Hugging Face Inference API
Model NameModel NameName of the model to use for embeddings
Cache FolderCache FolderFolder path to cache Hugging Face models
Encode KwargsEncoding ArgumentsAdditional arguments for the encoding process
Model KwargsModel ArgumentsAdditional arguments for the model
Multi ProcessMulti-ProcessWhether to use multiple processes

Outputs

NameDisplay NameInfo
embeddingsEmbeddingsThe generated embeddings

LM Studio Embeddings

This component generates embeddings using LM Studio models.

Inputs

NameDisplay NameInfo
modelModelThe LM Studio model to use for generating embeddings
base_urlLM Studio Base URLThe base URL for the LM Studio API
api_keyLM Studio API KeyAPI key for authentication with LM Studio
temperatureModel TemperatureTemperature setting for the model

Outputs

NameDisplay NameInfo
embeddingsEmbeddingsThe generated embeddings

MistralAI

This component generates embeddings using MistralAI models.

Inputs