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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4bc4869115d24f669782bd1a9313aa011c00c4f71f7e02a09b3b0b79d2ca6c6
MD5 3c26070038ddaef9940eec30892784fc
BLAKE2b-256 a58f0ac006f3d401043135fddb9fdfdacbe594c4a23c8c5b45425e93d4c04f19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a631e3f7965799d4bf800b04767b9f7943b2f7d2366d162c0daae2f8695ea971
MD5 c301c0ce098ed0dce7c2fbea3d87dfde
BLAKE2b-256 ba30b5db500fd4f5ac374b09f19965679e4ad1c355226cde33d37606a19f123a

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