pycityagent 2.0.0a63__cp311-cp311-macosx_11_0_arm64.whl → 2.0.0a64__cp311-cp311-macosx_11_0_arm64.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/cityagent/message_intercept.py +20 -4
- pycityagent/simulation/simulation.py +8 -1
- {pycityagent-2.0.0a63.dist-info → pycityagent-2.0.0a64.dist-info}/METADATA +1 -1
- {pycityagent-2.0.0a63.dist-info → pycityagent-2.0.0a64.dist-info}/RECORD +8 -8
- {pycityagent-2.0.0a63.dist-info → pycityagent-2.0.0a64.dist-info}/LICENSE +0 -0
- {pycityagent-2.0.0a63.dist-info → pycityagent-2.0.0a64.dist-info}/WHEEL +0 -0
- {pycityagent-2.0.0a63.dist-info → pycityagent-2.0.0a64.dist-info}/entry_points.txt +0 -0
- {pycityagent-2.0.0a63.dist-info → pycityagent-2.0.0a64.dist-info}/top_level.txt +0 -0
@@ -42,14 +42,23 @@ async def check_message(
|
|
42
42
|
|
43
43
|
|
44
44
|
class EdgeMessageBlock(MessageBlockBase):
|
45
|
+
def __init__(self, name: str = "", max_violation_time: int = 3) -> None:
|
46
|
+
super().__init__(name)
|
47
|
+
self.max_violation_time = max_violation_time
|
48
|
+
|
45
49
|
async def forward( # type:ignore
|
46
50
|
self,
|
47
51
|
from_uuid: str,
|
48
52
|
to_uuid: str,
|
49
53
|
msg: str,
|
54
|
+
violation_counts: dict[str, int],
|
50
55
|
black_list: list[tuple[str, str]],
|
51
56
|
):
|
52
|
-
if (
|
57
|
+
if (
|
58
|
+
(from_uuid, to_uuid) in set(black_list)
|
59
|
+
or (None, to_uuid) in set(black_list)
|
60
|
+
or (from_uuid, None) in set(black_list)
|
61
|
+
):
|
53
62
|
# 可选同时返回入队的信息(False,err) 如果只返回bool值则默认报错信息入队
|
54
63
|
return False
|
55
64
|
else:
|
@@ -59,7 +68,10 @@ class EdgeMessageBlock(MessageBlockBase):
|
|
59
68
|
llm_client=self.llm,
|
60
69
|
content=msg,
|
61
70
|
)
|
62
|
-
if
|
71
|
+
if (
|
72
|
+
not is_valid
|
73
|
+
and violation_counts[from_uuid] >= self.max_violation_time - 1
|
74
|
+
):
|
63
75
|
# 直接添加即可 在框架内部的异步锁保证不会冲突
|
64
76
|
black_list.append((from_uuid, to_uuid))
|
65
77
|
return is_valid
|
@@ -78,7 +90,11 @@ class PointMessageBlock(MessageBlockBase):
|
|
78
90
|
violation_counts: dict[str, int],
|
79
91
|
black_list: list[tuple[str, str]],
|
80
92
|
):
|
81
|
-
if (
|
93
|
+
if (
|
94
|
+
(from_uuid, to_uuid) in set(black_list)
|
95
|
+
or (None, to_uuid) in set(black_list)
|
96
|
+
or (from_uuid, None) in set(black_list)
|
97
|
+
):
|
82
98
|
# 可选同时返回入队的信息(False,err) 如果只返回bool值则默认报错信息入队
|
83
99
|
return False
|
84
100
|
else:
|
@@ -94,7 +110,7 @@ class PointMessageBlock(MessageBlockBase):
|
|
94
110
|
and violation_counts[from_uuid] >= self.max_violation_time - 1
|
95
111
|
):
|
96
112
|
# 直接添加即可 在框架内部的异步锁保证不会冲突
|
97
|
-
black_list.append((from_uuid,
|
113
|
+
black_list.append((from_uuid, None)) # type:ignore
|
98
114
|
return is_valid
|
99
115
|
|
100
116
|
|
@@ -283,7 +283,14 @@ class AgentSimulation:
|
|
283
283
|
}
|
284
284
|
_interceptor_blocks = [PointMessageBlock(**_kwargs)]
|
285
285
|
elif _mode == "edge":
|
286
|
-
_kwargs = {
|
286
|
+
_kwargs = {
|
287
|
+
k: v
|
288
|
+
for k, v in _intercept_config.items()
|
289
|
+
if k
|
290
|
+
in {
|
291
|
+
"max_violation_time",
|
292
|
+
}
|
293
|
+
}
|
287
294
|
_interceptor_blocks = [EdgeMessageBlock(**_kwargs)]
|
288
295
|
else:
|
289
296
|
raise ValueError(f"Unsupported interception mode `{_mode}!`")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pycityagent
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.0a64
|
4
4
|
Summary: LLM-based city environment agent building library
|
5
5
|
Author-email: Yuwei Yan <pinkgranite86@gmail.com>, Junbo Yan <yanjb20thu@gmali.com>, Jun Zhang <zhangjun990222@gmali.com>
|
6
6
|
License: MIT License
|
@@ -22,7 +22,7 @@ pycityagent/memory/utils.py,sha256=oJWLdPeJy_jcdKcDTo9JAH9kDZhqjoQhhv_zT9qWC0w,8
|
|
22
22
|
pycityagent/memory/const.py,sha256=6zpJPJXWoH9-yf4RARYYff586agCoud9BRn7sPERB1g,932
|
23
23
|
pycityagent/memory/faiss_query.py,sha256=V3rIw6d1_xcpNqZBbAYz3qfjVNE7NfJ7xOS5SibPtVU,13180
|
24
24
|
pycityagent/memory/state.py,sha256=TYItiyDtehMEQaSBN7PpNrnNxdDM5jGppr9R9Ufv3kA,5134
|
25
|
-
pycityagent/simulation/simulation.py,sha256=
|
25
|
+
pycityagent/simulation/simulation.py,sha256=dt1AHJX1xXjVYJwNKc2bDBsP0NV-EBCEL0vjrQgHnlo,35796
|
26
26
|
pycityagent/simulation/__init__.py,sha256=P5czbcg2d8S0nbbnsQXFIhwzO4CennAhZM8OmKvAeYw,194
|
27
27
|
pycityagent/simulation/agentgroup.py,sha256=V-ChLJtJUWJZnmTGllXqGk4XW4iDz9h3V89RgW0e4gg,31376
|
28
28
|
pycityagent/simulation/storage/pg.py,sha256=xRshSOGttW-p0re0fNBOjOpb-nQ5msIE2LsdT79_E_Y,8425
|
@@ -82,7 +82,7 @@ pycityagent/cityagent/firmagent.py,sha256=UVlNN0lpa4cC4PZVqYzQhbc5VJ2oGsA1731mhb
|
|
82
82
|
pycityagent/cityagent/nbsagent.py,sha256=WIXW__6dZ5IrqBqDCjvGbrCshpXzuFRV3Ww6gkYw7p4,4387
|
83
83
|
pycityagent/cityagent/initial.py,sha256=7hgCt_tGdnVTXGfEQOn1GTW5dAs1b-ru_FwXxRLI6tM,4549
|
84
84
|
pycityagent/cityagent/societyagent.py,sha256=2J2LWiEHie-NXDQAOBBe_dmb9Zk8mJsLB2SY820W6Ng,20441
|
85
|
-
pycityagent/cityagent/message_intercept.py,sha256=
|
85
|
+
pycityagent/cityagent/message_intercept.py,sha256=1YMOs6-6bbAaTt7RfMn-ALVIcp0frHN7oqGUkWRy5xE,4519
|
86
86
|
pycityagent/cityagent/governmentagent.py,sha256=HJLuhvEmllu_1KnFEJsYCIasaBJT0BV9Cn_4Y2QGPqg,2791
|
87
87
|
pycityagent/cityagent/blocks/dispatcher.py,sha256=mEa1r3tRS3KI1BMZR_w_sbUGzOj6aUJuiUrsHv1n2n0,2943
|
88
88
|
pycityagent/cityagent/blocks/needs_block.py,sha256=s8LikgtKORfo_Sw9SQ5_3biNPTof15QuUs4cDynXCyM,15332
|
@@ -97,9 +97,9 @@ pycityagent/cityagent/blocks/mobility_block.py,sha256=xWbARMfJ3-6fddrW3VOUKJrXfM
|
|
97
97
|
pycityagent/survey/models.py,sha256=YE50UUt5qJ0O_lIUsSY6XFCGUTkJVNu_L1gAhaCJ2fs,3546
|
98
98
|
pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
|
99
99
|
pycityagent/survey/manager.py,sha256=S5IkwTdelsdtZETChRcfCEczzwSrry_Fly9MY4s3rbk,1681
|
100
|
-
pycityagent-2.0.
|
101
|
-
pycityagent-2.0.
|
102
|
-
pycityagent-2.0.
|
103
|
-
pycityagent-2.0.
|
104
|
-
pycityagent-2.0.
|
105
|
-
pycityagent-2.0.
|
100
|
+
pycityagent-2.0.0a64.dist-info/RECORD,,
|
101
|
+
pycityagent-2.0.0a64.dist-info/LICENSE,sha256=n2HPXiupinpyHMnIkbCf3OTYd3KMqbmldu1e7av0CAU,1084
|
102
|
+
pycityagent-2.0.0a64.dist-info/WHEEL,sha256=NW1RskY9zow1Y68W-gXg0oZyBRAugI1JHywIzAIai5o,109
|
103
|
+
pycityagent-2.0.0a64.dist-info/entry_points.txt,sha256=BZcne49AAIFv-hawxGnPbblea7X3MtAtoPyDX8L4OC4,132
|
104
|
+
pycityagent-2.0.0a64.dist-info/top_level.txt,sha256=yOmeu6cSXmiUtScu53a3s0p7BGtLMaV0aff83EHCTic,43
|
105
|
+
pycityagent-2.0.0a64.dist-info/METADATA,sha256=Y5jk3ZxwATSr1K6QdN8hLQV-XUhcMNtPRJiXNDdniC4,9110
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|