generated from songquanpeng/gin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: support aws bedrockruntime claude3 #1328
Merged
Merged
Conversation
This file contains 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
5b960fc
to
ed716c8
Compare
…age metrics Based on the file summaries provided, here are the important bullet points for the commit message: - Add functionality to handle stream completion events from AWS in the relay/adaptor/aws/main.go file - Marshall AWS response to OpenAI format and calculate usage metrics in the same file - Implement a custom render function for streaming events in the same file - Improve error handling for JSON unmarshalling and marshalling errors in the same file
试了一下,应该是有问题的,在 gpt-next-web 这一块不行 |
本周末处理,感谢 pr |
- Implemented streaming response handling for AWS handler - Set response content type to text/event-stream - Added error handling for failed marshaling/unmarshaling - Updated return values to include `relaymodel.ErrorWithStatusCode` and `relaymodel.Usage` - Improved error handling and response formatting for AWS adaptor
* Refactor AWS adapter to improve model management - Replace hardcoded model list in `adapter.go` with a function to get models from `awsModelIDMap` - Update `GetModelList` function to return model list directly - Add `GetChannelName` function to get channel name from `Adaptor` object * Improve error handling and code organization in main.go - Replace switch statement with a map to map AWS model IDs to OpenAI model IDs - Return an error if the model is not found in the map - Use a single return statement instead of wrapping multiple return statements in the `awsModelID` function - Add a new error message for when the model is not found in the map in the `Handler` function
dirname
reviewed
Apr 21, 2024
billing.ReturnPreConsumedQuota(ctx, preConsumedQuota, meta.TokenId) | ||
return RelayErrorHandler(resp) | ||
if resp != nil { | ||
errorHappened := (resp.StatusCode != http.StatusOK) || (meta.IsStream && resp.Header.Get("Content-Type") == "application/json") |
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.
#1345, When the type is a Gemini streaming response, the content-type
remains application/json
.
This was referenced Apr 27, 2024
This was referenced May 28, 2024
Closed
SheldonLiu0412
pushed a commit
to SheldonLiu0412/one-api
that referenced
this pull request
Jan 23, 2025
* feat: support aws bedrockruntime claude3 closes songquanpeng#622, closes songquanpeng#749, closes songquanpeng#1300 * fix: convert to aws claude model id * fix: Update AWS adapter to handle stream completions and calculate usage metrics Based on the file summaries provided, here are the important bullet points for the commit message: - Add functionality to handle stream completion events from AWS in the relay/adaptor/aws/main.go file - Marshall AWS response to OpenAI format and calculate usage metrics in the same file - Implement a custom render function for streaming events in the same file - Improve error handling for JSON unmarshalling and marshalling errors in the same file * fix: Implement AWS handler with usage tracking and error handling - Implemented streaming response handling for AWS handler - Set response content type to text/event-stream - Added error handling for failed marshaling/unmarshaling - Updated return values to include `relaymodel.ErrorWithStatusCode` and `relaymodel.Usage` - Improved error handling and response formatting for AWS adaptor * fix: Refactor AWS Adapter for Improved Model Mapping and Error Handling * Refactor AWS adapter to improve model management - Replace hardcoded model list in `adapter.go` with a function to get models from `awsModelIDMap` - Update `GetModelList` function to return model list directly - Add `GetChannelName` function to get channel name from `Adaptor` object * Improve error handling and code organization in main.go - Replace switch statement with a map to map AWS model IDs to OpenAI model IDs - Return an error if the model is not found in the map - Use a single return statement instead of wrapping multiple return statements in the `awsModelID` function - Add a new error message for when the model is not found in the map in the `Handler` function * fix: bug fix * chore: change variable name & package * chore: change variable name * perf: update config related code --------- Co-authored-by: JustSong <[email protected]>
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.
closes #622, closes #749, closes #1300
变更
支持了 aws bedrockruntime 的 claude API
支持的模型有:
补充说明
自测
我已确认该 PR 已自测通过,相关截图如下: