Aleph Alpha의 semantic embedding을 사용하는 방법에는 두 가지가 있습니다. 서로 다른 구조의 텍스트(예: Document와 Query)가 있는 경우 asymmetric embedding을 사용하는 것이 좋습니다. 반대로, 비슷한 구조의 텍스트의 경우 symmetric embedding이 권장되는 접근 방식입니다.

Asymmetric

from langchain_community.embeddings import AlephAlphaAsymmetricSemanticEmbedding
document = "This is a content of the document"
query = "What is the content of the document?"
embeddings = AlephAlphaAsymmetricSemanticEmbedding(normalize=True, compress_to_size=128)
doc_result = embeddings.embed_documents([document])
query_result = embeddings.embed_query(query)

Symmetric

from langchain_community.embeddings import AlephAlphaSymmetricSemanticEmbedding
text = "This is a test text"
embeddings = AlephAlphaSymmetricSemanticEmbedding(normalize=True, compress_to_size=128)
doc_result = embeddings.embed_documents([text])
query_result = embeddings.embed_query(text)

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I