Structured Output Agent
AI-generatedOverview
This node, named Structured Output Agent, is designed to interact with OpenAI's language models to generate structured responses based on a system prompt and input data. It supports iterative processing with a maximum number of iterations to refine the output. The node can also handle tool integrations, invoking external tools during the conversation to enrich the response. It is useful in scenarios where structured, multi-step AI interactions are needed, such as automated workflows, AI-assisted decision making, or complex data processing tasks.
Use Case Examples
- Using a system prompt to guide the AI model in generating structured JSON responses for data extraction.
- Iteratively refining AI-generated content with a maximum iteration limit to ensure completion.
- Integrating external tools dynamically during the AI conversation to perform specific tasks and include their results in the final output.
Properties
| Name | Meaning |
|---|---|
| System Prompt | The initial prompt that sets the context or instructions for the AI model. |
| Max Iterations | The maximum number of iterations the node will perform to refine the AI response before stopping. |
| Model | The AI model to use for generating the response, selectable from available models filtered by certain criteria. |
| Custom File LLM Provider | Optional setting to specify a custom LLM provider for file-related API calls, useful when using proxies like LiteLLM. |
Output
JSON
messages- An array of message objects representing the conversation, including user inputs, AI responses, and tool call results.iterations- The number of iterations performed to reach the final response.success- Boolean indicating whether the node successfully obtained a final response within the iteration limit.files- Processed file data if any files were included in the input, after being handled by the LLM provider or proxy.
Dependencies
- OpenAI API key credential
Troubleshooting
- Ensure a system prompt is provided; the node throws an error if missing.
- If no model is set, the node defaults to 'gpt-4.1-mini' but warns in logs.
- Maximum iterations reached without a final response triggers an error; consider increasing the max iterations or adjusting the prompt.
- Tool invocation errors are logged and included in the output messages; verify tool availability and correct arguments.