Skip to main content

Official Python SDK for the Loci API

Project description

loci-sdk

Official Python SDK for the Loci API.

Installation

pip install loci-sdk

Quick Start

from loci import LociClient

client = LociClient(api_key="your-api-key")

# List documents
docs = client.documents.list(limit=20, tags=["contract"])
print(docs["documents"])

# RAG query
answer = client.query.ask("When does my lease expire?")
print(answer["answer"])
print(answer["sources"])

# Account info
account = client.account.get()
print(f"Plan: {account['plan_tier']}")

Configuration

client = LociClient(
    api_key="your-api-key",
    base_url="https://api.locivault.com",  # optional, this is the default
)

Documents

# List with filters
result = client.documents.list(
    q="lease agreement",
    file_type="pdf",
    date_from="2026-01-01",
    date_to="2026-12-31",
    tags=["legal"],
    limit=10,
    offset=0,
)

Query

# Simple query
answer = client.query.ask("What are the payment terms?")

# Team-scoped query
answer = client.query.ask("Q4 revenue projections", team_id="team-uuid")

# Continue a conversation thread
follow_up = client.query.ask("Can you elaborate?", thread_id="thread-uuid")

Webhooks

# List webhooks
hooks = client.webhooks.list()

# Create a webhook
created = client.webhooks.create(
    url="https://example.com/webhook",
    events=["document.processed", "query.completed"],
)

# Test a webhook
test = client.webhooks.test(created["webhook"]["id"])
print(f"Status: {test['responseCode']}, Latency: {test['latencyMs']}ms")

# Delete a webhook
client.webhooks.delete(created["webhook"]["id"])

Error Handling

from loci import LociClient, LociApiError

try:
    docs = client.documents.list()
except LociApiError as err:
    print(f"API error {err.status_code}: {err.message}")
    print(f"Response body: {err.body}")

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

loci_sdk-1.0.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

loci_sdk-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file loci_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: loci_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for loci_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 545b7f0add21e24fe2c7752b1a819737f5bb1e69fd1cc04c0546dff9f1ce15d9
MD5 afb0d5962c49a4875a10319b0951101c
BLAKE2b-256 ba81e5d81607c33a23610c5b91f475420cee588952dfb0349bbe5d09f718aa9b

See more details on using hashes here.

File details

Details for the file loci_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: loci_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for loci_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d82ff66d62176d0b5c9fa230eacd4f38ab21ed277e5e21ce9bddaa57b2c748a2
MD5 544ef7ae6f818a8d7f37ee476c2b821c
BLAKE2b-256 02c22d550a244a0fd06f9eb01bb3b070a02c40e20922e776dae64fbf636d1d26

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