-
Notifications
You must be signed in to change notification settings - Fork 1k
apigw-lambda-bedrock-js-sam: Update ModelId to Claude Sonnet 4.5 #2906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,18 +9,25 @@ export const handler = async (event) => { | |
| //console.log(prompt) | ||
| //const prompt = 'Write a text to be posted on my social media channels about how Amazon Bedrock works'; | ||
| const body = { | ||
| 'prompt': "\n\nHuman:" + prompt + "\n\nAssistant:", | ||
| "temperature": 0.5, | ||
| "top_p": 1, | ||
| "top_k": 250, | ||
| "max_tokens_to_sample": 200, | ||
| "stop_sequences": ["\n\nHuman:"] | ||
| } | ||
| anthropic_version: "bedrock-2023-05-31", | ||
| messages: [ | ||
| { | ||
| role: "user", | ||
| content: [ | ||
| { | ||
| "type": "text", | ||
| "text": prompt | ||
| } | ||
| ], | ||
| }, | ||
| ], | ||
| max_tokens: 200 | ||
| }; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Update for using Messages API. |
||
| const input = { | ||
| body: JSON.stringify(body), | ||
| contentType: "application/json", | ||
| accept: "application/json", | ||
| modelId: "anthropic.claude-v2", | ||
| modelId: "global.anthropic.claude-sonnet-4-5-20250929-v1:0", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Update ModelId. |
||
| }; | ||
| const command = new InvokeModelCommand(input); | ||
| const res = await client.send(command); | ||
|
|
@@ -29,7 +36,7 @@ export const handler = async (event) => { | |
| //console.log(JSON.stringify(stringifiedResponse)); | ||
| const response = { | ||
| statusCode: 200, | ||
| body: JSON.stringify(stringifiedResponse), | ||
| body: stringifiedResponse, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Removed |
||
| }; | ||
| return response; | ||
| }; | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo