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

Client

LightOn

LightOn.ask()

Arguments Returns

LightOn.close()

Abort every in-flight request. The client is not reusable afterwards.

LightOn.extract()

Arguments Returns

LightOn.parse()

Arguments Returns
Arguments Returns

LightOnConfiguration

Non-essential client knobs. apiKey stays a direct LightOn() argument, so a config object can be shared or logged without carrying a secret.

DEFAULT_BASE_URL

Client configuration.

VERSION

Workspaces & files

Workspace

Workspace.get()

Fetch a single workspace by id. Arguments Returns

Workspace.list()

List every workspace, following pagination to the end. Only a listing returns taxonomy and the other listing-only extras. Arguments Returns

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. Returns

Workspace.ingest()

Upload a File into this workspace. Uploading is the ingestion. Non-blocking by default: the returned File is pending, poll it with refresh() or wait(). Pass wait: true to block until ingestion is terminal. Arguments Returns Throws

Workspace.ingestMany()

Upload many files into this workspace, concurrently. Every local path is validated to exist before any upload starts. Staying under the API rate limit and honoring the 429 cooldown are the client’s job, so they apply across uploads and status polls alike. Arguments Returns Throws

Workspace.refresh()

Re-fetch this resource from the API. Returns

Workspace.save()

Persist local edits to name and description. Returns

WorkspaceInit

WorkspaceListOptions

IngestOptions

WorkspaceTaxonomy

How much of a workspace is classified, and under which roots. The cheapest way to see classification coverage without listing files. Only the list endpoint returns it; the detail endpoint omits the key entirely, so get() and refresh() leave whatever was already there rather than clearing it.

RootContentType

How many of a workspace’s documents sit under one root content type.

WorkspaceSync

The external datasource a workspace imports from, when one is connected. Null on a workspace whose documents were uploaded directly.

File

File.deleteMany()

Delete many files in one request. All-or-nothing: if any id is unknown (or not yours), the API rejects the whole call with 404 and deletes nothing, which surfaces as a NotFoundError. There is no partial-success result to report, so a failure throws rather than returning a per-file report: nothing was deleted, and retrying with the ids you can account for is the fix. Arguments Returns Throws

File.get()

Fetch a single file by id. Arguments Returns

File.getByName()

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, so this returns every match rather than picking one. The API’s title filter is a case-insensitive partial match, so candidates are narrowed to an exact title match here. Arguments Returns Throws

File.list()

List files, following pagination to the end. Arguments Returns

File.classify()

Assign a content type to this file. Arguments Returns

File.clearAttribute()

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

File.create()

Upload the file. This starts ingestion. Arguments Returns Throws

File.delete()

Delete this resource and clear its local id. Returns

File.download()

Download this document’s stored bytes. Arguments Returns

File.downloadThumbnail()

Download this document’s 256x256 WebP thumbnail. Generated asynchronously and independently of ingestion, so an embedded file may still have none. Check the thumbnail field first. Returns Throws

File.facets()

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

File.pages()

Fetch the parsed text of this document, one entry per page. The platform stores what it parsed at ingestion, so this reads it back instead of re-uploading and re-parsing a document it already has. The result is the same {index, markdown} shape parse returns, so code can move between parsing a local file and reading an ingested one without reshaping anything. A method, not a field: the text can be large, and most callers of refresh() don’t want it riding along. Returns

File.refresh()

Re-fetch this resource from the API. Returns

File.replace()

Replace this document’s content in place. The document keeps its id, title, tags and content-type classifications, and is re-ingested from the new content, so every reference to the id survives what used to need a delete plus a re-upload. The new file may be of a different type. filename follows the new file, but title is preserved, so a replaced document is still found under the name it was uploaded with. Addressed by id, never by name: titles and filenames aren’t unique, so resolve to the one document you mean first. Arguments Returns

File.save()

Persist local edits to title, plus whatever you pass explicitly. filename is immutable server-side. title is a plain field: set it and save. tags and externalMetadata are options, not fields, because neither is a plain set server-side, and naming them at the call site says which one you are doing. Omitting either leaves that part of the document untouched, so a bare save() only ever writes the title. Arguments Returns

File.setAttribute()

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

File.tag()

