pycityagent 2.0.0a52__cp311-cp311-macosx_11_0_arm64.whl → 2.0.0a54__cp311-cp311-macosx_11_0_arm64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. pycityagent/agent/agent.py +83 -62
  2. pycityagent/agent/agent_base.py +81 -54
  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 +45 -57
  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/message_intercept.py +99 -0
  17. pycityagent/cityagent/nbsagent.py +6 -29
  18. pycityagent/cityagent/societyagent.py +325 -127
  19. pycityagent/cli/wrapper.py +4 -0
  20. pycityagent/economy/econ_client.py +0 -2
  21. pycityagent/environment/__init__.py +7 -1
  22. pycityagent/environment/sim/client.py +10 -1
  23. pycityagent/environment/sim/clock_service.py +2 -2
  24. pycityagent/environment/sim/pause_service.py +61 -0
  25. pycityagent/environment/sim/sim_env.py +34 -46
  26. pycityagent/environment/simulator.py +18 -14
  27. pycityagent/llm/embeddings.py +0 -24
  28. pycityagent/llm/llm.py +18 -10
  29. pycityagent/memory/faiss_query.py +29 -26
  30. pycityagent/memory/memory.py +733 -247
  31. pycityagent/message/__init__.py +8 -1
  32. pycityagent/message/message_interceptor.py +322 -0
  33. pycityagent/message/messager.py +42 -11
  34. pycityagent/pycityagent-sim +0 -0
  35. pycityagent/simulation/agentgroup.py +137 -96
  36. pycityagent/simulation/simulation.py +184 -38
  37. pycityagent/simulation/storage/pg.py +2 -2
  38. pycityagent/tools/tool.py +7 -9
  39. pycityagent/utils/__init__.py +7 -2
  40. pycityagent/utils/pg_query.py +1 -0
  41. pycityagent/utils/survey_util.py +26 -23
  42. pycityagent/workflow/block.py +14 -7
  43. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a54.dist-info}/METADATA +2 -2
  44. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a54.dist-info}/RECORD +48 -46
  45. pycityagent/cityagent/blocks/time_block.py +0 -116
  46. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a54.dist-info}/LICENSE +0 -0
  47. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a54.dist-info}/WHEEL +0 -0
  48. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a54.dist-info}/entry_points.txt +0 -0
  49. {pycityagent-2.0.0a52.dist-info → pycityagent-2.0.0a54.dist-info}/top_level.txt +0 -0
@@ -1,58 +1,53 @@
1
- pycityagent-2.0.0a52.dist-info/RECORD,,
2
- pycityagent-2.0.0a52.dist-info/LICENSE,sha256=n2HPXiupinpyHMnIkbCf3OTYd3KMqbmldu1e7av0CAU,1084
3
- pycityagent-2.0.0a52.dist-info/WHEEL,sha256=NW1RskY9zow1Y68W-gXg0oZyBRAugI1JHywIzAIai5o,109
4
- pycityagent-2.0.0a52.dist-info/entry_points.txt,sha256=BZcne49AAIFv-hawxGnPbblea7X3MtAtoPyDX8L4OC4,132
5
- pycityagent-2.0.0a52.dist-info/top_level.txt,sha256=yOmeu6cSXmiUtScu53a3s0p7BGtLMaV0aff83EHCTic,43
6
- pycityagent-2.0.0a52.dist-info/METADATA,sha256=WBBdIOQzkArKVtcDejBHFlvBAyVJlfpBhIN3e8kvOQE,9110
7
- pycityagent/pycityagent-sim,sha256=n96jlVZRINlBec5SPOGAdUmeLWMoEKGgoH29iOVJ0wE,34081890
1
+ pycityagent/pycityagent-sim,sha256=1Nu-QYC0AuZyVWciGNa2XkYsUntbwAS15Bo7l-y6eok,35449490
8
2
  pycityagent/__init__.py,sha256=PUKWTXc-xdMG7px8oTNclodsILUgypANj2Z647sY63k,808
