Amazon Bedrock基础指南:参考资料、模型特点、价格、使用方法及运行时API执行示例

这次我整理了2023年9月28日正式发布的Amazon Bedrock的基本信息和Runtime API的执行示例。此外,还在文中插入了最基本的术语解释,以帮助理解令牌和参数的概念。

※本文及其他由本文作者发表的文章中所包含的源代码均为自主研究活动的一部分。如需使用,请自行承担责任。另外,代码可能会在没有预告的情况下进行修改,敬请谅解。

Amazon Bedrock的基本情報

Amazon Bedrock 的参考资料与学习资源

有助于理解 Amazon Bedrock 的主要参考资料和学习资源如下:
本文内容基于这些参考资料和学习资源中的信息。

Amazon Bedrock是什么?

Amazon Bedrock 是一项服务,提供通过 API 访问基础模型(Foundation Models, FMs)和使用独有数据对这些模型进行私有化定制的功能。它支持多种基础模型,包括 AI21 Labs 的 Jurassic-2、Amazon 的 Titan、Anthropic 的 Claude、Cohere 的 Command、Meta 的 Llama 2 和 Stability AI 的 Stable Diffusion。用户可以根据不同的使用场景,如文本生成、聊天机器人、搜索、文本摘要、图像生成和个性化推荐等,选择适合的基础模型来构建和扩展生成式 AI 应用。

在处理文本的生成型AI中,“令牌(tokens)”是什么?

在查看 Amazon Bedrock 的模型列表和价格表之前,我们先简要说明一下作为限制和计费单位的“令牌(tokens)”。

请注意,为了便于理解,这里提供的定义可能与严格的定义有所不同。

在处理文本的生成型AI中,“令牌(tokens)”是指将文本分割成有意义部分的单位。令牌可以是单词,但不一定完全等同于单词,也可能是字符、子词等。

例如,将字符串Amazon Bedrock is amazing!按单词进行令牌化,结果如下:

["Amazon", "Bedrock", "is", "amazing", "!"]

然而,如果使用不是基于单词的其他令牌化方法(Tokenization),可能会将空格也包括在内进行分割,结果如下:

["Amazon", " ", "Bedrock", " ", "is", " ", "amazing", "!"]

令牌化方法除了基于单词外,还有如 Unigram Tokenization、WordPiece、SentencePiece、Byte Pair Encoding(BPE)等高级方法。不同的模型采用不同的令牌化手法,因此在使用时需要注意这一点。

特别是在进行基于令牌的费用计算时,最好根据目标模型的令牌化手法,在接近实际使用条件的场景中计算令牌数。然而,个人来说,在考虑 Generative AI 服务的月度预算时,如果不想花费过多时间和精力在详细的令牌数预测上,我会使用 Generative AI 本身进行计算,或者为了方便计算,将 1 个字符估算为 1 个令牌,略高估费用。

准备好的模型列表

本文是根据产品页面的 Amazon Bedrock – AWSAWS Management Console 中的 Amazon Bedrock Model Providers 在撰写本文时的数据进行总结的。

※支持嵌入(Embed)的模型能够将文本输入(如单词、短语或较大的文本单位)转换为包含文本意义的数值表示(嵌入)。

