Draft
Conversation
axyr
commented
May 30, 2025
|
|
||
| protected function handleMessageStart(array $chunk): null | ||
| { | ||
| // { |
Author
There was a problem hiding this comment.
Not sure how to best store this information.
axyr
commented
May 30, 2025
| ); | ||
| } | ||
|
|
||
| protected function handleReasoningContentBlockDelta(array $reasoningContent): Chunk |
axyr
commented
May 30, 2025
| ); | ||
| } | ||
|
|
||
| protected function handleMetadata(array $chunk): void |
Author
There was a problem hiding this comment.
Not sure what to do with this information.
| 'version' => config('prism.providers.bedrock.version', 'latest'), | ||
| 'credentials' => [ | ||
| 'key' => config('prism.providers.bedrock.api_key', ''), | ||
| 'secret' => config('prism.providers.bedrock.api_secret', ''), |
Contributor
There was a problem hiding this comment.
you'll need to add 'token' => config('prism.providers.bedrock.session_token', ''), to work with sts.
* 'main' of github.com:prism-php/bedrock: fix(converse): parameterless tools (prism-php#28) fix: prism >=v0.77.1 incompatibilities (prism-php#27) # Conflicts: # src/Bedrock.php
DanielFerguson
added a commit
to communitilabs/prism-bedrock
that referenced
this pull request
Apr 18, 2026
Adds stream() implementation for the Converse schema via the AWS SDK's BedrockRuntimeClient::converseStream() — the binary event-stream format returned by Bedrock is non-trivial to decode over raw HTTP, and the SDK already does it for us. - New BedrockStreamHandler contract mirroring the Text/Structured handlers - New ConverseStreamHandler implementing the streaming + tool-use loop, using Prism's CallsTools trait for multi-step recursion up to maxSteps - BedrockSchema gains streamHandler() (Converse only for now; Anthropic schema streaming is future work) - Bedrock provider exposes awsCredentials() / awsRegion() so the stream handler can construct an SDK client; stream() dispatches via the schema like text() and structured() Maps the full Converse stream event vocabulary (contentBlockStart / contentBlockDelta / messageStop / metadata) into Prism's typed StreamEvent subclasses (StreamStart, StepStart, TextStart/Delta/Complete, ToolCall, StepFinish, StreamEnd). Tested end-to-end against ap-southeast-2 with the au.* APAC inference profile in a downstream app — both streaming text and streaming tool-use loops verified. Integration-style coverage that drives converseStream() through a mocked AWS SDK client is the natural follow-up; draft PR prism-php#23 establishes the BedrockClientFactory + MockHandler pattern we'd reuse.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I have minimal viable stream working, but only tested with
anthropic.claude-3-5-sonnet-20240620-v1:0.It is far from complete, and it was a bit harder than I expected...
I'm still finding my way around the different schema's and message formats.
I tried to keep things as 'Prism' as possible, but to get the stream even decoding working I had to use the aws sdk client in order to retrieve readable events from
converseStream.Added this WIP PR for first feedback and to 'publish' the work to prevent doing double work if others are also working on this.