Skip to content

Validate Message

The Validate Message endpoint uses Artificial Intelligence (AI) to validate a message using the specified criteria.

Endpoint POST

https://api.ttgtoolbox.com/v1/validate/message

Request body

This endpoint uses the POST method and requires a JSON object as the request body.

Required parameters

The request body requires the following parameters.

messagestringrequired

The message to validate. The message can be from any source, including non-standard formatting characters, such as paging pipes (|).

criteriastringrequired

The validation criteria. The criteria provided dictate the specific aspects of the message that the AI validation API will assess for accuracy, relevance, or compliance.

Criteria suggestions & examples

  1. Check Fields: Do the message fields contain specific or required information?

    Example: "The caller is Luke Skywalker and he's arrived at Alderaan."

  2. Grammar and Spelling: Ensuring the message is grammatically correct and free of spelling errors.

    Example: "Please check if the message adheres to proper grammar and spelling."

  3. Content Relevance: Verifying that the message content aligns with the intended purpose or topic.

    Example: "Verify if the message content is relevant to ..."

  4. Sensitive Information Detection: Identifying sensitive information, such as personal identifiers like SSNs or credit card numbers.

    Example: "Check for the presence of sensitive information, such as Social Security Numbers or credit card details."

  5. Language Tone: Assessing the tone of the message to ensure it matches the desired level of formality or politeness.

    Example: "Evaluate the language tone to confirm it aligns with ..."

Optional parameters

modelstring

The default LLM for message validation is OpenAI's GPT-3.5 Turbo gpt-3.5-turbo, which performs effectively for basic messages. Nevertheless, you have the flexibility to explore other LLM options by specifying the model parameter.

Modelmodel value
OpenAI GPT-3.5 Turbogpt-3.5-turbo default
OpenAI GPT-4 Turbogpt-4-turbo
OpenAI GPT-4gpt-4
Cohere Commandcohere.command-text-v14

Additional models may be added in future releases. Costs vary depending the chosen LLM.


Example request body

json
{
  "criteria": "Caller's Name, Company, Account, Phone Number, Product, Outage",
  "message": "Message Ticket: \nCaller:| Jim Hall |\nCompany:| Acme |\nAccount:| 1029 |\nPhone:| 555-719-3559 |\nProduct: eFax\nOutage: Yes\nMsg:| Not getting notice of faxes anymore. . . Not getting failed or successful faxes. |"
}

Example request body with optional parameters

json
{
  "model": "gpt-4",
  "criteria": "The caller is Luke Skywalker and he's arrived at Alderaan.",
  "message": "Message Ticket: Caller:| Luke Skywalker |Company:|| Account:| 11111 | Phone:| 800-555-1212 | \nMsg:|. he's caught in a tractor beam and being pulled into a space station.|"
}

Returns

A JSON object containing message validation results and estimated credit usage.


Valid message response

json
{
  "valid": true,
  "message": "All requirements for the message have been met.",
  "credits": 1
}

Invalid message response

json
{
  "valid": false,
  "message": "The requirements were not met. The caller, Luke Skywalker, was supposed to have arrived at Alderaan. However, the message states that he's caught in a tractor beam and being pulled into a space station.",
  "credits": 1
}

Notes

Be advised

The Message Validation API uses a Large Language Model (LLM) to generate the validation results. Repeated calls to the API using the exact text will produce different responses. Also, note that other models behave differently depending on the specific criteria and message. It may take some experimenting to determine what works best for you and your particular use case.