Amazon Bedrock is a fully managed service that makes Foundation Models (FMs) from leading AI startups and Amazon available via an API. You can choose from a wide range of FMs to find the model that is best suited for your use case.This will help you get started with Bedrock completion models (LLMs) using LangChain. For detailed documentation on
Bedrock features and configuration options, please refer to the API reference.
概述
集成详情
设置
要访问 Bedrock models,你需要create an AWS account, get an API key, and install the@langchain/community integration, along with a few peer dependencies.
凭证
Head to aws.amazon.com to sign up to AWS Bedrock and generate an API key. Once you’ve done this set the environment variables:安装
LangChain 的 Bedrock 集成位于@langchain/community 包中:
@aws-sdk/credential-provider-node dependency
and using the web entrypoint:
@aws-sdk/credential-provider-node dependency
and using the web entrypoint:
@aws-sdk/credential-provider-node dependency
and using the web entrypoint:
实例化
现在我们可以实例化模型对象并生成聊天补全:调用
Note that some models require specific prompting techniques. For example, Anthropic’s Claude-v2 model will throw an error if the prompt does not start withHuman:.
API 参考
有关所有 Bedrock 功能和配置的详细文档,请前往 API 参考。将这些文档连接到 Claude、VSCode 等工具,通过 MCP 获取实时答案。

