new sdk v0.1.85 (#2421)
This commit is contained in:
@@ -17,7 +17,6 @@ from ..types.workflow_run_response import WorkflowRunResponse
|
||||
from .types.agent_get_run_response import AgentGetRunResponse
|
||||
from ..core.jsonable_encoder import jsonable_encoder
|
||||
from ..errors.not_found_error import NotFoundError
|
||||
from ..types.workflow import Workflow
|
||||
from ..core.client_wrapper import AsyncClientWrapper
|
||||
|
||||
# this is used as the default value for optional parameters
|
||||
@@ -111,7 +110,6 @@ class AgentClient:
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.agent.run_task(
|
||||
prompt="prompt",
|
||||
@@ -243,7 +241,6 @@ class AgentClient:
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.agent.run_workflow(
|
||||
workflow_id="wpid_123",
|
||||
@@ -329,7 +326,6 @@ class AgentClient:
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.agent.get_run(
|
||||
run_id="tsk_123",
|
||||
@@ -399,7 +395,6 @@ class AgentClient:
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.agent.cancel_run(
|
||||
run_id="run_id",
|
||||
@@ -434,64 +429,6 @@ class AgentClient:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
def update_workflow(self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Workflow:
|
||||
"""
|
||||
Update a workflow definition
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_id : str
|
||||
The ID of the workflow to update. Workflow ID starts with `wpid_`.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Workflow
|
||||
Successfully updated workflow
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.agent.update_workflow(
|
||||
workflow_id="wpid_123",
|
||||
)
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/workflows/{jsonable_encoder(workflow_id)}",
|
||||
method="POST",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
Workflow,
|
||||
parse_obj_as(
|
||||
type_=Workflow, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_response_json = _response.json()
|
||||
except JSONDecodeError:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
|
||||
class AsyncAgentClient:
|
||||
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
||||
@@ -582,7 +519,6 @@ class AsyncAgentClient:
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
@@ -722,7 +658,6 @@ class AsyncAgentClient:
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
@@ -818,7 +753,6 @@ class AsyncAgentClient:
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
@@ -896,7 +830,6 @@ class AsyncAgentClient:
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
@@ -936,71 +869,3 @@ class AsyncAgentClient:
|
||||
except JSONDecodeError:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
async def update_workflow(
|
||||
self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> Workflow:
|
||||
"""
|
||||
Update a workflow definition
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_id : str
|
||||
The ID of the workflow to update. Workflow ID starts with `wpid_`.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Workflow
|
||||
Successfully updated workflow
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.agent.update_workflow(
|
||||
workflow_id="wpid_123",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/workflows/{jsonable_encoder(workflow_id)}",
|
||||
method="POST",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
Workflow,
|
||||
parse_obj_as(
|
||||
type_=Workflow, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_response_json = _response.json()
|
||||
except JSONDecodeError:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
@@ -21,6 +21,7 @@ class AgentGetRunResponse_TaskV1(UniversalBaseModel):
|
||||
output: typing.Optional[TaskRunResponseOutput] = None
|
||||
downloaded_files: typing.Optional[typing.List[FileInfo]] = None
|
||||
recording_url: typing.Optional[str] = None
|
||||
screenshot_urls: typing.Optional[typing.List[str]] = None
|
||||
failure_reason: typing.Optional[str] = None
|
||||
created_at: dt.datetime
|
||||
modified_at: dt.datetime
|
||||
@@ -44,6 +45,7 @@ class AgentGetRunResponse_TaskV2(UniversalBaseModel):
|
||||
output: typing.Optional[TaskRunResponseOutput] = None
|
||||
downloaded_files: typing.Optional[typing.List[FileInfo]] = None
|
||||
recording_url: typing.Optional[str] = None
|
||||
screenshot_urls: typing.Optional[typing.List[str]] = None
|
||||
failure_reason: typing.Optional[str] = None
|
||||
created_at: dt.datetime
|
||||
modified_at: dt.datetime
|
||||
@@ -67,6 +69,7 @@ class AgentGetRunResponse_OpenaiCua(UniversalBaseModel):
|
||||
output: typing.Optional[TaskRunResponseOutput] = None
|
||||
downloaded_files: typing.Optional[typing.List[FileInfo]] = None
|
||||
recording_url: typing.Optional[str] = None
|
||||
screenshot_urls: typing.Optional[typing.List[str]] = None
|
||||
failure_reason: typing.Optional[str] = None
|
||||
created_at: dt.datetime
|
||||
modified_at: dt.datetime
|
||||
@@ -90,6 +93,7 @@ class AgentGetRunResponse_AnthropicCua(UniversalBaseModel):
|
||||
output: typing.Optional[TaskRunResponseOutput] = None
|
||||
downloaded_files: typing.Optional[typing.List[FileInfo]] = None
|
||||
recording_url: typing.Optional[str] = None
|
||||
screenshot_urls: typing.Optional[typing.List[str]] = None
|
||||
failure_reason: typing.Optional[str] = None
|
||||
created_at: dt.datetime
|
||||
modified_at: dt.datetime
|
||||
@@ -113,6 +117,7 @@ class AgentGetRunResponse_WorkflowRun(UniversalBaseModel):
|
||||
output: typing.Optional[WorkflowRunResponseOutput] = None
|
||||
downloaded_files: typing.Optional[typing.List[FileInfo]] = None
|
||||
recording_url: typing.Optional[str] = None
|
||||
screenshot_urls: typing.Optional[typing.List[str]] = None
|
||||
failure_reason: typing.Optional[str] = None
|
||||
created_at: dt.datetime
|
||||
modified_at: dt.datetime
|
||||
|
||||
Reference in New Issue
Block a user