Trying to get json output using llama3 in langchain. This is my prompt template:
<|begin_of_text|><|start_header_id|>system<|end_header_id|> You are a helpful text similarity assistant. Find the sentence in this list ({context}) that has the most words that are the same as this sentence ({query}), ignoring word order and Focus on negation words (e.g. “not”, “no”, “never”). When finding the matching sentence, consider every word and choose the one with the most matched words. Return a JSON object with the matching sentence as the value for the key ‘key’ and one of ‘REPORTABLE’, ‘NOT REPORTABLE’, or ‘REVIEW’ as the key of ‘value’. <|end_header_id|><|start_header_id|>assistant<|end_header_id|>
Even though I tell the model to return the key called ‘value’, sometimes it doesn’t. I have some error handling to call the model 10 times, but it gives the same response (without the ‘value’ key) and errors out. Is there anyway to get it to always give me the ‘value’ key?