Assign tags to this file. Arguments Returns

File.unclassify()

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

File.untag()

Remove tags from this file, one request each: there is no bulk tag delete. Arguments Returns

File.wait()

Poll until ingestion reaches a terminal state. A pending reprocess counts as not terminal: while pendingReprocess is set the queued work has not started and status still reports the previous run, so trusting it would call a replace() done before it began. ponytail: a plain poll loop, because the API offers no webhook. Use waitAll to run several concurrently. Arguments Returns Throws

LightOnFile

Alias of File.

FileInit

FileListOptions

CreateOptions

SaveOptions

WaitOptions

FileSource

A local path (Node-family runtimes), a File/Blob, or a Blob with a name.

ExternalMetadata

Where a document came from in a third-party system. Set it on upload (or with save()) and it survives on the File, so a later sync can match the platform document back to the record it was ingested from. Updates merge server-side, including into additionalMetadata: patching one key leaves the others in place. There is no replace mode and no way to drop the record. What you can clear, verified against the live API:

Thumbnail

Whether a file’s 256x256 WebP thumbnail exists yet, and where it lives. Generation is asynchronous and independent of ingestion, so check status before fetching: file.downloadThumbnail() 404s while it isn’t READY.

Page

One page of a document. Defined once and reused everywhere: parse returns these, and so does file.pages(), so code moves between parsing a local file and reading an ingested one without reshaping. Never redefine this shape per app.

waitAll()

Wait for many ingestions at once. Arguments Returns Throws

Tags & content types

Tag

Tag.get()

Not available: the tags API exposes no single-tag GET. Declared so the failure is a clear message at the call site rather than a 404 from a URL that was never going to exist. Use Tag.list instead. Returns Throws

Tag.list()

List every tag, following pagination to the end. Arguments Returns

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. Returns

Tag.refresh()

Re-fetch this resource from the API. Returns Throws

TagInit

TagListOptions

TagRef

A Tag, its id, or its name. The three mix freely in one list.

ContentType

A node in the content-type taxonomy.

ContentType.adopt()

Import starter trees from the template catalog into your taxonomy. Arguments Returns

ContentType.batch()

Apply several taxonomy actions in one request. Each entry is the body a single-action method would send, so a tree and its attributes land together instead of one round trip each:
The entries are wire bodies, so their keys are the server’s, not the SDK’s. Arguments Returns

ContentType.define()

Create or update one node. Idempotent: defining an existing code again updates it, so this is also how you rename a node. Arguments Returns

ContentType.defineAttribute()

Create or update an attribute column on a node. Arguments Returns Throws

ContentType.list()

List the content-type taxonomy: top-level nodes, each carrying its children. Arguments Returns

ContentType.templates()

List the starter taxonomies you can ContentType.adopt. Arguments Returns

ContentType.undefine()

Delete a node and cascade its whole subtree. Arguments Returns

ContentType.undefineAttribute()

Remove an attribute column from a node. Arguments Returns

ContentTypeListOptions

DefineOptions

DefineAttributeOptions

Template

