Generated from
@lighton-ai/sdk 1.0.0.
Install it and see runnable examples in the quick start.Client
LightOn
LightOn.ask()
Returns
LightOn.close()
LightOn.extract()
Returns
LightOn.parse()
Returns
LightOn.search()
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
VERSION
Workspaces & files
Workspace
Workspace.get()
Returns
Workspace.list()
taxonomy and the other listing-only extras.
Arguments
Returns
Workspace.create()
Returns
Workspace.delete()
Workspace.ingest()
pending, poll it with refresh() or
wait(). Pass wait: true to block until ingestion is terminal.
Arguments
Returns
Throws
Workspace.ingestMany()
Returns
Throws
Workspace.refresh()
Workspace.save()
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, soget() 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()
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()
Returns
File.getByName()
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()
Returns
File.classify()
Returns
File.clearAttribute()
Returns
File.create()
Returns
Throws
File.delete()
File.download()
Returns
File.downloadThumbnail()
thumbnail field first.
Returns
Throws
File.facets()
File.pages()
{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()
File.replace()
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()
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()
Returns
File.tag()
Returns
File.unclassify()
Returns
File.untag()
Returns
File.wait()
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 ofFile.
FileInit
FileListOptions
CreateOptions
SaveOptions
WaitOptions
FileSource
A local path (Node-family runtimes), aFile/Blob, or a Blob with a name.
ExternalMetadata
Where a document came from in a third-party system. Set it on upload (or withsave()) 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 checkstatus 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()
Returns
Throws
Tags & content types
Tag
Tag.get()
Tag.list instead.
Returns
Throws
Tag.list()
Returns
Tag.create()
Returns
Tag.delete()
Tag.refresh()
Throws
TagInit
TagListOptions
TagRef
ATag, its id, or its name. The three mix freely in one list.
ContentType
A node in the content-type taxonomy.ContentType.adopt()
Returns
ContentType.batch()
Returns
ContentType.define()
Returns
ContentType.defineAttribute()
Returns
Throws
ContentType.list()
children.
Arguments
Returns
ContentType.templates()
ContentType.adopt.
Arguments
Returns
ContentType.undefine()
Returns
ContentType.undefineAttribute()
Returns
ContentTypeListOptions
DefineOptions
DefineAttributeOptions
Template
A starter taxonomy from the catalog, whatadopt() 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 aContentType.batch call.
API keys
ApiKey
ApiKey.get()
Returns
ApiKey.list()
Returns
ApiKey.create()
Returns
ApiKey.delete()
ApiKey.refresh()
ApiKey.save()
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 byask.
SearchResponse
Ranked passages, with optional warnings and scoring breakdown.SearchResultItem
One ranked passage returned bysearch.
ParseResponse
A completed synchronousparse.
ParseResult
ParseDocument
ParseUsage
ParseError
ExtractJobResponse
Anextract 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 iscompletedAt 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()
Returns
Job.wait()
Returns
Throws
ParseJob
An asyncparse job. Differs from ExtractJob only in what it carries.
ParseJob.poll()
Returns
ParseJob.wait()
Returns
Throws
ExtractJob
An asyncextract job.
ExtractJob.poll()
Returns
ExtractJob.wait()
Returns
Throws
BatchIngestJob
A running (or finished) batch ingestion. Returned byWorkspace.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()
poll(), except that nothing needs fetching:
the batch is driven from this process, so its state is already current.
Returns
BatchIngestJob.wait()
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()
Returns
Throws
normalizeJsonSchema()
$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 inputask 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 forFile.list, e.g. status, tag_id, external_metadata__external_id.
WorkspaceFilters
Filters forWorkspace.list, e.g. name, user_role, ordering.
TagFilters
Filters forTag.list, e.g. name, auto_assign.
ApiKeyFilters
Filters forApiKey.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 tooriginal 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. Onlypending (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 fromLightOnError, 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.