Skip to content

Commit 1f03f90

Browse files
IDs for ReasoningPart and AssistantMessage (#34)
* feat: IDs for reasoning parts and assistant messages * fix: make view_range List * version++ --------- Co-authored-by: Justin Sun <[email protected]>
1 parent ca58b5c commit 1f03f90

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "scrapybara"
33

44
[tool.poetry]
55
name = "scrapybara"
6-
version = "2.3.2"
6+
version = "2.3.3"
77
description = ""
88
readme = "README.md"
99
authors = []

src/scrapybara/client.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,8 @@ def act(
17171717
([TextPart(text=step.text)] if step.text else [])
17181718
+ (step.reasoning_parts if step.reasoning_parts else [])
17191719
+ (step.tool_calls or [])
1720-
)
1720+
),
1721+
response_id=step.response_id
17211722
)
17221723
result_messages.append(assistant_msg)
17231724
if step.tool_results:
@@ -1874,6 +1875,7 @@ def act_stream(
18741875
tool_calls=tool_calls if tool_calls else None,
18751876
finish_reason=act_response.finish_reason,
18761877
usage=act_response.usage,
1878+
response_id=act_response.message.response_id if act_response.message.response_id else None
18771879
)
18781880

18791881
# Check if there are tool calls
@@ -2135,7 +2137,8 @@ async def act(
21352137
([TextPart(text=step.text)] if step.text else [])
21362138
+ (step.reasoning_parts if step.reasoning_parts else [])
21372139
+ (step.tool_calls or [])
2138-
)
2140+
),
2141+
response_id=step.response_id
21392142
)
21402143
result_messages.append(assistant_msg)
21412144
if step.tool_results:
@@ -2292,6 +2295,7 @@ async def act_stream(
22922295
tool_calls=tool_calls if tool_calls else None,
22932296
finish_reason=act_response.finish_reason,
22942297
usage=act_response.usage,
2298+
response_id=act_response.message.response_id if act_response.message.response_id else None
22952299
)
22962300

22972301
# Check if there are tool calls

src/scrapybara/core/client_wrapper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]:
1616
headers: typing.Dict[str, str] = {
1717
"X-Fern-Language": "Python",
1818
"X-Fern-SDK-Name": "scrapybara",
19-
"X-Fern-SDK-Version": "2.3.2",
19+
"X-Fern-SDK-Version": "2.3.3",
2020
}
2121
headers["x-api-key"] = self.api_key
2222
return headers

src/scrapybara/tools/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List, Optional, Tuple
1+
from typing import Any, List, Optional
22
from pydantic import BaseModel, Field
33

44
from ..types import Action, Button, ClickMouseActionClickType, Tool
@@ -121,7 +121,7 @@ class EditToolParameters(BaseModel):
121121
file_text: Optional[str] = Field(
122122
None, description="File content for create command"
123123
)
124-
view_range: Optional[Tuple[int, int]] = Field(
124+
view_range: Optional[List[int]] = Field(
125125
None, description="Line range for view command"
126126
)
127127
old_str: Optional[str] = Field(

src/scrapybara/types/act.py

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ToolResultPart(BaseModel):
3333

3434
class ReasoningPart(BaseModel):
3535
type: Literal["reasoning"] = "reasoning"
36+
id: Optional[str] = None
3637
reasoning: str
3738
signature: Optional[str] = None
3839
instructions: Optional[str] = None
@@ -45,6 +46,7 @@ class UserMessage(BaseModel):
4546
class AssistantMessage(BaseModel):
4647
role: Literal["assistant"] = "assistant"
4748
content: List[Union[TextPart, ToolCallPart, ReasoningPart]]
49+
response_id: Optional[str] = None
4850

4951

5052
class ToolMessage(BaseModel):
@@ -88,6 +90,7 @@ class SingleActResponse(BaseModel):
8890
# Step definition
8991
class Step(BaseModel):
9092
text: str
93+
response_id: Optional[str] = None
9194
reasoning_parts: Optional[List[ReasoningPart]] = None
9295
tool_calls: Optional[List[ToolCallPart]] = None
9396
tool_results: Optional[List[ToolResultPart]] = None

0 commit comments

Comments
 (0)