Flow description
Purpose and benefits
Overview
The RIG (Retrieval Interleaved Generator) Wikipedia Assistant is an automated workflow designed to answer user queries by generating initial responses, identifying necessary factual data, retrieving information from Wikipedia, and refining its answers with precise citations for each section. Its primary goal is to provide answers that are grounded in verifiable sources and to specify exactly which sections and sources were used, making it especially useful for research, fact-checking, and educational purposes.
How the Workflow Operates
Chat Initiation & Welcome
- When a chat session is opened, the user is greeted with a welcome message explaining the flow’s purpose: providing reliable, source-backed answers. This helps set expectations for the quality and transparency of responses.
User Query Intake
- The user submits a question through the chat input. This input is captured and passed along for processing.
Prompt Generation
- The workflow includes a Prompt Template that takes the user’s question and constructs a detailed prompt. This prompt instructs the system to:
- Generate a draft answer, even if it uses placeholder data.
- For each section in the answer, specify which external source (like Wikipedia) or internal knowledge base should be used to verify and refine that section.
- Include search queries for Wikipedia to fetch the correct information for each section.
Example:
User Input: Which countries are top in terms of renewable energy?
Draft Output: The top countries are Norway, Sweden, Portugal [Search in Wikipedia: "Top Countries in renewable Energy"]...
Initial Answer Generation
- Using a language model generator, the system creates an answer draft based on the prompt, highlighting where factual data needs to be inserted and which sources to use for verification.
Data Retrieval & Answer Refinement
- An AI Agent receives the draft answer and leverages the Wikipedia Tool to search Wikipedia for the specified queries.
- For each section of the answer, the agent retrieves the relevant factual data from Wikipedia and replaces the draft or placeholder content.
- Each section is refined to include a direct link to the exact Wikipedia article or section used, ensuring transparency and easy verification.
The agent is instructed to avoid generic or filler phrases, focusing only on concise, factual content.
Final Output
- The fully refined answer, with each section grounded in a specific Wikipedia source (and links provided inline), is displayed to the user in the chat interface.
Workflow Structure
Step | Component | Purpose |
---|
1 | Chat Opened Trigger | Detects new chat session and triggers welcome message |
2 | Message Widget | Displays initial greeting and instructions |
3 | Chat Input | Accepts user’s question |
4 | Prompt Template | Formats prompt with instructions for draft answer + source pointers |
5 | Generator | Produces initial answer draft (with placeholders) |
6 | Wikipedia Tool | Enables data retrieval from Wikipedia |
7 | AI Agent | Refines draft, fetches facts, inserts citations/links |
8 | Chat Output | Presents the final, grounded answer to the user |
Key Features and Benefits
- Source Transparency: Each section of the answer clearly specifies which Wikipedia page or section was used, including direct links for user verification.
- Automation & Scale: The workflow automates the process of drafting, fact-checking, and refining answers, making it suitable for handling many queries efficiently.
- Research-Grade Output: By grounding every claim in a verifiable external source, the system produces answers suitable for academic, business, and professional contexts.
- Customizability: If needed, internal knowledge sources can be plugged in alongside Wikipedia, making the system adaptable for company-specific data retrieval.
Use Cases
- Educational Assistants: Provide students with answers that always cite their sources.
- Fact-Checking Bots: Instantly verify information and present sources without manual research.
- Customer Support: Deliver company or product information with clear data provenance.
- Content Creation: Writers and journalists can get draft content with embedded references for further development.
Summary
This workflow empowers users with trustworthy, well-referenced answers by interleaving generation and retrieval steps. It is especially useful wherever factual accuracy, transparency, and source attribution are crucial. Its modular, automated design makes it highly scalable for organizations seeking to automate research and Q&A tasks at scale.