Skip to main content

llama-index embeddings nvidia integration

Project description

NVIDIA NIMs

The llama-index-embeddings-nvidia package contains LlamaIndex integrations building applications with models on NVIDIA NIM inference microservice. NIM supports models across domains like chat, embedding, and re-ranking models from the community as well as NVIDIA. These models are optimized by NVIDIA to deliver the best performance on NVIDIA accelerated infrastructure and deployed as a NIM, an easy-to-use, prebuilt containers that deploy anywhere using a single command on NVIDIA accelerated infrastructure.

NVIDIA hosted deployments of NIMs are available to test on the NVIDIA API catalog. After testing, NIMs can be exported from NVIDIA’s API catalog using the NVIDIA AI Enterprise license and run on-premises or in the cloud, giving enterprises ownership and full control of their IP and AI application.

NIMs are packaged as container images on a per model basis and are distributed as NGC container images through the NVIDIA NGC Catalog. At their core, NIMs provide easy, consistent, and familiar APIs for running inference on an AI model.

NVIDIA's Embeddings connector

With this connector, you'll be able to connect to and generate from compatible models available and hosted on NVIDIA API Catalog, such as:

  • NVIDIA's Retrieval QA Embedding Model embed-qa-4

Installation

pip install llama-index-embeddings-nvidia

Setup

To get started:

  1. Create a free account with NVIDIA, which hosts NVIDIA AI Foundation models.

  2. Select the Retrieval tab, then select your model of choice.

  3. Under Input select the Python tab, and click Get API Key. Then click Generate Key.

  4. Copy and save the generated key as NVIDIA_API_KEY. From there, you should have access to the endpoints.

import getpass
import os

if os.environ.get("NVIDIA_API_KEY", "").startswith("nvapi-"):
    print("Valid NVIDIA_API_KEY already in environment. Delete to reset")
else:
    nvapi_key = getpass.getpass("NVAPI Key (starts with nvapi-): ")
    assert nvapi_key.startswith(
        "nvapi-"
    ), f"{nvapi_key[:5]}... is not a valid key"
    os.environ["NVIDIA_API_KEY"] = nvapi_key

Working with API Catalog

from llama_index.embeddings.nvidia import NVIDIAEmbedding

embedder = NVIDIAEmbedding()
embedder.get_query_embedding("What's the weather like in Komchatka?")

Working with NVIDIA NIMs

When ready to deploy, you can self-host models with NVIDIA NIM—which is included with the NVIDIA AI Enterprise software license—and run them anywhere, giving you ownership of your customizations and full control of your intellectual property (IP) and AI applications.

Learn more about NIMs

from llama_index.embeddings.nvidia import NVIDIAEmbedding

# connect to an embedding NIM running at localhost:8080
embedder = NVIDIAEmbeddings(base_url="http://localhost:8080/v1")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_embeddings_nvidia-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file llama_index_embeddings_nvidia-0.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_nvidia-0.2.0.tar.gz
Algorithm Hash digest
SHA256 db7a2a03caec6f27b0511f697d4f10b97ae9a3fbde5031712a370020be41aa78
MD5 ab961d4443031a2736795e0d8d394ed1
BLAKE2b-256 3187ce58ceda2b14018e5f5cfc7f1cc97b176fceb4fd62d4132a3b7d54aa48f1

See more details on using hashes here.

File details

Details for the file llama_index_embeddings_nvidia-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_embeddings_nvidia-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8d56baa8bcef518db7980cff6c70bfff892269127b886ba5a86fca9a8dbd5ab
MD5 14ac56057b98ea3d6cb606cec5fcf048
BLAKE2b-256 b9c9c737ef8b1d30fc408df08c87207c86398f91c7fb7568e43f9740c39186f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page