Skip to main content

llama-index embeddings databricks integration

Project description

LlamaIndex Embeddings Integration: Databricks

This integration adds support for embedding models hosted on the databricks platform via serving endpoints. The API follows the specifications of OpenAI, so this integration simply adapts the llama-index-embeddings-openai integration and internally uses the openai Python API library, too.

The signature furthermore aligns with the existing Databricks LLM integration with respect to the naming of the model, api_key and endpoint variables to ensure a smooth user experience.

Installation

pip install llama-index
pip install llama-index-embeddings-databricks

Usage

Passing the api_key and endpoint directly as arguments:

import os
from llama_index.core import Settings
from llama_index.embeddings.databricks import DatabricksEmbedding

# Set up the DatabricksEmbedding class with the required model, API key and serving endpoint
embed_model = DatabricksEmbedding(
    model="databricks-bge-large-en",
    api_key="<MY TOKEN>",
    endpoint="<MY ENDPOINT>",
)
Settings.embed_model = embed_model

# Embed some text
embeddings = embed_model.get_text_embedding(
    "The DatabricksEmbedding integration works great."
)

Using environment variables:

export DATABRICKS_TOKEN=<MY TOKEN>
export DATABRICKS_SERVING_ENDPOINT=<MY ENDPOINT>
import os
from dotenv import load_dotenv
from llama_index.core import Settings
from llama_index.embeddings.databricks import DatabricksEmbedding

load_dotenv()
# Set up the DatabricksEmbedding class with the required model, API key and serving endpoint
embed_model = DatabricksEmbedding(model="databricks-bge-large-en")
Settings.embed_model = embed_model

# Embed some text
embeddings = embed_model.get_text_embedding(
    "The DatabricksEmbedding integration works great."
)

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

Built Distribution

File details

Details for the file llama_index_embeddings_databricks-0.2.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b4d9bf99145db1db9455ef8f37660eb674b17b247116da8f3afd94a11b9b53b1
MD5 947376fa2cf7bd51447c8de99996cd9e
BLAKE2b-256 d4d0bb6e99ea4b5688955761e6d33c2aa52a84764e04291d077b1424dd74a5a5

See more details on using hashes here.

File details

Details for the file llama_index_embeddings_databricks-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f8897563ed8a996341b1b4e0f48f6c37c70718d37feb7063a1248b61d62d2d3
MD5 5912138839fe01d9ef555aeff661832c
BLAKE2b-256 b2836ecc1dc67424d06faa22c02ff55af24c871bdf1baca0017493449a9f65d2

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