Skip to content

Azure OpenAI Embeddings

Azure OpenAI Embeddings is a component that lets you turn text into numerical vectors (embeddings) using Azure’s OpenAI service. These vectors can then be used for similarity search, clustering, or as inputs to other AI models.

How it Works

When you run the component, it sends your text to the Azure OpenAI embeddings API. The API processes the text with the selected model and returns a list of numbers that represent the meaning of the text. The component then makes these numbers available to the rest of your workflow as an Embeddings output.

Inputs

Mapping Mode

This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:

  • Fixed: You type the value directly into the field.
  • Mapped: You connect the output of another component to use its result as the value.
  • Javascript: You write Javascript code to dynamically calculate the value.

This flexibility allows you to create more dynamic and connected workflows.

Input Fields

The following fields are available to configure this component. Each field may be used in any workflow that includes this component.

  • API Version: Choose the Azure OpenAI API version you want to use. The default is the most recent preview.
  • Deployment Name: The name of the Azure OpenAI deployment that hosts the embeddings model.
  • Azure Endpoint: Your Azure endpoint, including the resource. Example: https://example-resource.azure.openai.com/.
  • Dimensions: The number of dimensions the resulting output embeddings should have. Only supported by certain models.

Credential
This component requires an Azure OpenAI API credential.

  1. First, configure the Azure OpenAI API credential in the Credentials section of Nappai.
  2. Then, select that credential in the component’s Credential field.
    The credential stores the Azure OpenAI API Key securely, so you don’t need to enter it directly in the component.

Outputs

  • Embeddings: A list of numerical vectors that represent the input text. These can be passed to other components such as similarity search, clustering, or downstream AI models.

Usage Example

  1. Set up the credential

    • Go to CredentialsAdd CredentialAzure OpenAI API.
    • Enter your Azure OpenAI API Key.
  2. Add the component to your workflow

    • Drag the Azure OpenAI Embeddings component onto the canvas.
    • Select the credential you created.
    • Fill in the Azure Endpoint (e.g., https://myresource.azure.openai.com/).
    • Choose the Deployment Name (e.g., text-embedding-ada-002).
    • Pick an API Version (or leave the default).
    • Optionally set Dimensions if your model supports it.
  3. Connect the component

    • Connect a text source (e.g., a Message Text component) to the Azure OpenAI Embeddings component.
    • Use the Embeddings output in a downstream component, such as Similarity Search or Vector Store.
  4. Run the workflow

    • Execute the workflow. The component will return embeddings that you can use for further analysis.
  • OpenAI Embeddings – Generates embeddings using the OpenAI API instead of Azure.
  • Azure OpenAI Text Generation – Creates text completions with Azure OpenAI models.
  • Similarity Search – Finds the most similar embeddings from a vector store.
  • Vector Store – Stores and retrieves embeddings for quick lookup.

Tips and Best Practices

  • Choose the right API version: Newer preview versions may have additional features but could change behavior.
  • Use Mapping Mode for batch processing: If you need embeddings for many records, enable Mapping Mode and map a list of texts to the component.
  • Set Dimensions only when supported: Some models ignore this parameter; check the model documentation.
  • Keep credentials secure: Never expose your API key in the workflow; always use the credential system.
  • Monitor usage: Azure OpenAI has rate limits; monitor your quota in the Azure portal.

Security Considerations

  • The component uses a stored credential to access Azure OpenAI, so the API key is never exposed in the workflow.
  • Ensure that only authorized users have access to the credential in Nappai.
  • Review Azure’s access policies to restrict who can invoke the embeddings endpoint.