A starter taxonomy from the catalog, what adopt() imports. The same tree as a ContentType except for attributes: on a template it is a map from node path to that node’s attribute definitions, with the whole subtree’s attributes hanging off the root, rather than this node’s own list. A sibling interface, not an extension: TypeScript cannot re-type an inherited member, so the Python subclass (which needs a # type: ignore for exactly this) has no direct equivalent.

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 absent for a bare definition or when unset.

Facet

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

BatchActionResult

One result of a ContentType.batch call.

API keys

ApiKey

ApiKey.get()

Fetch a single API key by id. The plaintext secret is never included. Arguments Returns

ApiKey.list()

List every API key, following pagination to the end. The plaintext secret is never included. Arguments Returns

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. Returns

ApiKey.refresh()

Re-fetch this resource from the API. Returns

ApiKey.save()

Persist local edits to name and scopes. Returns

ApiKeyInit

ApiKeyScope

Access granted on one workspace.

ApiKeyListOptions

Verb options

ScopeOptions

AskOptions

SearchOptions

ParseOptions

ParseAsyncOptions

ExtractOptions

ExtractAsyncOptions

Responses

AskResponse

A grounded answer plus the chunks it was grounded in.

AskResultItem

One retrieved chunk used as context by ask.

SearchResponse

Ranked passages, with optional warnings and scoring breakdown.

SearchResultItem

One ranked passage returned by search.

ParseResponse

A completed synchronous parse.

ParseResult

ParseDocument

ParseUsage

ParseError

ExtractJobResponse

An extract job, whether it ran inline or was queued.

ExtractResult

ExtractDocument

ExtractUsage

JobProgress

Progress reported by a running async job.

Jobs & batches

Job

A queued parse or extract job. Terminal state is completedAt being set, not a status string: the API documents only pending and completed and publishes no failure vocabulary, so a job that ends badly is one whose completedAt is set while succeeded is false.

Job.poll()

Re-fetch the job, updating it in place. Arguments Returns

Job.wait()

Poll until the job is terminal. Arguments Returns Throws

ParseJob

An async parse job. Differs from ExtractJob only in what it carries.

ParseJob.poll()

Re-fetch the job, updating it in place. Arguments Returns

ParseJob.wait()

Poll until the job is terminal. Arguments Returns Throws

ExtractJob

An async extract job.

ExtractJob.poll()

Re-fetch the job, updating it in place. Arguments Returns

ExtractJob.wait()

Poll until the job is terminal. Arguments Returns Throws

BatchIngestJob

A running (or finished) batch ingestion. Returned by Workspace.ingestMany(files, { mode: "async" }). Uploads (and, when wait is set, ingestion polls) run in the background; read progress, succeeded and failed at any time, or block with wait().

BatchIngestJob.poll()

The current progress. The mirror of a parse/extract job’s poll(), except that nothing needs fetching: the batch is driven from this process, so its state is already current. Returns

BatchIngestJob.wait()

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

BatchOptions

BatchIngest

The terminal outcome of a batch.

BatchProgress

A snapshot of a running batch.

FailedIngest

One item of a batch that did not make it.

Streaming events

AskEvent

SourcesEvent

The retrieved chunks, sent once before generation starts.

TokenEvent

One chunk of the answer as it generates.

DoneEvent

Generation finished; no further events follow.

Schemas

asJsonSchema()

Either guided-generation input, as the self-contained schema to send. Arguments Returns Throws

normalizeJsonSchema()

Normalize a JSON Schema into the self-contained shape vLLM wants. $defs/$ref inlined, nullable anyOf collapsed to type: [X, "null"], and the draft-2020-12 $schema marker added (an existing one is kept). Arguments Returns Throws

SchemaInput

Either input ask and extract accept for guided generation. A Zod schema is converted with Zod’s own toJSONSchema, imported only when one is actually passed, so zod stays an optional peer dependency that costs nothing to callers who hand over a plain JSON Schema instead.

JsonSchema

A JSON Schema, as a plain object.

List filters

FileFilters

Filters for File.list, e.g. status, tag_id, external_metadata__external_id.

WorkspaceFilters

Filters for Workspace.list, e.g. name, user_role, ordering.

TagFilters

Filters for Tag.list, e.g. name, auto_assign.

ApiKeyFilters

Filters for ApiKey.list, e.g. is_expired.

Enums

AttributeType

Type of a content-type attribute column. select and multiSelect require choices; the API also accepts the aliases multiselect and richtext for the hyphenated values used here.

DownloadPurpose

Which stored version of a file to download. The server falls back to original when the requested purpose has no associated file.

ExecMode

Execution mode for parse/extract: run inline or queue as an async job.

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 is for call-site comparisons, NOT to validate the response field, so an unrecognized server value compares unequal rather than erroring. Detect terminal failure via completedAt being set without completed (or, for parse, the error block) rather than a status string.

RelevanceScoring

Cross-encoder relevance scoring step for search.

ReprocessLevel

Reprocessing level queued on a File (pendingReprocess), update = replacement.

Role

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

SearchMode

Retrieval mode for search and ask.

ThumbnailStatus

Whether a file’s thumbnail has been generated (uppercase, as the API sends).

Errors

Everything the SDK throws derives from LightOnError, importable from @lighton-ai/sdk. Every method that performs a request can throw these, so they are listed once here rather than repeated on each method. A method’s own Throws block covers only what it throws directly.