Skip to content

Fix timeout and output parsing issues for local models #2045

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

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

Conversation

jjmachan
Copy link
Member

This PR addresses issue #2044 by improving the handling of local models in Ragas.

Changes

  1. Added a new is_local_model flag to RunConfig with increased timeout (10 minutes) for local models
  2. Improved the JSON extraction logic in extract_json to handle common issues with local model outputs:
    • Better handling of markdown code blocks
    • Converting single quotes to double quotes
    • Removing trailing commas in arrays and objects
  3. Enhanced the RagasOutputParser to be more robust with malformed JSON
  4. Added tests to verify the fixes

These changes should help users who are using local models like Ollama to get better results with metrics like context_recall, faithfulness, and context_precision by reducing timeouts and improving output parsing.

Fixes #2044

@jjmachan can click here to continue refining the PR

This commit addresses issue #2044 by:
1. Adding a new is_local_model flag to RunConfig with increased timeout for local models
2. Improving the JSON extraction logic in extract_json to handle common issues with local model outputs
3. Enhancing the RagasOutputParser to be more robust with malformed JSON
4. Adding tests to verify the fixes
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluation Errors: Output Parsing and Timeout Issues for Context/Faithfulness Metrics
2 participants