Model ProviderModelModel IDMax tokensModality
(Data Type)
LanguagesSupported use cases
AI21 LabsJurassic-2 Ultra
(v1)
ai21.j2-ultra-v18191TextEnglish
Spanish
French
German
Portuguese
Italian
Dutch
Open book question answering
summarization
draft generation
information extraction
ideation
AI21 LabsJurassic-2 Mid
(v1)
ai21.j2-mid-v18191TextEnglish
Spanish
French
German
Portuguese
Italian
Dutch
Open book question answering
summarization
draft generation
information extraction
ideation
AmazonTitan Embeddings G1 - Text
(v1.2)
amazon.titan-embed-text-v18kEmbeddingEnglish, Arabic, Chinese (Sim.), French, German, Hindi, Japanese, Spanish, Czech, Filipino, Hebrew, Italian, Korean, Portuguese, Russian, Swedish, Turkish, Chinese (trad), Dutch, Kannada, Malayalam, Marathi, Polish, Tamil, Telugu and others.Translate text inputs (words, phrases or possibly large units of text) into numerical representations (known as embeddings) that contain the semantic meaning of the text.
AmazonTitan Text G1 - Liteamazon.titan-text-lite-v14kTextEnglishSummarization and copywriting.
AmazonTitan Text G1 - Expressamazon.titan-text-express-v18kTextEnglish (GA), Multilingual in 100+ languages (Preview)Open ended text generation
brainstorming
summarization
code generation
table creation
data formatting
paraphrasing
chain of though
rewrite
extraction
Q&A
chat
AmazonTitan Image Generator G1amazon.titan-image-generator-v177ImageEnglishText to image generation
image editing
image variations
AmazonTitan Multimodal Embeddings G1amazon.titan-embed-image-v1128EmbeddingEnglishSearch
recommendation
personalization
AnthropicClaude 3.5 Sonnetanthropic.claude-3-5-sonnet-20240620-v1:0200kTextEnglish and multiple other languagesComplex tasks like customer support
Coding
Data Analysis
and Visual Processing.
Streamlining of Workflows
Generation of Insights
and Production of High-Quality
Natural-Sounding Content.
AnthropicClaude 3 Opusanthropic.claude-3-opus-20240229-v1:0200kTextEnglish and multiple other languagesTask automation: plan and execute complex actions across APIs and databases, interactive coding
R&D: research review, brainstorming and hypothesis generation, drug discovery
Strategy: advanced analysis of charts & graphs, financials and market trends, forecasting
AnthropicClaude 3 Sonnetanthropic.claude-3-sonnet-20240229-v1:0200kTextEnglish and multiple other languagesData processing: RAG or search & retrieval over vast amounts of knowledge
Sales: product recommendations, forecasting, targeted marketing
Time-saving tasks: code generation, quality control, parse text from images
AnthropicClaude 3 Haikuanthropic.claude-3-haiku-20240307-v1:0200kTextEnglish and multiple other languagesCustomer interactions: quick and accurate support in live interactions, translations
Content moderation: catch risky behavior or customer requests
Cost-saving tasks: optimized logistics, inventory management, extract knowledge from unstructured data
AnthropicClaude v2.1anthropic.claude-v2:1200kTextEnglish and multiple other languagesQuestion answering
information extraction
removing PII
content generation
multiple choice classification
Roleplay
comparing text
summarization
document Q&A with citation
AnthropicClaude v2anthropic.claude-v2100kTextEnglish and multiple other languagesQuestion answering
information extraction
removing PII
content generation
multiple choice classification
Roleplay
comparing text
summarization
document Q&A with citation
Anthropic[Legacy version]
Claude v1.3
anthropic.claude-v1100kTextEnglish and multiple other languagesQuestion answering
information extraction
removing PII
content generation
multiple choice classification
Roleplay
comparing text
summarization
document Q&A with citation
AnthropicClaude Instant v1.2anthropic.claude-instant-v1100kTextEnglish and multiple other languagesQuestion answering
information extraction
removing PII
content generation
multiple choice classification
Roleplay
comparing text
summarization
document Q&A with citation
CohereCommand R+
(v1)
cohere.command-r-plus-v1:0128kTextEnglish, French, Spanish, Italian, German, Portuguese, Japanese, Korean, Arabic, and ChineseComplex RAG on large amounts of data
Q&A
Multi-step tool use
chat
text generation
text summarization
CohereCommand R
(v1)
cohere.command-r-v1:0128kTextEnglish, French, Spanish, Italian, German, Portuguese, Japanese, Korean, Arabic, and ChineseChat
text generation
text summarization
RAG on large amounts of data
Q&A
function calling
CohereCommand
(v14.7)
cohere.command-text-v144000TextEnglishSummarization
copywriting
dialogue
extraction
question answering
CohereCommand Light
(v14.7)
cohere.command-light-text-v144000TextEnglishSummarization
copywriting
dialogue
extraction
question answering
CohereEmbed English
(v3)
cohere.embed-english-v3512EmbeddingEnglishSemantic search
retrieval-augmented generation (RAG)
classification
clustering
CohereEmbed Multilingual
(v3)
cohere.embed-multilingual-v3512Embedding108 LanguagesSemantic search
retrieval-augmented generation (RAG)
classification
clustering
MetaLlama 3 70B Instructmeta.llama3-70b-instruct-v1:08kTextEnglishLanguage modeling
Dialog systems
Code generation
Following instructions
Sentiment analysis with nuances in reasoning
Text classification with improved accuracy and nuance
Text summarization with accuracy and nuance
MetaLlama 3 8B Instructmeta.llama3-8b-instruct-v1:08kTextEnglishText summarization
Text classification
Sentiment analysis
MetaLlama 2 Chat 13Bmeta.llama2-13b-chat-v14096TextEnglishText generation
Conversation
Chat based applications
MetaLlama 2 Chat 70Bmeta.llama2-70b-chat-v14096TextEnglishText generation
Conversation
Chat based applications
Mistral AIMistral 7B Instructmistral.mistral-7b-instruct-v0:232KTextEnglishClassification
Text generation
Code generation
Mistral AIMixtral 8x7B Instructmistral.mixtral-8x7b-instruct-v0:132KTextEnglish, French, Italian, German and SpanishComplex reasoning & analysis
Text generation
Code generation
Mistral AIMistral Largemistral.mistral-large-2402-v1:032KTextEnglish, French, Italian, German and SpanishComplex reasoning & analysis
Text generation
Code generation
RAG
Agents
Mistral AIMistral Smallmistral.mistral-small-2402-v1:032KTextEnglish, French, Italian, German and SpanishText generation
Code generation
Classification
RAG
Conversation
Stability AI[Legacy version]
Stable Diffusion XL
(v0.8)
stability.stable-diffusion-xl-v077ImageEnglishimage generation
image editing
Stability AIStable Diffusion XL
(v1.0)
stability.stable-diffusion-xl-v177ImageEnglishimage generation
image editing

