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

llama_index_embeddings_databricks-0.4.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.4.1.tar.gz
Algorithm Hash digest
SHA256 378fd1426b9909871dec9a42e7dcb4965208cf1017c9b8c380432773c13fcc68
MD5 9bbd99bc12e7b514c568d29d7a33a44a
BLAKE2b-256 75213bd40a9c70d22ef9eb2761f0a3c2b70515d0b47d6ec0b46c81985fadd03e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8b7f7d8f74383880e4d76ccd0b66e3117e891cc9fbab5085dcbd518f9668f6f
MD5 760c32e22b6b1e5fa6d2b3c7c73cfdea
BLAKE2b-256 c40838d96dbf95aaa0a91bc6318ffdc3f0556755a9999328f9d169aff08cade6

See more details on using hashes here.

Supported by

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