9
3
  pycityagent/pycityagent-ui,sha256=cHZjqtrQ4Fh4qtRahFNCNbT2DNHLmUexiDAa-72Z3RQ,40333378
10
4
  pycityagent/metrics/mlflow_client.py,sha256=g_tHxWkWTDijtbGL74-HmiYzWVKb1y8-w12QrY9jL30,4449
11
5
  pycityagent/metrics/__init__.py,sha256=X08PaBbGVAd7_PRGLREXWxaqm7nS82WBQpD1zvQzcqc,128
12
6
  pycityagent/metrics/utils/const.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
7
  pycityagent/economy/__init__.py,sha256=aonY4WHnx-6EGJ4WKrx4S-2jAkYNLtqUA04jp6q8B7w,75
14
- pycityagent/economy/econ_client.py,sha256=GuHK9ZBnhqW3Z7F8ViDJn_iN73yOBbbwFyJv1wLEBDk,12211
8
+ pycityagent/economy/econ_client.py,sha256=Nf73GPFJgiDbisi8ghmv_Dz6iUlNE2Ey62B-eJ-tQ84,12186
15
9
  pycityagent/tools/__init__.py,sha256=XtdtGyWeFyK1YOUvWkykBWxemtmwQjWUIuuyU1-gosQ,261
16
- pycityagent/tools/tool.py,sha256=qhjvPMKsGQ02oIGLl6ZdETTAR0q_av2qK2Ovf1XS_so,8758
10
+ pycityagent/tools/tool.py,sha256=D-ESFlX7EESm5mcvs2zRlGEQTzXbVfQc8G7Vpz8TmAw,8651
17
11
  pycityagent/llm/llmconfig.py,sha256=4Ylf4OFSBEFy8jrOneeX0HvPhWEaF5jGvy1HkXK08Ro,436
18
12
  pycityagent/llm/__init__.py,sha256=iWs6FLgrbRVIiqOf4ILS89gkVCTvS7HFC3vG-MWuyko,205
19
- pycityagent/llm/llm.py,sha256=owTYuXmnHZnvXaAvwiiyD511P3wpU3K04xZArhhiJF0,15700
20
- pycityagent/llm/embeddings.py,sha256=Nhf_tUIlaYJAZ93wW2QTCtS1wq7e8fUgdn2JketEAuQ,7600
13
+ pycityagent/llm/llm.py,sha256=4AJlTj9llT909gzx9SfcBvbUJrWqHzEo3DaHWgQ3-3I,15852
14
+ pycityagent/llm/embeddings.py,sha256=2_P4TWm3sJKFdGDx2Q1a2AEapFopDctIXsGuntvmP6E,6816
21
15
  pycityagent/llm/utils.py,sha256=hoNPhvomb1u6lhFX0GctFipw74hVKb7bvUBDqwBzBYw,160
22
- pycityagent/memory/memory.py,sha256=RV54r9uE3H7RIfz5ifaeXiD7RrOJotxJNhAOguZrYUk,17273
16
+ pycityagent/memory/memory.py,sha256=MusbnD-Us5IF16CkYRSlcer-TEbaPsHxQEYzcugo0N4,34589
23
17
  pycityagent/memory/profile.py,sha256=q8ZS9IBmHCg_X1GONUvXK85P6tCepTKQgXKuvuXYNXw,5203
24
18
  pycityagent/memory/__init__.py,sha256=_Vfdo1HcLWsuuz34_i8e91nnLVYADpMlHHSVaB3xgIk,297
25
19
  pycityagent/memory/memory_base.py,sha256=QG_j3BxZvkadFEeE3uBR_kjl_xcXD1aHUVs8GEF3d6w,5654
26
20
  pycityagent/memory/self_define.py,sha256=vpZ6CIxR2grNXEIOScdpsSc59FBg0mOKelwQuTElbtQ,5200
27
21
  pycityagent/memory/utils.py,sha256=oJWLdPeJy_jcdKcDTo9JAH9kDZhqjoQhhv_zT9qWC0w,877
28
22
  pycityagent/memory/const.py,sha256=6zpJPJXWoH9-yf4RARYYff586agCoud9BRn7sPERB1g,932
29
- pycityagent/memory/faiss_query.py,sha256=Z0JS4udyPYCIzHMq464QtHscnswu35gh9fQptikAwkQ,12976
23
+ pycityagent/memory/faiss_query.py,sha256=V3rIw6d1_xcpNqZBbAYz3qfjVNE7NfJ7xOS5SibPtVU,13180
30
24
  pycityagent/memory/state.py,sha256=TYItiyDtehMEQaSBN7PpNrnNxdDM5jGppr9R9Ufv3kA,5134
31
- pycityagent/simulation/simulation.py,sha256=DkTYkdNknz2d7hIdYhxxLewUkYwmS9uOxnmEGTwbL_Q,26098
25
+ pycityagent/simulation/simulation.py,sha256=mgzghIaud8M-gUjTlA8vRZ7X7l3UJgXBRm68cT0Fy18,32781
32
26
  pycityagent/simulation/__init__.py,sha256=P5czbcg2d8S0nbbnsQXFIhwzO4CennAhZM8OmKvAeYw,194
33
- pycityagent/simulation/agentgroup.py,sha256=fMTN9xDC-PdTGZ4KCMovZeGjzv8HIQJ1AGVG7iAJnD4,29351
34
- pycityagent/simulation/storage/pg.py,sha256=5itxKOkNPlOzN7z2_3oKU1ZK0uLTDugfld8ZkRbD69I,8407
35
- pycityagent/message/__init__.py,sha256=TCjazxqb5DVwbTu1fF0sNvaH_EPXVuj2XQ0p6W-QCLU,55
36
- pycityagent/message/messager.py,sha256=78K31EPKfC5IxbISc-Lc2babC7VOh9Vbe3c0sO-YDLA,3333
27
+ pycityagent/simulation/agentgroup.py,sha256=ANTQA2OFQpuNZBz2VRhy60pTPUM1lXHFJLzFgK1SvxQ,31633
28
+ pycityagent/simulation/storage/pg.py,sha256=xRshSOGttW-p0re0fNBOjOpb-nQ5msIE2LsdT79_E_Y,8425
29
+ pycityagent/message/message_interceptor.py,sha256=w8XTyZStQtMjILpeAX3VMhAWcYAuaxCgSMwXQU1OryM,8951
30
+ pycityagent/message/__init__.py,sha256=f5QH7DKPqEAMyfSlBMnl3uouOKlsoel909STlIe7nUk,276
31
+ pycityagent/message/messager.py,sha256=8mhTU2bb9K405_lwd9tN2ha7cCQ9m6hPFxf2fYxRjVg,4368
37
32
  pycityagent/utils/avro_schema.py,sha256=AlADbzV8FxiSfvhQhiX9KhrwMjrx0lGT-lED4TI1gJM,4152
38
- pycityagent/utils/__init__.py,sha256=xli0FuRffR9Wp4aRcMnlfeDHuGxB8Y5paDjyAt0UoeE,462
39
- pycityagent/utils/survey_util.py,sha256=Be9nptmu2JtesFNemPgORh_2GsN7rcDYGQS9Zfvc5OI,2169
40
- pycityagent/utils/pg_query.py,sha256=Nm2U1SZtWf6oFeDJV-zLnG0PxyL3xIRTGX1yX3EE-gw,2198
33
+ pycityagent/utils/__init__.py,sha256=GQEa4x_uJBK19Z57vfm9Omvqg1c4ysi3QJ9wx8xiDhI,524
34
+ pycityagent/utils/survey_util.py,sha256=o-gvmmfus3vMIN-EMWPzfLbHkDH4DfZb8B-yBd_mGYk,2076
35
+ pycityagent/utils/pg_query.py,sha256=KAcnBDLyzUu2il18SGXxk8dySdBen_8ejfpxiWuKUMA,2225
41
36
  pycityagent/utils/decorators.py,sha256=Gk3r41hfk6awui40tbwpq3C7wC7jHaRmLRlcJFlLQCE,3160
