cognovi-ai / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling and reframing distorted thinking when you've been thinking this way your whole life. The CDJ can help with that 🧠✨ -- v2 is in development!
https://thecdj.app
4 stars 0 forks source link

Replace any with return type from CdGpt response and implement validation for LLM response. #172

Open hiyaryan opened 1 month ago

hiyaryan commented 1 month ago

Currently the CdGpt response is getting unpacked as a JSON string in Message.content. This isn't fully capturing what the LLM returns, which appears to more closely match the FormatInstructions interface. More validation needs to happen with the LLM response as well as it is non-deterministic.

Figure out an appropriate type for the LLM response and implement validation for it.

Accomplish TODO below from commit in backend/src/models/entry/entryAnalysis.ts of #169 and remove ESLint disable comments.

Line: 16 Message: // TODO: any should be replaced with return type from cdgpt response Commit: 6007601