Skip to main content

DataCoder SDK

Python SDK for DataCoder — AI Data Analyst Platform.

Query your RAG knowledge bases programmatically.

Installation

pip install datacoder

Quick Start

from datacoder import DataCoderClient

# Initialize with your SDK key and server URL
client = DataCoderClient(
    api_key="dc_sk_your_key_here",
    base_url="https://datacoder.clouditia.com",
)

# Test connectivity
if client.ping():
    print("Connected!")

# Search a knowledge base
results = client.search("Quels sont les risques de credit ?")
for r in results:
    print(r.content, r.source, r.score)

# Search in a specific folder
results = client.search(
    "Clause de resiliation",
    folder_id="your-folder-uuid",
)

# Full query with RAGResult
result = client.query(
    folder_id="your-folder-uuid",
    query="Quels sont les risques de credit dans Bale III ?",
)
print(result.answer)    # Combined text from all matching chunks
print(result.sources)   # List of source document names

# Check your quota
quota = client.quota()
print(f"Plan: {quota.plan}")
print(f"SDK remaining today: {quota.sdk_remaining}")

# List accessible folders
folders = client.folders()
for f in folders:
    print(f["name"], f["id"])

API Reference

DataCoderClient(api_key, base_url, timeout=30)

Initialize the SDK client.

Parameter Type Default Description
api_key str — Your SDK key (starts with dc_sk_)
base_url str https://datacoder.clouditia.com DataCoder server URL
timeout int 30 Request timeout in seconds

client.search(query, folder_id=None, top_k=10) → list[SearchResult]

Search a RAG knowledge base. Returns a list of results.

Parameter Type Default Description
query str — Natural language question
folder_id str None UUID of the knowledge folder (None = all folders)
top_k int 10 Max results (1-20)

Returns: list[SearchResult]

Property Type Description
r.content str Matching text chunk
r.source str Source document name
r.score float Similarity score (0-1)
r.page int | None Page number in source document

client.query(folder_id, query, top_k=10) → RAGResult

Full RAG query with aggregated results.

Parameter Type Default Description
folder_id str — UUID of the knowledge folder
query str — Natural language question
top_k int 10 Max results (1-20)

Returns: RAGResult

Property Type Description
result.answer str Concatenated content from all matching chunks
result.sources list[str] Source document names
result.items list[SearchResult] Results as SearchResult objects
result.count int Number of results

client.folders() → list[dict]

List knowledge folders accessible by this API key.

client.quota() → QuotaInfo

Check current usage and limits.

Property Type Description
quota.plan str Current plan (free, pro, enterprise)
quota.sdk_used_today int SDK requests used today
quota.sdk_limit int Daily SDK limit (-1 = unlimited)
quota.sdk_remaining int Remaining SDK requests (-1 = unlimited)
quota.sdk_rate_limit int Max requests per minute

client.ping() → bool

Test if the API is reachable and the key is valid. Returns True or False.

Plans & Quotas

Free Pro (29€/mo) Enterprise (99€/mo)
SDK requests/day 10 1,000 100,000
SDK rate limit 5/min 100/min 1,000/min
Chat messages/day 20 200 50,000

Error Handling

from datacoder import DataCoderClient
from datacoder.client import (
    AuthenticationError,
    QuotaExceededError,
    ForbiddenError,
    NotFoundError,
    DataCoderError,
)

client = DataCoderClient(api_key="dc_sk_...", base_url="https://...")

try:
    results = client.search("Ma question", folder_id="...")
except AuthenticationError:
    print("Invalid or expired API key")
except QuotaExceededError as e:
    print(f"Quota exceeded. Retry after {e.retry_after}s")
except ForbiddenError:
    print("No access to this folder with this SDK key")
except NotFoundError:
    print("Folder not found or not owned by this user")
except DataCoderError as e:
    print(f"API error: {e} (HTTP {e.status_code})")

Migration from 0.2.x

The class DataCoder has been renamed to DataCoderClient in 0.3.0. The old name still works as an alias for backward compatibility.

# Old (still works)
from datacoder import DataCoder
sdk = DataCoder(api_key="...")

# New (recommended)
from datacoder import DataCoderClient
client = DataCoderClient(api_key="...")

New in 0.3.0: client.search() returns a flat list of SearchResult objects — simpler for most use cases.

Get your SDK Key

  1. Log in to DataCoder
  2. Go to Settings → SDK
  3. Enter a name and click Generate
  4. Copy your key (shown only once)

On-Premise

DataCoder can be deployed on your own infrastructure. Point base_url to your self-hosted instance:

client = DataCoderClient(
    api_key="dc_sk_...",
    base_url="https://datacoder.your-company.com",
)

License

MIT — Clouditia

Metadata

Release files for datacoder 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datacoder 0.3.0
File Size Uploaded Provenance Actions
datacoder-0.3.0.tar.gz 6.5 kB Without provenance Details for datacoder-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datacoder 0.3.0
File Interpreter ABI Platform Actions
datacoder-0.3.0-py3-none-any.whl Python 3 none any Details for datacoder-0.3.0-py3-none-any.whl

Total release size: 13.0 kB

Release files / datacoder-0.3.0.tar.gz

Download URL datacoder-0.3.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a5cf0b9a7761eb3ba4dc8a8ef4552023e579fa0fb3a2da42abec2ec9193b77f
BLAKE2b-256 checksum
How to use checksums
d42d6eacb3e4caf8e9cc6cbc55b693943afffdaf26c54b08bccda55af53f1b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / datacoder-0.3.0-py3-none-any.whl

Download URL datacoder-0.3.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d56026f6808ca1147810102181355f62db501b88569737a5f1cec06d9a1c5e5f
BLAKE2b-256 checksum
How to use checksums
ba5abd2a5e56447255314ed9c5610eee1dbbd5b181c026ed3589f8c0e5f7b842
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for datacoder 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page