Parse the response of a LLM
parseLlmResponse(response, noMatchIsDontKnow = TRUE)
The response of a LLM to the system prompt with prompt generated by
createSystemPrompt()
and createPrompt()
, respectively.
If the response doesn't fit any predefined pattern, should we return "I don't know"?
Returns a character string with one of the following values:
"yes": Yes, the patient has the disease.
"no": No, the patient does not have the disease.
"I don't know": The LLM cannot decide whether the patient has the disease.
NA: There was a problem parsing the LLM's response.
parseLlmResponse("Summary: yes")
#> [1] "yes"
parseLlmResponse("Summary: It is unclear whether the patient has the disease.")
#> [1] "I don't know"