Skip to content

Conversation

@Ali-Meh619
Copy link
Collaborator

@Ali-Meh619 Ali-Meh619 commented Nov 10, 2025

PR Type

[Feature | Fix | Documentation | Other() ]

Fix

Short Description

  1. Fixed max_tokens limit in src/utils/model_client_utils.py: reduced from 30,720 to 16,384 to match gpt-4o's limit, preventing API errors.
  2. Fixed JSON parsing in src/utils/json_utils.py: rewrote fix_common_json_errors() to handle LaTeX backslashes ((, ), \to, \lim, etc.) by escaping them correctly, and added a fallback in the exception handler. This resolved JSON parsing errors in task generation and problem solving.

Tests Added

...


This change is Reviewable

1) Fixed max_tokens limit in src/utils/model_client_utils.py: reduced from 30,720 to 16,384 to match gpt-4o's limit, preventing API errors.
2) Fixed JSON parsing in src/utils/json_utils.py: rewrote fix_common_json_errors() to handle LaTeX backslashes (\(, \), \to, \lim, etc.) by escaping them correctly, and added a fallback in the exception handler. This resolved JSON parsing errors in task generation and problem solving.
@Ali-Meh619 Ali-Meh619 requested a review from afkanpour November 10, 2025 23:00
Copy link
Collaborator

@afkanpour afkanpour left a comment

Choose a reason for hiding this comment

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

@afkanpour reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Ali-Meh619)


src/utils/json_utils.py line 0 at r1 (raw file):
Please add a unit test for the changes you make below. The test module should be located under https://github.com/VectorInstitute/automated_capability_evaluation/tree/main/tests/src


src/utils/json_utils.py line 51 at r1 (raw file):

    # Valid JSON escapes: \", \\, \/, \b, \f, \n, \r, \t, \uXXXX
    # LaTeX uses \(, \), \[, \], \epsilon, \delta, etc. which need to be escaped as \\(, \\), etc.
    

Please remove all instances of trailing whitespaces.

Code quote:

···

Create Unit test for json parsing
Removed all trailing whitespace from json_utils.py
@Ali-Meh619 Ali-Meh619 requested a review from afkanpour November 11, 2025 18:55
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