ChatEntity represents a structured data object used in chat completions to encapsulate specific information extracted from user inputs or external sources. It is designed to facilitate the processing and understanding of complex data within conversational AI applications.
Definition
Below is the interface definition for theChatEntity:
ChatEntity
| Property | Type | Description |
|---|---|---|
| messages | Array | An array of message objects representing the conversation history. Each message includes a role and content. |
| output | Record | Optional JSON Schema (Draft 7) that defines the expected structure of the response. |
messages Property:
| Property | Type | Description |
|---|---|---|
| role | user, assistant, system | The role of the message sender. Can be user for user messages, assistant for AI responses, or system for system-level messages. |
| content | string | The actual text content of the message. |
Currently only the
user role is allowed.output Property:
The output property is an optional JSON Schema that defines the expected structure of the response generated by the chat completion. It enables developers to specify the format and constraints of the output data, ensuring that responses adhere to a predefined schema.
Below are some useful resources to help you get started with structured output:
Examples
Below are several practical examples demonstrating how to use theChatEntity in different scenarios.
Basic Example
This example demonstrates a simple chat interaction using theChatEntity without any structured output.
Structured Output Example
This example demonstrates how to use theChatEntity with a structured output defined by a JSON Schema.
Use Case Examples
We will now explore several practical use cases demonstrating how to leverage theChatEntity for various data extraction scenarios.
Get Search Volume
Retrieve the search volume for a specific keyword in a given country.Get Reddit Comments
Extract two comments from the Reddit article sorted by thebest rating.
Web Search
Perform a web search for a specific keyword and return structured search results using Tedi completions with structured output.Deep Research
Conduct in-depth research on a specific topic by visiting multiple web pages and extracting structured data using Tedi completions with structured output.Without Structured Output
Use standard chat completions without structured output.Using Cache with ChatEntity
Enable caching for completions to speed up responses and reduce costs for repeated requests.Conclusion
TheChatEntity is a powerful tool for structuring chat interactions and extracting specific information in a controlled manner. By leveraging the capabilities of structured output, developers can create more efficient and effective conversational AI applications.
Tedi is specifically designed to perform SEO and market research tasks using structured data extraction techniques.
Tedi is not a general-purpose model and may not perform well outside of its intended use cases.

