GigaChat 임베딩

GigaChat 임베딩

GigaChat의 임베딩 모델을 LlamaIndex에서 쓰는 예시예요. 인증 정보와 scope를 설정하고 텍스트·쿼리 임베딩을 만드는 방법을 보여줘요.

출처: 문서

본문

%pip install llama-index-embeddings-gigachat
!pip install llama-index
from llama_index.embeddings.gigachat import GigaChatEmbedding


gigachat_embedding = GigaChatEmbedding(
    auth_data="your-auth-data",
    scope="your-scope",  # 개인용이면 'GIGACHAT_API_PERS', 기업용이면 'GIGACHAT_API_CORP'로 설정합니다.
)


queries_embedding = gigachat_embedding._get_query_embeddings(
    ["This is a passage!", "This is another passage"]
)
print(queries_embedding)


text_embedding = gigachat_embedding._get_text_embedding("Where is blue?")
print(text_embedding)