42
37
  pycityagent/utils/parsers/__init__.py,sha256=AN2xgiPxszWK4rpX7zrqRsqNwfGF3WnCA5-PFTvbaKk,281
43
38
  pycityagent/utils/parsers/code_block_parser.py,sha256=Cs2Z_hm9VfNCpPPll1TwteaJF-HAQPs-3RApsOekFm4,1173
44
39
  pycityagent/utils/parsers/parser_base.py,sha256=KBKO4zLZPNdGjPAGqIus8LseZ8W3Tlt2y0QxqeCd25Q,1713
45
40
  pycityagent/utils/parsers/json_parser.py,sha256=tjwyPluYfkWgsvLi0hzfJwFhO3L6yQfZMKza20HaGrY,2911
46
- pycityagent/agent/agent_base.py,sha256=78J6np8XrFXTUXTC9x_O28EUmyWsdgtARd1KfNcC0cI,23073
41
+ pycityagent/agent/agent_base.py,sha256=vC1nMWahwi_nVBUXVdC1CnZpqimKZApixD2m2Iqu_bg,24196
47
42
  pycityagent/agent/__init__.py,sha256=U20yKu9QwSqAx_PHk5JwipfODkDfxONtumVfnsKjWFg,180
48
- pycityagent/agent/agent.py,sha256=8biuC44Yx4T8Fntlj_RGTlnKWwS0XDNkfYQrv5xXUwE,11548
49
- pycityagent/cli/wrapper.py,sha256=2Tb52gOlEVgn11Ekt6ZkRXr_BGzte-EPyBKnR6g6hQ4,1143
43
+ pycityagent/agent/agent.py,sha256=FNon_OPvGrh976AEHpaAQyLQN7erbGOX-BxGnCVZza8,12038
44
+ pycityagent/cli/wrapper.py,sha256=9aG6D2cnmh6aIhiVXKPGKuMjVcdAa-TwzANudb2q_FU,1147
50
45
  pycityagent/workflow/__init__.py,sha256=H08Ko3eliZvuuCMajbEri-IP4-SeswYU6UjHBNA4Ze0,490
51
46
  pycityagent/workflow/prompt.py,sha256=6jI0Rq54JLv3-IXqZLYug62vse10wTI83xvf4ZX42nk,2929
52
- pycityagent/workflow/block.py,sha256=3X6qzpYmmMyZyXA6Dxl4lS-mNR0eLzLoiRhHY-H1rzE,9667
47
+ pycityagent/workflow/block.py,sha256=4QufS8XnyP6SYp8g1gDODW-H0nAHA7lvivrPGUq1p-w,9922
53
48
  pycityagent/workflow/trigger.py,sha256=Df-MOBEDWBbM-v0dFLQLXteLsipymT4n8vqexmK2GiQ,5643
54
- pycityagent/environment/__init__.py,sha256=awHxlOud-btWbk0FCS4RmGJ13W84oVCkbGfcrhKqihA,240
55
- pycityagent/environment/simulator.py,sha256=1OUfODDzM4EN6Lw_Wzq4KeQb-EpcUBioZYc9fxfSPn0,12070
49
+ pycityagent/environment/__init__.py,sha256=MyZBwsweDIHOKSX2iSZs748foNtaiyEcyg6sc747T2g,263
50
+ pycityagent/environment/simulator.py,sha256=gqkECMzhXRh4WHTyLFEL1_X1R7F1aX4g9881zUFv7DI,12136
56
51
  pycityagent/environment/message/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
52
  pycityagent/environment/utils/port.py,sha256=3OM6kSUt3PxvDUOlgyiendBtETaWU8Mzk_8H0TzTmYg,295
58
53
  pycityagent/environment/utils/grpc.py,sha256=6EJwKXXktIWb1NcUiJzIRmfrY0S03QAXXGcCDHqAT00,1998
@@ -66,38 +61,45 @@ pycityagent/environment/sence/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
66
61
  pycityagent/environment/sence/static.py,sha256=9s7jz8HitstTrk-GqpnVB26oPrjuTyNeL7hcoxjPhV4,29104
