POST /infer. Body must satisfy AIRequest (tenant_id, task_type, input, options.max_tokens > 0, ...). Returns parsed JSON; on 2xx success this matches AIResponse (result, request_id, ...).
(self, body: Dict[str, Any])
| 40 | raise ValueError("auth must be 'header' or 'bearer'") |
| 41 | |
| 42 | def infer(self, body: Dict[str, Any]) -> Dict[str, Any]: |
| 43 | """ |
| 44 | POST /infer. Body must satisfy AIRequest (tenant_id, task_type, input, options.max_tokens > 0, ...). |
| 45 | |
| 46 | Returns parsed JSON; on 2xx success this matches AIResponse (result, request_id, ...). |
| 47 | """ |
| 48 | url = f"{self.base_url}/infer" |
| 49 | resp = self._session.post( |
| 50 | url, |
| 51 | json=body, |
| 52 | timeout=self._timeout, |
| 53 | headers={"Content-Type": "application/json"}, |
| 54 | ) |
| 55 | resp.raise_for_status() |
| 56 | data: Dict[str, Any] = resp.json() |
| 57 | return data |
| 58 | |
| 59 | def health(self) -> Dict[str, Any]: |
| 60 | """GET /health (unauthenticated).""" |