This workflow compares question-answering performance across QA Chain versions (v1.3, v1.4, v1.5) using OpenAI’s GPT-3.5-turbo and vector store for document retrieval. Key nodes include Manual Trigger (starts workflow), Input Validation (sets query, document_text, memory_key), Validate Input (ensures query length ≥5 characters), Prepare Document (loads default Bitcoin paper if no document provided), Store In Vector DB (stores document), Document Loader (processes text), Token Splitter (chunks text), Embeddings OpenAI Store/Retrieval (creates embeddings with text-embedding-3-small), Vector Store Retriever (retrieves data), QA Chain v1.3/v1.4/v1.5 (processes query), Merge Results (combines outputs), Format Success Response (returns v1_3_response, v1_4_response, v1_5_response), and Format Validation Error (handles invalid inputs). It utilizes OpenAI’s API. Set up Requirements and Configuration: Install n8n from n8n.io for self-hosting or sign up at cloud.n8n.io for cloud-based setup. Follow installation prompts or create a cloud account. Obtain an OpenAI API key from platform.openai.com: sign up, go to ‘API Keys,’ and generate a key. In n8n, import the JSON workflow. Configure OpenAI Chat Model and both Embeddings OpenAI nodes (Store/Retrieval) with your API key under ‘Credentials’ > ‘OpenAI API.’ Replace Manual Trigger with a Webhook Trigger: set path to ‘qa-chain-comparison,’ configure for POST requests, and optionally add header authentication with a secure key. Ensure sufficient server resources for API calls and vector storage.\n\nTesting and Deployment Steps: Test via Postman with a POST request to the Webhook URL. Example JSON: {'query': 'What is the size of a block header with no transactions?', 'memory_key': 'test_key'} with an authentication header if set. Alternatively, use Manual Trigger. ‘Format Success Response’ returns a 200 status with v1_3_response, v1_4_response, v1_5_response (e.g., ‘80’ bytes), memory_key_used, or ‘Format Validation Error’ (400 status) for queries shorter than 5 characters. Check logs for errors like ‘Invalid API key’ or ‘Vector store failure,’ and verify credentials or memory_key. Activate workflow in n8n. Validate output to ensure responses match query (e.g., ‘80’ for block header size).
$6.99
Workflow steps: 18
Integrated apps: manualTrigger, set, if