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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.4.0.tar.gz
Algorithm Hash digest
SHA256 68728345a17a7c0d7cc709523786c4fd76ba5c24abcd4b678dcd342d0bcedd0d
MD5 e9130581b5b5f22b477b6474636c29d7
BLAKE2b-256 3ff3e92090b3ce92fa4045b2ccdd7b038dd9bea65951bedb768cb0c44f906d52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_databricks-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db782e4a8c688098235ae191e7d3f024cefb1bc9a7ad4a57a46c0342d1babe34
MD5 deaccfbb757075df51cc6a38b4775e32
BLAKE2b-256 3ac8681a449ca3b16d36d53cc00dcaa5892e3eeb6fc391ef3fbc13cbb04f4c44

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