smoothbrain-ai / smoothbrain-anki

SmoothBrain is an Anki plugin that fetches Readwise highlights and makes flashcards using OpenAI GPT.
39 stars 6 forks source link

ValueError on some completions #34

Closed abdnh closed 1 year ago

abdnh commented 1 year ago

GPT sometimes gives output containing Question:/Answer: instead of the Q:/A: that the code tests for, resulting in the following error:

ValueError: not enough values to unpack (expected 2, got 1)

Example output:

Question: How should you prepare for an interview focused on your area of expertise?
    Answer: Prepare by focusing on being straight to the point, testing one fact, and using a Q&A format.

Maybe we should test for those prefixes too at least.

alexbowe commented 1 year ago

Thanks for reporting this! I think this is fairly easy to fix by improving the prompt to tell GPT to respond with a parsable format like JSON (and specify the keys)