diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c7fa21..af5982e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,19 @@ No `git tag`, no `git push --tags`, no Actions clicks. ## [Unreleased] +## [0.3.1] — 2026-11-04 + +The `capabilities.0 Input should be 'tool_calling', 'vision', 'embedding' +or 'reasoning'` error on custom models was fixed in the API, which now +keeps `capabilities` within that enum; 0.3.0 works without upgrading. + +### Added + +- `CustomModel.derived_capabilities`: every capability the model has, + including architecture-derived ones such as `image_input`, + `video_input` and `thinking` (OpenAPI 0.38.0). `None` from older + control planes. + ## [0.3.0] — 2026-10-25 LoRA adapters on a shared base (public beta). diff --git a/pyproject.toml b/pyproject.toml index 7857360..eef929e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "graphn" -version = "0.3.0" +version = "0.3.1" description = "Official Python SDK for the Graphn API: workflows, agents, knowledge bases, custom models, and OpenAI-compatible inference." readme = "README.md" requires-python = ">=3.10" @@ -84,6 +84,7 @@ minversion = "8.0" addopts = "-ra --strict-markers" testpaths = ["tests"] asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "function" filterwarnings = [ "error", "ignore::DeprecationWarning:httpx.*", diff --git a/src/graphn/_version.py b/src/graphn/_version.py index eb31720..2fcf467 100644 --- a/src/graphn/_version.py +++ b/src/graphn/_version.py @@ -3,4 +3,4 @@ Kept in sync with ``project.version`` in ``pyproject.toml``. """ -__version__ = "0.3.0" +__version__ = "0.3.1" diff --git a/src/graphn/custom_models/types.py b/src/graphn/custom_models/types.py index 00391b7..68148da 100644 --- a/src/graphn/custom_models/types.py +++ b/src/graphn/custom_models/types.py @@ -55,6 +55,13 @@ class CustomModel(BaseModel): weight_source: WeightSource gpu_count: int capabilities: list[Capability] = Field(default_factory=list) + """Spec-enum view of :attr:`derived_capabilities`: ``"image_input"`` is + reported as ``"vision"``, ``"thinking"`` as ``"reasoning"``, others omitted.""" + derived_capabilities: list[str] | None = None + """Every capability the model has, including ones derived from its + architecture such as ``"image_input"``, ``"video_input"`` and + ``"thinking"``. Open-ended, so expect new values. ``None`` from control + planes before OpenAPI 0.38.0.""" min_replicas: int max_replicas: int cooldown_seconds: int diff --git a/tests/test_custom_models.py b/tests/test_custom_models.py index c519f5d..6bcd42b 100644 --- a/tests/test_custom_models.py +++ b/tests/test_custom_models.py @@ -91,6 +91,32 @@ def test_get_returns_typed_model(client: Client, respx_mock: respx.MockRouter) - assert model.status == "ready" +def test_refresh_returns_derived_capabilities(client: Client, respx_mock: respx.MockRouter) -> None: + respx_mock.post(cp_url("custom-models/cm_01/refresh")).mock( + return_value=httpx.Response( + 200, + json=_model_payload( + capabilities=["vision", "tool_calling"], + derived_capabilities=["image_input", "tool_calling", "video_input", "vision"], + ), + ) + ) + + model = client.custom_models.refresh("cm_01") + assert model.capabilities == ["vision", "tool_calling"] + assert model.derived_capabilities == ["image_input", "tool_calling", "video_input", "vision"] + + +def test_derived_capabilities_absent_on_older_control_plane( + client: Client, respx_mock: respx.MockRouter +) -> None: + respx_mock.get(cp_url("custom-models/cm_01")).mock( + return_value=httpx.Response(200, json=_model_payload()) + ) + + assert client.custom_models.get("cm_01").derived_capabilities is None + + def test_get_404_maps_to_not_found(client: Client, respx_mock: respx.MockRouter) -> None: respx_mock.get(cp_url("custom-models/missing")).mock( return_value=httpx.Response(