Bedrock
Amazon Bedrock 是一項全受管服務,可透過單一 API 提供來自領先 AI 公司 (如
AI21 Labs
、Anthropic
、Cohere
、Meta
、Stability AI
和Amazon
) 的各種高效能基礎模型 (FM),以及您構建具有安全性、隱私和負責任 AI 的生成式 AI 應用程式所需的各種功能。使用Amazon Bedrock
,您可以輕鬆地試驗和評估適用於您的用例的頂級 FM,使用微調和檢索增強生成
(RAG
) 等技術私下使用您的資料進行自訂,並構建使用您的企業系統和資料來源執行任務的代理程式。由於Amazon Bedrock
是無伺服器的,因此您不必管理任何基礎架構,並且可以使用您已經熟悉的 AWS 服務安全地將生成式 AI 功能整合和部署到您的應用程式中。
%pip install --upgrade --quiet boto3
from langchain_aws import BedrockEmbeddings
embeddings = BedrockEmbeddings(
credentials_profile_name="bedrock-admin", region_name="us-east-1"
)
API 參考:BedrockEmbeddings
embeddings.embed_query("This is a content of the document")
embeddings.embed_documents(
["This is a content of the document", "This is another document"]
)
# async embed query
await embeddings.aembed_query("This is a content of the document")
# async embed documents
await embeddings.aembed_documents(
["This is a content of the document", "This is another document"]
)