goose-py 0.7.2__py3-none-any.whl → 0.8.0__py3-none-any.whl
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.
goose/_internal/state.py
CHANGED
@@ -61,6 +61,13 @@ class NodeState[ResultT: Result](BaseModel):
|
|
61
61
|
self.conversation.user_messages.append(message)
|
62
62
|
return self
|
63
63
|
|
64
|
+
def edit_last_result(self, *, result: ResultT) -> Self:
|
65
|
+
if len(self.conversation.result_messages) == 0:
|
66
|
+
raise Honk("Node awaiting response, has no result")
|
67
|
+
|
68
|
+
self.conversation.result_messages[-1] = result
|
69
|
+
return self
|
70
|
+
|
64
71
|
def undo(self) -> Self:
|
65
72
|
self.conversation.undo()
|
66
73
|
return self
|
@@ -119,7 +126,7 @@ class FlowRun:
|
|
119
126
|
self._flow_args = args
|
120
127
|
self._flow_kwargs = kwargs
|
121
128
|
|
122
|
-
def
|
129
|
+
def upsert_node_state(self, node_state: NodeState[Any], /) -> None:
|
123
130
|
key = (node_state.task_name, node_state.index)
|
124
131
|
self._node_states[key] = node_state.model_dump_json()
|
125
132
|
|
goose/_internal/task.py
CHANGED
@@ -43,7 +43,7 @@ class Task[**P, R: Result]:
|
|
43
43
|
else:
|
44
44
|
return state.result
|
45
45
|
|
46
|
-
async def
|
46
|
+
async def refine(
|
47
47
|
self,
|
48
48
|
*,
|
49
49
|
user_message: UserMessage,
|
@@ -59,21 +59,27 @@ class Task[**P, R: Result]:
|
|
59
59
|
|
60
60
|
result = await self.__adapt(conversation=node_state.conversation, agent=flow_run.agent)
|
61
61
|
node_state.add_result(result=result)
|
62
|
-
flow_run.
|
62
|
+
flow_run.upsert_node_state(node_state)
|
63
63
|
|
64
64
|
return result
|
65
65
|
|
66
|
+
def edit(self, *, result: R, index: int = 0) -> None:
|
67
|
+
flow_run = self.__get_current_flow_run()
|
68
|
+
node_state = flow_run.get(task=self, index=index)
|
69
|
+
node_state.edit_last_result(result=result)
|
70
|
+
flow_run.upsert_node_state(node_state)
|
71
|
+
|
66
72
|
def undo(self, *, index: int = 0) -> None:
|
67
73
|
flow_run = self.__get_current_flow_run()
|
68
74
|
node_state = flow_run.get(task=self, index=index)
|
69
75
|
node_state.undo()
|
70
|
-
flow_run.
|
76
|
+
flow_run.upsert_node_state(node_state)
|
71
77
|
|
72
78
|
async def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R:
|
73
79
|
flow_run = self.__get_current_flow_run()
|
74
80
|
node_state = flow_run.get_next(task=self)
|
75
81
|
result = await self.generate(node_state, *args, **kwargs)
|
76
|
-
flow_run.
|
82
|
+
flow_run.upsert_node_state(node_state)
|
77
83
|
return result
|
78
84
|
|
79
85
|
async def __adapt(self, *, conversation: Conversation[R], agent: Agent) -> R:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: goose-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.8.0
|
4
4
|
Summary: A tool for AI workflows based on human-computer collaboration and structured output.
|
5
5
|
Author-email: Nash Taylor <nash@chelle.ai>, Joshua Cook <joshua@chelle.ai>, Michael Sankur <michael@chelle.ai>
|
6
6
|
Requires-Python: >=3.12
|
@@ -8,11 +8,11 @@ goose/_internal/agent.py,sha256=l0pKfShovrs238sKAr-zubtcacYm82TGwQHcBWVJm2g,5875
|
|
8
8
|
goose/_internal/conversation.py,sha256=1OZQ_N6QZE7L_ZpXG2bjoWkVQ-G7h0JvKkqswmQWG58,1202
|
9
9
|
goose/_internal/flow.py,sha256=KGT6NpkMY8q_N1yKwWrxfTbhwcu5AwdHtgCPqCdL3F8,3266
|
10
10
|
goose/_internal/result.py,sha256=-eZJn-2sPo7rHZ38Sz6IAHXqiJ-Ss39esEoFGimJEBI,155
|
11
|
-
goose/_internal/state.py,sha256=
|
11
|
+
goose/_internal/state.py,sha256=mXwSkTQq5Y6xLSRgvfUPILmK5nbiA-sp8Nunjcra5n4,6045
|
12
12
|
goose/_internal/store.py,sha256=vIxPIpechF_lEQlQ8JT1NDySDfHe3-eMHEWeTqVbscg,946
|
13
|
-
goose/_internal/task.py,sha256=
|
13
|
+
goose/_internal/task.py,sha256=gKOheVs4xCvqDLazzgp5Ok6bLz-MuywViiEXWNOQ_gQ,5186
|
14
14
|
goose/_internal/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
goose/_internal/types/agent.py,sha256=rNVt2gEr_m4_8tGFgcdichpPp8xhOS5GY0kN2C4tiE8,2153
|
16
|
-
goose_py-0.
|
17
|
-
goose_py-0.
|
18
|
-
goose_py-0.
|
16
|
+
goose_py-0.8.0.dist-info/METADATA,sha256=bg599aFGIn1jHNInnQ36ie5bF-2sgQMEhvV2naYZqi8,441
|
17
|
+
goose_py-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
18
|
+
goose_py-0.8.0.dist-info/RECORD,,
|
File without changes
|