67
62
  pycityagent/environment/sidecar/__init__.py,sha256=RFbOf40aYBP4WwRpFkua5tlRE_OtMcMNyp1Lew_aaAU,235
68
63
  pycityagent/environment/sidecar/sidecarv2.py,sha256=beKlYZgt38EQbV1x6NWQo7xVXyB-5QHfbwJexyXu7Tg,3252
64
+ pycityagent/environment/sim/pause_service.py,sha256=DcAOVRxNkHGk4jyzFkxHMUPgp0Ck4mYHoPh6qxjhhLQ,1744
69
65
  pycityagent/environment/sim/person_service.py,sha256=5r1F2Itn7dKJ2U4hSLovrk5p4qy-2n77MTAv_OlTIwA,10673
70
66
  pycityagent/environment/sim/aoi_service.py,sha256=2UjvUTF4CW4E_L30IRcdwv6t_q1ZdXN3TTLOKSOaaXE,1230
71
- pycityagent/environment/sim/sim_env.py,sha256=HI1LcS_FotDKQ6vBnx0e49prXSABOfA20aU9KM-ZkCY,4625
67
+ pycityagent/environment/sim/sim_env.py,sha256=V3Pf_nsebs07-ZaXPSCaA1HBGv4n7v8yxMz6GKQaZPk,3908
72
68
  pycityagent/environment/sim/lane_service.py,sha256=N2dUe-3XuqqKLsNXt1k4NN8uV-J_ruo08yhaUd_hwOI,3916
73
- pycityagent/environment/sim/client.py,sha256=MHR7Hhu-Cr7B61d3K_QDpSJh4HrUU9JQf6Cu7_8pdsE,3493
69
+ pycityagent/environment/sim/client.py,sha256=j0f8qjR1nIava4VkoZNEPqW5h08WPdcC5wzM9DP3tIs,3772
74
70
  pycityagent/environment/sim/__init__.py,sha256=JVG6sSD2Hbohl1TtKjuQi7_M7tKMrFh9vl3QV3VA5O0,724
75
71
  pycityagent/environment/sim/social_service.py,sha256=9EFJAwVdUuUQkNkFRn9qZRDfD1brh2fqkvasnXUEBhQ,2014
76
72
  pycityagent/environment/sim/economy_services.py,sha256=xoc-1_H8JmQwJ24oWRS1fD-hGYtz2I-x6BOkQ4yENzU,7106
77
73
  pycityagent/environment/sim/light_service.py,sha256=KVwt7ii_iLGA7gANZe3n6-4RiiPQt1w9H6ZOoizMI04,4242
78
- pycityagent/environment/sim/clock_service.py,sha256=fgYXacf_-ixhVAn5uKUvqvemBS6A0oQK8JOZukkhXyY,1353
74
+ pycityagent/environment/sim/clock_service.py,sha256=gBUujvX_vIFMKVfcLRyk1GcpRRL606opLhNjCYL7Gt4,1363
79
75
  pycityagent/environment/sim/road_service.py,sha256=bKyn3_me0sGmaJVyF6eNeFbdU-9C1yWsa9L7pieDJzg,1285
80
76
  pycityagent/environment/interact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
77
  pycityagent/environment/interact/interact.py,sha256=ifxPPzuHeqLHIZ_6zvfXMoBOnBsXNIP4bYp7OJ7pnEQ,6588
82
- pycityagent/cityagent/memory_config.py,sha256=6dkgqPczANUqZpqGXDOt7wrS6vHdFSMNkWvEVwo6VIQ,10672
83
- pycityagent/cityagent/bankagent.py,sha256=9J0c_r6m0OJH2KpXxeCWstLqZVpjQ67xuWmDTbVm7KM,2217
78
+ pycityagent/cityagent/memory_config.py,sha256=yZdtfXz5VaASKRUiiotHXGVc8axCiCsTNGvoSkTWWgk,10861
79
+ pycityagent/cityagent/bankagent.py,sha256=lr4GEcqt-iwA7DXoDry0WXkV6benmdaAyLpswqSpKlY,2120
84
80
  pycityagent/cityagent/__init__.py,sha256=gcBQ-a50XegFtjigQ7xDXRBZrywBKqifiQFSRnEF8gM,572
