DeepsetNvidiaTextEmbedder

Embed strings of text using embedding models by NVIDIA Triton on optimized hardware.

Basic Information

  • Pipeline type: Query
  • Type: deepset_cloud_custom_nodes.embedders.nvidia.text_embedder.DeepsetNvidiaTextEmbedder
  • Components it most often connects with:
    • Query: DeepsetNvidiaDocumentEmbedder receives the query to embed from Query.
    • Embedding Retrievers: DeepsetNvidiaDocumentEmbedder can send the embedded query to an Embedding Retriever that uses it to find matching documents.

Inputs

NameTypeDescription
textStringThe text to embed.

Outputs

NameTypeDescription
embeddingList of floatsThe embedding of the text.
metaDictionaryMetadata regarding the usage statistics.

Overview

NvidiaTextEmbedder uses NVIDTIA Triton models to embed a string, such as a query. This is useful if your pipeline performs vector-based retrieval. The Embedding Retriever can then used the embedded query to find matching documents in the document store.

This component runs on optimized hardware in deepset Cloud, which means it doesn't work if you export it to a local Python file. If you're planning to export, use SentenceTransformersTextEmbedder instead.

ℹ️

Embedding Models in Query and Indexing Pipelines

The embedding model you use to embed documents in your indexing pipeline must be the same as the embedding model you use to embed the query in your query pipeline.

This means the embedders for your indexing and query pipelines must match. For example, if you use CohereDocumentEmbedder to embed your documents, you should use CohereTextEmbedder with the same model to embed your queries.

Usage Example

This is an example of a DeepsetNvidiaTextEmbedder used in a query pipeline. It receives the text to embed from Query and then sends the embedded query to OpenSearchEmbeddingRetriever:

DeepsetNvidiaTextEmbedder connected to Query and OpenSearchEmbeddingRetriever in Builder

Here's the YAML configuration:

components:
  DeepsetNvidiaTextEmbedder:
    type: deepset_cloud_custom_nodes.embedders.nvidia.text_embedder.DeepsetNvidiaTextEmbedder
    init_parameters:
      model: intfloat/multilingual-e5-base
      prefix: ''
      suffix: ''
      truncate: null
      normalize_embeddings: true
      timeout: null
      backend_kwargs: null
  OpenSearchEmbeddingRetriever:
    type: haystack_integrations.components.retrievers.opensearch.embedding_retriever.OpenSearchEmbeddingRetriever
    init_parameters:
      document_store:
        type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
        init_parameters:
          use_ssl: true
          verify_certs: false
          hosts:
            - ${OPENSEARCH_HOST}
          http_auth:
            - ${OPENSEARCH_USER}
            - ${OPENSEARCH_PASSWORD}
          embedding_dim: 1024
          similarity: cosine
      filters: null
      top_k: 10
      filter_policy: replace
      custom_query: null
      raise_on_failure: true
      efficient_filtering: false
connections:
  - sender: DeepsetNvidiaTextEmbedder.embedding
    receiver: OpenSearchEmbeddingRetriever.query_embedding
max_runs_per_component: 100
metadata: {}
inputs:
  query:
    - DeepsetNvidiaTextEmbedder.text


Init Parameters

ParameterTypePossible valuesDescription
modelDeepsetNVIDIAEmbeddingModelsDefault: DeepsetNVIDIAEmbeddingModels.INTFLOAT_MULTILINGUAL_E5_BASEThe model to use for calculating embeddings. Choose the model from the list in Builder. Required.
prefixStringDefault: ""A string to add at the beginning of the string being embedded. Required.
suffixStringDefault: ""A string to add at the end of the string being embedded. Required.
truncateEmbeddingTruncateModeSTART, END, NONE
Default: None
Specifies how to truncate inputs longer than the maximum token length. Possible options are: START, END, NONE.
If set to START, the input is truncated from the start.
If set to END, the input is truncated from the end.
If set to NONE, returns an error if the input is too long. Optional.
normalize_embeddingsBooleanTrue
False
Default: True
Whether to normalize the embeddings by dividing the embedding by its L2 norm. Required.
timeoutFloatDefault: NoneTimeout for request calls in seconds. Optional.
backend_kwargsDictionary Default: NoneKeyword arguments to further customize model behavior. Optional.