Incorporate AI Tristate Analyzers into Process and Product Workflows

Andy Nanopoulos • March 7, 2023 2 min read

incorporate-ai-tristate-analyzer-into-workflows

A Tristate Analyzer, coined by Andy Nanopoulos, is a system that analyzes an input and responds with one of three answers: yes, no, or unknown. Given that the results are bounded, one can use the results in a process or product workflow. For example, for the question "Is this customer review positive?", one could publish the positive reviews directly to social media, where negative reviews may need to be vetted.

Large Language Models (LLM) can be used to analyze many types of inputs and return results that can be parsed as a Tristate Analyzer: tristate-analyzer-example

The tristate analyzer I've written is available on Npm and Github. Here are two examples of how to configure the tristate analyzer:

tristateAnalyzerConfig = {
  yesCriteria: "positive customer review",
  noCriteria: "negative customer review",
  unknownCriteria: "the customer review is neither positive nor negative"
}

tristateAnalyzerConfig = {
  yesCriteria: "75% or more of the supplied statements are true",
  noCriteria: "74% or less of the supplied statements are false",
  unknownCriteria: "the supplied statements can not be analyzed"
}

The package will create the appropriate prompt and send the prompt to the OpenAI gpt-3.5-turbo model. The tristate analyzer's response will be similar to this:

{
  analysis: 'yes',
  prompt: 'Return "yes" if positive customer review, "no" if negative customer review, or "unknown" if the customer review is neither positive nor negative and give the reason for your response: The food was very delicious and the staff was very polite',
  message: 'yes - The customer review is positive because they mentioned that the food was delicious and the staff was polite.'
}

You can use the analysis value to change your back-end workflow.

Enjoy!