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: Completion Edge Cases & Improve Error Handling UX #3968

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

danny-avila
Copy link
Owner

@danny-avila danny-avila commented Sep 10, 2024

Summary

Closes #3966

  • Refactored the BaseClient class to handle different types of completion responses, including string arrays for parameter-based endpoints.
  • Modified the OpenAIClient to properly handle cases where the chat completion response has no choices or undefined messages.
  • Improved error handling in the OpenAIClient to return intermediate replies as strings when available
  • Added a new error type INVALID_REQUEST to the ErrorTypes enum in the data provider package.
  • Implemented specific error handling for invalid requests in the abortMiddleware, setting a custom error message for better clarity.
  • Updated the client-side error handling to include the new INVALID_REQUEST error type, providing a more informative message to users.
  • Added a new localization string for the invalid request error in English.

image

Testing

Attempt to reproduce #3966 after these changes, observe a more informative error message instead of an empty response

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have added necessary error handling and logging
  • Local unit tests pass with my changes

@danny-avila danny-avila merged commit 341e086 into main Sep 10, 2024
4 checks passed
@danny-avila danny-avila deleted the fix/invalid-req-error branch September 10, 2024 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant