pycityagent 2.0.0a52__cp312-cp312-macosx_11_0_arm64.whl → 2.0.0a53__cp312-cp312-macosx_11_0_arm64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. pycityagent/agent/agent.py +48 -62
  2. pycityagent/agent/agent_base.py +66 -53
  3. pycityagent/cityagent/bankagent.py +5 -7
  4. pycityagent/cityagent/blocks/__init__.py +0 -2
  5. pycityagent/cityagent/blocks/cognition_block.py +149 -172
  6. pycityagent/cityagent/blocks/economy_block.py +90 -129
  7. pycityagent/cityagent/blocks/mobility_block.py +56 -29
  8. pycityagent/cityagent/blocks/needs_block.py +163 -145
  9. pycityagent/cityagent/blocks/other_block.py +17 -9
  10. pycityagent/cityagent/blocks/plan_block.py +44 -56
  11. pycityagent/cityagent/blocks/social_block.py +70 -51
  12. pycityagent/cityagent/blocks/utils.py +2 -0
  13. pycityagent/cityagent/firmagent.py +6 -7
  14. pycityagent/cityagent/governmentagent.py +7 -9
  15. pycityagent/cityagent/memory_config.py +48 -48
  16. pycityagent/cityagent/nbsagent.py +6 -29
  17. pycityagent/cityagent/societyagent.py +204 -119
  18. pycityagent/environment/sim/client.py +10 -1
  19. pycityagent/environment/sim/clock_service.py +2 -2
  20. pycityagent/environment/sim/pause_service.py +61 -0
  21. pycityagent/environment/simulator.py +17 -12
  22. pycityagent/llm/embeddings.py +0 -24
  23. pycityagent/memory/faiss_query.py +29 -26
  24. pycityagent/memory/memory.py +720 -272
  25. pycityagent/pycityagent-sim +0 -0
  26. pycityagent/simulation/agentgroup.py +92 -99
  27. pycityagent/simulation/simulation.py +115 -40
  28. pycityagent/tools/tool.py +7 -9
  29. pycityagent/workflow/block.py +11 -4
  30. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/METADATA +1 -1
  31. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/RECORD +35 -35
  32. pycityagent/cityagent/blocks/time_block.py +0 -116
  33. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/LICENSE +0 -0
  34. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/WHEEL +0 -0
  35. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a53.dist-info}/entry_points.txt +0 -0
  36. {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
- if return_score_type == "L2-distance":
120
- _result = await self.vectors_store.asimilarity_search_with_score(
121
- query=query,
122
- k=k,
123
- filter=_filter,
124
- fetch_k=fetch_k,
125
- )
126
- return [(r.page_content, s, r.metadata) for r, s in _result]
127
- elif return_score_type == "none":
128
- _result = await self.vectors_store.asimilarity_search(
129
- query=query,
130
- k=k,
131
- filter=_filter,
132
- fetch_k=fetch_k,
133
- )
134
- return [(r.page_content, r.metadata) for r in _result]
135
- elif return_score_type == "similarity_score":
136
- _result = await self.vectors_store.asimilarity_search_with_relevance_scores(
137
- query=query,
138
- k=k,
139
- filter=_filter,
140
- fetch_k=fetch_k,
141
- )
142
- return [(r.page_content, s, r.metadata) for r, s in _result]
143
- else:
144
- raise ValueError(f"Invalid `return_score_type` {return_score_type}!")
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(