85
- pycityagent/cityagent/firmagent.py,sha256=Mtb58YfW3V696gXA6TRw1qUL1WIzthahDBv2X5x_Iyg,4176
86
- pycityagent/cityagent/nbsagent.py,sha256=SIOigR8eiSHC0Gi8kg32hLxsqPKDgCHWF0HA89EU7eA,5202
81
+ pycityagent/cityagent/firmagent.py,sha256=UVlNN0lpa4cC4PZVqYzQhbc5VJ2oGsA1731mhbCjnR8,4109
82
+ pycityagent/cityagent/nbsagent.py,sha256=WIXW__6dZ5IrqBqDCjvGbrCshpXzuFRV3Ww6gkYw7p4,4387
87
83
  pycityagent/cityagent/initial.py,sha256=7hgCt_tGdnVTXGfEQOn1GTW5dAs1b-ru_FwXxRLI6tM,4549
88
- pycityagent/cityagent/societyagent.py,sha256=oVDWt-DDGMDxh_LpqMs4_CX-5hVQORyPC1ZW2a8CrhI,14960
89
- pycityagent/cityagent/governmentagent.py,sha256=9fjGueVmYok7zca14E1VL4N3ENEhnq2nubI6ab7Hzp0,2825
84
+ pycityagent/cityagent/societyagent.py,sha256=vvFGAr8wlZ82f4qHvpawa1VsHungDegjKn1E51bDUnc,24767
85
+ pycityagent/cityagent/message_intercept.py,sha256=HiNOtBXKq40LCmvsw2KMLxMsbmXSVcbRytAO-eI-1sU,3279
86
+ pycityagent/cityagent/governmentagent.py,sha256=HJLuhvEmllu_1KnFEJsYCIasaBJT0BV9Cn_4Y2QGPqg,2791
90
87
  pycityagent/cityagent/blocks/dispatcher.py,sha256=mEa1r3tRS3KI1BMZR_w_sbUGzOj6aUJuiUrsHv1n2n0,2943
