---
title: Build a model from a prompt or a document
description: System Two from a task description, a policy PDF, or both. Portable definitions, question contracts and sample inputs.
icon: wand-sparkles
---

When you have a policy rather than a list of questions, start from the policy.

## From a prompt

```bash
curl https://api.aityx.ai/v1/systemtwo/models \
  -H "Authorization: Bearer $AITYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "aityx-gen-0.98",
    "prompt": "Decide whether an expense claim can be auto-approved, needs a manager, or must be rejected. Policy, in this order: reject if the total exceeds USD 75 and a receipt is missing; otherwise route to a manager if cost per person exceeds USD 75, total exceeds USD 500, or submission is more than 30 calendar days after the expense date; otherwise auto-approve. Calculate cost per person from the total and number of people. Require a positive total and at least one person.",
    "output": {
      "disposition": {
        "type": "choice",
        "instructions": "What should happen to the claim?",
        "criteria": { "auto_approve": "", "manager": "", "reject": "" }
      },
      "cost_per_person": { "type": "number", "instructions": "Expense per person in USD" }
    }
  }'
```

The response includes `model: {content, questions}` and the derived `input` schema. Its top-level
`content` and `output` repeat the definition and question contract for authoring.
Without `output`, the generator designs the questions as well. Save the complete `model` object to submit
with later execution requests.

## From documents

Send `multipart/form-data` with the fields as form parts and documents as `file` parts. PDFs and images are
read natively; spreadsheets, Word, PowerPoint and text files are extracted to text.

```bash
curl https://api.aityx.ai/v1/systemtwo/models \
  -H "Authorization: Bearer $AITYX_API_KEY" \
  -F model=aityx-gen-0.98 \
  -F mode=thinking \
  -F 'prompt=Qualify rental income for a mortgage application under the attached policy.' \
  -F file=@rental-income-policy.pdf
```

The generator is instructed to use the documents as the source of truth. Review the resulting rules and
their `why` annotations against the policy, then test boundaries and exceptions. Structural validation
does not establish that a generated rule interprets the policy correctly. Use `mode: thinking` for long
or dense documents.

## Revise the definition you kept

Every generated definition is returned for you to inspect and keep. To revise it, send its `content` and
`questions` as `output` to the same endpoint, with a new prompt. The revised definition is returned without
replacing the file your application uses. See [Compare revised rules](/docs/guides/revise-and-replay).

## Sample inputs

Ask for them in the prompt ("create six demo cases covering the boundaries") and the response carries an
`examples` array of named JSON states that satisfy the model's inputs. They are fictional, validated against
the model, and carry no predicted answers.

## Then

- Execute with `POST /v1/systemone`, sending the complete returned `model` object and a `state`.
- Upload it in the console to see the diagram, tables and input schema. Download your work before leaving the session.
- [Revise](/docs/guides/revise-and-replay) when the policy changes.
