Reasoning instructions
This flow generates a final response with justification. To do this, first create a logical justification and then integrate it into the response before sending.
Reasoning Instructions Workflow
The workflow automatically produces an answer to a user question with an accompanying logical justification.
It first generates a rationale for the answer, then incorporates that rationale into the final response, and finally delivers the combined text back to the chat interface.
🧩 Overview
The system accepts a user query, generates a detailed justification, and uses that justification to produce a polished answer. The justification and answer are concatenated into a single message that is returned to the chat. This approach enhances transparency by showing the reasoning behind the answer and keeps the interaction flow seamless.
⚙️ Main Features
- Accepts user messages through a chat interface.
- Builds a prompt to request a justification for the question.
- Calls an OpenAI model to generate the justification text.
- Builds a second prompt that includes the original question and the justification.
- Calls an OpenAI model to generate the final answer.
- Concatenates the justification and answer into a single formatted string.
- Sends the combined text back to the chat as the final reply.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Chat Input | Receives the user’s question. | User message text | Message object |
| Prompt for Justification | Creates a prompt that asks the model to generate a rationale. | User question | Prompt message |
| Generates Justification | Calls an OpenAI model to produce a justification. | Prompt message | Justification text |
| Prompt for Final Answer | Builds a prompt that includes the question and the generated rationale. | User question, justification text | Prompt message |
| Generates Response | Calls an OpenAI model to produce the final answer. | Prompt message | Final answer text |
| Combine Text | Concatenates the justification and the answer using a newline delimiter. | Justification text, final answer text | Combined text |
| Chat Output | Sends the combined text back to the chat interface. | Combined text | Message displayed to the user |
🧠 Notes
- The workflow uses OpenAI’s
gpt‑4o‑mini(or a similarly capable model) for both justification and answer generation. - Prompt templates are defined dynamically; placeholders
{question}and{rationale}are replaced at runtime. - The system does not stream responses; it waits for full completion before proceeding to the next step.
- The delimiter used in the text combination defaults to a double newline (
\n\n). - All API calls require a valid OpenAI API key; the base URL defaults to
https://api.openai.com/v1. - Token limits are governed by the selected model and the
max_tokenssetting (default is unlimited). - The workflow assumes a stable internet connection; any network interruption will halt the process.
- The labels (
Label Component) present in the visual diagram provide contextual information to users but do not participate in the data flow.