-
Notifications
You must be signed in to change notification settings - Fork 742
feat(ai-proxy): support Amazon Bedrock #2039
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
Conversation
ca13e9c
to
f89fa7a
Compare
contextCache *contextCache | ||
} | ||
|
||
func (b *bedrockProvider) OnStreamingResponseBody(ctx wrapper.HttpContext, name ApiName, chunk []byte, isLastChunk bool) ([]byte, error) { |
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.
这块可以看下能否改成实现 StreamingEventHandler 接口,这样就不需要 extractAmazonEventStreamEvents
方法了,SSE 消息的逻辑会由 ExtractStreamingEvents 公共方法进行处理。
参考 PR: #1800
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.
bedrock的返回不是text/event-stream,是这个
content-type:application/vnd.amazon.eventstream
好像不能转换成
type StreamEvent struct {
Id string `json:"id"`
Event string `json:"event"`
Data string `json:"data"`
HttpStatus string `json:"http_status"`
}
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.
这块可以看下能否改成实现 StreamingEventHandler
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2039 +/- ##
==========================================
+ Coverage 35.91% 43.66% +7.75%
==========================================
Files 69 79 +10
Lines 11576 12753 +1177
==========================================
+ Hits 4157 5569 +1412
+ Misses 7104 6836 -268
- Partials 315 348 +33 🚀 New features to boost your workflow:
|
Ⅰ. Describe what this PR did
Support ai-proxy bedrock provider
Ⅱ. Does this pull request fix one issue?
fix #1695
Ⅳ. Describe how to verify it
docker-compose.yaml
envoy.yaml
测试非流式请求:
非流式响应:
测试流式请求:
流式响应: