主题
如果你在 Colab 中打开这个 Notebook,可能需要先安装 LlamaIndex 🦙。
%pip install llama-index-embeddings-llm-rails1
!pip install llama-index1
# imports
from llama_index.embeddings.llm_rails import LLMRailsEmbedding1
2
3
2
3
# get credentials and create embeddings
import os
api_key = os.environ.get("API_KEY", "your-api-key")
model_id = os.environ.get("MODEL_ID", "your-model-id")
embed_model = LLMRailsEmbedding(model_id=model_id, api_key=api_key)
embeddings = embed_model.get_text_embedding(
"It is raining cats and dogs here!"
)1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12