Handling Negative Responses from GPT-3.5 in File Analysis Using LangChain

Hi everyone,

I’ve been utilizing GPT-3.5 via LangChain for some file analysis, and occasionally, I’m receiving negative responses like: “Sorry, I’m a language model,…” or “Sorry, but I couldn’t find the analysis process you specified for this file.”

These negative answers can vary in wording and structure. I’m looking for a method to detect and handle these responses efficiently. How could I programmatically identify such messages?

Would utilizing regular expressions (regex) or similar pattern-matching techniques be a convenient solution? Or are there more robust ways to identify these types of responses, given that the wording can change?

1 Like