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
- Download URL: llama_index_embeddings_databricks-0.2.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86f7c56bef8b8cc20abdc49c50227087ac7e75688142730cb45864542954062d |
|
MD5 | 1e689fd018bcf77a0e237c323ed2d1c5 |
|
BLAKE2b-256 | 8fe431db4273e3290a5f699fbde0a0d15dd0d59f162b9c254e0954740d786475 |
File details
Details for the file llama_index_embeddings_databricks-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_embeddings_databricks-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9267de8761c3b0f5be165532d46674cbd89e5ee5f67add1c471462d91f3d76e4 |
|
MD5 | 078c3dd5434249a77c7601ef430f9055 |
|
BLAKE2b-256 | 3ef143d71dc5f0510f5ca485d34853ad454c87f5a6b6d70b2fb761afbd9df8b5 |