Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.*",
Expand Down
2 changes: 1 addition & 1 deletion src/graphn/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Kept in sync with ``project.version`` in ``pyproject.toml``.
"""

__version__ = "0.3.0"
__version__ = "0.3.1"
7 changes: 7 additions & 0 deletions src/graphn/custom_models/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions tests/test_custom_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading