bug: no validation of JSON object returned by LLM models
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 73
- Forks
- 89
- Avg merge
- 14d 58m
- Merged PRs (30d)
- 2
Description
## Describe the bug
There are two files where json object is parsed from the model response with exception handling. These are the two files.
`react.py` ->
https://github.com/mesa/mesa-llm/blob/a719dac14e3f314a29cf8758114ba349e99fbb29/mesa_llm/reasoning/react.py#L97
https://github.com/mesa/mesa-llm/blob/a719dac14e3f314a29cf8758114ba349e99fbb29/mesa_llm/reasoning/react.py#L148
`episodic_memory.py` ->
https://github.com/mesa/mesa-llm/blob/a719dac14e3f314a29cf8758114ba349e99fbb29/mesa_llm/memory/episodic_memory.py#L155
https://github.com/mesa/mesa-llm/blob/a719dac14e3f314a29cf8758114ba349e99fbb29/mesa_llm/memory/episodic_memory.py#L170
This may throw errors when the returned response is not a json object or corrupted.
## Fix
Add try-except block around the parser.
## PR
I'll open a PR and link this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the four parser locations linked in mesa_llm/reasoning/react.py and mesa_llm/memory/episodic_memory.py. Reproduce responses that are corrupted or not JSON objects, then verify the affected paths handle those responses without uncaught parsing errors. Done means all four model-response parsing sites have the requested exception handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100