准备好的模型价格

本文参考了 Amazon Bedrock Pricing 页面中的数据进行总结。

未标注价格的模型表示尚未提供该价格选项,或者该模型不支持定制功能。

处理文本的模型价格

处理文本的模型价格如下所示:

按需定价
按需定价是根据每1,000个输入令牌和每1,000个输出令牌的数量进行计算的(不是基于时间的支付)。

预置吞吐量
预置吞吐量通过承诺在指定期间内按时间支付来提供充足的吞吐量,以满足大规模使用的需求。承诺的时间有无期限、1个月和6个月,承诺时间越长,折扣越大。

模型定制(微调)
如果使用微调来创建定制模型,则会产生每1,000个令牌的训练费用以及每个定制模型的月度存储费用。

Model ProviderModelOn-Demand
(per 1000 input tokens)
On-Demand
(per 1000 output tokens)
Provisioned Throughput
(per hour per model)
Model customization through Fine-tuning
AI21 LabsJurassic-2 Ultra0.0188 USD0.0188 USD--
AI21 LabsJurassic-2 Mid0.0125 USD0.0125 USD--
AmazonTitan Text Lite(Titan Text G1 - Lite)0.0003 USD0.0004 USDno commitment: 7.10 USD

1-month commitment: 6.40 USD

6-month commitment: 5.10 USD
Train(per 1000 tokens): 0.0004 USD

Store each custom model(per month): 1.95 USD
AmazonTitan Text Express(Titan Text G1 - Express)0.0008 USD0.0016 USDno commitment: 20.50 USD

1-month commitment: 18.40 USD

6-month commitment: 14.80 USD
Train(per 1000 tokens): 0.008 USD

Store each custom model(per month): 1.95 USD
AmazonTitan Embeddings(Titan Embeddings G1 - Text)0.0001 USDN/Ano commitment: N/A

1-month commitment: 6.40 USD

6-month commitment: 5.10 USD
-
AnthropicClaude 3.5 Sonnet0.00300 USD0.01500 USDno commitment: N/A

1-month commitment: N/A

6-month commitment: N/A
-
AnthropicClaude 3 Opus0.01500 USD0.07500 USDno commitment: N/A

1-month commitment: N/A

6-month commitment: N/A
-
AnthropicClaude 3 Sonnet0.00300 USD0.01500 USDno commitment: N/A

1-month commitment: N/A

6-month commitment: N/A
-
AnthropicClaude 3 Haiku0.00025 USD0.00125 USDno commitment: N/A

1-month commitment: N/A

6-month commitment: N/A
-
AnthropicClaude(v2.0, v2.1)0.00800 USD0.02400 USDno commitment: N/A

1-month commitment: 63.00 USD

6-month commitment: 35.00 USD
-
AnthropicClaude Instant(v1.2)0.00080 USD0.00240 USDno commitment: N/A

