Skip to content

Commit 5dcf360

Browse files
feat: Fix Stainless GitHub Action
1 parent 78727c0 commit 5dcf360

File tree

7 files changed

+36
-19
lines changed

7 files changed

+36
-19
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 26
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browser-use%2Fbrowser-use-9ff5409663c58ae9e3ecc9ac764956189e3a70600f5ba1b961bb1dedf0208271.yml
3-
openapi_spec_hash: 9865acb75430d9b799502acbae860df0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browser-use%2Fbrowser-use-d20f308ac3a63b1ea5749dac763fd846481c9723156a5653c1d03669e73d5b5e.yml
3+
openapi_spec_hash: ccf5babfe92a776213a3e5097a7cd546
44
config_hash: 9d52be5177b2ede4cb0633c04f4cc4ef

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ from browser_use_sdk import BrowserUse
114114

115115
client = BrowserUse()
116116

117-
task_view = client.tasks.create(
117+
task = client.tasks.create(
118118
task="x",
119119
agent_settings={},
120120
)
121-
print(task_view.agent_settings)
121+
print(task.agent_settings)
122122
```
123123

124124
## Handling errors

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ from browser_use_sdk.types import (
3636
TaskStatus,
3737
TaskStepView,
3838
TaskView,
39+
TaskCreateResponse,
3940
TaskListResponse,
4041
TaskGetLogsResponse,
4142
TaskGetOutputFileResponse,
@@ -45,7 +46,7 @@ from browser_use_sdk.types import (
4546

4647
Methods:
4748

48-
- <code title="post /tasks">client.tasks.<a href="./src/browser_use_sdk/resources/tasks.py">create</a>(\*\*<a href="src/browser_use_sdk/types/task_create_params.py">params</a>) -> <a href="./src/browser_use_sdk/types/task_view.py">TaskView</a></code>
49+
- <code title="post /tasks">client.tasks.<a href="./src/browser_use_sdk/resources/tasks.py">create</a>(\*\*<a href="src/browser_use_sdk/types/task_create_params.py">params</a>) -> <a href="./src/browser_use_sdk/types/task_create_response.py">TaskCreateResponse</a></code>
4950
- <code title="get /tasks/{task_id}">client.tasks.<a href="./src/browser_use_sdk/resources/tasks.py">retrieve</a>(task_id) -> <a href="./src/browser_use_sdk/types/task_view.py">TaskView</a></code>
5051
- <code title="patch /tasks/{task_id}">client.tasks.<a href="./src/browser_use_sdk/resources/tasks.py">update</a>(task_id, \*\*<a href="src/browser_use_sdk/types/task_update_params.py">params</a>) -> <a href="./src/browser_use_sdk/types/task_view.py">TaskView</a></code>
5152
- <code title="get /tasks">client.tasks.<a href="./src/browser_use_sdk/resources/tasks.py">list</a>(\*\*<a href="src/browser_use_sdk/types/task_list_params.py">params</a>) -> <a href="./src/browser_use_sdk/types/task_list_response.py">TaskListResponse</a></code>

src/browser_use_sdk/resources/tasks.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .._base_client import make_request_options
2222
from ..types.task_view import TaskView
2323
from ..types.task_list_response import TaskListResponse
24+
from ..types.task_create_response import TaskCreateResponse
2425
from ..types.task_get_logs_response import TaskGetLogsResponse
2526
from ..types.task_get_output_file_response import TaskGetOutputFileResponse
2627
from ..types.task_get_user_uploaded_file_response import TaskGetUserUploadedFileResponse
@@ -64,7 +65,7 @@ def create(
6465
extra_query: Query | None = None,
6566
extra_body: Body | None = None,
6667
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
67-
) -> TaskView:
68+
) -> TaskCreateResponse:
6869
"""
6970
Create and start a new AI agent task.
7071
@@ -103,7 +104,7 @@ def create(
103104
104105
Returns:
105106
106-
- The created task with its initial details
107+
- The created task ID together with the task's session ID
107108
108109
Raises:
109110
@@ -148,7 +149,7 @@ def create(
148149
options=make_request_options(
149150
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
150151
),
151-
cast_to=TaskView,
152+
cast_to=TaskCreateResponse,
152153
)
153154

154155
def retrieve(
@@ -567,7 +568,7 @@ async def create(
567568
extra_query: Query | None = None,
568569
extra_body: Body | None = None,
569570
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
570-
) -> TaskView:
571+
) -> TaskCreateResponse:
571572
"""
572573
Create and start a new AI agent task.
573574
@@ -606,7 +607,7 @@ async def create(
606607
607608
Returns:
608609
609-
- The created task with its initial details
610+
- The created task ID together with the task's session ID
610611
611612
Raises:
612613
@@ -651,7 +652,7 @@ async def create(
651652
options=make_request_options(
652653
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
653654
),
654-
cast_to=TaskView,
655+
cast_to=TaskCreateResponse,
655656
)
656657

657658
async def retrieve(

src/browser_use_sdk/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .task_update_params import TaskUpdateParams as TaskUpdateParams
1919
from .session_list_params import SessionListParams as SessionListParams
2020
from .browser_profile_view import BrowserProfileView as BrowserProfileView
21+
from .task_create_response import TaskCreateResponse as TaskCreateResponse
2122
from .session_list_response import SessionListResponse as SessionListResponse
2223
from .session_update_params import SessionUpdateParams as SessionUpdateParams
2324
from .task_get_logs_response import TaskGetLogsResponse as TaskGetLogsResponse
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from pydantic import Field as FieldInfo
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["TaskCreateResponse"]
8+
9+
10+
class TaskCreateResponse(BaseModel):
11+
id: str
12+
13+
session_id: str = FieldInfo(alias="sessionId")

tests/api_resources/test_tasks.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from browser_use_sdk.types import (
1313
TaskView,
1414
TaskListResponse,
15+
TaskCreateResponse,
1516
TaskGetLogsResponse,
1617
TaskGetOutputFileResponse,
1718
TaskGetUserUploadedFileResponse,
@@ -29,7 +30,7 @@ def test_method_create(self, client: BrowserUse) -> None:
2930
task = client.tasks.create(
3031
task="x",
3132
)
32-
assert_matches_type(TaskView, task, path=["response"])
33+
assert_matches_type(TaskCreateResponse, task, path=["response"])
3334

3435
@pytest.mark.skip(reason="Prism tests are disabled")
3536
@parametrize
@@ -50,7 +51,7 @@ def test_method_create_with_all_params(self, client: BrowserUse) -> None:
5051
secrets={"foo": "string"},
5152
structured_output_json="structuredOutputJson",
5253
)
53-
assert_matches_type(TaskView, task, path=["response"])
54+
assert_matches_type(TaskCreateResponse, task, path=["response"])
5455

5556
@pytest.mark.skip(reason="Prism tests are disabled")
5657
@parametrize
@@ -62,7 +63,7 @@ def test_raw_response_create(self, client: BrowserUse) -> None:
6263
assert response.is_closed is True
6364
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6465
task = response.parse()
65-
assert_matches_type(TaskView, task, path=["response"])
66+
assert_matches_type(TaskCreateResponse, task, path=["response"])
6667

6768
@pytest.mark.skip(reason="Prism tests are disabled")
6869
@parametrize
@@ -74,7 +75,7 @@ def test_streaming_response_create(self, client: BrowserUse) -> None:
7475
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
7576

7677
task = response.parse()
77-
assert_matches_type(TaskView, task, path=["response"])
78+
assert_matches_type(TaskCreateResponse, task, path=["response"])
7879

7980
assert cast(Any, response.is_closed) is True
8081

@@ -366,7 +367,7 @@ async def test_method_create(self, async_client: AsyncBrowserUse) -> None:
366367
task = await async_client.tasks.create(
367368
task="x",
368369
)
369-
assert_matches_type(TaskView, task, path=["response"])
370+
assert_matches_type(TaskCreateResponse, task, path=["response"])
370371

371372
@pytest.mark.skip(reason="Prism tests are disabled")
372373
@parametrize
@@ -387,7 +388,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncBrowserUse
387388
secrets={"foo": "string"},
388389
structured_output_json="structuredOutputJson",
389390
)
390-
assert_matches_type(TaskView, task, path=["response"])
391+
assert_matches_type(TaskCreateResponse, task, path=["response"])
391392

392393
@pytest.mark.skip(reason="Prism tests are disabled")
393394
@parametrize
@@ -399,7 +400,7 @@ async def test_raw_response_create(self, async_client: AsyncBrowserUse) -> None:
399400
assert response.is_closed is True
400401
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
401402
task = await response.parse()
402-
assert_matches_type(TaskView, task, path=["response"])
403+
assert_matches_type(TaskCreateResponse, task, path=["response"])
403404

404405
@pytest.mark.skip(reason="Prism tests are disabled")
405406
@parametrize
@@ -411,7 +412,7 @@ async def test_streaming_response_create(self, async_client: AsyncBrowserUse) ->
411412
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
412413

413414
task = await response.parse()
414-
assert_matches_type(TaskView, task, path=["response"])
415+
assert_matches_type(TaskCreateResponse, task, path=["response"])
415416

416417
assert cast(Any, response.is_closed) is True
417418

0 commit comments

Comments
 (0)