Skip to main content

Official Python SDK for FAQai.app — turn documents into production-ready RAG datasets.

Project description

FAQai Python SDK

Official Python client for FAQai.app — turn any document into production-ready RAG datasets (Canonical Q&A, Query Variants, Evaluation, Adversarial, and RAG Chunks) and export to 16 formats including Pinecone, Qdrant, pgvector, Chroma, Weaviate, Milvus, LanceDB, and Upstash.

Large files just work. Uploads above ~4 MB are automatically routed through the FAQai upload proxy, so you never hit the serverless 4.5 MB body limit and never see a 413 — up to your plan's 25 MB maximum, in a single call.

Install

pip install faqai

Quickstart

from faqai import FaqaiClient

client = FaqaiClient("faq_your_api_key")  # or set FAQAI_API_KEY

# Upload (any size up to your plan limit) and wait for processing
doc = client.upload("large-report.pdf", wait=True)
print(doc["status"])  # "completed"

# List generated datasets
datasets = client.list_datasets(doc["id"])
for ds in datasets["datasets"]:
    print(ds["dataset_type"], ds["item_count"])

# Export a dataset for your vector DB
ds_id = datasets["datasets"][0]["id"]
client.export(ds_id, "pinecone", path="pinecone.json")

# Search your generated Q&A
hits = client.search("refund policy", dataset_type="canonical_qa")
print(hits["total"])

# Coverage report
print(client.coverage(ds_id)["coverage_percent"])

Ingesting from a URL or website

No file needed — point FAQai at a public web page, or crawl a whole same-domain site (discovered via its sitemap, or a breadth-first walk if there is none). Crawling honors robots.txt and your plan's per-crawl page cap (Free 5, Basic 50, Starter 150, Pro 500). Only static HTML is read, so JavaScript-rendered pages may yield little content.

# Single page
doc = client.ingest_url("https://example.com/docs/faq", wait=True)

# Crawl a site (up to 50 same-domain pages), steer generation, and wait
site = client.ingest_url(
    "https://example.com/",
    crawl=True,
    max_pages=50,
    generation_context="customer_support_bot",
    wait=True,
)
print(site.get("crawl"))  # {discovered, capped_to, estimated_pages, mode}

Configuration

Argument / env var Default Purpose
api_key / FAQAI_API_KEY Your faq_... API key (required)
base_url / FAQAI_BASE_URL https://faqai.app API base URL
upload_proxy_url / FAQAI_UPLOAD_PROXY_URL FAQai production proxy Large-file upload proxy URL
timeout 60 Per-request timeout (seconds)
max_retries 3 Retries for 429/5xx with backoff

Error handling

All failures raise a FaqaiError (or a subclass: AuthenticationError, PermissionError_, NotFoundError, PayloadTooLargeError, RateLimitError, TimeoutError_). Each carries .status, .code, and .response_body.

from faqai import FaqaiClient, RateLimitError

client = FaqaiClient()
try:
    client.upload("doc.pdf")
except RateLimitError as e:
    print("Slow down:", e.message)

How large-file uploads work

Files ≤ 4 MB are sent directly to POST /api/v1/documents. Larger files are sent to the FAQai upload proxy (a Supabase Edge Function), which performs the 3-step presigned upload flow on your behalf and returns the same document record. You don't need to change anything — it's automatic.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faqai-0.2.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faqai-0.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file faqai-0.2.0.tar.gz.

File metadata

  • Download URL: faqai-0.2.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for faqai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b185bae55097858ddb05d5d1de657a43f1492057300702265f065eedb21d56ff
MD5 a33b29acd9f421247d3e50af96ffe0c6
BLAKE2b-256 c56f6e3cf4a3bede18b7cf4b469a5657c632c5b3424f5206f836a163fbb58a10

See more details on using hashes here.

File details

Details for the file faqai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: faqai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for faqai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18b12fa5d62610124ce646f9715f5f92f851c87b4afb10ea23ddf5e58f699428
MD5 de9a1ed616f693d3486626ac76adfc72
BLAKE2b-256 446f78ef77b3619b30e7ab950cf131f18691323dcf4dad6fd4275d01a77c5335

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page