radicalxdev / kai-ai-backend

This is the Kai Teaching Assistant ai repo.
MIT License
12 stars 46 forks source link

Solve Validation Errors for Quizzify #49

Open AaronSosaRamos opened 2 weeks ago

AaronSosaRamos commented 2 weeks ago

This PR is made for solving Issue #48. What I've discovered in my research of this problem was that a malformed JSON was made when the number of chunks was generally bigger. For example, I've found this for the actual details that @mikhailocampo provided: image image I've also tested them with the following files and found the same problem: https://hagan.okstate.edu/NNDesign.pdf with the topic "Neural Networks" image https://diposit.ub.edu/dspace/bitstream/2445/180441/2/tfm_lichtner_bajjaoui_aisha.pdf image So, I've discovered that the malformed JSON had a "properties" key in its composition, making it unappropriate for the actual Pydantic Schema. So, I developed a function to test if the response has that. If so, then it will re-try to generate another question, providing appropriate results with bigger PDF files. image image image

mikhailocampo commented 1 week ago

Although accurate, I think this is separate from the #48 Issue given that the issue encountered here is related to ValidationErrors rather than the mapping error from #48