pycityagent 2.0.0a32__py3-none-any.whl → 2.0.0a34__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.
- pycityagent/simulation/agentgroup.py +4 -11
- pycityagent/workflow/block.py +49 -3
- {pycityagent-2.0.0a32.dist-info → pycityagent-2.0.0a34.dist-info}/METADATA +1 -1
- {pycityagent-2.0.0a32.dist-info → pycityagent-2.0.0a34.dist-info}/RECORD +5 -5
- {pycityagent-2.0.0a32.dist-info → pycityagent-2.0.0a34.dist-info}/WHEEL +0 -0
@@ -411,19 +411,12 @@ class AgentGroup:
|
|
411
411
|
}
|
412
412
|
_statuses_time_list.append((_status_dict, _date_time))
|
413
413
|
else:
|
414
|
+
# institution
|
414
415
|
for agent in self.agents:
|
415
416
|
_date_time = datetime.now(timezone.utc)
|
416
|
-
position
|
417
|
-
|
418
|
-
|
419
|
-
lng, lat = self.projector(x, y, inverse=True)
|
420
|
-
if "aoi_position" in position:
|
421
|
-
parent_id = position["aoi_position"]["aoi_id"]
|
422
|
-
elif "lane_position" in position:
|
423
|
-
parent_id = position["lane_position"]["lane_id"]
|
424
|
-
else:
|
425
|
-
# BUG: 需要处理
|
426
|
-
parent_id = -1
|
417
|
+
# ATTENTION: no valid position for an institution
|
418
|
+
lng, lat = -1, -1
|
419
|
+
parent_id = -1
|
427
420
|
try:
|
428
421
|
nominal_gdp = await agent.memory.get("nominal_gdp")
|
429
422
|
except:
|
pycityagent/workflow/block.py
CHANGED
@@ -148,9 +148,9 @@ class Block:
|
|
148
148
|
trigger: Optional[EventTrigger] = None,
|
149
149
|
):
|
150
150
|
self.name = name
|
151
|
-
self.
|
152
|
-
self.
|
153
|
-
self.
|
151
|
+
self._llm = llm
|
152
|
+
self._memory = memory
|
153
|
+
self._simulator = simulator
|
154
154
|
# 如果传入trigger,将block注入到trigger中并立即初始化
|
155
155
|
if trigger is not None:
|
156
156
|
trigger.block = self
|
@@ -163,3 +163,49 @@ class Block:
|
|
163
163
|
To be overridden by specific block implementations.
|
164
164
|
"""
|
165
165
|
raise NotImplementedError("Subclasses should implement this method")
|
166
|
+
|
167
|
+
@property
|
168
|
+
def llm(
|
169
|
+
self,
|
170
|
+
) -> LLM:
|
171
|
+
if self._llm is None:
|
172
|
+
raise RuntimeError(f"LLM access before assignment, please `set_llm` first!")
|
173
|
+
return self._llm
|
174
|
+
|
175
|
+
@property
|
176
|
+
def memory(
|
177
|
+
self,
|
178
|
+
) -> Memory:
|
179
|
+
if self._memory is None:
|
180
|
+
raise RuntimeError(
|
181
|
+
f"Memory access before assignment, please `set_memory` first!"
|
182
|
+
)
|
183
|
+
return self._memory
|
184
|
+
|
185
|
+
@property
|
186
|
+
def simulator(
|
187
|
+
self,
|
188
|
+
) -> Simulator:
|
189
|
+
if self._simulator is None:
|
190
|
+
raise RuntimeError(
|
191
|
+
f"Simulator access before assignment, please `set_simulator` first!"
|
192
|
+
)
|
193
|
+
return self._simulator
|
194
|
+
|
195
|
+
def set_llm_client(self, llm: LLM):
|
196
|
+
"""
|
197
|
+
Set the llm_client of the block.
|
198
|
+
"""
|
199
|
+
self._llm = llm
|
200
|
+
|
201
|
+
def set_simulator(self, simulator: Simulator):
|
202
|
+
"""
|
203
|
+
Set the simulator of the block.
|
204
|
+
"""
|
205
|
+
self._simulator = simulator
|
206
|
+
|
207
|
+
def set_memory(self, memory: Memory):
|
208
|
+
"""
|
209
|
+
Set the memory of the block.
|
210
|
+
"""
|
211
|
+
self._memory = memory
|
@@ -50,7 +50,7 @@ pycityagent/metrics/__init__.py,sha256=X08PaBbGVAd7_PRGLREXWxaqm7nS82WBQpD1zvQzc
|
|
50
50
|
pycityagent/metrics/mlflow_client.py,sha256=g_tHxWkWTDijtbGL74-HmiYzWVKb1y8-w12QrY9jL30,4449
|
51
51
|
pycityagent/metrics/utils/const.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
52
|
pycityagent/simulation/__init__.py,sha256=P5czbcg2d8S0nbbnsQXFIhwzO4CennAhZM8OmKvAeYw,194
|
53
|
-
pycityagent/simulation/agentgroup.py,sha256=
|
53
|
+
pycityagent/simulation/agentgroup.py,sha256=QwVbgqKYp42_wRS3K6C6E7Aq8cYBacabHmXIKRaxYyw,23955
|
54
54
|
pycityagent/simulation/simulation.py,sha256=9kkdgXSEOAN8wiewVFyORksti4IdVNU0opObV6ZYa9k,23344
|
55
55
|
pycityagent/simulation/storage/pg.py,sha256=qGrYzJIAzjv8-d3-cle0rY0AN6XB6MgnHkFLBoLmKWU,7251
|
56
56
|
pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
|
@@ -66,10 +66,10 @@ pycityagent/utils/parsers/parser_base.py,sha256=KBKO4zLZPNdGjPAGqIus8LseZ8W3Tlt2
|
|
66
66
|
pycityagent/utils/pg_query.py,sha256=h5158xcrxjUTR0nKwAaG1neFfTHPbN5guLmaXpC8yvs,1918
|
67
67
|
pycityagent/utils/survey_util.py,sha256=Be9nptmu2JtesFNemPgORh_2GsN7rcDYGQS9Zfvc5OI,2169
|
68
68
|
pycityagent/workflow/__init__.py,sha256=QNkUV-9mACMrR8c0cSKna2gC1mMZdxXbxWzjE-Uods0,621
|
69
|
-
pycityagent/workflow/block.py,sha256=
|
69
|
+
pycityagent/workflow/block.py,sha256=C2aWdVRffb3LknP955GvPcBMsm3VPXN9ZuAtCgITFTo,7181
|
70
70
|
pycityagent/workflow/prompt.py,sha256=6jI0Rq54JLv3-IXqZLYug62vse10wTI83xvf4ZX42nk,2929
|
71
71
|
pycityagent/workflow/tool.py,sha256=xADxhNgVsjNiMxlhdwn3xGUstFOkLEG8P67ez8VmwSI,8555
|
72
72
|
pycityagent/workflow/trigger.py,sha256=Df-MOBEDWBbM-v0dFLQLXteLsipymT4n8vqexmK2GiQ,5643
|
73
|
-
pycityagent-2.0.
|
74
|
-
pycityagent-2.0.
|
75
|
-
pycityagent-2.0.
|
73
|
+
pycityagent-2.0.0a34.dist-info/METADATA,sha256=za2dplTaxTwxYovvgF_HioNdjMXvmpTdg6v4Nx8Q2vI,8033
|
74
|
+
pycityagent-2.0.0a34.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
75
|
+
pycityagent-2.0.0a34.dist-info/RECORD,,
|
File without changes
|