Step 1: Install Dependencies
Before starting, ensure you have an Orq account. If not, sign up first. Additionally, we’ve prepared a Google Colab file that you can copy and run immediately, simplifying the setup process. Just replace the API key, and you’re ready to go For more advanced topics, check out the Orq documentation. Start by installing the required packages to use the Orq SDK and manage your knowledge baseStep 2: Contact Tracking (Optional)
Contacts in Orq.ai help track user interactions and API usage across your application. They can represent users, teams, or projects and enable better analytics and budget management. Create a contact through the Orq.ai Studio:- Go to Contact Analytics in your workspace
- Click Create a Contact
- Add the user details (name, email, external ID)
- Set optional metadata and budget limits
Step 3: Set Up the Orq Client
Next, set up the Orq client using your API key. Replace the placeholder with your actual API key.Step 4: Setting Up a Knowledge Base in Orq.ai
To power the FAQ bot, you’ll need a knowledge base containing relevant documents. In Orq.ai, knowledge bases are built using vector embeddings, enabling the bot to retrieve the most relevant information for any query. For this setup, we scraped our technical documentation and uploaded it to the knowledge base via the Orq platform. Keep in mind that this approach does not ensure continuous updates — any changes to your documentation will need to be manually re-uploaded. To upload a knowledge base in Orq.ai:- Create a New Knowledge Base in the Orq workspace.
- Upload Documents by dragging files.
- Process the Files to generate vector embeddings, making your content searchable by the bot.
Step 5: Orq FAQ Chat Prompt
This prompt defines the behavior of Orq.ai’s FAQ bot, ensuring responses are accurate, context-driven, and based only on the provided knowledge base. The assistant acts as a customer service agent, delivering factual answers while avoiding speculation. The prompt includes clear instructions to maintain professionalism: ✅ Use only the knowledge base for answers ✅ Express uncertainty when information is unclear ✅ Avoid opinions or assumptions ✅ Break down complex topics into simple explanations ✅ Use objective, neutral language This ensures reliable and well-supported answers for users across various contexts. This is the general prompt in Orq.ai:Step 6: Define the Interaction Function
The bot will need a function to handle user input, manage conversation memory, and invoke the RAG deployment. Here’s a sample function:Step 7: Run Your FAQ Bot
In a real deployment, feedback would be collected through front-end buttons (e.g., thumbs-up/down, dropdowns, or action buttons). For demonstration purposes, we simulate this process in the notebook using text-based inputs.How the Feedback Loop Works:
- User Rating – After each response, users mark it as good or bad to signal quality.
- Logging Context – If bad, the bot stores: “REMEMBER ‘[response]’ was a bad response to ‘[question]’” This helps the model learn from past mistakes.
- Defect Classification – Users specify the issue (e.g., grammatical, hallucination, off-topic) for targeted improvements.
Next Steps
Great job! You’ve implemented a structured feedback loop for your FAQ bot, ensuring continuous learning and response improvement. To take it further:- Integrate interaction tracking – Link front-end actions (copied, saved, deleted, shared) to feedback logging, allowing the bot to learn without requiring explicit user input.
- Create annotated datasets in Orq – Use feedback as a selection method to build curated datasets for evaluation. Run experiments to see if updates to prompts, models, parameters, or the knowledge base improve performance and response quality.