Skip to main content

Get Embedding Node

Get Embedding Node Screenshot

Overview

The Get Embedding Node is used to generate a vector embedding for a given input text. This node is particularly useful when you want to convert text into a numerical representation that can K-nearest neighbor search, and more.

The node requires an integration to be available in the context when the graph is being run. The integration is responsible for generating the embedding. Currently, the only supported integration is OpenAI. However, when running Rivet in a parent application, you can register custom integrations.

Inputs

TitleData TypeDescriptionDefault ValueNotes
InputstringThe text for which the embedding should be generated.(required)The input will be coerced into a string if it is not a string.
IntegrationstringThe name of the integration to use for generating the embedding.(required if the input toggle for Integration is enabled)The input will be coerced into a string if it is not a string.

Example 1: Generate an embedding for a text

  1. Create a Text Node and set the text to "Hello, world!".
  2. Create a Get Embedding Node and connect the Text Node to its Input input.
  3. Run the graph. The Embedding output of the Get Embedding Node should contain the vector embedding for the input text.

Get Embedding Node Example 1

Error Handling

The Get Embedding Node will error if the integration is not available in the context when the graph is being run. It will also error if the Input input is not provided.

FAQ

Q: What is an embedding?

A: An embedding is a numerical representation of a piece of text. Embeddings are useful for performing K-nearest neighbor search, which is a common operation in AI applications.

Q: Can I use my own integration?

A: Yes, you can use your own integration by passing it to the context when the graph is being run. The integration must implement the EmbeddingGenerator interface, which includes a method for generating an embedding.

See Also