Gravity Embed

Convert text to Titan Text Embeddings 2 vectors

Overview

This node converts input text into embedding vectors using Amazon's Titan Text Embeddings models. It is designed to transform textual data into numerical vector representations, which are useful for various AI and machine learning tasks such as semantic search, clustering, recommendation systems, and natural language understanding.

Typical use cases include:

  • Generating embeddings for documents or sentences to enable similarity comparisons.
  • Preparing text data for downstream AI workflows that require vector inputs.
  • Enhancing search capabilities by indexing content with vector embeddings.

For example, you can input a product description and get its embedding vector to find similar products based on semantic meaning rather than exact keyword matches.

Properties

Name Meaning
Input Text The text string to convert into an embedding vector.
Model The embedding model to use. Options:
- Titan Text Embeddings v2
- Titan Text Embeddings v1

Output

The node outputs JSON data containing the original input merged with the following fields:

  • embedding: An array of numbers representing the embedding vector generated from the input text.
  • _embeddingModel: The identifier of the embedding model used.
  • _embeddingDimension: The length (dimensionality) of the embedding vector.
  • _originalText: The original input text provided.

Example output JSON structure:

{
  "inputText": "example text",
  "embedding": [0.123, -0.456, ...],
  "_embeddingModel": "amazon.titan-embed-text-v2:0",
  "_embeddingDimension": 768,
  "_originalText": "example text"
}

No binary data output is produced by this node.

Dependencies

  • Requires valid AWS credentials with access to Amazon Bedrock services.
  • Uses the AWS SDK client for Bedrock Runtime to invoke the embedding models.
  • The AWS region can be set via the environment variable AWS_REGION; defaults to us-east-1 if not specified.

Troubleshooting

  • Missing Input Text: If the input text is empty or only whitespace, the node throws an error stating "Input text is required". Ensure the input text property is properly set.
  • Embedding Extraction Failure: If the response from the embedding service does not contain a valid embedding array, an error "Failed to extract embedding from response" is thrown. This may indicate issues with the service or invalid model ID.
  • Credential Issues: Errors related to AWS authentication usually mean the provided API key credential is missing, invalid, or lacks necessary permissions.
  • Region Configuration: If the AWS region is not correctly set in environment variables or credentials, connection errors may occur.

To handle errors gracefully, the node supports continuing on failure, allowing partial processing of multiple inputs.

Links and References

Discussion