pycityagent 2.0.0a36__py3-none-any.whl → 2.0.0a37__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/agent.py CHANGED
@@ -688,6 +688,28 @@ class InstitutionAgent(Agent):
688
688
  _id = random.randint(100000, 999999)
689
689
  self._agent_id = _id
690
690
  self.memory.set_agent_id(_id)
691
+ map_header = self.simulator.map.header
692
+ # TODO: remove random position assignment
693
+ await self.memory.update(
694
+ "position",
695
+ {
696
+ "xy_position": {
697
+ "x": float(
698
+ random.randrange(
699
+ start=int(map_header["west"]),
700
+ stop=int(map_header["east"]),
701
+ )
702
+ ),
703
+ "y": float(
704
+ random.randrange(
705
+ start=int(map_header["south"]),
706
+ stop=int(map_header["north"]),
707
+ )
708
+ ),
709
+ }
710
+ },
711
+ protect_llm_read_only_fields=False,
712
+ )
691
713
  await self.memory.update("id", _id, protect_llm_read_only_fields=False)
692
714
  try:
693
715
  await self._economy_client.remove_orgs([self._agent_id])
@@ -134,8 +134,8 @@ class AgentGroup:
134
134
  agent.memory.set_embedding_model(self.embedding_model)
135
135
 
136
136
  async def __aexit__(self, exc_type, exc_value, traceback):
137
- self.message_dispatch_task.cancel()
138
- await asyncio.gather(self.message_dispatch_task, return_exceptions=True)
137
+ self.message_dispatch_task.cancel() # type: ignore
138
+ await asyncio.gather(self.message_dispatch_task, return_exceptions=True) # type: ignore
139
139
 
140
140
  async def init_agents(self):
141
141
  logger.debug(f"-----Initializing Agents in AgentGroup {self._uuid} ...")
@@ -418,8 +418,11 @@ class AgentGroup:
418
418
  # institution
419
419
  for agent in self.agents:
420
420
  _date_time = datetime.now(timezone.utc)
421
+ position = await agent.memory.get("position")
422
+ x = position["xy_position"]["x"]
423
+ y = position["xy_position"]["y"]
424
+ lng, lat = self.projector(x, y, inverse=True)
421
425
  # ATTENTION: no valid position for an institution
422
- lng, lat = -1, -1
423
426
  parent_id = -1
424
427
  try:
425
428
  nominal_gdp = await agent.memory.get("nominal_gdp")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycityagent
3
- Version: 2.0.0a36
3
+ Version: 2.0.0a37
4
4
  Summary: LLM-based城市环境agent构建库
5
5
  License: MIT
6
6
  Author: Yuwei Yan
@@ -1,5 +1,5 @@
1
1
  pycityagent/__init__.py,sha256=fv0mzNGbHBF6m550yYqnuUpB8iQPWS-7EatYRK7DO4s,693
2
- pycityagent/agent.py,sha256=r1uG4ib6fAmqzZXqGUiwswYdIOS8ybTFdbVqJWjhwuI,29047
2
+ pycityagent/agent.py,sha256=_klNenWHt_AB6go57pjLqw4TcGW6AjoyZTUkmADT6q4,29910
3
3
  pycityagent/economy/__init__.py,sha256=aonY4WHnx-6EGJ4WKrx4S-2jAkYNLtqUA04jp6q8B7w,75
4
4
  pycityagent/economy/econ_client.py,sha256=GuHK9ZBnhqW3Z7F8ViDJn_iN73yOBbbwFyJv1wLEBDk,12211
5
5
  pycityagent/environment/__init__.py,sha256=awHxlOud-btWbk0FCS4RmGJ13W84oVCkbGfcrhKqihA,240
@@ -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=mZXznSf7VEHNjU0KM5TuPB-Z09DqMZ6VeQib7ciTLpo,23914
53
+ pycityagent/simulation/agentgroup.py,sha256=e6K388TzfwBDyZmfPAxLl_Z1eKcyEn3qgvSlbyw-ggI,24158
54
54
  pycityagent/simulation/simulation.py,sha256=OVflF_Z_kZfE6c4z_6tHTGD53jq89Hewg8Yc5KflRI0,23008
55
55
  pycityagent/simulation/storage/pg.py,sha256=qGrYzJIAzjv8-d3-cle0rY0AN6XB6MgnHkFLBoLmKWU,7251
56
56
  pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
@@ -70,6 +70,6 @@ pycityagent/workflow/block.py,sha256=C2aWdVRffb3LknP955GvPcBMsm3VPXN9ZuAtCgITFTo
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.0a36.dist-info/METADATA,sha256=aJH2tcaEccrMdJRwjgNmRS8bYla-E_TTMh1bgevmHEM,8046
74
- pycityagent-2.0.0a36.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
75
- pycityagent-2.0.0a36.dist-info/RECORD,,
73
+ pycityagent-2.0.0a37.dist-info/METADATA,sha256=ibC4tsZ7FUxY1TK9t5sZGSe8sXE47C4ocnbd7QxSpGw,8046
74
+ pycityagent-2.0.0a37.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
75
+ pycityagent-2.0.0a37.dist-info/RECORD,,