LLMRails 임베딩
LLMRails 임베딩 (LLMRails Embeddings)
LLMRails의 임베딩 모델을 LlamaIndex에서 사용하는 예시예요. API 키와 모델 ID로 임베딩 모델을 만들고 텍스트를 벡터화해요.
출처: 문서
본문
colab에서 이 노트북을 열고 있다면 LlamaIndex 🦙를 설치해야 할 거예요.
%pip install llama-index-embeddings-llm-rails
!pip install llama-index
# imports
from llama_index.embeddings.llm_rails import LLMRailsEmbedding
# 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!"
)