Skip to content
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

[FIX] fixing bug in using AsyncOpenAI client (header setting, token counting, etc) #738

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gangmuk
Copy link
Collaborator

@gangmuk gangmuk commented Feb 25, 2025

Pull Request Description

This PR fixes a few bugs in client and also improves failure request handling.
Bugs

  • Header setting in AsyncOpenAI was not being done (routing-strategy header)
  • It was counting the number of output tokens in a wrong way in streaming client.

Improvement

  • Handling failure request in a better way

Related Issues

Resolves: #[Insert issue number(s)]

Important: Before submitting, please complete the description above and review the checklist below.


Contribution Guidelines (Expand for Details)

We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:

Pull Request Title Format

Your PR title should start with one of these prefixes to indicate the nature of the change:

  • [Bug]: Corrections to existing functionality
  • [CI]: Changes to build process or CI pipeline
  • [Docs]: Updates or additions to documentation
  • [API]: Modifications to aibrix's API or interface
  • [CLI]: Changes or additions to the Command Line Interface
  • [Misc]: For changes not covered above (use sparingly)

Note: For changes spanning multiple categories, use multiple prefixes in order of importance.

Submission Checklist

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

- Fixing header setting bug in AsyncOpenAI client
- Fixing wrong token count issue in streaming client
- Handling failed request properly for streaming client.
- Added request id in output log

Signed-off-by: “Gangmuk <[email protected]>
@gangmuk gangmuk force-pushed the gangmuk/fix-bug-in-client branch from 3abf67a to 2001ca9 Compare February 25, 2025 02:05
@@ -199,7 +219,9 @@ def main(args):
base_url=args.endpoint + "/v1",
)
if args.routing_strategy is not None:
client.default_headers["routing-strategy"] = args.routing_strategy
client = client.with_options(
Copy link
Collaborator

Choose a reason for hiding this comment

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

em. that's something we didn't review clearly. good fix

@Jeffwan
Copy link
Collaborator

Jeffwan commented Feb 25, 2025

For the CI issue, I left comment here #739 and please take a look

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.

2 participants