-
Notifications
You must be signed in to change notification settings - Fork 0
Native Amazon Bedrock adapter support -- !:json_schema #2
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?
Conversation
.vscode/settings.json
Outdated
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.
should this file be ignored??
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.
this should be ignored by default. I'll make the change
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.
I've removed it. It seems that the json file was there before thus marked deleted
pxp9
left a comment
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.
LGTM !
| {value, rest} | ||
|
|
||
| _ -> | ||
| {nil, rest} |
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.
For any other type, you currently return {nil, rest} without consuming the value bytes.
Example: <<name_len, "foo", type=1, AA, BB, CC, ...>>
After reading name and type, rest = <<AA, BB, CC, ...>>.
This is then recursed with this same rest, so AA is wrongly treated as the next header's name_length. This could desync the parser and can cause MatchError or corrupted headers.
To be correct, unknown types must either be fully parsed/skipped or cause a fail-fast error, not silently ignored.
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.
Good catch! You're right — the original _ -> {nil, rest} clause didn't consume the value bytes, which would desync the parser for any non-string (7) header.
Fixed by explicitly handling all AWS Event Stream header types (0-9), consuming the correct number of bytes for each type.
0xSSDD
left a comment
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.
lgtm
The OpenAPI compatibility does not support all models (Anthropic models) and native API implementation is needed.
This adapter uses
converseAPI for model's response consistency.