pycityagent 2.0.0a52__cp310-cp310-macosx_11_0_arm64.whl → 2.0.0a53__cp310-cp310-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/agent/agent.py +48 -62
- pycityagent/agent/agent_base.py +66 -53
- pycityagent/cityagent/bankagent.py +5 -7
- pycityagent/cityagent/blocks/__init__.py +0 -2
- pycityagent/cityagent/blocks/cognition_block.py +149 -172
- pycityagent/cityagent/blocks/economy_block.py +90 -129
- pycityagent/cityagent/blocks/mobility_block.py +56 -29
- pycityagent/cityagent/blocks/needs_block.py +163 -145
- pycityagent/cityagent/blocks/other_block.py +17 -9
- pycityagent/cityagent/blocks/plan_block.py +44 -56
- pycityagent/cityagent/blocks/social_block.py +70 -51
- pycityagent/cityagent/blocks/utils.py +2 -0
- pycityagent/cityagent/firmagent.py +6 -7
- pycityagent/cityagent/governmentagent.py +7 -9
- pycityagent/cityagent/memory_config.py +48 -48
- pycityagent/cityagent/nbsagent.py +6 -29
- pycityagent/cityagent/societyagent.py +204 -119
- pycityagent/environment/sim/client.py +10 -1
- pycityagent/environment/sim/clock_service.py +2 -2
- pycityagent/environment/sim/pause_service.py +61 -0
- pycityagent/environment/simulator.py +17 -12
- pycityagent/llm/embeddings.py +0 -24
- pycityagent/memory/faiss_query.py +29 -26
- pycityagent/memory/memory.py +720 -272
- pycityagent/pycityagent-sim +0 -0
- pycityagent/simulation/agentgroup.py +92 -99
- pycityagent/simulation/simulation.py +115 -40
- pycityagent/tools/tool.py +7 -9
- pycityagent/workflow/block.py +11 -4
- {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/METADATA +1 -1
- {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/RECORD +35 -35
- pycityagent/cityagent/blocks/time_block.py +0 -116
- {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/LICENSE +0 -0
- {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/WHEEL +0 -0
- {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/entry_points.txt +0 -0
- {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
+
import warnings
|
2
3
|
from collections.abc import Sequence
|
3
4
|
from typing import Any, Literal, Optional, Union
|
4
5
|
|
@@ -116,32 +117,34 @@ class FaissQuery:
|
|
116
117
|
}
|
117
118
|
if filter is not None:
|
118
119
|
_filter.update(filter)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
120
|
+
with warnings.catch_warnings():
|
121
|
+
warnings.simplefilter("ignore")
|
122
|
+
if return_score_type == "L2-distance":
|
123
|
+
_result = await self.vectors_store.asimilarity_search_with_score(
|
124
|
+
query=query,
|
125
|
+
k=k,
|
126
|
+
filter=_filter,
|
127
|
+
fetch_k=fetch_k,
|
128
|
+
)
|
129
|
+
return [(r.page_content, s, r.metadata) for r, s in _result]
|
130
|
+
elif return_score_type == "none":
|
131
|
+
_result = await self.vectors_store.asimilarity_search(
|
132
|
+
query=query,
|
133
|
+
k=k,
|
134
|
+
filter=_filter,
|
135
|
+
fetch_k=fetch_k,
|
136
|
+
)
|
137
|
+
return [(r.page_content, r.metadata) for r in _result]
|
138
|
+
elif return_score_type == "similarity_score":
|
139
|
+
_result = await self.vectors_store.asimilarity_search_with_relevance_scores(
|
140
|
+
query=query,
|
141
|
+
k=k,
|
142
|
+
filter=_filter,
|
143
|
+
fetch_k=fetch_k,
|
144
|
+
)
|
145
|
+
return [(r.page_content, s, r.metadata) for r, s in _result]
|
146
|
+
else:
|
147
|
+
raise ValueError(f"Invalid `return_score_type` {return_score_type}!")
|
145
148
|
|
146
149
|
@lock_decorator
|
147
150
|
async def similarity_search_by_embedding(
|