| 114 | raise ValueError(f"request is not readable JSON: {exc}") from exc |
| 115 | if request.get("protocol_major") != PROTOCOL_MAJOR: |
| 116 | raise ValueError( |
| 117 | f"unsupported protocol major {request.get('protocol_major')!r}; this adapter implements {PROTOCOL_MAJOR}" |
| 118 | ) |
| 119 | if request.get("model_major") != MODEL_VERSION: |
| 120 | raise ValueError( |
| 121 | f"unsupported model major {request.get('model_major')!r}; this adapter emits {MODEL_VERSION}" |
| 122 | ) |
| 123 | for key in ("identity", "compatibility", "producer", "inputs", "output", "requested_backend"): |
| 124 | if key not in request: |
| 125 | raise ValueError(f"request is missing {key}") |
| 126 | return request |
| 127 | |
| 128 | |