# Welcome

<div data-full-width="false"><figure><picture><source srcset="/files/XElGRKvhdyH5unbX9hyH" media="(prefers-color-scheme: dark)"><img src="/files/0gIDppmJ23Mkkwy6g33e" alt=""></picture><figcaption></figcaption></figure></div>

### Hypster is a lightweight configuration framework for managing and **optimizing AI & ML workflows**

## Key Features

* :snake: **Pythonic API**: Intuitive & minimal syntax that feels natural to Python developers
* :nesting\_dolls: **Hierarchical, Conditional Configurations**: Support for nested and swappable configurations
* :triangular\_ruler: **Type Safety**: Built-in type hints and validation
* :mag: **Schema Exploration**: Inspect parameters, defaults, and active branches with `explore()`
* :test\_tube: **Hyperparameter Optimization Built-In**: Native, first-class optuna support

> Show your support by giving us a [star](https://github.com/gilad-rubin/hypster)! ⭐

## How Does it work?

{% stepper %}
{% step %}
**Install Hypster**

{% code overflow="wrap" %}

```bash
uv add hypster
```

{% endcode %}
{% endstep %}

{% step %}
**Define a configuration space**

{% code overflow="wrap" %}

```python
from hypster import HP
from my_app.llms import LLMClient


def llm_config(hp: HP) -> LLMClient:
    model_name = hp.select(["gpt-5.5", "gpt-5.5-mini"], name="model_name")
    temperature = hp.float(0.0, name="temperature", min=0.0, max=1.0)

    return LLMClient(model_name=model_name, temperature=temperature)
```

{% endcode %}
{% endstep %}

{% step %}
**Explore your configuration**

{% code overflow="wrap" %}

```python
from hypster import explore

explore(llm_config)
```

{% endcode %}
{% endstep %}

{% step %}
**Instantiate your runtime object**

{% code overflow="wrap" %}

```python
from hypster import instantiate

llm = instantiate(llm_config, values={"model_name": "gpt-5.5", "temperature": 0.7})
```

{% endcode %}
{% endstep %}

{% step %}
**Execute!**

{% code overflow="wrap" %}

```python
llm.invoke("What is Hypster?")
```

{% endcode %}
{% endstep %}
{% endstepper %}

## Discover Hypster

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Getting Started</strong></td><td>How to create &#x26; instantiate Hypster configs</td><td></td><td><a href="/files/gvePptq2cRq2igl7WW6q">/files/gvePptq2cRq2igl7WW6q</a></td><td><a href="/pages/AOgX0cNsNavrnnfQlMx0">/pages/AOgX0cNsNavrnnfQlMx0</a></td></tr><tr><td><strong>Tutorials</strong></td><td>Step-by-step guides for ML &#x26; Generative AI use-cases</td><td></td><td><a href="/files/Nj5lJQCrmlAPCTmQbniQ">/files/Nj5lJQCrmlAPCTmQbniQ</a></td><td><a href="/pages/sG9e3bPGcSDJ519TnTmC">/pages/sG9e3bPGcSDJ519TnTmC</a></td></tr><tr><td><strong>Best Practices</strong></td><td>How to make the most out of Hypster</td><td></td><td><a href="/files/3HiBewQRJ2fliafwoYSY">/files/3HiBewQRJ2fliafwoYSY</a></td><td><a href="/pages/xpQxAIZEJ6Qsrj3Scmbh">/pages/xpQxAIZEJ6Qsrj3Scmbh</a></td></tr></tbody></table>

## Why Use Hypster?

In modern AI/ML development, we often need to handle **multiple configurations across different scenarios**. This is essential because:

1. We don't know in advance which **hyperparameters** will best optimize our performance metrics and satisfy our constraints.
2. We need to support multiple **"modes"** for different scenarios. For example:
   1. Local vs. Remote Environments, Development vs. Production Settings
   2. Different App Configurations for specific use-cases and populations

Hypster takes care of these challenges by providing a simple way to define configuration spaces and instantiate them into concrete workflows. This enables you to manage and optimize swappable runtime components in your codebase.

## Core Workflow

* **Define** ordinary Python config functions whose first argument is `hp: HP`.
* **Return** the initialized object your application will use whenever that object is cheap and safe to construct.
* **Choose** swappable components with named option dictionaries that map simple keys to config functions.
* **Explore** the active parameter tree with `explore(config)` before running a branch.
* **Instantiate** with `instantiate(config, values={...})` when you only need the returned object.
* **Log params** with `instantiate_with_params(config, values={...})` when you need a stable replay record.

## Design Notes

Hypster treats `values=` as a reproducibility surface. Unknown values and values for inactive branches raise by default, because silently accepting them can make an experiment impossible to replay. Use `explore(config, values=...)` to inspect a branch before instantiating it.

Because exploration and interactive controls execute the config function to discover the current branch, avoid doing work there that should happen only once or only after the user confirms a run. Build expensive clients, load indexes, write files, call paid APIs, and train models after `instantiate()` returns.

## Additional Reading

* [Introducing Hypster](https://medium.com/@giladrubin/introducing-hypster-a-pythonic-framework-for-managing-configurations-to-build-highly-optimized-ai-5ee004dbd6a5)
* [Implementing Modular RAG With Haystack & Hypster](https://towardsdatascience.com/implementing-modular-rag-with-haystack-and-hypster-d2f0ecc88b8f)
* [5 Pillars for Hyper-Optimized AI Workflows](https://medium.com/@giladrubin/5-pillars-for-a-hyper-optimized-ai-workflow-21fcaefe48ca)

## AI-Readable Docs

GitBook publishes Hypster's docs as an agent-friendly index at [llms.txt](https://gilad-rubin.gitbook.io/hypster/llms.txt) and as a full Markdown export at [llms-full.txt](https://gilad-rubin.gitbook.io/hypster/llms-full.txt).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gilad-rubin.gitbook.io/hypster/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
