> ## Documentation Index
> Fetch the complete documentation index at: https://khaos-ml.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Khaos

> Pre-trained models for domain-specific tasks, local-first.

Khaos is a lightweight, modular, **local-first** machine learning framework
providing pre-trained models for specialized engineering, scientific and
financial data behind a single small API.

## Why Khaos

**Khaos** is the transliteration of the Greek **χάος**. It comes from the verb *khaínein*, "to gape" or
"to yawn", and its oldest meaning is a gap, a chasm, an open void. In Hesiod's *Theogony* (around
700 BC) Khaos is the first thing that exists, the yawning emptiness before earth, sky and the gods,
and everything with a shape comes after it. Only later, through Latin *chaos* and Ovid's formless
tangle of matter, did the word come to mean disorder.

The name fits the problem. Data from the real world arrives as a gap between what you have and what
you can use: SEC filings are free text and XML, sensor streams are raw numbers, CAD files are point
clouds, spreadsheets have no declared types, and every field has its own formats, tools and
conventions. Khaos is the step that gives that material a shape.

It does this in four ways:

* **One interface.** Every domain works the same way: load an artifact, call it on raw input, read a
  typed result. You don't learn eight toolchains.
* **Structure out of raw input.** Filing text becomes labelled entities, columns get semantic types,
  point clouds and molecules become comparable vectors, sensor windows get anomaly scores, and PDE
  setups become solution fields.
* **A fixed contract.** Each artifact is a manifest plus an ONNX file with named, shape-documented
  inputs and outputs, versioned as `v1`, so results are reproducible and the runtime stays small.
* **Local and honest.** Models run on your machine, and every model card states its measured accuracy
  next to a baseline, so you can see which ones to trust.

```python theme={null}
import khaos

nlp = khaos.load("sec_10k_core")
doc = nlp("path/to/10k_filing.html")
print(doc.ents[0])
# Entity(label="Revenue", value="$12.4B", period="FY2025")
```

> [!NOTE]
>
> Khaos is on **version v1**. The first release of every artifact is named `v1`;
> there are no `v0.x` versions. The runtime, architectures and serving are in place,
> and artifacts are being trained and published domain by domain.

Every domain shares one interface: **load an artifact, call it on raw input, read the
result.** Lorem ipsum dolor sit amet, consectetur adipiscing elit.

```python theme={null}
import khaos

model = khaos.load("pde_darcy_flow_2d")   # 1. load an artifact by name
result = model(boundary_grid)          # 2. call it on raw domain input
print(result.prediction.shape)         # 3. read the domain's result container
# (128, 128)
```

Each domain returns its own result type, so the attributes differ by domain:

```python theme={null}
doc = khaos.load("sec_10k_core")("filing.html")
doc.ents, doc.vector.shape              # finance
# [Entity(label="Revenue", value="$12.4B")] (768,)

traj = khaos.load("robo_kinematics_sm")(joint_trajectory_array)
traj.vector.shape                       # robotics
# (256,)
```

## Concepts

> [accordion] Artifact
>
> A pre-trained model for one task, identified by a name such as
> `sec_10k_core`. Weights live on the Hugging Face Hub, not in this repository.

> [accordion] Vertical
>
> A domain (finance, physics, robotics, ...) with its own subpackage under
> `khaos/`, its own result containers and its own optional install extra.

> [accordion] Pipeline
>
> A callable that wraps preprocessing, inference and postprocessing for an artifact.
> Subclass of `khaos.pipeline.BasePipeline`.

> [accordion] Container
>
> A result object defined by a vertical, such as `finance.Doc` or
> `physics.FieldResult`. Containers are independent; there is no common parent.

> [accordion] Registry
>
> Maps artifact names to pipeline classes. `khaos.load()` resolves a name, imports
> only the needed vertical, and returns the pipeline.

## Where to go next

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium
doloremque laudantium, totam rem aperiam.

> [card] [Installation](https://khaos-ml.mintlify.site/installation.md)
>
> Get Khaos and its optional extras.

> [card] [Artifacts](https://khaos-ml.mintlify.site/usage/artifacts.md)
>
> The domains and artifacts we are building.

> [card] [Command line](https://khaos-ml.mintlify.site/usage/cli.md)
>
> The `khaos` command.

> [card] [API reference](https://khaos-ml.mintlify.site/api/core.md)
>
> `load`, pipelines and per-domain result containers.

> [card] [Architecture](https://khaos-ml.mintlify.site/architecture.md)
>
> How the repo and runtime fit together.

> [card] [Contributing](https://khaos-ml.mintlify.site/contributing.md)
>
> Dev setup, tests and commit conventions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.