91
- pycityagent/cityagent/blocks/needs_block.py,sha256=pPPjdVFCqFvAV0RM1LVevQIH5d0GALnB6xLekvplutE,13113
92
- pycityagent/cityagent/blocks/cognition_block.py,sha256=CGIYwuF1twS5g3DNhCkaSFT2s1IQXF5NjJO38EX6FLg,15633
93
- pycityagent/cityagent/blocks/time_block.py,sha256=M7ng1jQ14gz4Xle0DC-kWeZmetq9lYQ2HzgEgsu-eX8,4337
94
- pycityagent/cityagent/blocks/social_block.py,sha256=AkI9wLm9WUEFe5Hc5uDfLfwJtWe1TpLLsWdjm__9KM0,14012
95
- pycityagent/cityagent/blocks/__init__.py,sha256=j8aKIrSEkoMjoWKPQbyRqmeHaB-bjaJObyfrEagq8MI,503
96
- pycityagent/cityagent/blocks/economy_block.py,sha256=yysi4E_k47sNmeMorbHVJydYymyTqo9J6hdQnzJ4HN8,20793
97
- pycityagent/cityagent/blocks/utils.py,sha256=BYf15pDynAQw8eeXyn1iVfVDDdkkoRz9e6eiSGUnz4g,2031
98
- pycityagent/cityagent/blocks/other_block.py,sha256=ETgtj_EpYbAocIJq12LB-SPcHAY-b7TRsm9llo3ZIrc,3845
99
- pycityagent/cityagent/blocks/plan_block.py,sha256=Ad_K2m0gYwH5qJi1HOETgEe83uRX06TXconAR8RIZHU,11479
100
- pycityagent/cityagent/blocks/mobility_block.py,sha256=ZebloDhvZJYbV0YSWhAbnOLToiL-4fG7vKNq3kh37M4,10788
88
+ pycityagent/cityagent/blocks/needs_block.py,sha256=s8LikgtKORfo_Sw9SQ5_3biNPTof15QuUs4cDynXCyM,15332
89
+ pycityagent/cityagent/blocks/cognition_block.py,sha256=aeDIWbEmlcqmXyxeEiewXJyV0te3L6k95Kec12mUSM0,14954
90
+ pycityagent/cityagent/blocks/social_block.py,sha256=y46mPK9SLvcOHYB64l6qz5ZgT0dWNmX-C3Cusj_44mE,15540
91
+ pycityagent/cityagent/blocks/__init__.py,sha256=wydR0s-cCRWgdvQetkfQnD_PU8vC3eTmt2zntcb4fSA,452
92
+ pycityagent/cityagent/blocks/economy_block.py,sha256=m5B67cgGZ9nKWtrYeak5gxMoCoKlRbATAsXpFajYKyg,19129
93
+ pycityagent/cityagent/blocks/utils.py,sha256=8O5p1B8JlreIJTGXKAP03rTcn7MvFSR8qJ1_hhszboU,2065
94
+ pycityagent/cityagent/blocks/other_block.py,sha256=NnDwxQAO5XZ7Uxe-n3qtrfNItHlwFYk2MQsh2GYDKMQ,4338
95
+ pycityagent/cityagent/blocks/plan_block.py,sha256=YEU0pHK_fB1lvvml9u7bGz-2bzM2axE9jW-aSgPYs6M,10996
96
+ pycityagent/cityagent/blocks/mobility_block.py,sha256=xWbARMfJ3-6fddrW3VOUKJrXfMGmroiSN0B8t8lVYXA,12725
101
97
  pycityagent/survey/models.py,sha256=YE50UUt5qJ0O_lIUsSY6XFCGUTkJVNu_L1gAhaCJ2fs,3546
102
98
  pycityagent/survey/__init__.py,sha256=rxwou8U9KeFSP7rMzXtmtp2fVFZxK4Trzi-psx9LPIs,153
103
99
  pycityagent/survey/manager.py,sha256=S5IkwTdelsdtZETChRcfCEczzwSrry_Fly9MY4s3rbk,1681