1-month commitment: 39.60 USD

6-month commitment: 22.00 USD
-
CohereCommand R+0.0030 USD0.0150 USD--
CohereCommand R0.0005 USD0.0015 USD--
CohereCommand0.0015 USD0.0020 USDno commitment: 49.50 USD

1-month commitment: 39.60 USD

6-month commitment: 23.77 USD
Train(per 1000 tokens): 0.004 USD

Store each custom model(per month): 1.95 USD
CohereCommand-Light0.0003 USD0.0006 USDno commitment: 8.56 USD

1-month commitment: 6.85 USD

6-month commitment: 4.11 USD
Train(per 1000 tokens): 0.001 USD

Store each custom model(per month): 1.95 USD
CohereEmbed – English0.0001 USDN/Ano commitment: 7.12 USD

1-month commitment: 6.76 USD

6-month commitment: 6.41 USD
-
CohereEmbed – Multilingual0.0001 USDN/Ano commitment: 7.12 USD

1-month commitment: 6.76 USD

6-month commitment: 6.41 USD
-
MetaLlama 3 Instruct 8B0.0003 USD0.0006 USD--
MetaLlama 3 Instruct 70B0.00265 USD0.0035 USD--
MetaLlama 2 Chat 13B0.00075 USD0.00100 USDno commitment: N/A

1-month commitment: 21.18 USD

6-month commitment: 13.08 USD
Train(per 1000 tokens): 0.00149 USD

Store each custom model(per month): 1.95 USD
MetaLlama 2 Chat 70B0.00195 USD0.00256 USDno commitment: N/A

1-month commitment: 21.18 USD

6-month commitment: 13.08 USD
Train(per 1000 tokens): 0.00799 USD

Store each custom model(per month): 1.95 USD
Mistral AIMistral 7B Instruct0.00015 USD0.0002 USD--
Mistral AIMixtral 8x7B Instruct0.00045 USD0.0007 USD--
Mistral AIMistral Small0.001 USD0.003 USD--
Mistral AIMistral Large0.004 USD0.012 USD--

多模态模型的价格

处理图像和其他媒体的多模态模型的定价基于图像数量、分辨率等多个标准,针对每个模型进行了总结。

Model ProviderModelStandard quality(<51 steps)
(per image)
Premium quality(>51 steps)
(per image)
Provisioned Throughput
(per hour per model)
Model customization through Fine-tuning
Stability AIStable Diffusion XL
(v0.8)
512x512 or smaller: 0.018 USD

Larger than 512x512: 0.036 USD
512x512 or smaller: 0.036 USD

Larger than 512x512: 0.072 USD
--
Stability AIStable Diffusion XL
(v1.0)
Up to 1024 x 1024: 0.04 USDUp to 1024 x 1024: 0.08 USDno commitment: N/A

1-month commitment: 49.86 USD

6-month commitment: 46.18 USD
-
Model ProviderModelStandard quality
(per image)
Premium quality
(per image)
Provisioned Throughput
(per hour per model)
Model customization through Fine-tuning
AmazonTitan Image Generator512x512: 0.008 USD

1024X1024: 0.01 USD
512x512: 0.01 USD

1024X1024: 0.012 USD
no commitment: N/A

1-month commitment: 16.20 USD

6-month commitment: 13.00 USD
Train(per image seen): 0.005 USD

Store each custom model(per month): 1.95 USD
AmazonTitan Image Generator(custom models)512x512: 0.018 USD

1024X1024: 0.02 USD
512x512: 0.02 USD

1024X1024: 0.022 USD
no commitment: 23.40 USD

1-month commitment: 21.00 USD

6-month commitment: 16.85 USD
-
Model ProviderModelOn-Demand
(per 1000 input tokens)
On-Demand
(per 1000 input image)
Provisioned Throughput
(per hour per model)
Model customization through Fine-tuning
AmazonTitan Multimodal Embeddings0.0008 USD0.00006 USDno commitment: 9.38 USD

1-month commitment: 8.45 USD

6-month commitment: 6.75 USD
Train(per image seen): 0.0002 USD

Store each custom model(per month): 1.95 USD

Amazon Bedrock的基本使用方法

Amazon Bedrock的入门和准备

