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.3.0.tar.gz
.
File metadata
- Download URL: llama_index_embeddings_databricks-0.3.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b47be04d47dde78e9743999881dcf422210c8cda3bf41150319507b160e5def |
|
MD5 | 663812480324d5e69256e8900fd275f2 |
|
BLAKE2b-256 | eb3611934fe002c9e293c9371be3b5edaf7c28469e69e1f1ae42cbd760ee3409 |
File details
Details for the file llama_index_embeddings_databricks-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_embeddings_databricks-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aff812442e36e9eed6d8897e8482e7fb6c64b6899e966d1c710cc26f4e2dd80 |
|
MD5 | 6744f4143018370dcb709d686a780cd5 |
|
BLAKE2b-256 | 310516bae4c7dae142acd9c1b84891d66b2a10f01ba474867018b430489a3a06 |