22
33from __future__ import annotations
44
5- from typing import Iterable
5+ from typing import Any , Iterable , cast
66from typing_extensions import Literal
77
88import httpx
@@ -163,8 +163,8 @@ def get_artifact(
163163 ) -> AgentGetArtifactResponse :
164164 """Retrieve an artifact by its UUID.
165165
166- For screenshot artifacts, returns a
167- time-limited signed download URL.
166+ For supported downloadable artifacts, returns
167+ a time-limited signed download URL.
168168
169169 Args:
170170 extra_headers: Send extra headers
@@ -177,12 +177,17 @@ def get_artifact(
177177 """
178178 if not artifact_uid :
179179 raise ValueError (f"Expected a non-empty value for `artifact_uid` but received { artifact_uid !r} " )
180- return self ._get (
181- path_template ("/agent/artifacts/{artifact_uid}" , artifact_uid = artifact_uid ),
182- options = make_request_options (
183- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
180+ return cast (
181+ AgentGetArtifactResponse ,
182+ self ._get (
183+ path_template ("/agent/artifacts/{artifact_uid}" , artifact_uid = artifact_uid ),
184+ options = make_request_options (
185+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
186+ ),
187+ cast_to = cast (
188+ Any , AgentGetArtifactResponse
189+ ), # Union types cannot be passed in as arguments in the type system
184190 ),
185- cast_to = AgentGetArtifactResponse ,
186191 )
187192
188193 def run (
@@ -382,8 +387,8 @@ async def get_artifact(
382387 ) -> AgentGetArtifactResponse :
383388 """Retrieve an artifact by its UUID.
384389
385- For screenshot artifacts, returns a
386- time-limited signed download URL.
390+ For supported downloadable artifacts, returns
391+ a time-limited signed download URL.
387392
388393 Args:
389394 extra_headers: Send extra headers
@@ -396,12 +401,17 @@ async def get_artifact(
396401 """
397402 if not artifact_uid :
398403 raise ValueError (f"Expected a non-empty value for `artifact_uid` but received { artifact_uid !r} " )
399- return await self ._get (
400- path_template ("/agent/artifacts/{artifact_uid}" , artifact_uid = artifact_uid ),
401- options = make_request_options (
402- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
404+ return cast (
405+ AgentGetArtifactResponse ,
406+ await self ._get (
407+ path_template ("/agent/artifacts/{artifact_uid}" , artifact_uid = artifact_uid ),
408+ options = make_request_options (
409+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
410+ ),
411+ cast_to = cast (
412+ Any , AgentGetArtifactResponse
413+ ), # Union types cannot be passed in as arguments in the type system
403414 ),
404- cast_to = AgentGetArtifactResponse ,
405415 )
406416
407417 async def run (
0 commit comments