Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/ultra/prompts/references/examples/schemas-and-routing.md

Raw
Rendered preview

schemas and routing

Each example is a complete workflow spec.

named output schema

{
  "name": "named-schema",
  "schemas": {
    "Finding": {
      "type": "object",
      "properties": { "title": { "type": "string" } },
      "required": ["title"]
    }
  },
  "phases": [
    {
      "id": "find",
      "kind": "fanout",
      "over": ["src/a.ts", "src/b.ts"],
      "step": { "summary": "Find issues in {item}", "prompt": "Inspect {item}; do not mutate anything.", "schema": "Finding" }
    }
  ]
}

inline output schema

{
  "name": "inline-schema",
  "phases": [
    {
      "id": "measure",
      "kind": "single",
      "step": {
        "summary": "Measure the target",
        "prompt": "Measure the target and return its size.",
        "schema": {
          "type": "object",
          "properties": { "size": { "type": "number", "minimum": 0 } },
          "required": ["size"]
        }
      }
    }
  ]
}

explicit concurrency

{
  "name": "bounded-fanout",
  "phases": [
    {
      "id": "inspect",
      "kind": "fanout",
      "over": [1, 2, 3, 4, 5, 6],
      "concurrency": 2,
      "step": { "summary": "Inspect item {item}", "prompt": "Inspect item {item}; do not mutate anything." }
    }
  ],
  "return": "{inspect.results}"
}

explicit model and reasoning

{
  "name": "routed-review",
  "phases": [
    {
      "id": "review",
      "kind": "single",
      "step": {
        "summary": "Review the change",
        "prompt": "Review the supplied change carefully.",
        "model": "large",
        "thinkingLevel": "high"
      }
    }
  ]
}

concrete provider model

{
  "name": "concrete-model",
  "phases": [
    {
      "id": "extract",
      "kind": "single",
      "step": {
        "summary": "Extract the value",
        "prompt": "Extract the requested value.",
        "model": "provider/model-id",
        "thinkingLevel": "low"
      }
    }
  ],
  "return": "{extract.results}"
}
# schemas and routing

Each example is a complete workflow spec.

## named output schema

```json
{
  "name": "named-schema",
  "schemas": {
    "Finding": {
      "type": "object",
      "properties": { "title": { "type": "string" } },
      "required": ["title"]
    }
  },
  "phases": [
    {
      "id": "find",
      "kind": "fanout",
      "over": ["src/a.ts", "src/b.ts"],
      "step": { "summary": "Find issues in {item}", "prompt": "Inspect {item}; do not mutate anything.", "schema": "Finding" }
    }
  ]
}
```

### inline output schema

```json
{
  "name": "inline-schema",
  "phases": [
    {
      "id": "measure",
      "kind": "single",
      "step": {
        "summary": "Measure the target",
        "prompt": "Measure the target and return its size.",
        "schema": {
          "type": "object",
          "properties": { "size": { "type": "number", "minimum": 0 } },
          "required": ["size"]
        }
      }
    }
  ]
}
```

### explicit concurrency

```json
{
  "name": "bounded-fanout",
  "phases": [
    {
      "id": "inspect",
      "kind": "fanout",
      "over": [1, 2, 3, 4, 5, 6],
      "concurrency": 2,
      "step": { "summary": "Inspect item {item}", "prompt": "Inspect item {item}; do not mutate anything." }
    }
  ],
  "return": "{inspect.results}"
}
```

### explicit model and reasoning

```json
{
  "name": "routed-review",
  "phases": [
    {
      "id": "review",
      "kind": "single",
      "step": {
        "summary": "Review the change",
        "prompt": "Review the supplied change carefully.",
        "model": "large",
        "thinkingLevel": "high"
      }
    }
  ]
}
```

### concrete provider model

```json
{
  "name": "concrete-model",
  "phases": [
    {
      "id": "extract",
      "kind": "single",
      "step": {
        "summary": "Extract the value",
        "prompt": "Extract the requested value.",
        "model": "provider/model-id",
        "thinkingLevel": "low"
      }
    }
  ],
  "return": "{extract.results}"
}
```