Skip to content

Improve loading of json if end of json is not found for metrics #814

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

Yleisnero
Copy link
Contributor

Some LLMs struggle to generate a complete and correct JSON (e.g. mistral-7b-instruct). Also see issue #743.
However, often, only the closing bracket of the JSON is missing. This can be fixed easily by adding the bracket at the end of the input string.

Copy link

vercel bot commented Jun 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
evals-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2024 8:47am

@Yleisnero Yleisnero closed this Jun 6, 2024
@Yleisnero Yleisnero deleted the feature/improve-json-loading-for-metrics branch June 6, 2024 11:32
@FaizaQamar
Copy link

Hey, I couldn't understand your solution. The same lines of code are in the utils.py file related to missing paranthesis. But the problem persists. Can you please explain your solution? @Yleisnero

@Yleisnero
Copy link
Contributor Author

@FaizaQamar I encountered the problem that Mistral was generating a correct json but was leaving out the closing curly bracket. So this solution only fixes this specific case.

@MINJIK01
Copy link

MINJIK01 commented Jul 3, 2024

I attached bracket at the end of the string, but it still doesn't work and reply same error.

I wrote like below.

test_case = LLMTestCase(
input="Write me a joke}",
actual_output="Why did the chicken go to the doctor? Because it had a fowl cough! I hope that made you cluck with laughter!",
)

@Yleisnero
Copy link
Contributor Author

This is not a fix that the user should apply. As @FaizaQamar mentioned, this code is in the utils.py because it is a merged pull request. This fixes some problems, but not everything. LLMs are not deterministic and unreliable. If you still encounter the issue, this here is not the solution.

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