From 7e4cf4e4ac8ab11b37ed1e17f1e3f193be803b7f Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 14:02:36 +0000 Subject: [PATCH 1/2] SDK regeneration --- .fern/metadata.json | 6 +++--- poetry.lock | 8 ++++---- pyproject.toml | 2 +- .../private/agents/sessions/raw_client.py | 4 ++-- .../types/created_by_subject_type.py | 4 ---- .../types/previous_turn_id_input.py | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.fern/metadata.json b/.fern/metadata.json index 506bb60..339357d 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "5.79.0", + "cliVersion": "5.80.2", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "5.21.0", + "generatorVersion": "5.22.1", "generatorConfig": { "package_name": "truefoundry_gateway_sdk", "use_request_defaults": "all", @@ -22,7 +22,7 @@ "numpydoc": ">=1.7.0,<2.0.0" } }, - "originGitCommit": "04ccea4a38938574a81790d93103a82db37968f9", + "originGitCommit": "8632e29353b0fea99dd9c6c309e38edd73fab4e1", "originGitCommitIsDirty": false, "invokedBy": "ci", "requestedVersion": "0.0.0", diff --git a/poetry.lock b/poetry.lock index 6c2130d..aa93f6e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -691,15 +691,15 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "httpx-aiohttp" -version = "0.1.8" +version = "0.1.12" description = "Aiohttp transport for HTTPX" optional = true python-versions = ">=3.8" groups = ["main"] markers = "extra == \"aiohttp\"" files = [ - {file = "httpx_aiohttp-0.1.8-py3-none-any.whl", hash = "sha256:b7bd958d1331f3759a38a0ba22ad29832cb63ca69498c17735228055bf78fa7e"}, - {file = "httpx_aiohttp-0.1.8.tar.gz", hash = "sha256:756c5e74cdb568c3248ba63fe82bfe8bbe64b928728720f7eaac64b3cf46f308"}, + {file = "httpx_aiohttp-0.1.12-py3-none-any.whl", hash = "sha256:5b0eac39a7f360fa7867a60bcb46bb1024eada9c01cbfecdb54dc1edb3fb7141"}, + {file = "httpx_aiohttp-0.1.12.tar.gz", hash = "sha256:81feec51fd82c0ecfa0e9aaf1b1a6c2591260d5e2bcbeb7eb0277a78e610df2c"}, ] [package.dependencies] @@ -2165,4 +2165,4 @@ aiohttp = ["aiohttp", "httpx-aiohttp"] [metadata] lock-version = "2.1" python-versions = ">=3.10" -content-hash = "e7dbcbfca4561ac937abd01771decdedf9be4fc132741bacde30f25b01a9e74c" +content-hash = "6a199718f628e7df205629b66ba61c462504e648aae4e3914e863ca0467c4bf0" diff --git a/pyproject.toml b/pyproject.toml index 281184c..9e49799 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Repository = 'https://github.com/truefoundry/truefoundry-gateway-python-sdk' python = ">=3.10" aiohttp = { version = ">=3.14.1,<4", optional = true, python = ">=3.10"} httpx = ">=0.21.2" -httpx-aiohttp = { version = "0.1.8", optional = true, python = ">=3.10"} +httpx-aiohttp = { version = "^0.1.8", optional = true, python = ">=3.10"} pydantic = ">= 1.9.2" pydantic-core = ">=2.18.2,<3.0.0" typing_extensions = ">= 4.0.0" diff --git a/src/truefoundry_gateway_sdk/private/agents/sessions/raw_client.py b/src/truefoundry_gateway_sdk/private/agents/sessions/raw_client.py index 56b4018..974036f 100644 --- a/src/truefoundry_gateway_sdk/private/agents/sessions/raw_client.py +++ b/src/truefoundry_gateway_sdk/private/agents/sessions/raw_client.py @@ -605,7 +605,7 @@ def create_turn( object_=input, annotation=typing.Sequence[TurnInputItem], direction="write" ), "previous_turn_id": convert_and_respect_annotation_metadata( - object_=previous_turn_id, annotation=typing.Optional[PreviousTurnIdInput], direction="write" + object_=previous_turn_id, annotation=PreviousTurnIdInput, direction="write" ), }, headers={ @@ -1699,7 +1699,7 @@ async def create_turn( object_=input, annotation=typing.Sequence[TurnInputItem], direction="write" ), "previous_turn_id": convert_and_respect_annotation_metadata( - object_=previous_turn_id, annotation=typing.Optional[PreviousTurnIdInput], direction="write" + object_=previous_turn_id, annotation=PreviousTurnIdInput, direction="write" ), }, headers={ diff --git a/src/truefoundry_gateway_sdk/types/created_by_subject_type.py b/src/truefoundry_gateway_sdk/types/created_by_subject_type.py index dca65c9..5edf8de 100644 --- a/src/truefoundry_gateway_sdk/types/created_by_subject_type.py +++ b/src/truefoundry_gateway_sdk/types/created_by_subject_type.py @@ -16,7 +16,6 @@ class CreatedBySubjectType(enum.StrEnum): TEAM = "team" SERVICEACCOUNT = "serviceaccount" VIRTUALACCOUNT = "virtualaccount" - EXTERNAL_IDENTITY = "external-identity" AGENT_IDENTITY = "agent-identity" ROLE = "role" _UNKNOWN = "__CREATEDBYSUBJECTTYPE_UNKNOWN__" @@ -36,7 +35,6 @@ def visit( team: typing.Callable[[], T_Result], serviceaccount: typing.Callable[[], T_Result], virtualaccount: typing.Callable[[], T_Result], - external_identity: typing.Callable[[], T_Result], agent_identity: typing.Callable[[], T_Result], role: typing.Callable[[], T_Result], _unknown_member: typing.Callable[[str], T_Result], @@ -49,8 +47,6 @@ def visit( return serviceaccount() if self is CreatedBySubjectType.VIRTUALACCOUNT: return virtualaccount() - if self is CreatedBySubjectType.EXTERNAL_IDENTITY: - return external_identity() if self is CreatedBySubjectType.AGENT_IDENTITY: return agent_identity() if self is CreatedBySubjectType.ROLE: diff --git a/src/truefoundry_gateway_sdk/types/previous_turn_id_input.py b/src/truefoundry_gateway_sdk/types/previous_turn_id_input.py index 55082bf..0e5f035 100644 --- a/src/truefoundry_gateway_sdk/types/previous_turn_id_input.py +++ b/src/truefoundry_gateway_sdk/types/previous_turn_id_input.py @@ -2,4 +2,4 @@ import typing -PreviousTurnIdInput = typing.Union[typing.Literal["auto"], str] +PreviousTurnIdInput = typing.Union[typing.Literal["auto"], typing.Literal["none"], str] From c761555aab41a451fe95f1b80e858ca7ddca743f Mon Sep 17 00:00:00 2001 From: Chirag Jain Date: Mon, 27 Jul 2026 21:19:13 +0530 Subject: [PATCH 2/2] Fix high level sdk to have OMIT as defaults --- .../agents/agent_session.py | 11 +++++--- .../agents/prepared_turn.py | 27 +++++++++++++------ .../agents/private/agent_draft_session.py | 12 +++++---- .../private/private_agent_session_client.py | 4 ++- .../agents/session_mixin.py | 11 +++++--- src/truefoundry_gateway_sdk/agents/turn.py | 13 ++++++--- 6 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/truefoundry_gateway_sdk/agents/agent_session.py b/src/truefoundry_gateway_sdk/agents/agent_session.py index 67c17a6..add2f04 100644 --- a/src/truefoundry_gateway_sdk/agents/agent_session.py +++ b/src/truefoundry_gateway_sdk/agents/agent_session.py @@ -4,6 +4,9 @@ from .session_mixin import AsyncSessionMixin, SessionMixin +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + if typing.TYPE_CHECKING: from ..client import AsyncTrueFoundryGateway, TrueFoundryGateway from ..core.pagination import AsyncPager, SyncPager @@ -110,8 +113,8 @@ def updated_at(self) -> str: def prepare_turn( self, *, - input: typing.Optional[typing.Sequence[TurnInputItem]] = None, - previous_turn_id: typing.Optional[PreviousTurnIdInput] = None, + input: typing.Optional[typing.Sequence[TurnInputItem]] = OMIT, + previous_turn_id: typing.Optional[PreviousTurnIdInput] = OMIT, ) -> PreparedTurn: """ Stage a turn locally; call ``execute()`` to start ``create_turn``. @@ -319,8 +322,8 @@ def updated_at(self) -> str: def prepare_turn( self, *, - input: typing.Optional[typing.Sequence[TurnInputItem]] = None, - previous_turn_id: typing.Optional[PreviousTurnIdInput] = None, + input: typing.Optional[typing.Sequence[TurnInputItem]] = OMIT, + previous_turn_id: typing.Optional[PreviousTurnIdInput] = OMIT, ) -> AsyncPreparedTurn: """ Stage a turn locally; call ``execute()`` to start ``create_turn``. diff --git a/src/truefoundry_gateway_sdk/agents/prepared_turn.py b/src/truefoundry_gateway_sdk/agents/prepared_turn.py index 5b8c029..99998fe 100644 --- a/src/truefoundry_gateway_sdk/agents/prepared_turn.py +++ b/src/truefoundry_gateway_sdk/agents/prepared_turn.py @@ -8,6 +8,9 @@ from .turn import AsyncTurn, Turn from .turn_stream_data import TurnStreamData +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + if typing.TYPE_CHECKING: from ..client import AsyncTrueFoundryGateway, TrueFoundryGateway from ..core.pagination import AsyncPager, SyncPager @@ -37,7 +40,10 @@ def __init__( session: typing.Union["AgentSession", "AgentDraftSession"], client: TrueFoundryGateway, ) -> None: - self._input = list(input) if input is not None else None + # Keep the raw value (which may be the OMIT sentinel) to forward to create_turn + # unchanged; self._input is the list-or-None form used for local state/exposure. + self._input_param = input + self._input = list(input) if input is not None and input is not OMIT else None self._previous_turn_id = previous_turn_id self._session: typing.Union["AgentSession", "AgentDraftSession"] = session self._session_id: str = session.id @@ -193,7 +199,7 @@ def execute( def stream( self, *, - after_sequence_number: typing.Optional[int] = None, + after_sequence_number: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[TurnStreamData]: """ @@ -202,7 +208,8 @@ def stream( Parameters ---------- after_sequence_number : typing.Optional[int] - Sequence number to resume SSE subscription after. + Sequence number to resume SSE subscription after. Omit to resume via the + Last-Event-Id header instead. request_options : typing.Optional[RequestOptions] Overrides client timeout, retries, headers, and stream reconnect. @@ -320,7 +327,7 @@ def _consume_stream(self, request_options: typing.Optional[RequestOptions]) -> t """Consume the create_turn SSE, adopting the inner Turn from the first turn.created.""" for event in self._client.agents.sessions.create_turn( self._session_id, - input=self._input, + input=self._input_param, previous_turn_id=self._previous_turn_id, request_options=request_options, ): @@ -389,7 +396,10 @@ def __init__( session: typing.Union["AsyncAgentSession", "AsyncAgentDraftSession"], client: AsyncTrueFoundryGateway, ) -> None: - self._input = list(input) if input is not None else None + # Keep the raw value (which may be the OMIT sentinel) to forward to create_turn + # unchanged; self._input is the list-or-None form used for local state/exposure. + self._input_param = input + self._input = list(input) if input is not None and input is not OMIT else None self._previous_turn_id = previous_turn_id self._session: typing.Union["AsyncAgentSession", "AsyncAgentDraftSession"] = session self._session_id: str = session.id @@ -545,7 +555,7 @@ def execute( async def stream( self, *, - after_sequence_number: typing.Optional[int] = None, + after_sequence_number: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[TurnStreamData]: """ @@ -554,7 +564,8 @@ async def stream( Parameters ---------- after_sequence_number : typing.Optional[int] - Sequence number to resume SSE subscription after. + Sequence number to resume SSE subscription after. Omit to resume via the + Last-Event-Id header instead. request_options : typing.Optional[RequestOptions] Overrides client timeout, retries, headers, and stream reconnect. @@ -677,7 +688,7 @@ async def _consume_stream( ) -> typing.AsyncIterator[TurnStreamData]: async for event in self._client.agents.sessions.create_turn( self._session_id, - input=self._input, + input=self._input_param, previous_turn_id=self._previous_turn_id, request_options=request_options, ): diff --git a/src/truefoundry_gateway_sdk/agents/private/agent_draft_session.py b/src/truefoundry_gateway_sdk/agents/private/agent_draft_session.py index 9229f9f..09c5bef 100644 --- a/src/truefoundry_gateway_sdk/agents/private/agent_draft_session.py +++ b/src/truefoundry_gateway_sdk/agents/private/agent_draft_session.py @@ -2,9 +2,11 @@ import typing -from ...private.agents.private.draft_sessions.client import OMIT from ..session_mixin import AsyncSessionMixin, SessionMixin +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + if typing.TYPE_CHECKING: from ...client import AsyncTrueFoundryGateway, TrueFoundryGateway from ...core.pagination import AsyncPager, SyncPager @@ -153,8 +155,8 @@ def update( def prepare_turn( self, *, - input: typing.Optional[typing.Sequence[TurnInputItem]] = None, - previous_turn_id: typing.Optional[PreviousTurnIdInput] = None, + input: typing.Optional[typing.Sequence[TurnInputItem]] = OMIT, + previous_turn_id: typing.Optional[PreviousTurnIdInput] = OMIT, ) -> PreparedTurn: """ Stage a turn locally; call ``execute()`` to start ``create_turn``. @@ -402,8 +404,8 @@ async def update( def prepare_turn( self, *, - input: typing.Optional[typing.Sequence[TurnInputItem]] = None, - previous_turn_id: typing.Optional[PreviousTurnIdInput] = None, + input: typing.Optional[typing.Sequence[TurnInputItem]] = OMIT, + previous_turn_id: typing.Optional[PreviousTurnIdInput] = OMIT, ) -> AsyncPreparedTurn: """ Stage a turn locally; call ``execute()`` to start ``create_turn``. diff --git a/src/truefoundry_gateway_sdk/agents/private/private_agent_session_client.py b/src/truefoundry_gateway_sdk/agents/private/private_agent_session_client.py index f4e6510..14ca8e9 100644 --- a/src/truefoundry_gateway_sdk/agents/private/private_agent_session_client.py +++ b/src/truefoundry_gateway_sdk/agents/private/private_agent_session_client.py @@ -4,10 +4,12 @@ import typing from ...core.pagination import AsyncPager, SyncPager -from ...private.agents.private.draft_sessions.client import OMIT from ..agent_session import AgentSession, AsyncAgentSession from .agent_draft_session import AgentDraftSession, AsyncAgentDraftSession +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + if typing.TYPE_CHECKING: import httpx from ...client import AsyncTrueFoundryGateway, TrueFoundryGateway diff --git a/src/truefoundry_gateway_sdk/agents/session_mixin.py b/src/truefoundry_gateway_sdk/agents/session_mixin.py index a225f90..a05b165 100644 --- a/src/truefoundry_gateway_sdk/agents/session_mixin.py +++ b/src/truefoundry_gateway_sdk/agents/session_mixin.py @@ -6,6 +6,9 @@ from .prepared_turn import AsyncPreparedTurn, PreparedTurn from .turn import AsyncTurn, Turn +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + if typing.TYPE_CHECKING: from ..client import AsyncTrueFoundryGateway, TrueFoundryGateway from ..core.request_options import RequestOptions @@ -89,8 +92,8 @@ def prepare_turn( self, owner: SyncSessionOwner, *, - input: typing.Optional[typing.Sequence[TurnInputItem]] = None, - previous_turn_id: typing.Optional[PreviousTurnIdInput] = None, + input: typing.Optional[typing.Sequence[TurnInputItem]] = OMIT, + previous_turn_id: typing.Optional[PreviousTurnIdInput] = OMIT, ) -> PreparedTurn: """ Stage a turn locally; call ``execute()`` to start ``create_turn``. @@ -241,8 +244,8 @@ def prepare_turn( self, owner: AsyncSessionOwner, *, - input: typing.Optional[typing.Sequence[TurnInputItem]] = None, - previous_turn_id: typing.Optional[PreviousTurnIdInput] = None, + input: typing.Optional[typing.Sequence[TurnInputItem]] = OMIT, + previous_turn_id: typing.Optional[PreviousTurnIdInput] = OMIT, ) -> AsyncPreparedTurn: """ Stage a turn locally; call ``execute()`` to start ``create_turn``. diff --git a/src/truefoundry_gateway_sdk/agents/turn.py b/src/truefoundry_gateway_sdk/agents/turn.py index cc78277..d9eb804 100644 --- a/src/truefoundry_gateway_sdk/agents/turn.py +++ b/src/truefoundry_gateway_sdk/agents/turn.py @@ -10,6 +10,9 @@ from ..types.turn_state_error import TurnStateError from .turn_stream_data import TurnStreamData +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + if typing.TYPE_CHECKING: from ..client import AsyncTrueFoundryGateway, TrueFoundryGateway from ..core.pagination import AsyncPager, SyncPager @@ -194,7 +197,7 @@ def wait_for_completion( def stream( self, *, - after_sequence_number: typing.Optional[int] = None, + after_sequence_number: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[TurnStreamData]: """ @@ -203,7 +206,8 @@ def stream( Parameters ---------- after_sequence_number : typing.Optional[int] - Sequence number to resume SSE subscription after. + Sequence number to resume SSE subscription after. Omit to resume via the + Last-Event-Id header instead. request_options : typing.Optional[RequestOptions] Overrides client timeout, retries, headers, and stream reconnect. @@ -440,7 +444,7 @@ async def wait_for_completion( async def stream( self, *, - after_sequence_number: typing.Optional[int] = None, + after_sequence_number: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[TurnStreamData]: """ @@ -449,7 +453,8 @@ async def stream( Parameters ---------- after_sequence_number : typing.Optional[int] - Sequence number to resume SSE subscription after. + Sequence number to resume SSE subscription after. Omit to resume via the + Last-Event-Id header instead. request_options : typing.Optional[RequestOptions] Overrides client timeout, retries, headers, and stream reconnect.