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:
-
Create a free account with NVIDIA, which hosts NVIDIA AI Foundation models.
-
Select the
Retrieval
tab, then select your model of choice. -
Under
Input
select thePython
tab, and clickGet API Key
. Then clickGenerate Key
. -
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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_embeddings_nvidia-0.2.1.tar.gz
.
File metadata
- Download URL: llama_index_embeddings_nvidia-0.2.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de470497511ed4d34f7dae4eda323dca8faec7c046b3db0fdc8b93b2e7e97e52 |
|
MD5 | 259121bedd096b7eef55ef52eecd7dd8 |
|
BLAKE2b-256 | 15dc9918a1ea6d438ba7a364fd4245289efbef45013048310b0386f8ab185ecc |
File details
Details for the file llama_index_embeddings_nvidia-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: llama_index_embeddings_nvidia-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ad06c4ac7745529443e17dc124a64d4b306aa35069d1260fa15c52b8e774fa1 |
|
MD5 | 532ac97ed38d14543fae4a3a7aed561c |
|
BLAKE2b-256 | 4dad289297730c55573e7d11293a3a4ffdfd05cf7abe0b9f1dc046ebb16e4c0f |