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.3.0.tar.gz (8.8 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.3.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for faqai-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3956c91cb2370b7712dc3cf5d32be7173dc818f69a25f732394233b6b6a4523a
MD5 6747b1b13655a42a43e9afed8f8bc285
BLAKE2b-256 8bd510d07791881583f47360dbe07fc8d483e67f5bfd2c12a7745641d7cd3b13

See more details on using hashes here.

File details

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

File metadata

  • Download URL: faqai-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d7955517800106837b4fcf92347ea9545d80f954b9eb535fb0d922f1ca233cb
MD5 1f28c40d6d1aaab7b81e00033652bc30
BLAKE2b-256 5a452afe2ed2f401c5575beaedd4faf03765f71fd9255f3a0f263bf2a6f2ee1c

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