Documentation
Everything you need to get started with FAQai.app.
Usage Guide
How to use a RAG dataset generator in production. This covers the document to Q&A dataset, the RAG evaluation dataset generator, and the other exports. Code examples in Python, JavaScript, cURL, and Go.
OCR Page Caps (Scanned PDFs)
Scanned PDFs are processed via a vision LLM model. OCR page usage is tracked separately from your regular page quota. Available on paid plans only.
Free
0
Basic
100/mo
Starter
300/mo
Pro
1,000/mo
Using RAG Chunks
RAG Chunks are structured, enriched document chunks ready for ingestion into vector databases. Each chunk includes metadata (keywords, entities, topic, section), quality signals (completeness, overlap risk, fragmentation risk), and retrieval hints (search type, priority, use-case tags).
The file contains embedding_text, not a vector. The examples below call your embedding model, then write the vector into the database you host. The LlamaIndex chunk export leaves embedding null. Upstash Vector is the exception: its data field is the same text, and Upstash embeds it on import. FAQai does not store the vectors or run the production chatbot.
Common Use Cases
- Feed vector databases (Pinecone, Qdrant, pgvector) with enriched chunks
- Generate embeddings from the pre-cleaned
embedding_textfield - Use
retrieval_hintsto configure per-chunk search strategy - Filter or weight results using
chunk_qualitysignals
Python
import os, json, requests, openai
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# 1. Export RAG chunks in Pinecone format
resp = requests.get(
f"{BASE}/datasets/DATASET_ID/export?format=pinecone&chunk_mode=true",
headers=HEADERS,
)
data = resp.json()
# 2. Generate embeddings and upsert
client = openai.OpenAI()
for record in data["records"]:
embedding = client.embeddings.create(
model="text-embedding-3-small",
input=record["metadata"]["text"],
).data[0].embedding
record["values"] = embedding
# 3. Upsert to Pinecone
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
index = pc.Index("my-index")
index.upsert(vectors=data["records"])JavaScript / TypeScript
import OpenAI from "openai";
import { Pinecone } from "@pinecone-database/pinecone";
const API_KEY = process.env.FAQAI_API_KEY;
const BASE = "https://faqai.app/api/v1";
// 1. Export RAG chunks in Pinecone format
const resp = await fetch(
`${BASE}/datasets/DATASET_ID/export?format=pinecone&chunk_mode=true`,
{ headers: { Authorization: `Bearer ${API_KEY}` } },
);
const data = await resp.json();
// 2. Generate embeddings
const openai = new OpenAI();
for (const record of data.records) {
const emb = await openai.embeddings.create({
model: "text-embedding-3-small",
input: record.metadata.text,
});
record.values = emb.data[0].embedding;
}
// 3. Upsert to Pinecone
const pc = new Pinecone({ apiKey: process.env.PINECONE_API_KEY });
const index = pc.index("my-index");
await index.upsert(data.records);cURL
# Export RAG chunks as Pinecone-ready JSON curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=pinecone&chunk_mode=true" \ -H "Authorization: Bearer faq_YOUR_API_KEY" \ -o rag-chunks.pinecone.json # Export as Qdrant-ready JSON curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=qdrant&chunk_mode=true" \ -H "Authorization: Bearer faq_YOUR_API_KEY" \ -o rag-chunks.qdrant.json # Export as pgvector-ready JSON curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=pgvector&chunk_mode=true" \ -H "Authorization: Bearer faq_YOUR_API_KEY" \ -o rag-chunks.pgvector.json
Go
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func main() {
apiKey := os.Getenv("FAQAI_API_KEY")
url := "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=pinecone&chunk_mode=true"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer "+apiKey)
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]interface{}
json.Unmarshal(body, &data)
records := data["records"].([]interface{})
fmt.Printf("Exported %d chunks ready for Pinecone upsert\n", len(records))
}Using Canonical Q&A
Canonical Q&A pairs are the core question-answer dataset grounded in your document content. Each item includes the question, answer, source context, confidence score, and full traceability (chunk ID, page, section).
Common Use Cases
- Validate retrieval accuracy by asserting correct answers
- Seed FAQ chatbots or support knowledge bases (Zendesk, Intercom)
- Fine-tune domain-specific Q&A models
- Create automated regression tests for your RAG pipeline
Python - Automated Retrieval Test
import os, requests
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(f"{BASE}/datasets/DATASET_ID/export?format=json", headers=HEADERS)
dataset = resp.json()
passed, failed = 0, 0
for qa in dataset["canonical_qa"]:
result = my_rag_system.query(qa["question"])
if qa["chunk_id"] in [r["chunk_id"] for r in result["sources"][:5]]:
passed += 1
else:
failed += 1
print(f"MISS: {qa['question']}")
print(f"Retrieval accuracy: {passed}/{passed + failed} ({100*passed/(passed+failed):.1f}%)")cURL
curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=json" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o canonical-qa.json curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=csv" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o canonical-qa.csv
Using Query Variants
Query Variants provide 10 alternative phrasings per canonical question across 8 types: short, vague, broken, typo, incorrect assumption, partial, conversational, and multi-intent. They simulate how real users actually search.
Common Use Cases
- Stress-test retrieval by running all variants through your retriever
- Identify which variant types cause the most retrieval failures
- Train query rewriting or intent classification models
- A/B test different search configurations across variant types
Python - Retrieval Robustness Test
import os, requests
from collections import defaultdict
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(f"{BASE}/datasets/DATASET_ID/export?format=json", headers=HEADERS)
dataset = resp.json()
failures_by_type = defaultdict(list)
for qa in dataset["canonical_qa"]:
variants = dataset.get("query_variants", {}).get(qa["id"], [])
for variant in variants:
result = my_retriever.search(variant["text"], top_k=5)
retrieved_ids = [r["chunk_id"] for r in result]
if qa["chunk_id"] not in retrieved_ids:
failures_by_type[variant["type"]].append(variant["text"])
for vtype, fails in sorted(failures_by_type.items(), key=lambda x: -len(x[1])):
print(f"{vtype}: {len(fails)} failures")Using Evaluation Data
The Evaluation dataset provides question-context-expected_answer triples designed for measuring RAG performance. Compatible with RAGAS, DeepEval, and similar evaluation frameworks.
Common Use Cases
- Run RAGAS benchmarks for faithfulness, relevancy, and context recall
- Run DeepEval metrics for answer correctness and hallucination
- Set up CI/CD quality gates that fail builds if scores drop
- Track improvements over time after changes to chunking, embeddings, or prompts
Python - RAGAS Evaluation
import os, requests
from ragas import evaluate
from ragas.metrics import faithfulness, answer_relevancy, context_recall
from datasets import Dataset
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(f"{BASE}/datasets/DATASET_ID/export?format=evaluation", headers=HEADERS)
eval_data = resp.json()
questions = [d["question"] for d in eval_data["data"]]
ground_truths = [d["ground_truth"] for d in eval_data["data"]]
contexts = [d["contexts"] for d in eval_data["data"]]
answers = [my_rag.query(q)["answer"] for q in questions]
dataset = Dataset.from_dict({
"question": questions,
"answer": answers,
"contexts": contexts,
"ground_truth": ground_truths,
})
result = evaluate(dataset, metrics=[faithfulness, answer_relevancy, context_recall])
print(result)
assert result["faithfulness"] > 0.8, f"Faithfulness too low: {result['faithfulness']}"
assert result["context_recall"] > 0.7, f"Context recall too low: {result['context_recall']}"cURL
curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=evaluation" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o evaluation.eval.json
Using Adversarial Data
The Adversarial dataset contains deliberately misleading and edge-case questions designed to break your RAG system. Use it to detect hallucinations, test out-of-scope handling, and validate safety guardrails before production launch.
Common Use Cases
- Detect hallucinations: check if your RAG generates confident but wrong answers
- Verify out-of-scope handling: ensure your system says “I don't know”
- Red-team your system before production launch
- Test safety guardrails against manipulative queries
Python - Hallucination Detection
import os, requests
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(f"{BASE}/datasets/DATASET_ID/export?format=json", headers=HEADERS)
dataset = resp.json()
hallucinations = []
for adv in dataset.get("adversarial", []):
result = my_rag.query(adv["question"])
if result.get("confidence", 0) > 0.8:
hallucinations.append({
"question": adv["question"],
"system_answer": result["answer"],
"expected": adv.get("expected_answer", "Should refuse or flag uncertainty"),
})
print(f"Hallucination rate: {len(hallucinations)}/{len(dataset.get('adversarial', []))}")
for h in hallucinations:
print(f" Q: {h['question']}")
print(f" Got: {h['system_answer'][:100]}")Using Quality Insights
Quality Insights provide AI-generated analysis of your RAG system's weaknesses across 9 categories (ambiguous queries, chunking issues, semantic overlap, missing context, and more). Each insight includes a risk level and actionable recommendation.
Common Use Cases
- Prioritise improvements by focusing on high-risk insights first
- Fix chunking strategy if
chunking_issuesis flagged - Reduce semantic overlap between chunks
- Use recommendations to refine your system prompt and retrieval config
Python - Parse and Prioritise Insights
import os, requests
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(f"{BASE}/datasets/DATASET_ID/export?format=json", headers=HEADERS)
dataset = resp.json()
insights = dataset.get("dataset_quality_insights", [])
high_risk = [i for i in insights if i["risk_level"] == "high"]
medium_risk = [i for i in insights if i["risk_level"] == "medium"]
print(f"High risk: {len(high_risk)}, Medium risk: {len(medium_risk)}")
for insight in high_risk:
print(f" [{insight['insight_type']}] {insight['description']}")
print(f" Recommendation: {insight['recommendation']}")
failures = dataset.get("failure_analysis", [])
for f in failures:
print(f" [{f['severity']}] {f['issue']} -> {f.get('suggestedFix', 'N/A')}")RAG Playground
The RAG Playground lets you chat with any processed document to test retrieval quality before deploying to production. Open a processed document, switch to the RAG Playground tab, and ask questions directly.
Common Use Cases
- Validate retrieval accuracy on real questions before production launch
- Spot-check edge cases identified by adversarial and evaluation datasets
- Demo RAG capabilities to stakeholders using their own documents
- Compare response quality across different documents or chunking strategies
Monthly Message Limits
Each plan includes a monthly RAG Playground allowance with no per-document cap. Spread your messages across any documents.
Free
5 msgs
Basic
200 msgs
Starter
500 msgs
Pro
1,500 msgs
Overage Bonus
Paid plans can purchase overage page packs that also include bonus playground messages: Small (+500), Medium (+1,500), Large (+3,000). Bonus messages are valid for the current billing cycle.
Export Format Guide
All 16 export formats are available via the API. Add chunk_mode=true to export enriched RAG chunks instead of Q&A dataset items.
| Format | API Parameter | Extension | Target System |
|---|---|---|---|
| JSON | json | .json | Any language, custom pipelines |
| CSV | csv | .csv | Excel, Google Sheets, pandas |
| Markdown | markdown | .md | GitHub, Notion, Confluence |
| LangChain | langchain_json | .langchain.json | LangChain (Python / JS) |
| LlamaIndex | llamaindex_json | .llamaindex.json | LlamaIndex (Python) |
| Evaluation | evaluation | .eval.json | RAGAS, DeepEval |
| Pinecone | pinecone | .pinecone.json | Pinecone vector DB |
| Qdrant | qdrant | .qdrant.json | Qdrant vector DB |
| pgvector | pgvector | .pgvector.json | PostgreSQL + pgvector |
| ChromaDB | chroma | .chroma.json | ChromaDB vector DB |
| Weaviate | weaviate | .weaviate.json | Weaviate vector DB |
| Milvus | milvus | .milvus.json | Milvus vector DB |
| LanceDB | lancedb | .lancedb.json | LanceDB embedded DB |
| Upstash Vector | upstash | .upstash.json | Upstash Vector |
| JSONL Fine-Tuning | jsonl | .jsonl | OpenAI / Mistral / Together AI |
API Endpoint
GET /v1/datasets/{id}/export?format={format} for Q&A datasets. Add &chunk_mode=true for RAG chunk exports.
Python - Download Any Format
import os, requests
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
DATASET_ID = "your-dataset-id"
formats = ["json", "csv", "markdown", "langchain_json", "llamaindex_json",
"evaluation", "pinecone", "qdrant", "pgvector",
"chroma", "weaviate", "milvus", "lancedb", "upstash", "jsonl"]
for fmt in formats:
resp = requests.get(f"{BASE}/datasets/{DATASET_ID}/export?format={fmt}", headers=HEADERS)
ext = resp.headers.get("Content-Disposition", f".{fmt}").split(".")[-1].rstrip('"')
with open(f"dataset.{ext}", "wb") as f:
f.write(resp.content)
print(f"Downloaded {fmt} -> dataset.{ext}")cURL - All Formats
curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=json" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o dataset.json curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=evaluation" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o dataset.eval.json curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=pinecone&chunk_mode=true" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o rag-chunks.pinecone.json curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=chroma" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o dataset.chroma.json curl "https://faqai.app/api/v1/datasets/DATASET_ID/export?format=jsonl" \ -H "Authorization: Bearer faq_YOUR_API_KEY" -o dataset.jsonl
Using Webhooks
Webhooks let you receive real-time HTTP callbacks when events occur, eliminating the need to poll for status changes. This is the recommended approach for production workflows.
Available Events
document.uploaded - File accepteddocument.completed - Dataset readydocument.failed - Processing errordocument.cancelled - User cancelleddataset.exported - Export deliveredcURL - Register a Webhook
curl -X POST https://faqai.app/api/v1/webhooks \
-H "Authorization: Bearer faq_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhooks/faqai",
"events": ["document.completed", "document.failed", "dataset.exported"],
"description": "Production RAG pipeline"
}'Python - Webhook Receiver (Flask)
import os, hmac, hashlib, json, requests
from flask import Flask, request, jsonify
app = Flask(__name__)
WEBHOOK_SECRET = os.environ["FAQAI_WEBHOOK_SECRET"]
API_KEY = os.environ["FAQAI_API_KEY"]
BASE = "https://faqai.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
def verify_signature(payload: bytes, signature: str) -> bool:
expected = hmac.new(WEBHOOK_SECRET.encode(), payload, hashlib.sha256).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)
@app.route("/webhooks/faqai", methods=["POST"])
def handle_webhook():
signature = request.headers.get("X-FAQai-Signature", "")
if not verify_signature(request.data, signature):
return jsonify({"error": "Invalid signature"}), 401
event = request.json
if event["event"] == "document.completed":
doc_id = event["data"]["id"]
ds_resp = requests.get(f"{BASE}/documents/{doc_id}/datasets", headers=HEADERS)
for ds in ds_resp.json()["datasets"]:
export = requests.get(
f"{BASE}/datasets/{ds['id']}/export?format=pinecone&chunk_mode=true",
headers=HEADERS,
)
ingest_to_pinecone(export.json())
return jsonify({"received": True}), 200Automation Workflows
FAQai's REST API and webhooks integrate with popular no-code and low-code automation platforms. Below are practical workflow recipes you can build today.
Prerequisites
All recipes require a Basic, Starter or Pro plan with an API key. Store your key as a credential / environment variable in your automation platform.
n8n - Auto-Process Google Drive Uploads
Automatically process new documents added to a Google Drive folder and export results to Google Sheets.
Google Drive Trigger → HTTP Request (Upload) → Wait → Webhook Trigger → HTTP Request (Export) → Google Sheets
Make.com - Document Pipeline with Slack Notifications
Upload documents via a custom webhook, wait for processing, export to Pinecone format, and notify your team on Slack.
Custom Webhook → HTTP (Upload) → Sleep → HTTP (Poll Status) → Router → HTTP (Export) → Slack
Zapier - Email-to-Dataset Pipeline
Automatically process email attachments, generate datasets, and save results to Google Drive.
Gmail Trigger → Webhooks POST → Delay → Webhooks GET → Filter → Webhooks GET → Google Drive
Power Automate - SharePoint Document Processor
Process documents uploaded to SharePoint, generate RAG datasets, and post results to Microsoft Teams.
SharePoint Trigger → HTTP (Upload) → Do Until (Poll) → HTTP (Export) → Teams Message
Pipedream - Event-Driven RAG Pipeline
Build a fully event-driven pipeline using Pipedream's webhook triggers and Node.js steps.
HTTP Trigger (Upload) → FAQai Upload → Webhook Trigger (Callback) → Export → Forward
Tips for All Platforms
- Prefer webhooks over polling for production workflows
- Store your API key as a credential or secret, never hardcode it
- Add error handling for
document.failedevents - Use
chunk_mode=truewhen exporting for vector database ingestion - For detailed API reference and webhook payload schemas, see the Webhooks section
End-to-End Workflows
Complete workflows that combine multiple dataset sections and export formats to solve real production challenges.
Workflow 1: Production RAG Chatbot
- Upload your document via
POST /v1/documents - Poll until status is
completed - Export RAG Chunks in Pinecone format
- Generate embeddings and upsert into your vector database
- Use RAG Playground to interactively test retrieval quality
- Export Canonical Q&A for automated retrieval tests
- Run RAGAS evaluation to get baseline scores
- Run adversarial tests to check hallucination handling
- Review Quality Insights and iterate
Workflow 2: CI/CD Quality Gate
- Generate datasets once per document version
- In your CI pipeline, export Evaluation and Adversarial datasets via API
- Run RAGAS evaluation - fail if faithfulness < 0.8 or context recall < 0.7
- Run adversarial tests - fail if hallucination rate > 10%
- Deploy only when all quality gates pass
Workflow 3: LangChain / LlamaIndex Integration
- Export RAG Chunks in LangChain format:
format=langchain_json&chunk_mode=true - Load directly into your framework using JSONLoader or custom loader
- Build your retrieval chain (VectorStore, RetrievalQA)
- Export Evaluation dataset for framework-native evaluation
- Review Quality Insights for tuning guidance