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.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.2.0.tar.gz
Algorithm Hash digest
SHA256 86f7c56bef8b8cc20abdc49c50227087ac7e75688142730cb45864542954062d
MD5 1e689fd018bcf77a0e237c323ed2d1c5
BLAKE2b-256 8fe431db4273e3290a5f699fbde0a0d15dd0d59f162b9c254e0954740d786475

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9267de8761c3b0f5be165532d46674cbd89e5ee5f67add1c471462d91f3d76e4
MD5 078c3dd5434249a77c7601ef430f9055
BLAKE2b-256 3ef143d71dc5f0510f5ca485d34853ad454c87f5a6b6d70b2fb761afbd9df8b5

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