# Selecting Output Variables

Return exactly what your execution code needs. A configuration function can return a dict, object, or any structure you prefer.

## Return directly

```python
from hypster import HP


def model_cfg(hp: HP):
    # ... define parameters ...
    return {"model": model, "config": config}

cfg = instantiate(model_cfg, values={...})
run("Hello", **cfg)  # consumes only what it needs
```

## Using hp.collect

If you prefer, you can gather outputs from locals using `hp.collect`:

```python

def build(hp: HP):
    model = ...
    optimizer = ...
    learning_rate = ...
    return hp.collect(locals(), include=["model", "optimizer", "learning_rate"])
```

Keep your returns explicit and minimal to avoid signature mismatches and accidental coupling.


---

# 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/getting-started/selecting-output-variables.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.
