Spaces:
Sleeping
Sleeping
File size: 1,095 Bytes
0580de5 bbbfba8 0580de5 bbbfba8 0580de5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | """API runtime — calls an external HTTP endpoint."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from src.app.providers.runtimes.base import BaseRuntime
if TYPE_CHECKING:
from pathlib import Path
from src.app.domain.models import RawProviderPayload
class ApiRuntime(BaseRuntime):
"""Runtime that calls an external API endpoint.
Supports OpenAI-compatible and custom endpoints.
In V1 this is a skeleton — actual HTTP calls will be added
when API-based providers are integrated.
"""
def __init__(self, timeout: int = 60, max_retries: int = 2) -> None:
self._timeout = timeout
self._max_retries = max_retries
def execute(
self,
image_path: Path,
model_id: str,
*,
options: dict[str, Any] | None = None,
) -> RawProviderPayload:
raise NotImplementedError(
"ApiRuntime.execute is not yet implemented. "
"In V1, provide raw payloads directly to the job service."
)
def is_available(self) -> bool:
return True
|