Skip to content

Summarize Message

Summarizes message text using a Large Language Model (LLM) and Artificial Intelligence (AI).

Endpoint POST

https://api.ttgtoolbox.com/v1/summarize/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.

textstringrequired

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

Optional parameters

modelstring

The default LLM for generating summaries 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
AI21 Jurassic-2 Ultraai21.j2-ultra-v1

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

promptstringadvanced feature

The default prompt is a variation of "In 3-4 sentences summarize the following message ticket." You can override this prompt using the prompt parameter. See the request example to the right.


Example request body

json
{
  "text": "Name: John Smith Issue: I'm experiencing an issue with my recent order. The tracking information seems to be incorrect, and I haven't received my package yet. Order Number: ABC456 Additional Information: I placed the order last week and was expecting it to arrive by now. Can you please help me resolve this?"
}

Example request body with optional parameters

json
{
  "text": "Name: John Smith Issue: I'm experiencing an issue with my recent order. The tracking information seems to be incorrect, and I haven't received my package yet. Order Number: ABC456 SSN: 123-45-6789 Additional Information: I placed the order last week and was expecting it to arrive by now. Can you please help me resolve this?",
  "prompt": "Summarize the provided message, but do NOT include the SSN or and any PII if provided.",
  "model": "gpt-4-turbo"
}

Returns

A JSON object containing summarized message and estimated credit usage.


Response

json
{
  "summary": "John Smith is encountering an issue with his recent order (Order Number: ABC456). The tracking information is inaccurate, and he has not received his package despite placing the order last week with the expectation of a timely delivery. John is seeking assistance in resolving this matter promptly.",
  "credits": 1
}

Notes

Be advised

The Summary API uses a Large Language Model (LLM) to generate message summaries. Repeated calls to the API using the same text will produce different responses.