LLMRails 嵌入¶
如果您在 Colab 上打开此 Notebook,您可能需要安装 LlamaIndex 🦙。
In [ ]
已复制!
%pip install llama-index-embeddings-llm-rails
%pip install llama-index-embeddings-llm-rails
In [ ]
已复制!
!pip install llama-index
!pip install llama-index
In [ ]
已复制!
# imports
from llama_index.embeddings.llm_rails import LLMRailsEmbedding
# 从 llama_index.embeddings.llm_rails 导入 LLMRailsEmbedding # 获取凭据并创建嵌入 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!" )
In [ ]
已复制!
# 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!"
)
# 获取凭据并创建嵌入 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!" )