Skip to main content

Official Python SDK for Wauldo — Verified AI answers from your documents

Project description

Wauldo Python SDK

PyPI Downloads Python License: MIT

Verified AI answers from your documents. Every response includes source citations, confidence scores, and an audit trail — or we don't answer at all.

Official Python SDK for the Wauldo API — the AI inference layer with smart model routing, zero hallucinations, and standalone fact-checking.

Why Wauldo?

  • Fact-Check API — verify any claim against source context, get verdict (verified/weak/rejected), action (allow/review/block), and structured reason
  • Zero hallucinations — every answer is verified against source documents
  • Smart model routing — auto-selects the cheapest model that meets quality (save 40-80% on AI costs)
  • One API, 7+ providers — OpenAI, Anthropic, Google, Qwen, Meta, Mistral, DeepSeek with automatic fallback
  • OpenAI-compatible — swap your base_url, keep your existing code
  • Full audit trail — confidence score, grounded status, model used, latency on every response

Quick Start

from wauldo import HttpClient

client = HttpClient(base_url="https://api.wauldo.com", api_key="YOUR_API_KEY")

reply = client.chat_simple("auto", "What is Python?")
print(reply)

Installation

pip install wauldo

Requirements: Python 3.9+

Features

Chat Completions

from wauldo import HttpClient, ChatRequest, HttpChatMessage

client = HttpClient(base_url="https://api.wauldo.com", api_key="YOUR_API_KEY")

request = ChatRequest(
    model="auto",
    messages=[
        HttpChatMessage.system("You are a helpful assistant."),
        HttpChatMessage.user("Explain Python decorators"),
    ],
)
response = client.chat(request)
print(response.choices[0].message.content)

RAG — Upload & Query

# Upload a document
upload = client.rag_upload(content="Contract text here...", filename="contract.txt")
print(f"Indexed {upload.chunks_count} chunks")

# Query with verified answer
result = client.rag_query("What are the payment terms?")
print(f"Answer: {result.answer}")
print(f"Confidence: {result.get_confidence():.0%}")
print(f"Grounded: {result.audit.grounded}")
for source in result.sources:
    print(f"  Source ({source.score:.0%}): {source.content[:80]}")

Streaming (SSE)

from wauldo import ChatRequest, HttpChatMessage

request = ChatRequest(model="auto", messages=[HttpChatMessage.user("Hello!")])
for chunk in client.chat_stream(request):
    print(chunk, end="", flush=True)

Conversation Helper

conv = client.conversation(system="You are an expert on Python.", model="auto")
reply = conv.say("What are list comprehensions?")
follow_up = conv.say("Give me a nested example")

Fact-Check — Verify Claims

result = client.fact_check(
    text="Returns are accepted within 60 days.",
    source_context="Our policy allows returns within 14 days.",
    mode="lexical",
)
print(result.verdict)  # "rejected"
print(result.action)   # "block"
for claim in result.claims:
    print(f"{claim.text}{claim.verdict} ({claim.reason})")

Error Handling

from wauldo import WauldoError, ServerError, AgentTimeoutError

try:
    response = client.chat(ChatRequest.quick("auto", "Hello"))
except ServerError as e:
    print(f"Server error: {e}")
except AgentTimeoutError:
    print("Request timed out")
except WauldoError as e:
    print(f"SDK error: {e}")

RapidAPI

client = HttpClient(
    base_url="https://api.wauldo.com",
    headers={
        "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
        "X-RapidAPI-Host": "smart-rag-api.p.rapidapi.com",
    },
)

Get your free API key (300 req/month): RapidAPI

Links

Contributing

Found a bug? Have a feature request? Open an issue.

License

MIT — see LICENSE

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

wauldo-0.3.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

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

wauldo-0.3.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wauldo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ba78c305e38cf64c4e7153d9a41c500e6bad698c55bcfec0aa31f8702de7bc6a
MD5 dae8d927f7e19919202c464364a53625
BLAKE2b-256 372715a14af4b38064d119a4d506b13b99e967c66f330b5c2e08eaa2bd1c653e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wauldo-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for wauldo-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a5626a402a820642621fc670692b99f9546ce2d3ec16beeb6514ec55f5d6fd4
MD5 15c2b8f5e977bbec0a992f51a79b1437
BLAKE2b-256 ad1fd2c2f0d1ff8ba6cd9e65ec19d8806bdfb57c30b648bd596a6ad05a90a417

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