Skip to main content
Generated from lighton-sdk 1.0.0. Install it and see runnable examples in the quick start.

Client

LightOn

LightOn.ask()

POST /api/v3/ask, ask a grounded question over indexed documents. Arguments Returns

LightOn.close()

LightOn.extract()

POST /api/v3/extract, extract structured data from a document. Pass exactly one of: path: A local file to upload (multipart). url: A publicly accessible URL to fetch. Arguments Returns Raises

LightOn.parse()

POST /api/v3/parse, parse a document into per-page text. Pass exactly one of: path: A local file to upload (multipart). url: A publicly accessible URL to fetch. Arguments Returns Raises
POST /api/v3/search, retrieve relevant passages (no generation). Arguments Returns

LightOnConfiguration

Non-essential client knobs. api_key stays a direct LightOn() argument.

Workspaces & files

Workspace

Workspace.create()

Create this workspace and bind the client for later lifecycle calls. Arguments Returns

Workspace.delete()

Delete this resource and clear its local id.

Workspace.get()

Classmethod.
Fetch a single resource by id. Arguments Returns

Workspace.ingest()

Upload a File into this workspace, uploading is the ingestion. Non-blocking by default: the returned File is ‘pending’, poll it via refresh()/wait(). Pass wait=True to block until ingestion is terminal. Arguments Returns Raises

Workspace.ingest_many()

Upload many files into this workspace, concurrently. Every local path is validated to exist before any upload starts (fail fast). Staying under the API rate limit and the 429 cooldown are handled by the client (see LightOnConfiguration.max_requests_per_minute / rate_limit_retries), so they apply across uploads and status polls alike. Arguments Returns Raises

Workspace.list()

Classmethod.
List every resource, following pagination to the end. Arguments Returns

Workspace.refresh()

Re-fetch this resource from the API (GET). Returns

Workspace.save()

Persist local edits to name/description (PATCH). Returns

File

File.classify()

Assign a content type to this file (ContentType object or path string). Arguments Returns Raises

File.clear_attribute()

Clear an attribute value under an assigned content type. Arguments Returns

File.create()

Upload the file (multipart), this starts ingestion. Arguments Returns Raises

File.delete()

Delete this resource and clear its local id.

File.facets()

List this file’s assigned content types and their attribute values. Returns Raises

File.get()

Classmethod.
Fetch a single resource by id. Arguments Returns

File.get_by_name()

Classmethod.
Fetch every file with this user-facing name in a workspace. Matches title, not filename: the server uniquifies filenames on upload (“report.pdf” is stored as something like “report_20260728_c9be.pdf”), so the name you uploaded never matches the stored one. A title defaults to the uploaded filename without its extension, so “report.pdf” and “report” both find that upload. Titles are not unique the way stored filenames are, uploading the same document twice gives both copies the same title, so this returns every match rather than picking one. Check the length if you need exactly one. The API’s title filter is a case-insensitive partial match, so the candidates it returns are narrowed to an exact title match here. Arguments Returns Raises

File.list()

Classmethod.
List every resource, following pagination to the end. Arguments Returns

File.refresh()

Re-fetch this resource from the API (GET). Returns

File.save()

Persist local edits to title (PATCH). filename is immutable server-side. Returns

File.set_attribute()

Set an attribute value under an assigned content type. Arguments Returns

File.tag()

Assign tags to this file (POST /files/<id>/tags). Arguments Returns Raises

File.unclassify()

Remove a content-type assignment from this file. Arguments Returns

File.untag()

Remove tags from this file (DELETE /files/<id>/tags/<tag_id>, one each). Arguments Returns Raises

File.wait()

Block (polling) until ingestion reaches a terminal state. ponytail: dumb poll loop, the API offers no webhook. Run in a thread (or use wait_all) for concurrency; the SDK stays sync. Arguments Returns Raises

wait_all

Wait for many ingestions concurrently (threads, not async, sync SDK). Arguments Returns Raises

Tags & content types

Tag

Tag.create()

Create this tag and bind the client for later lifecycle calls. Arguments Returns

Tag.delete()

Delete this resource and clear its local id.

Tag.get()

Classmethod.
Raises

Tag.list()

Classmethod.
List every resource, following pagination to the end. Arguments Returns

Tag.refresh()

Raises

ContentType

A node in the content-type taxonomy.

ContentType.list()

Classmethod.
List the content-type taxonomy (top-level nodes, each with children). Arguments Returns

Attribute

One attribute of a content type, a definition, or a value set on a file. Carries both the schema (type/required/choices) and, when read from a file’s facets, the current value. value is None for bare definitions / when unset.

Facet

A content type assigned to a file, with the file’s attribute values on it.

API keys

ApiKey

ApiKey.create()

Create this API key and bind the client for later lifecycle calls. Arguments Returns

ApiKey.delete()

Delete this resource and clear its local id.

ApiKey.get()

Classmethod.
Fetch a single resource by id. Arguments Returns

ApiKey.list()

Classmethod.
List every resource, following pagination to the end. Arguments Returns

ApiKey.refresh()

Re-fetch this resource from the API (GET). Returns

ApiKey.save()

Persist local edits to name/scopes (PATCH). Returns

ApiKeyScope

Jobs & batches

ParseJob

ParseJob.poll()

Re-fetch this job’s status from the API, updating this object in place. Arguments Returns Raises

ExtractJob

ExtractJob.poll()

Re-fetch this job’s status from the API, updating this object in place. Arguments Returns Raises

BatchIngestJob

A running (or finished) batch ingestion. Returned by Workspace.ingest_many(mode=ExecMode.ASYNC). Uploads (and, when wait=True, ingestion polls) run in a background thread; read progress, succeeded, and failed at any time, or block with wait().

BatchIngestJob.poll()

Return the current progress. Mirror of the parse/extract job’s poll(); state updates itself in the background thread, so this just snapshots it.

BatchIngestJob.wait()

Block until the batch finishes, then return its result. Arguments Returns Raises

BatchIngest

Terminal result of a batch: the Files that succeeded and what failed.

BatchProgress

Live snapshot of a running batch (see BatchIngestJob.progress).

FailedIngest

One file that didn’t make it.

Enums

ExecMode

Execution mode for parse/extract: run inline or queue as an async job. Uppercase members (unlike the other enums here) so the async member can be ASYNC, lowercase async is a Python keyword and can’t be a member name.

FileStatus

Ingestion pipeline status for a File.

JobStatus

Status of an async parse/extract job. Only pending (initial) and completed (success) are documented by the API, the schema types status as a bare string with no enum and doesn’t publish the failure vocabulary. This enum is for call-site comparisons (StrEnum members equal their string values), NOT to validate the response field, so an unrecognized server value compares unequal rather than erroring. Detect terminal-failure via completed_at being set without completed (or, for parse, the error block) rather than a status string.

RelevanceScoring

Cross-encoder relevance scoring step for search.

Role

Access role granted by an API-key scope on a workspace.

SearchMode

Retrieval mode for search/ask.

Exceptions

Importable from lighton.exceptions. Every method that performs a request can raise these, so they are listed once here rather than repeated on each method. A method’s own Raises block covers only what it raises directly.