-
-
Notifications
You must be signed in to change notification settings - Fork 145
Create BedrockRuntime client with InvokeModel operation #1849
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5b3862b
Create BedrockRuntime client with InvokeModel operation
6698c3a
Fix documentation URL
ab04792
Fix BedrockRuntime InvokeModel documentation example
27319b8
Regenrate BedrockRuntime InvokeModel
ee4cd0c
Input and Result unit tests for BedrockRuntime InvokeModel operation
2d159f5
Fix BedrockRuntime tests
f3e76b3
Fix BedrockRuntime tests
d8b0edf
Fix SymfonyBundle Changelog
3141539
Upgraded Symfony/Bundle branch-alias dev-master from 1.13-dev to 1.14…
b78e037
Merge branch 'async-aws:master' into master
victor-upmeet 75d2c6b
Removed .idea files
585d257
Remove BedrockRuntime service endpoint- and smoke properties
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| layout: client | ||
| category: clients | ||
| name: BedrockRuntime | ||
| package: async-aws/bedrock-runtime | ||
| --- | ||
|
|
||
| ## Usage | ||
|
|
||
| ### InvokeModel | ||
|
|
||
| ```php | ||
| use AsyncAws\BedrockRuntime\BedrockRuntimeClient; | ||
| use AsyncAws\BedrockRuntime\Input\InvokeModelRequest; | ||
|
|
||
| $bedrockRuntime = new BedrockRuntimeClient(); | ||
|
|
||
| $body = [ | ||
| 'anthropic_version' => 'bedrock-2023-05-31', | ||
| 'max_tokens' => 4096, | ||
| 'messages' => [ | ||
| [ | ||
| 'role' => 'user', | ||
| 'content' => [ | ||
| ['type' => 'text', 'text' => 'Write me a love poem.'] | ||
| ] | ||
| ] | ||
| ], | ||
| 'temperature' => 1 | ||
| ]; | ||
|
|
||
| $result = $bedrockRuntime->invokeModel(new InvokeModelRequest([ | ||
| 'modelId' => 'us.anthropic.claude-3-7-sonnet-20250219-v1:0', | ||
| 'contentType' => 'application/json', | ||
| 'body' => json_encode($body, JSON_THROW_ON_ERROR) | ||
| ])); | ||
|
|
||
| $response = json_decode($result->getBody(), true, 512, JSON_THROW_ON_ERROR); | ||
|
|
||
| echo $response['content'][0]['text']; | ||
|
|
||
| ``` | ||
| more information [InvokeModel](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
|
|
||
| ## NOT RELEASED | ||
|
|
||
| ### Added | ||
|
|
||
| - Support for BedrockRuntime | ||
|
|
||
| ## 1.13.0 | ||
|
|
||
| ### Added | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ | |
| }, | ||
| "extra": { | ||
| "branch-alias": { | ||
| "dev-master": "1.13-dev" | ||
| "dev-master": "1.14-dev" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /.github export-ignore | ||
| /tests export-ignore | ||
| /.gitignore export-ignore | ||
| /Makefile export-ignore | ||
| /phpunit.xml.dist export-ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # These are supported funding model platforms | ||
|
|
||
| github: [nyholm, jderusse] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [*.yml] | ||
| indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: BC Check | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| roave-bc-check: | ||
| name: Roave BC Check | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Modify composer.json | ||
| run: | | ||
| sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json | ||
| cat composer.json | ||
|
|
||
| git config --local user.email "[email protected]" | ||
| git config --local user.name "AsyncAws Bot" | ||
| git commit -am "Allow unstable dependencies" | ||
|
|
||
| - name: Install PHP with extensions | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: 8.3 | ||
| tools: composer:v2 | ||
|
|
||
| - name: Install roave/backward-compatibility-check | ||
| run: composer require --dev roave/backward-compatibility-check | ||
|
|
||
| - name: Roave BC Check | ||
| run: vendor/bin/roave-backward-compatibility-check |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.