要开始使用Amazon Bedrock,请在AWS Management Console中导航到Amazon Bedrock的Model access页面,点击Edit,选择要使用的模型,然后点击Save changes请求访问该模型。
Amazon Bedrock > Model access - AWS Management Console
※使用Anthropic的模型时,需填写公司信息和使用目的等内容并提交请求。

请求被批准后,模型的访问权限将被激活,并可开始使用。

Amazon Bedrock Runtime API的InvokeModel和InvokeModelWithResponseStream方法及其参数

介绍实际使用Amazon Bedrock的API。
与Amazon Bedrock相关的API主要分为Bedrock API和Bedrock Runtime API。

Bedrock API用于通过微调创建自定义模型以及购买模型的预置吞吐量等操作AWS资源。

另一方面,Bedrock Runtime API用于指定基础模型或自定义模型,发送输入数据(Prompt)的请求,并从响应中获取输出数据(Completions),用于实际的执行。

在Amazon Bedrock Runtime API中,有InvokeModel和InvokeModelWithResponseStream用于实际调用和使用模型。

Amazon Bedrock Runtime API的InvokeModel是一种API,可以一次性获取请求的响应内容。

而Amazon Bedrock Runtime API的InvokeModelWithResponseStream是一种API,可以逐步地以流的形式获取响应内容的一部分字符。如果您已经使用过类似于聊天形式的生成式AI服务,可能见过Prompt的结果逐字显示的界面,InvokeModelWithResponseStream就可以用于这种显示方式。

Amazon Bedrock Runtime API的InvokeModel和InvokeModelWithResponseStream的请求中指定的参数是通用的,具体如下。

accept: 响应推理内容的MIME类型。(默认值: application/json)
contentType: 请求输入数据的MIME类型。(默认值: application/json)
modelId: [必填] 模型的标识符。(例如: ai21.j2-ultra-v1)
body: [必填] 以contentType指定的格式提供的输入数据。根据每个模型支持的推理参数指定body字段的格式。

一般推理参数的含义

接下来将介绍Amazon Bedrock Runtime API的实际使用例子,但在此之前,我们先简单说明一下在模型请求的Body中经常使用的一般推理参数。不过,为了便于理解,这里提供的定义可能与严格的定义有所不同。

temperature
这是一个用于调整模型输出概率分布的随机性和多样性的参数。值越大,生成的回答倾向于更随机和多样化;值越小,生成的回答倾向于更高概率的预估答案。temperature的通常范围是0到1之间,但有些模型可以设置超过1的值。例如,temperature=1.0时会生成更随机和多样化的回答,而temperature=0.1时则更可能生成高概率的预估答案。

topK
这是一个通过限制模型考虑的前K个令牌来调整随机性和多样性的参数。topK的最佳范围因使用的模型而异。设置此值后,输出令牌将从这些前K个令牌中选择。例如,topK=10表示模型在生成回答时只考虑概率最高的前10个令牌。简而言之,topK通过限制可选令牌的数量来调整多样性。

topP
这是一个通过从累积概率未超过指定P的令牌集合中采样来调整随机性和多样性的参数。通常的topP范围是0到1之间。例如,topP=0.9表示模型在生成回答时只考虑从概率最高的令牌到累积概率未超过0.9的令牌。简而言之,topP通过限制可选令牌的累积概率来调整多样性。

maxTokens
这是一个限制生成的令牌最大数量的参数,用于控制生成文本的长度。例如,maxTokens=800表示模型生成的文本不会超过800个令牌。

在API请求中,可以组合使用temperature、topK、topP参数来平衡信心度和多样性,并使用maxTokens限制输出的令牌数量。

关于Amazon Bedrock中各个模型的详细推理参数,请参考《Inference parameters for foundation models - Amazon Bedrock》。

使用AWS SDK for Python (Boto3) 调用Amazon Bedrock Runtime的invoke_model示例

这里介绍了使用AWS SDK for Python (Boto3)在AWS Lambda函数中调用Amazon Bedrock Runtime的invoke_model的示例。
在撰写本文时,AWS Lambda函数的默认AWS SDK for Python (Boto3)尚不支持调用bedrock和bedrock-runtime的Client。
因此,以下是添加了最新的AWS SDK for Python (Boto3)到Lambda Layer中,并使用bedrock-runtime的Client的示例。

  • 示例代码(AWS Lambda函数)
import boto3
import json
import os
region = os.environ.get('AWS_REGION')
bedrock_runtime_client = boto3.client('bedrock-runtime', region_name=region)
def lambda_handler(event, context):
    modelId = 'ai21.j2-ultra-v1'
    contentType = 'application/json'
    accept = 'application/json'
    body = json.dumps({
        "prompt": "Please tell us all the states in the U.S.",
        "maxTokens": 800,
        "temperature": 0.7,
        "topP": 0.95
    })
    response = bedrock_runtime_client.invoke_model(
        modelId=modelId,
        contentType=contentType,
        accept=accept, 
        body=body
    )
    response_body = json.loads(response.get('body').read())
    return response_body
  • 执行结果示例(上述AWS Lambda函数的返回值)
{
    "id": 1234,
    "prompt": {
        "text": "Please tell us all the states in the U.S.",
        "tokens": [
            〜省略〜
        ]
    },
    "completions": [
        {
            "data": {
                "text": "\nUnited States of America is a federal republic consisting of 50 states, a federal district (Washington, D.C., the capital city of the United States), five major territories, and various minor islands. The 50 states are Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, and Wyoming.",
                "tokens": [
                    〜省略〜
                ]
            },
            "finishReason": {
                "reason": "endoftext"
            }
        }
    ]
}

※本文撰写时,最新的AWS SDK for Python (Boto3) 提供了Amazon Bedrock Runtime的invoke_model_with_response_stream命令。不过,由于计划在另一篇文章中详细说明,因此这篇文章中将不详细讨论。

使用AWS CLI调用Amazon Bedrock Runtime的invoke-model示例

这里介绍了使用AWS CLI调用Amazon Bedrock Runtime的invoke-model示例。
在撰写本文时,Amazon Bedrock Runtime API尚未支持AWS CLI的版本2。
因此,以下示例是使用支持Amazon Bedrock Runtime API的AWS CLI版本1单独安装并执行的。

  • 格式
aws bedrock-runtime invoke-model \
    --region [Region] \
    --model-id "[modelId]" \
    --content-type "[contentType]" \
    --accept "[accept]" \
    --body "[body]" [Output FileName]
  • 执行示例
aws bedrock-runtime invoke-model \
    --region us-east-1 \
    --model-id "ai21.j2-ultra-v1" \
    --content-type "application/json" \
    --accept "application/json" \
    --body "{\"prompt\": \"Please tell us all the states in the U.S.\", \"maxTokens\": 800,\"temperature\": 0.7,\"topP\": 0.95}" invoke-model-output.txt
  • 响应示例
* 屏幕显示  
{"contentType": "application/json"}
* 文件内容(invoke-model-output.txt)  
{"id": 1234,"prompt": {"text": "Please tell us all the states in the U.S.","tokens": [〜省略〜]},"completions": [{"data": {"text": "\nUnited States of America is a federal republic consisting of 50 states, a federal district (Washington, D.C., the capital city of the United States), five major territories, and various minor islands. The 50 states are Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, and Wyoming.","tokens": [〜省略〜]},"finishReason": {"reason": "endoftext"}}]}

※撰写本文时,AWS CLI中尚未提供用于Amazon Bedrock Runtime的invoke-model-with-response-stream命令。

参考:
Amazon Bedrock is now generally available
Amazon Bedrock Is Now Generally Available – Build and Scale Generative AI Applications with Foundation Models
Amazon Bedrock Pricing
GitHub - aws-samples/amazon-bedrock-workshop: This is a workshop designed for Amazon Bedrock a foundational model service.
What is Amazon Bedrock? - Amazon Bedrock
Bedrock API Reference - Amazon Bedrock
Bedrock - Boto3 documentation
BedrockRuntime - Boto3 documentation
bedrock — AWS CLI Command Reference
bedrock-runtime — AWS CLI Command Reference
Amazon Bedrock Model Providers - AWS Management Console
 

总结

本次介绍了Amazon Bedrock的参考资料、模型列表、价格、使用方法、令牌和参数的术语解释,以及Runtime API的执行示例。通过整理这些信息,我们了解到Amazon Bedrock提供了多种模型,用户可以根据具体的使用场景进行选择,并且可以通过高度兼容的AWS SDK和AWS CLI接口调用。此外,Amazon Bedrock还与其他AWS服务具有很高的兼容性。今后,我们将继续关注Amazon Bedrock的更新、实现方法以及与其他服务的组合使用等方面。

  • 12
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值