Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "scrapybara"

[tool.poetry]
name = "scrapybara"
version = "2.3.2"
version = "2.3.3"
description = ""
readme = "README.md"
authors = []
Expand Down
8 changes: 6 additions & 2 deletions src/scrapybara/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,8 @@ def act(
([TextPart(text=step.text)] if step.text else [])
+ (step.reasoning_parts if step.reasoning_parts else [])
+ (step.tool_calls or [])
)
),
response_id=step.response_id
)
result_messages.append(assistant_msg)
if step.tool_results:
Expand Down Expand Up @@ -1874,6 +1875,7 @@ def act_stream(
tool_calls=tool_calls if tool_calls else None,
finish_reason=act_response.finish_reason,
usage=act_response.usage,
response_id=act_response.message.response_id if act_response.message.response_id else None
)

# Check if there are tool calls
Expand Down Expand Up @@ -2135,7 +2137,8 @@ async def act(
([TextPart(text=step.text)] if step.text else [])
+ (step.reasoning_parts if step.reasoning_parts else [])
+ (step.tool_calls or [])
)
),
response_id=step.response_id
)
result_messages.append(assistant_msg)
if step.tool_results:
Expand Down Expand Up @@ -2292,6 +2295,7 @@ async def act_stream(
tool_calls=tool_calls if tool_calls else None,
finish_reason=act_response.finish_reason,
usage=act_response.usage,
response_id=act_response.message.response_id if act_response.message.response_id else None
)

# Check if there are tool calls
Expand Down
2 changes: 1 addition & 1 deletion src/scrapybara/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "2.3.2",
"X-Fern-SDK-Version": "2.3.3",
}
headers["x-api-key"] = self.api_key
return headers
Expand Down
4 changes: 2 additions & 2 deletions src/scrapybara/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List, Optional, Tuple
from typing import Any, List, Optional
from pydantic import BaseModel, Field

from ..types import Action, Button, ClickMouseActionClickType, Tool
Expand Down Expand Up @@ -121,7 +121,7 @@ class EditToolParameters(BaseModel):
file_text: Optional[str] = Field(
None, description="File content for create command"
)
view_range: Optional[Tuple[int, int]] = Field(
view_range: Optional[List[int]] = Field(
None, description="Line range for view command"
)
old_str: Optional[str] = Field(
Expand Down
3 changes: 3 additions & 0 deletions src/scrapybara/types/act.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ToolResultPart(BaseModel):

class ReasoningPart(BaseModel):
type: Literal["reasoning"] = "reasoning"
id: Optional[str] = None
reasoning: str
signature: Optional[str] = None
instructions: Optional[str] = None
Expand All @@ -45,6 +46,7 @@ class UserMessage(BaseModel):
class AssistantMessage(BaseModel):
role: Literal["assistant"] = "assistant"
content: List[Union[TextPart, ToolCallPart, ReasoningPart]]
response_id: Optional[str] = None


class ToolMessage(BaseModel):
Expand Down Expand Up @@ -88,6 +90,7 @@ class SingleActResponse(BaseModel):
# Step definition
class Step(BaseModel):
text: str
response_id: Optional[str] = None
reasoning_parts: Optional[List[ReasoningPart]] = None
tool_calls: Optional[List[ToolCallPart]] = None
tool_results: Optional[List[ToolResultPart]] = None
Expand Down
Loading