goose-py 0.3.0__tar.gz → 0.3.1__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.
- {goose_py-0.3.0 → goose_py-0.3.1}/PKG-INFO +1 -1
- {goose_py-0.3.0 → goose_py-0.3.1}/goose/agent.py +4 -4
- {goose_py-0.3.0 → goose_py-0.3.1}/goose/flow.py +21 -10
- {goose_py-0.3.0 → goose_py-0.3.1}/pyproject.toml +1 -1
- {goose_py-0.3.0 → goose_py-0.3.1}/README.md +0 -0
- {goose_py-0.3.0 → goose_py-0.3.1}/goose/__init__.py +0 -0
- {goose_py-0.3.0 → goose_py-0.3.1}/goose/errors.py +0 -0
- {goose_py-0.3.0 → goose_py-0.3.1}/goose/py.typed +0 -0
@@ -112,7 +112,7 @@ class AgentResponse[R: BaseModel](BaseModel):
|
|
112
112
|
}
|
113
113
|
|
114
114
|
response: R
|
115
|
-
|
115
|
+
run_id: str
|
116
116
|
flow_name: str
|
117
117
|
task_name: str
|
118
118
|
model: GeminiModel
|
@@ -149,11 +149,11 @@ class Agent:
|
|
149
149
|
self,
|
150
150
|
*,
|
151
151
|
flow_name: str,
|
152
|
-
|
152
|
+
run_id: str,
|
153
153
|
logger: Callable[[AgentResponse[Any]], Awaitable[None]] | None = None,
|
154
154
|
) -> None:
|
155
155
|
self.flow_name = flow_name
|
156
|
-
self.
|
156
|
+
self.run_id = run_id
|
157
157
|
self.logger = logger
|
158
158
|
|
159
159
|
async def __call__[R: BaseModel](
|
@@ -189,7 +189,7 @@ class Agent:
|
|
189
189
|
end_time = datetime.now()
|
190
190
|
agent_response = AgentResponse(
|
191
191
|
response=parsed_response,
|
192
|
-
|
192
|
+
run_id=self.run_id,
|
193
193
|
flow_name=self.flow_name,
|
194
194
|
task_name=task_name,
|
195
195
|
model=model,
|
@@ -122,12 +122,17 @@ class FlowRun:
|
|
122
122
|
def __init__(self) -> None:
|
123
123
|
self._node_states: dict[tuple[str, int], str] = {}
|
124
124
|
self._last_requested_indices: dict[str, int] = {}
|
125
|
-
self.
|
125
|
+
self._flow_name = ""
|
126
|
+
self._id = ""
|
126
127
|
self._agent: Agent | None = None
|
127
128
|
|
128
129
|
@property
|
129
|
-
def
|
130
|
-
return self.
|
130
|
+
def flow_name(self) -> str:
|
131
|
+
return self._flow_name
|
132
|
+
|
133
|
+
@property
|
134
|
+
def id(self) -> str:
|
135
|
+
return self._id
|
131
136
|
|
132
137
|
@property
|
133
138
|
def agent(self) -> Agent:
|
@@ -169,14 +174,16 @@ class FlowRun:
|
|
169
174
|
last_input_hash=0,
|
170
175
|
)
|
171
176
|
|
172
|
-
def start(self, *,
|
177
|
+
def start(self, *, flow_name: str, run_id: str) -> None:
|
173
178
|
self._last_requested_indices = {}
|
174
|
-
self.
|
175
|
-
self.
|
179
|
+
self._flow_name = flow_name
|
180
|
+
self._id = run_id
|
181
|
+
self._agent = Agent(flow_name=self.flow_name, run_id=self.id)
|
176
182
|
|
177
183
|
def end(self) -> None:
|
178
184
|
self._last_requested_indices = {}
|
179
|
-
self.
|
185
|
+
self._flow_name = ""
|
186
|
+
self._id = ""
|
180
187
|
self._agent = None
|
181
188
|
|
182
189
|
def dump(self) -> SerializedFlowRun:
|
@@ -226,14 +233,18 @@ class Flow[**P]:
|
|
226
233
|
return run
|
227
234
|
|
228
235
|
@contextmanager
|
229
|
-
def start_run(
|
230
|
-
|
236
|
+
def start_run(
|
237
|
+
self, *, run_id: str, preload: FlowRun | None = None
|
238
|
+
) -> Iterator[FlowRun]:
|
239
|
+
if preload is None:
|
231
240
|
run = FlowRun()
|
241
|
+
else:
|
242
|
+
run = preload
|
232
243
|
|
233
244
|
old_run = _current_flow_run.get()
|
234
245
|
_current_flow_run.set(run)
|
235
246
|
|
236
|
-
run.start(name=
|
247
|
+
run.start(flow_name=self.name, run_id=run_id)
|
237
248
|
yield run
|
238
249
|
run.end()
|
239
250
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|