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

# Quickstart

> Install the SDK, get an API key, and fix your first samples in under five minutes.

## Prerequisites

* Python 3.12 or newer.
* An SDVM account. Create one at [sdvm.ai](https://sdvm.ai) and add credits on your profile page.

## Installation

<CodeGroup>
  ```bash pip theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
  pip install sdvm
  ```

  ```bash uv theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
  uv add sdvm
  ```
</CodeGroup>

To run the dataset walkthroughs in `examples/`, add the extra: `pip install "sdvm[examples]"`.

## Get an API key

Create a key on your [profile page](https://sdvm.ai/profile). It is shown once, so store it right away. The examples read it from an environment variable.

```bash theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
export SDVM_API_KEY=sdvm_...
```

<Note>
  Keep keys out of source control. Every client accepts `api_key=` directly, but reading it from the environment is the pattern used throughout these docs.
</Note>

## Fix your first samples

Wrap each string as a `TextSample`, pass the list to `Fixer.run`, and get fixed samples back.

```python theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
import os

from sdvm import Fixer
from sdvm.types import TextSample

fixer = Fixer(api_key=os.environ["SDVM_API_KEY"])

fixed = fixer.run([
    TextSample(text="she sels sea shells by the sea shor"),
    TextSample(text="i wanna no what da weather is gonna b like tmrw in nyc"),
])
for sample in fixed:
    print(sample.text)

# she sells sea shells by the sea shore
# i wanna know what da weather is gonna b like tmrw in nyc
```

`sels`, `shor` and `no` were corrected because they are genuine misspellings, while the missing
capitals, `wanna`, `da`, `b` and `tmrw` stayed: they are how the author writes, not mistakes. See
[what a fix will not do](/models/fix#a-real-request-and-response). Up to 100 samples go
in one request.

## Audit before you fix

For multiple-choice data, run the `Auditor` first. Each sample comes back with its verdicts on `.audit`, and `Auditor.aggregate` gives a local, dataset-level view.

```python wrap theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
from sdvm import Auditor
from sdvm.types import MultipleChoiceQuestionAnswerSample

samples = [
    MultipleChoiceQuestionAnswerSample(
        context="What is the capital of France?",
        choices=["Berlin", "Paris", "Madrid", "Rome"],
        answer_index=1,
    ),
]

audited = Auditor(api_key=os.environ["SDVM_API_KEY"]).run(samples)
print(audited[0].audit)
# {'label_correct': True, 'single_valid_answer': True, 'distractors_discriminating': True, ...}

print(Auditor.aggregate(audited)["answer_position"])
```

## Run the whole loop

`Refinery` runs `sdvm-audit-1`, `sdvm-fix-1` and `sdvm-audit-1` again in one call. Each sample comes back with `.audit` (the verdict before the fix), `.fix` (what changed) and `.reaudit` (the verdict after it, which tells you whether the fix helped).

```python wrap theme={"theme":{"light":"material-theme-lighter","dark":"material-theme-darker"}}
from sdvm import AuditorConfig, Refinery

refined = Refinery(api_key=os.environ["SDVM_API_KEY"], audit=AuditorConfig(votes=3)).run(samples)
for sample in refined:
    print(sample.audit, sample.fix, sample.reaudit)

flagged = [s for s in refined if s.fix["flagged"]]  # your review queue
```

## Next steps

<Columns cols={2}>
  <Card title="Core concepts" icon="lightbulb" href="/core-concepts">
    What the audit, fix and reaudit blocks mean.
  </Card>

  <Card title="Multiple choice" icon="list-check" href="/sample-types/multiple-choice">
    Completion stems versus questions, and why the type matters.
  </Card>

  <Card title="Dataset conventions" icon="sliders" href="/guides/conventions">
    Stop the audit flagging formatting that is a convention, not a defect.
  </Card>

  <Card title="Denoising with votes" icon="check-double" href="/guides/votes">
    Majority-vote the verdicts where one has to be stable.
  </Card>

  <Card title="Error handling" icon="triangle-exclamation" href="/guides/errors">
    The exception hierarchy and what each status code means.
  </Card>

  <Card title="Examples" icon="flask" href="/sdk/examples">
    HellaSwag and MMLU walkthroughs that ship with the SDK.
  </Card>
</Columns>