100
+ pycityagent-2.0.0a54.dist-info/RECORD,,
101
+ pycityagent-2.0.0a54.dist-info/LICENSE,sha256=n2HPXiupinpyHMnIkbCf3OTYd3KMqbmldu1e7av0CAU,1084
102
+ pycityagent-2.0.0a54.dist-info/WHEEL,sha256=NW1RskY9zow1Y68W-gXg0oZyBRAugI1JHywIzAIai5o,109
103
+ pycityagent-2.0.0a54.dist-info/entry_points.txt,sha256=BZcne49AAIFv-hawxGnPbblea7X3MtAtoPyDX8L4OC4,132
104
+ pycityagent-2.0.0a54.dist-info/top_level.txt,sha256=yOmeu6cSXmiUtScu53a3s0p7BGtLMaV0aff83EHCTic,43
105
+ pycityagent-2.0.0a54.dist-info/METADATA,sha256=rziSp1wXuaGcNbO3WTqNx6s7JqARZxLvFeNLvsChKUo,9110
@@ -1,116 +0,0 @@
1
- import asyncio
2
- from datetime import datetime
3
- import json
4
- from pycityagent.workflow import Block
5
- from pycityagent.llm.llm import LLM
6
- from pycityagent.memory import Memory
7
- from pycityagent.environment import Simulator
8
- from pycityagent.workflow.prompt import FormatPrompt
9
- from .utils import clean_json_response
10
-
11
- class WorkReflectionBlock(Block):
12
- """
13
- 反馈工作感受
14
- WorkReflectionBlock
15
- """
16
- def __init__(self, llm: LLM, memory: Memory, simulator: Simulator):
17
- super().__init__("WorkReflectionBlock", llm, memory, simulator)
18
- self.description = "Feedback on work experience"
19
-
20
- async def forward(self):
21
- prompt = """
22
- You are a {gender}, your consumption level is {consumption} and your education level is {education}.
23
- Today's working experience:
24
- {working_experience}
25
-
26
- How is your feeling of work today?
27
-
28
- Your answer should be one of the following:
29
- - excellent
30
- - good
31
- - soso
32
- - bad
33
- - very bad
34
- Answer in JSON format:
35
- {{
36
- "evaluation": "good",
37
- }}
38
- """
39
- prompt = FormatPrompt(prompt)
40
- prompt.format(
41
- **{key: await self.memory.get(key) for key in prompt.variables}
42
- )
43
- evaluation = await self.llm.atext_request(prompt.to_dialog(), timeout=300)
44
- evaluation = clean_json_response(evaluation)
45
- try:
46
- evaluation = json.loads(evaluation)
47
- except Exception as e:
48
- evaluation = {'evaluation': 'soso'}
49
- if evaluation['evaluation'] == 'excellent':
50
- safe_improve = 0.2
51
- elif evaluation['evaluation'] == 'good':
52
- safe_improve = 0.1
53
- elif evaluation['evaluation'] == 'soso':
54
- safe_improve = 0.0
55
- elif evaluation['evaluation'] == 'bad':
56
- safe_improve = -0.1
57
- elif evaluation['evaluation'] == 'very bad':
58
- safe_improve = -0.2
59
- else:
60
- safe_improve = 0.0
61
-
62
- needs = await self.memory.get("needs")
63
- needs['safe'] += safe_improve
64
- await self.memory.update("needs", needs)
65
- await self.memory.update("working_experience", [])
66
- return
67
-
68
-
69
- class TimeBlock(Block):
70
- """固定时间trigger的工作流"""
71
- def __init__(self, llm: LLM, memory: Memory, simulator: Simulator):
72
- super().__init__(name="time_block", llm=llm, memory=memory, simulator=simulator)
73
- self.blocks = []
74
- self.work_reflection_block = WorkReflectionBlock(llm, memory, simulator)
75
- self.blocks.append((self.work_reflection_block, self.str_to_time('23:59:59'))) # end of day
76
- self.last_check_time = None
77
- self.trigger_time = 0
78
- self.token_consumption = 0
79
-
80
- def str_to_time(self, time_str: str):
81
- time_obj = datetime.strptime(time_str, '%H:%M:%S')
82
- return time_obj.hour * 3600 + time_obj.minute * 60 + time_obj.second
83
-
84
- async def blocks_to_trigger(self):
85
- trigger_blocks = []
86
- now_time = await self.simulator.get_time(format_time=True)
87
- now_time = self.str_to_time(now_time)
88
- if self.last_check_time is None:
89
- self.last_check_time = now_time
90
- else:
91
- whether_cross_day = True if now_time < self.last_check_time else False
92
- for block, trigger_time in self.blocks:
93
- if whether_cross_day and trigger_time > self.last_check_time:
94
- trigger_blocks.append(block)
95
- elif not whether_cross_day and trigger_time > self.last_check_time and trigger_time <= now_time:
96
- trigger_blocks.append(block)
97
- self.last_check_time = now_time
98
- return trigger_blocks
99
-
100
- async def forward(self):
101
- while True:
102
- if len(self.blocks) == 0:
103
- await asyncio.sleep(30)
104
- continue
105
- trigger_blocks = await self.blocks_to_trigger()
106
- if len(trigger_blocks) == 0:
107
- await asyncio.sleep(30)
108
- continue
109
- self.trigger_time += 1
110
- consumption_start = self.llm.prompt_tokens_used + self.llm.completion_tokens_used
111
- tasks = []
112
- for block in trigger_blocks:
113
- tasks.append(block.forward())
114
- await asyncio.gather(*tasks)
115
- consumption_end = self.llm.prompt_tokens_used + self.llm.completion_tokens_used
116
- self.token_consumption += consumption_end - consumption_start