主题
如果你在 Colab 中打开这个 Notebook,可能需要先安装 LlamaIndex 🦙。
%pip install llama-index
%pip install llama-index-embeddings-databricks1
2
2
import os
from llama_index.core import Settings
from llama_index.embeddings.databricks import DatabricksEmbedding1
2
3
2
3
# Set up the DatabricksEmbedding class with the required model, API key and serving endpoint
os.environ["DATABRICKS_TOKEN"] = "<MY TOKEN>"
os.environ["DATABRICKS_SERVING_ENDPOINT"] = "<MY ENDPOINT>"
embed_model = DatabricksEmbedding(model="databricks-bge-large-en")
Settings.embed_model = embed_model1
2
3
4
5
2
3
4
5
# Embed some text
embeddings = embed_model.get_text_embedding(
"The DatabricksEmbedding integration works great."
)1
2
3
4
2
3
4