Skip to content

Improve error messages for Rust client and Try with variant#3768

Merged
virajmehta merged 5 commits intomainfrom
gb/fix-3519
Oct 1, 2025
Merged

Improve error messages for Rust client and Try with variant#3768
virajmehta merged 5 commits intomainfrom
gb/fix-3519

Conversation

@GabrielBianconi
Copy link
Copy Markdown
Member

@GabrielBianconi GabrielBianconi commented Oct 1, 2025

Fix #3519

CleanShot 2025-09-30 at 20 12 42@2x

Important

Improved error message handling for Python and Rust clients by simplifying Python test assertions and enhancing Rust error parsing logic.

  • Python Client:
    • Simplified error message assertions in test_client.py by removing JSON formatting from expected error messages.
  • Rust Client:
    • Updated TensorZeroError::Http in lib.rs to attempt JSON parsing of error messages before using raw text.
    • Modified check_http_response() and http_inference_stream() to extract error from JSON response if available, otherwise use raw body.
    • Adjusted try_adjust_tool_call_arguments() to handle tool call arguments based on gateway version.

This description was created by Ellipsis for 37cbe7f. You can customize this summary. It will automatically update as commits are pushed.

Copilot AI review requested due to automatic review settings October 1, 2025 00:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves error messages for the Rust client by standardizing error field naming and enhancing error message formatting. The changes focus on renaming the text field to message in the TensorZeroError::Http variant and implementing JSON error parsing for better error handling.

  • Renamed text field to message in TensorZeroError::Http variant for consistency
  • Enhanced error message formatting with conditional display logic
  • Added JSON error parsing to extract structured error messages from API responses

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
clients/rust/src/lib.rs Updated error struct field name, improved error message formatting, and added JSON error parsing
clients/python/src/lib.rs Updated field reference from text to message in error conversion
tensorzero-core/tests/e2e/rate_limiting.rs Updated test assertions to use message field instead of text

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

virajmehta
virajmehta previously approved these changes Oct 1, 2025
@virajmehta virajmehta enabled auto-merge October 1, 2025 00:28
virajmehta
virajmehta previously approved these changes Oct 1, 2025
@virajmehta virajmehta enabled auto-merge October 1, 2025 00:33
@virajmehta virajmehta added this pull request to the merge queue Oct 1, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 1, 2025
Copilot AI review requested due to automatic review settings October 1, 2025 16:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@virajmehta virajmehta added this pull request to the merge queue Oct 1, 2025
Merged via the queue into main with commit cf59438 Oct 1, 2025
32 checks passed
@virajmehta virajmehta deleted the gb/fix-3519 branch October 1, 2025 19:00
github-merge-queue bot pushed a commit that referenced this pull request Oct 1, 2025
…3768)" (#3790)

This reverts commit cf59438.

Co-authored-by: Gabriel Bianconi <GabrielBianconi@users.noreply.github.com>
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.

Improve error handling and visibility in Try With Variant

3 participants