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.
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
feat:Add Amazon Bedrock to support the leading large language models such as Amazon Nova, Claude, Llama, Mistral, and others. #5746
base: main
Are you sure you want to change the base?
feat:Add Amazon Bedrock to support the leading large language models such as Amazon Nova, Claude, Llama, Mistral, and others. #5746
Changes from 39 commits
ff356f0
722c288
dca4a0e
fc39116
0f276f5
afbf5eb
58837f6
f532731
e3c18bb
d55c752
1164e1b
1998cf5
045adc3
1f66d37
cae20af
ca17e90
c55cea5
952d883
3bf55d3
f0c23cc
5d5456c
4204890
9e04198
82a368a
0e09697
09e4f95
f120584
afb0752
bfa4339
70f066c
1b5a81c
24261d2
6bc1612
225ad30
b2d5e0e
dfeb9e7
9d3f1d2
f60c237
bd68df1
b0c1ccd
a85db21
ff88421
a6337e9
238eb70
513cf1b
a19ba69
2ccdd17
6f7a635
5bd7e28
0abfd27
2fe848e
9a47304
15d0600
e663375
448babd
b39b3f7
9c648e5
8ce2cf5
471b178
d9d2a27
a75b9f7
0c55850
4254fd3
57dc44a
ad49cd0
5ac651a
603415f
26b9fa9
f5ae086
fb3437c
7830b37
4b2f447
93337b2
a088687
44a1cf6
50a241b
372a327
2a9f7d7
12d38aa
19437c7
e455840
cb0422b
0ec1ae6
e839940
9643adc
92615da
26f79aa
89b1774
29b9a20
b0f78e9
6d72a04
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
🛠️ Refactor suggestion
Add type definition for parsed response
The function returns
any
type which reduces type safety. Consider defining a specific type for the parsed response.📝 Committable suggestion
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.
Avoid logging sensitive response data
Logging the entire error object could expose sensitive information in the response.
Apply this diff:
📝 Committable suggestion
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.
Use a safer method to clean control characters
The current regex pattern for cleaning control characters is flagged as potentially unsafe.
📝 Committable suggestion
🧰 Tools
🪛 Biome (1.9.4)
[error] 48-48: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
[error] 48-48: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
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.
🛠️ Refactor suggestion
Improve error handling in fallback parsing
The catch block for
innerError
should provide more context about the parsing failure.📝 Committable suggestion
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.
🛠️ Refactor suggestion
Add timeout handling for stream processing
The stream processing lacks timeout handling which could lead to hung connections.
async function* transformBedrockStream( stream: ReadableStream, modelId: string, + signal?: AbortSignal, ) {
And update the implementation to handle timeouts:
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.
Remove sensitive data logging
Logging the parsed response could expose sensitive information.
Apply this diff:
📝 Committable suggestion
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.
🛠️ Refactor suggestion
Use a safer method to clean control characters
Using control characters in regex is flagged as potentially unsafe.
Apply this diff:
📝 Committable suggestion
🧰 Tools
🪛 Biome (1.9.4)
[error] 103-103: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
[error] 103-103: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
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.
🛠️ Refactor suggestion
Replace 'any' type with a specific type definition
Using
any
type reduces type safety. Define a specific type for the request body.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.
🛠️ Refactor suggestion
Add validation for unsupported model IDs
The function should explicitly reject unsupported model IDs.
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.
Remove sensitive request logging
Logging the entire request body could expose sensitive information.
📝 Committable suggestion
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.
🛠️ Refactor suggestion
Improve path validation
The current path validation is basic and could be bypassed.
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.
Sanitize error messages in response
Exposing raw error messages in the response could reveal sensitive information.
Apply this diff:
📝 Committable suggestion