> ## Documentation Index
> Fetch the complete documentation index at: https://cognis.vasanth.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> LLM clients, streaming, embeddings + similarity search, length-based routing, multimodal.

Model examples enact what happens at the LLM-client layer. Sources under [`examples/models/`](https://github.com/0xvasanth/cognis/tree/main/examples/models).

| Name                    | Scenario                                                                                                                      | Source                                                                                   |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `models_streaming_chat` | Stream a one-line explanation to a CLI chat UI — print tokens as they arrive.                                                 | [src](https://github.com/0xvasanth/cognis/blob/main/examples/models/streaming_chat.rs)   |
| `models_embedding`      | Find the most similar product description for a search query, using cosine similarity.                                        | [src](https://github.com/0xvasanth/cognis/blob/main/examples/models/embedding_models.rs) |
| `models_routing`        | Route by intent — short greetings to a fast model, long technical questions to a bigger one.                                  | [src](https://github.com/0xvasanth/cognis/blob/main/examples/models/model_routing.rs)    |
| `models_content_blocks` | Caption an image — multimodal `ContentPart::Image`. (Needs a vision model: `COGNIS_OLLAMA_MODEL=llava` or hosted equivalent.) | [src](https://github.com/0xvasanth/cognis/blob/main/examples/models/content_blocks.rs)   |

## How to run

```bash theme={null}
COGNIS_PROVIDER=ollama COGNIS_OLLAMA_MODEL=llama3.1 \
  cargo run -p cognis-examples --example models_streaming_chat

# For multimodal:
ollama pull llava
COGNIS_PROVIDER=ollama COGNIS_OLLAMA_MODEL=llava \
  cargo run -p cognis-examples --example models_content_blocks
```

## See also

<CardGroup cols={2}>
  <Card title="Models and providers" icon="plug" href="/building-agents/models">
    `Client::from_env`, provider builders, the env-var table.
  </Card>

  <Card title="Streaming" icon="signal" href="/building-agents/streaming">
    Tokens vs structured events.
  </Card>

  <Card title="Embeddings & stores" icon="database" href="/building-rag/embeddings">
    Where the embedders feed.
  </Card>
</CardGroup>
