Skip to content

feat: support bedrock reasoning content response #1074

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

alexagriffith
Copy link
Contributor

Description

support returning reasoning content from aws bedrock in openai.
required adding aws bedrock fields that were missing and requires returning extra fields. since we are already refactoring to use openai go sdk, it makes sense to implement this here instead of adding it to our custom openai struct.

@alexagriffith alexagriffith changed the title Alexagriffith/support bedrock thinking feat: support bedrock reasoning content response Aug 13, 2025
@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.13%. Comparing base (fb1f875) to head (205689e).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
internal/extproc/translator/openai_awsbedrock.go 95.74% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1074      +/-   ##
==========================================
- Coverage   78.33%   78.13%   -0.21%     
==========================================
  Files          81       82       +1     
  Lines        9349     9629     +280     
==========================================
+ Hits         7324     7524     +200     
- Misses       1681     1749      +68     
- Partials      344      356      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -467,21 +513,20 @@ func (o *openAIToAWSBedrockTranslatorV1ChatCompletion) bedrockStopReasonToOpenAI

func (o *openAIToAWSBedrockTranslatorV1ChatCompletion) bedrockToolUseToOpenAICalls(
toolUse *awsbedrock.ToolUseBlock,
) *openai.ChatCompletionMessageToolCallParam {
) openaigo.ChatCompletionMessageToolCall {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to a pointer return?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just dereference the ptr right after returning, what do u think is best to do?

},
FinishReason: o.bedrockStopReasonToOpenAIStopReason(bedrockResp.StopReason),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we set the finishReason inplace?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for Index

if choice.Message.Content == nil {
choice.Message.Content = output.Text
switch {
case output.ToolUse != nil:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToolUse and Text cannot be non-nil at the same time, right?
if yes, can you add comment about it or point to docs about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants