VEuPathDB / VEuPathDB/ApiCommonWebsite
AI Expression malformed individual experiment responses cause user-facing exception
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 3
- Forks
- 1
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 6
Description
Every now and then, the user will get a
We're sorry, something went wrong.
during the processing of a gene.
I managed to track one down and it's malformed JSON returned by OpenAI despite it having been given a responseFormat schema. Boo!
I think the only solution is to assume these are 1 in 50 events and have a retry strategy?
From the tomcat logs for VectorBase on watermelon
Caused by: java.lang.RuntimeException: Error parsing JSON response for dataset DS_047c56768c. Raw response string:
{"one_sentence_summary":"This gene is moderately expressed in <i>Anopheles gambiae</i> midguts and salivary glands infected with <i>Plasmodium falciparum</i>, showing a slightly h
igher expression in salivary glands.","biological_importance":3,"confidence":4,"notes":"Expression values indicate a slightly higher level in salivary gland samples compared to mi
dgut samples, and expression seems consistent across paired-end and single-end methodologies.","experiment_keywords":["mosquito tissues","midgut","salivary gland","Plasmodium falc
iparum infection","RNA-Seq"],"confidence":4}
at org.apidb.apicommon.model.report.ai.expression.Summarizer.lambda$describeExperiment$0(Summarizer.java:159)
Caused by: org.json.JSONException: Duplicate key "confidence" at 579 [character 580 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:536)
at org.json.JSONObject.<init>(JSONObject.java:259)
at org.json.JSONObject.<init>(JSONObject.java:481)
at org.json.JSONObject.<init>(JSONObject.java:458)
at org.apidb.apicommon.model.report.ai.expression.Summarizer.lambda$describeExperiment$0(Summarizer.java:150)
See also #263
Contributor guide
No contributing guide indexed for this repository
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 at Model/src/main/java/org/apidb/apicommon/model/report/ai/expression/Summarizer.java around line 150, where the experiment response is parsed, and compare the related context in issue #263. Reproduce the duplicate-key malformed response if possible and determine how parsing should recover or retry. Done means malformed individual responses no longer surface as an unhandled user-facing exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ai, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100