models-metadata

Recipe: a client adapter, static first

An adapter turns a route profile into a client’s own model configuration. Write it in two phases. The mapping is the same in both; only where the profile comes from changes.

Phase 1: static

  1. Input. An effective profile, the shape scripts/resolve.py writes to examples/effective/:

    { "workflow": "arazzo/<route>/arazzo.json#<workflowId>",
      "layers":   { "model": {...}, "provider": {...}, "account": {...} },
      "effective": {...},       // the layers merged, least specific first (jq `*`)
      "live":     ["provider.limit.context", ...] }   // outputs only a runner can fill
    

    Read effective. Read layers only to show where a value came from. A path listed in live is unknown in phase 1.

  2. Pin. Record the profile’s sha256 (the digest of its describedby descriptor, or of the file) next to the generated configuration, so a changed profile is a visible diff.

  3. Map. Write one table: facts path, client field, conversion. Rules:
    • Absent means unknown. Leave the client field unset so the client’s own default or catalog applies. Never write a placeholder value.
    • Convert units in code, not in the profile: tokens.per says how many tokens one price buys, so a client priced per million multiplies by 1000000 / per.
    • Lifetimes are ISO 8601 durations (PT5M, PT1H); convert to the client’s unit.
    • controls.<field>.support of rejected means the client must not send the field; ignored means sending it has no effect.
    • A section the client has no field for is reported, not dropped silently (step 5).
  4. Precedence. The user’s explicit configuration beats the profile; the profile beats the client’s bundled catalog, because the serving host, not the model card, decides served limits and prices.

  5. Test. Golden files: each file in examples/effective/ produces an expected client configuration, checked byte for byte. A second test lists every facts path present in the input that the adapter did not map, against a committed list, so a new field in the profile shows up as a failing test until it is mapped or declared unmapped.

Phase 2: live

Replace the static file with a run of the workflow, which fills the live outputs from the provider’s own API (served context, account balance, loaded quantization). Runners that read Arazzo: Python arazzo-runner (CLI execute-workflow; its Arazzo 1.1 support is not established), TypeScript @usearazzo/runner (library; its docs list Arazzo 1.1.0), Redocly respect (CLI; its docs say Arazzo 1.0.1 only). The mapping table and the tests from phase 1 do not change; the golden inputs gain the live values.

Run a live workflow only when the user asks: some steps cost money (a request that loads a model or sends a prompt), and an account layer reads the user’s own balance.