Data to TOON
This component helps you transform complex data structures, such as lists or dictionaries, into a specific text format known as “TOON.” In the Nappai automation system, this is useful when you need to send data in a readable text format, for example, to feed information into an AI assistant or to store data in a plain text file.
Think of it as a translator: you give it a structured object (like a contact list with names and phone numbers), and it outputs a clean, text-based version that other parts of your workflow can read and process.
How it Works
Internally, this component acts as a data transformer. It does not call external APIs or require internet connections to function. Instead, it processes the data directly within the Nappai environment.
- Receives Input: The component takes a structured data object as input. This could be a simple list, a dictionary (key-value pairs), or a more complex nested structure.
- Encodes Data: It applies a specific encoding rule (the TOON format) to convert this internal object into a single string of text.
- Outputs Text: The result is a plain text string (
toon_text) that represents your original data in a format optimized for language models or text-based storage.
Because it relies on local processing logic, the transformation is fast and does not depend on external services.
Connection & Credentials
This component does not require any credentials or API keys. It works independently once you provide the data.
Inputs
Mapping Mode
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
- Data: The structured data object (such as a dictionary or list) that you want to convert into TOON text. This is the main input that feeds into the component.
- Visible in: No operations
Outputs
The component produces a single output:
- toon_text: A string containing the encoded representation of your input data. You can connect this output to other components that accept text input, such as AI assistants, text parsers, or file writers.
Output Data Example (JSON)
json { “toon_text”: ”{‘key1’: ‘value1’, ‘key2’: ‘value2’}” } Note: The actual string content will vary based on the complexity of your input data. If your input is a simple list, the output string will reflect that list’s items.
Connectivity
This component typically connects to:
- Preceding Components: Data generators, databases, or previous steps in your workflow that produce structured data (like dictionaries or lists).
- Following Components: Text processors, AI language model integrations (LLMs), or file storage components that need text input.
It serves as a bridge between structured data handling and text-based processing systems.
Usage Example
Imagine you are building a workflow to analyze customer feedback:
- Step 1: A previous component retrieves customer comments from a database and returns them as a Dictionary (structured data).
- Step 2: You connect this Dictionary to the Data to TOON component.
- Step 3: The Data to TOON component converts the dictionary into a TOON text string.
- Step 4: You send this text string to an AI Assistant component to summarize the feedback.
Without this step, the AI might struggle to process the raw dictionary structure directly, so the conversion ensures compatibility.
Tips and Best Practices
- Ensure Valid Data: Make sure the input “Data” field contains valid structured data (like a dict or list). Empty or null inputs may result in an empty or error-prone output.
- Use for Text-Based AI: This component is particularly useful when sending data to Large Language Models (LLMs) that require text input rather than complex object structures.
- Check Output Type: The output is always a String. If your next step expects a number or boolean, you may need an additional conversion component.
Security Considerations
- Data Privacy: Be mindful of the data you are converting. Since the output is a text string, ensure that sensitive information (like personal identifiable information) is handled according to your organization’s data privacy policies before encoding.
- Input Validation: Ensure that the data coming into this component is sanitized to prevent any unexpected behavior during the encoding process.
Important Notes
This section is omitted as there are no specific user notes provided for this component.
Security Considerations
This section is omitted as no specific security risks beyond standard data handling were identified.