-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: handle ByteString conversion errors in OpenAI embedders #8008
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
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.
Thank you for your contribution! I've reviewed the changes and the fix correctly addresses the ByteString conversion error. The implementation is solid and follows existing patterns well. I have a couple of suggestions for improvement.
src/package.json
Outdated
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.
Is this keybinding addition intentional for this PR? It seems unrelated to the ByteString error fix. Consider moving this to a separate PR to keep changes focused on the issue being fixed.
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.
Good implementation of the error handler! Could we also add a test case for this in the OpenAI embedder's test file to ensure the ByteString error is properly handled here as well? I see we have a test for openai-compatible.spec.ts but not for the regular OpenAI embedder.
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.
Excellent use of the existing error handler! The try-catch pattern here is clean and consistent with the codebase.
- Apply handleOpenAIError to OpenAI client creation in both openai.ts and openai-compatible.ts embedders - Transforms cryptic ByteString errors into user-friendly messages when API keys contain invalid characters - Add test coverage for the ByteString error scenario - Fixes #7959
c1a168d to
3a7f4bf
Compare
Summary
This PR fixes the ByteString conversion error that occurs when users configure code indexing with API keys containing special characters.
Problem
Users were encountering a cryptic error message:
Solution
Applied the existing
handleOpenAIErrorfunction to all embedders that create OpenAI client instances:Changes Made:
Result
Now when users have an API key with invalid characters, they receive a clear, actionable error message:
Testing
Fixes #7959
Important
Fix ByteString conversion error in OpenAI embedders by applying error handling for API keys with special characters.
handleOpenAIErrortoOpenAICompatibleEmbedderinopenai-compatible.tsandOpenAiEmbedderinopenai.tsto handle ByteString conversion errors.openai-compatible.spec.tsfor handling ByteString conversion errors with invalid API keys.roo-cline.addToContextinpackage.json.This description was created by
for c1a168d48b31cdf1c55a3e8fa93ec8beb152d9e5. You can customize this summary. It will automatically update as commits are pushed.