smooth-py 0.3.0.dev20251009__tar.gz → 0.3.0.dev20251014__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of smooth-py might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: smooth-py
3
- Version: 0.3.0.dev20251009
3
+ Version: 0.3.0.dev20251014
4
4
  Summary:
5
5
  Author: Luca Pinchetti
6
6
  Author-email: luca@circlemind.co
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "smooth-py"
3
- version = "0.3.0.dev20251009"
3
+ version = "0.3.0.dev20251014"
4
4
  description = ""
5
5
  authors = [
6
6
  {name = "Luca Pinchetti",email = "luca@circlemind.co"}
@@ -113,12 +113,12 @@ class TaskRequest(BaseModel):
113
113
  return self.profile_id
114
114
 
115
115
  @session_id.setter
116
- def session_id(self, value):
116
+ def session_id(self, value: str | None):
117
117
  """(Deprecated) Sets the session ID."""
118
118
  warnings.warn("'session_id' is deprecated, use 'profile_id' instead", DeprecationWarning, stacklevel=2)
119
119
  self.profile_id = value
120
120
 
121
- def model_dump(self, **kwargs) -> dict[str, Any]:
121
+ def model_dump(self, **kwargs: Any) -> dict[str, Any]:
122
122
  """Dump model to dict, including deprecated session_id for retrocompatibility."""
123
123
  data = super().model_dump(**kwargs)
124
124
  # Add deprecated session_id field for retrocompatibility
@@ -151,12 +151,12 @@ class BrowserSessionRequest(BaseModel):
151
151
  return self.profile_id
152
152
 
153
153
  @session_id.setter
154
- def session_id(self, value):
154
+ def session_id(self, value: str | None):
155
155
  """(Deprecated) Sets the session ID."""
156
156
  warnings.warn("'session_id' is deprecated, use 'profile_id' instead", DeprecationWarning, stacklevel=2)
157
157
  self.profile_id = value
158
158
 
159
- def model_dump(self, **kwargs) -> dict[str, Any]:
159
+ def model_dump(self, **kwargs: Any) -> dict[str, Any]:
160
160
  """Dump model to dict, including deprecated session_id for retrocompatibility."""
161
161
  data = super().model_dump(**kwargs)
162
162
  # Add deprecated session_id field for retrocompatibility
@@ -188,7 +188,7 @@ class BrowserSessionResponse(BaseModel):
188
188
  return self.profile_id
189
189
 
190
190
  @session_id.setter
191
- def session_id(self, value):
191
+ def session_id(self, value: str):
192
192
  """(Deprecated) Sets the session ID."""
193
193
  warnings.warn("'session_id' is deprecated, use 'profile_id' instead", DeprecationWarning, stacklevel=2)
194
194
  self.profile_id = value
@@ -215,12 +215,12 @@ class BrowserProfilesResponse(BaseModel):
215
215
  return self.profile_ids
216
216
 
217
217
  @session_ids.setter
218
- def session_ids(self, value):
218
+ def session_ids(self, value: list[str]):
219
219
  """(Deprecated) Sets the session IDs."""
220
220
  warnings.warn("'session_ids' is deprecated, use 'profile_ids' instead", DeprecationWarning, stacklevel=2)
221
221
  self.profile_ids = value
222
222
 
223
- def model_dump(self, **kwargs) -> dict[str, Any]:
223
+ def model_dump(self, **kwargs: Any) -> dict[str, Any]:
224
224
  """Dump model to dict, including deprecated session_ids for retrocompatibility."""
225
225
  data = super().model_dump(**kwargs)
226
226
  # Add deprecated session_ids field for retrocompatibility
@@ -486,7 +486,7 @@ class SmoothClient(BaseClient):
486
486
  response_model: If provided, the schema describing the desired output structure.
487
487
  url: The starting URL for the task. If not provided, the agent will infer it from the task.
488
488
  metadata: A dictionary containing variables or parameters that will be passed to the agent.
489
- files: A dictionary of file names to their ids. These files will be passed to the agent.
489
+ files: A list of file ids to pass to the agent.
490
490
  agent: The agent to use for the task.
491
491
  max_steps: Maximum number of steps the agent can take (max 64).
492
492
  device: Device type for the task. Default is mobile.
@@ -510,7 +510,7 @@ class SmoothClient(BaseClient):
510
510
  """
511
511
  payload = TaskRequest(
512
512
  task=task,
513
- response_model=response_model.model_json_schema() if issubclass(response_model, BaseModel) else response_model,
513
+ response_model=response_model if isinstance(response_model, dict | None) else response_model.model_json_schema(),
514
514
  url=url,
515
515
  metadata=metadata,
516
516
  files=files,
@@ -686,7 +686,7 @@ class AsyncTaskHandle:
686
686
  await asyncio.sleep(poll_interval)
687
687
  raise TimeoutError(f"Task {self.id()} did not complete within {timeout} seconds.")
688
688
 
689
- async def live_url(self, interactive: bool = True, embed: bool = False, timeout: int | None = None):
689
+ async def live_url(self, interactive: bool = False, embed: bool = False, timeout: int | None = None):
690
690
  """Returns the live URL for the task."""
691
691
  if self._task_response and self._task_response.live_url:
692
692
  return _encode_url(self._task_response.live_url, interactive=interactive, embed=embed)
@@ -695,13 +695,13 @@ class AsyncTaskHandle:
695
695
  while timeout is None or (time.time() - start_time) < timeout:
696
696
  task_response = await self._client._get_task(self.id())
697
697
  self._task_response = task_response
698
- if task_response.live_url is not None:
698
+ if self._task_response.live_url:
699
699
  return _encode_url(self._task_response.live_url, interactive=interactive, embed=embed)
700
700
  await asyncio.sleep(1)
701
701
 
702
702
  raise TimeoutError(f"Live URL not available for task {self.id()}.")
703
703
 
704
- async def recording_url(self, timeout: int | None = None):
704
+ async def recording_url(self, timeout: int | None = None) -> str:
705
705
  """Returns the recording URL for the task."""
706
706
  if self._task_response and self._task_response.recording_url is not None:
707
707
  return self._task_response.recording_url
@@ -799,7 +799,7 @@ class SmoothAsyncClient(BaseClient):
799
799
  response_model: If provided, the schema describing the desired output structure.
800
800
  url: The starting URL for the task. If not provided, the agent will infer it from the task.
801
801
  metadata: A dictionary containing variables or parameters that will be passed to the agent.
802
- files: A dictionary of file names to their url or base64-encoded content to be used by the agent.
802
+ files: A list of file ids to pass to the agent.
803
803
  agent: The agent to use for the task.
804
804
  max_steps: Maximum number of steps the agent can take (max 64).
805
805
  device: Device type for the task. Default is mobile.
@@ -823,7 +823,7 @@ class SmoothAsyncClient(BaseClient):
823
823
  """
824
824
  payload = TaskRequest(
825
825
  task=task,
826
- response_model=response_model.model_json_schema() if issubclass(response_model, BaseModel) else response_model,
826
+ response_model=response_model if isinstance(response_model, dict | None) else response_model.model_json_schema(),
827
827
  url=url,
828
828
  metadata=metadata,
829
829
  files=files,
@@ -850,8 +850,8 @@ class SmoothAsyncClient(BaseClient):
850
850
  """Opens an interactive browser instance asynchronously.
851
851
 
852
852
  Args:
853
+ profile_id: The profile ID to use for the session. If None, a new profile will be created.
853
854
  session_id: (Deprecated, now `profile_id`) The session ID to associate with the browser.
854
- profile_id: The profile ID to associate with the browser.
855
855
  live_view: Whether to enable live view for the session.
856
856
 
857
857
  Returns:
@@ -936,11 +936,12 @@ class SmoothAsyncClient(BaseClient):
936
936
  if name is None:
937
937
  raise ValueError("File name must be provided or the file object must have a 'name' attribute.")
938
938
 
939
- files = {"file": (Path(name).name, file)}
940
939
  if purpose:
941
940
  data = {"file_purpose": purpose}
942
941
  else:
943
942
  data = None
943
+
944
+ files = {"file": (Path(name).name, file)}
944
945
  response = await self._client.post(f"{self.base_url}/file", files=files, data=data)
945
946
  data = self._handle_response(response)
946
947
  return UploadFileResponse(**data["r"])