aiverify-moonshot 0.4.0__py3-none-any.whl → 0.4.2__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.
- {aiverify_moonshot-0.4.0.dist-info → aiverify_moonshot-0.4.2.dist-info}/METADATA +2 -2
- {aiverify_moonshot-0.4.0.dist-info → aiverify_moonshot-0.4.2.dist-info}/RECORD +60 -50
- {aiverify_moonshot-0.4.0.dist-info → aiverify_moonshot-0.4.2.dist-info}/WHEEL +1 -1
- moonshot/__main__.py +79 -36
- moonshot/api.py +14 -0
- moonshot/integrations/cli/benchmark/benchmark.py +29 -13
- moonshot/integrations/cli/benchmark/cookbook.py +36 -6
- moonshot/integrations/cli/benchmark/datasets.py +33 -3
- moonshot/integrations/cli/benchmark/metrics.py +33 -3
- moonshot/integrations/cli/benchmark/recipe.py +36 -6
- moonshot/integrations/cli/benchmark/result.py +33 -3
- moonshot/integrations/cli/benchmark/run.py +34 -3
- moonshot/integrations/cli/common/common.py +12 -6
- moonshot/integrations/cli/common/connectors.py +73 -9
- moonshot/integrations/cli/common/prompt_template.py +38 -3
- moonshot/integrations/cli/redteam/attack_module.py +75 -24
- moonshot/integrations/cli/redteam/context_strategy.py +77 -23
- moonshot/integrations/cli/redteam/prompt_template.py +1 -1
- moonshot/integrations/cli/redteam/redteam.py +52 -6
- moonshot/integrations/cli/redteam/session.py +549 -41
- moonshot/integrations/web_api/__main__.py +2 -0
- moonshot/integrations/web_api/app.py +6 -6
- moonshot/integrations/web_api/container.py +12 -2
- moonshot/integrations/web_api/routes/bookmark.py +173 -0
- moonshot/integrations/web_api/schemas/bookmark_create_dto.py +13 -0
- moonshot/integrations/web_api/services/bookmark_service.py +90 -0
- moonshot/integrations/web_api/services/utils/file_manager.py +52 -0
- moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py +0 -1
- moonshot/integrations/web_api/temp/.gitkeep +0 -0
- moonshot/src/api/api_bookmark.py +95 -0
- moonshot/src/api/api_connector_endpoint.py +1 -1
- moonshot/src/api/api_context_strategy.py +2 -2
- moonshot/src/api/api_session.py +1 -1
- moonshot/src/bookmark/bookmark.py +257 -0
- moonshot/src/bookmark/bookmark_arguments.py +38 -0
- moonshot/src/configs/env_variables.py +12 -2
- moonshot/src/connectors/connector.py +15 -7
- moonshot/src/connectors_endpoints/connector_endpoint.py +65 -49
- moonshot/src/cookbooks/cookbook.py +57 -37
- moonshot/src/datasets/dataset.py +9 -5
- moonshot/src/metrics/metric.py +8 -4
- moonshot/src/metrics/metric_interface.py +8 -2
- moonshot/src/prompt_templates/prompt_template.py +5 -1
- moonshot/src/recipes/recipe.py +38 -25
- moonshot/src/redteaming/attack/attack_module.py +19 -9
- moonshot/src/redteaming/attack/attack_module_arguments.py +1 -1
- moonshot/src/redteaming/attack/context_strategy.py +6 -2
- moonshot/src/redteaming/session/session.py +15 -11
- moonshot/src/results/result.py +7 -3
- moonshot/src/runners/runner.py +65 -42
- moonshot/src/runs/run.py +15 -11
- moonshot/src/runs/run_progress.py +7 -3
- moonshot/src/storage/db_interface.py +14 -0
- moonshot/src/storage/storage.py +33 -2
- moonshot/src/utils/find_feature.py +45 -0
- moonshot/src/utils/log.py +66 -0
- moonshot/src/utils/timeit.py +8 -1
- {aiverify_moonshot-0.4.0.dist-info → aiverify_moonshot-0.4.2.dist-info}/licenses/AUTHORS.md +0 -0
- {aiverify_moonshot-0.4.0.dist-info → aiverify_moonshot-0.4.2.dist-info}/licenses/LICENSE.md +0 -0
- {aiverify_moonshot-0.4.0.dist-info → aiverify_moonshot-0.4.2.dist-info}/licenses/NOTICES.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: aiverify-moonshot
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: AI Verify advances Gen AI testing with Project Moonshot.
|
|
5
5
|
Project-URL: Repository, https://github.com/aiverify-foundation/moonshot
|
|
6
6
|
Project-URL: Documentation, https://aiverify-foundation.github.io/moonshot/
|
|
@@ -43,7 +43,7 @@ Description-Content-Type: text/markdown
|
|
|
43
43
|
|
|
44
44
|

|
|
45
45
|
|
|
46
|
-
**Version 0.4.
|
|
46
|
+
**Version 0.4.2**
|
|
47
47
|
|
|
48
48
|
A simple and modular tool to evaluate any LLM application.
|
|
49
49
|
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
moonshot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
moonshot/__main__.py,sha256=
|
|
3
|
-
moonshot/api.py,sha256=
|
|
2
|
+
moonshot/__main__.py,sha256=NB_sWjPRcwr8BbFXtih2y3fbVYPZ1YS5dI_bNNaTD3U,7551
|
|
3
|
+
moonshot/api.py,sha256=elAkJoQE6BuKTJ-E-7x1FLyMeb5I_B8G3ieIs--pS7A,4771
|
|
4
4
|
moonshot/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
moonshot/integrations/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
moonshot/integrations/cli/__main__.py,sha256=0VnYSj2AayvDCZ3uXpldPcjMHt2Yd7BWojWzFOGSSl4,679
|
|
7
7
|
moonshot/integrations/cli/active_session_cfg.py,sha256=n8hOFxFjvz26qbEFY4q7iPUZYrGLoeCmXJxmOb_xWUE,20
|
|
8
8
|
moonshot/integrations/cli/cli.py,sha256=9tnzcxcSOjblxCUpyh3pK0ke0bLs3s-63OxXtYoZI2g,2769
|
|
9
9
|
moonshot/integrations/cli/benchmark/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
moonshot/integrations/cli/benchmark/benchmark.py,sha256=
|
|
11
|
-
moonshot/integrations/cli/benchmark/cookbook.py,sha256=
|
|
12
|
-
moonshot/integrations/cli/benchmark/datasets.py,sha256=
|
|
13
|
-
moonshot/integrations/cli/benchmark/metrics.py,sha256=
|
|
14
|
-
moonshot/integrations/cli/benchmark/recipe.py,sha256=
|
|
15
|
-
moonshot/integrations/cli/benchmark/result.py,sha256=
|
|
16
|
-
moonshot/integrations/cli/benchmark/run.py,sha256=
|
|
10
|
+
moonshot/integrations/cli/benchmark/benchmark.py,sha256=QUxr6DU11-XeH6Y3j1uPsZsotshgy64G_cWNf0Rn2_U,6303
|
|
11
|
+
moonshot/integrations/cli/benchmark/cookbook.py,sha256=KPmLMYdbJDWhejHaU8WRilrQhSyEPOXHpdUGcV_bhhE,22032
|
|
12
|
+
moonshot/integrations/cli/benchmark/datasets.py,sha256=VE1-7w64Afp0VePTgRJFruMJJUE-Q4Rit9WnoGRdGDA,7053
|
|
13
|
+
moonshot/integrations/cli/benchmark/metrics.py,sha256=bkEedpPJLM3X-R5DyVR-g6RYKZXIImvuhtw6kLwJ9Ik,6156
|
|
14
|
+
moonshot/integrations/cli/benchmark/recipe.py,sha256=n2mw_uKdNK_0rArriUSy1VWDjaK6rm1iaw-yF5J6D4k,23260
|
|
15
|
+
moonshot/integrations/cli/benchmark/result.py,sha256=11KgObrq4QvpAfbaj_HTafqsQwT45bpGMQ8nKuxF_1A,9422
|
|
16
|
+
moonshot/integrations/cli/benchmark/run.py,sha256=IHZjDumaWr0blK4ol_lOqWA2Q_lq5fWB-gqw9shV5Kc,6127
|
|
17
17
|
moonshot/integrations/cli/benchmark/runner.py,sha256=nAnNKihQD0AScl6vPFiFH_9MZU4ppeMG34QaLRidqvU,6602
|
|
18
18
|
moonshot/integrations/cli/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
moonshot/integrations/cli/common/common.py,sha256=
|
|
20
|
-
moonshot/integrations/cli/common/connectors.py,sha256=
|
|
19
|
+
moonshot/integrations/cli/common/common.py,sha256=kXqzOmtwU2LrFeosAr9h0Edond9kk3sWlH-jNb54i8M,2854
|
|
20
|
+
moonshot/integrations/cli/common/connectors.py,sha256=kHm1ldo1LEYyrsw5hQMjwxIRk20WQZmsHug_0wCaRo0,13738
|
|
21
21
|
moonshot/integrations/cli/common/display_helper.py,sha256=8rVowW33XK0j0C_X_H1jUbFlFk1Y2WpzxmIUE3Ca5Co,1459
|
|
22
|
-
moonshot/integrations/cli/common/prompt_template.py,sha256=
|
|
22
|
+
moonshot/integrations/cli/common/prompt_template.py,sha256=CiR7b8dMaxf6nReLmlpRJynhCRiyvfydmYyp8AWjdyI,4682
|
|
23
23
|
moonshot/integrations/cli/initialisation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
moonshot/integrations/cli/initialisation/initialisation.py,sha256=zMjklhoBlYLPshe7Q16vBBbOfhbPjZc4_ooywAFp2XY,387
|
|
25
25
|
moonshot/integrations/cli/redteam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
moonshot/integrations/cli/redteam/attack_module.py,sha256=
|
|
27
|
-
moonshot/integrations/cli/redteam/context_strategy.py,sha256=
|
|
28
|
-
moonshot/integrations/cli/redteam/prompt_template.py,sha256=
|
|
29
|
-
moonshot/integrations/cli/redteam/redteam.py,sha256
|
|
30
|
-
moonshot/integrations/cli/redteam/session.py,sha256=
|
|
26
|
+
moonshot/integrations/cli/redteam/attack_module.py,sha256=kO_eXHMUM6ErBXFAAy1caM6W7EC9U_b8-Hdj1oBMipA,4060
|
|
27
|
+
moonshot/integrations/cli/redteam/context_strategy.py,sha256=MikcpolrnZf80G2U6LO7oDhb5mYuQRVTJ76e90Cwbnw,6980
|
|
28
|
+
moonshot/integrations/cli/redteam/prompt_template.py,sha256=rWINvMFLax8ynIFJoX93xsB1cWJ8-dQ1nRyqgdri2yQ,2079
|
|
29
|
+
moonshot/integrations/cli/redteam/redteam.py,sha256=144tVuiSWBLseC0EvvIuevHYJhqn39xvg36-1cLgGWQ,4257
|
|
30
|
+
moonshot/integrations/cli/redteam/session.py,sha256=V-K-eFdgathpEM1WvpXoJElfBPT15buB7ckUGst-vLo,33266
|
|
31
31
|
moonshot/integrations/web_api/.env.dev,sha256=0z5_Ut8rF-UqFZtgjkH2qoqORhD5_nSs2w_OeX2SteI,182
|
|
32
32
|
moonshot/integrations/web_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
|
-
moonshot/integrations/web_api/__main__.py,sha256=
|
|
34
|
-
moonshot/integrations/web_api/app.py,sha256=
|
|
35
|
-
moonshot/integrations/web_api/container.py,sha256=
|
|
33
|
+
moonshot/integrations/web_api/__main__.py,sha256=MdnLi_ZF-olAAEJwTPU1iGYFYwo-fNWNT2qfchkH3y4,2050
|
|
34
|
+
moonshot/integrations/web_api/app.py,sha256=7BL8w9ch52pLFlpSQqFxQZOxjDAs0cPV2TYx8WH90MU,3651
|
|
35
|
+
moonshot/integrations/web_api/container.py,sha256=DVkJG_qm7ItcG6tgMYOqIj07wpKhPWOOfy6-bEv72y4,5915
|
|
36
36
|
moonshot/integrations/web_api/logging_conf.py,sha256=t3EGRV6tZhV732KXe8_Tiy0fiwVAWxZX5Tt8VTgrrfg,3388
|
|
37
37
|
moonshot/integrations/web_api/log/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
38
|
moonshot/integrations/web_api/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
moonshot/integrations/web_api/routes/attack_modules.py,sha256=m0mGGTEHyaVld8WYHXxQ5Gm0sKdTqy_rJUrNVFcgVgw,2413
|
|
40
40
|
moonshot/integrations/web_api/routes/benchmark.py,sha256=RRzouKcoVNYXm7o1LadsZTgzfmUsaYdQTC0AfsLdiC4,4163
|
|
41
41
|
moonshot/integrations/web_api/routes/benchmark_result.py,sha256=WZ_dI8qT4dli9hKPNkhSwhdfz2VfW5BshirpEVEUci4,6351
|
|
42
|
+
moonshot/integrations/web_api/routes/bookmark.py,sha256=K-1jL0IwOYvmYpgJvU65-lRfQlQhMzJk_n-Zf92IeR0,6135
|
|
42
43
|
moonshot/integrations/web_api/routes/context_strategy.py,sha256=kJTpjrwxfYGyBLY_hAgpHOMZMtjV5Z6vpu7RIdHDylg,4828
|
|
43
44
|
moonshot/integrations/web_api/routes/cookbook.py,sha256=oddmcdfhgH3qZb4_ThfUk8SBKmHOt51dFlAHubQh2fQ,8648
|
|
44
45
|
moonshot/integrations/web_api/routes/dataset.py,sha256=Pvr1WRKom9UrLzfrHozSKXKxOz9BJfbxUZ6EB-M3g10,4319
|
|
@@ -50,6 +51,7 @@ moonshot/integrations/web_api/routes/redteam.py,sha256=t-jNot5_PkV6f5_WBorp1HL43
|
|
|
50
51
|
moonshot/integrations/web_api/routes/runner.py,sha256=NQdAmVIOnNgSESX3am6wAE0YLIxHYXlnQbh00_7-SD4,8438
|
|
51
52
|
moonshot/integrations/web_api/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
53
|
moonshot/integrations/web_api/schemas/benchmark_runner_dto.py,sha256=nfNMt_9Xg0YAL5f93dZamu7DxSLvAsz8-tdA_DTCXQQ,322
|
|
54
|
+
moonshot/integrations/web_api/schemas/bookmark_create_dto.py,sha256=C78vG8UG02N7Cmt6RSuS8e4sX_G-MLCiAWT-cF5BE8s,374
|
|
53
55
|
moonshot/integrations/web_api/schemas/cookbook_create_dto.py,sha256=00SPVw7lEpfY9yOFdt1XkvvNAzfFRd7d7CA90qguhuQ,670
|
|
54
56
|
moonshot/integrations/web_api/schemas/cookbook_response_model.py,sha256=eJtAi5cbGfSqP57qyzyeLqffPIrpM5lutqpW7_H0xLY,240
|
|
55
57
|
moonshot/integrations/web_api/schemas/dataset_response_dto.py,sha256=s5x4-UXEWccWhK42E0FPXiHG6VqjuFuph-2t5atEkg4,171
|
|
@@ -71,6 +73,7 @@ moonshot/integrations/web_api/services/benchmark_result_service.py,sha256=-oPvLL
|
|
|
71
73
|
moonshot/integrations/web_api/services/benchmark_test_manager.py,sha256=zsB8zTDUvH-hT1c-rmyh71uO9ZuIxYbUP3msh8Hdkm4,4024
|
|
72
74
|
moonshot/integrations/web_api/services/benchmark_test_state.py,sha256=MyhTxpAhhP66JF0ua1SMc_IIeIjDxQY5swOXv9cmYaY,1887
|
|
73
75
|
moonshot/integrations/web_api/services/benchmarking_service.py,sha256=lJZeNTqxEPBLrZNX3Z9JIilgwetywSkv0deQkcb8mQs,1257
|
|
76
|
+
moonshot/integrations/web_api/services/bookmark_service.py,sha256=l8CVC24JB2qmRDOHZh-F0S_KBa2pnZ_AhLxVAAimrmM,3384
|
|
74
77
|
moonshot/integrations/web_api/services/context_strategy_service.py,sha256=6YKnnG8JlE_1nlnr4Hq7rgz-sxI6oQglK0STaWPFQxQ,710
|
|
75
78
|
moonshot/integrations/web_api/services/cookbook_service.py,sha256=avAFiX_ZrBvCZcGFuZlp1Zw9AQVSdZ5ysKIS5JfIeh8,6760
|
|
76
79
|
moonshot/integrations/web_api/services/dataset_service.py,sha256=KAyfewnP2V-6vekktVll4uM_2-tVEzLXFddBVaseB88,768
|
|
@@ -81,16 +84,19 @@ moonshot/integrations/web_api/services/recipe_service.py,sha256=rOCke7_NKNKrimg-
|
|
|
81
84
|
moonshot/integrations/web_api/services/runner_service.py,sha256=_ljFTVtMzt3fxlY0l2252KTxgVsqoQB6vsOXBIY0PIU,4584
|
|
82
85
|
moonshot/integrations/web_api/services/session_service.py,sha256=g0iMGkSAbc2Vx3c9m4aqe15LknsiHgzs7ErV1hHq5nA,13821
|
|
83
86
|
moonshot/integrations/web_api/services/utils/exceptions_handler.py,sha256=anaQQYLAXzbt-cL4nAZGm1TIlP9fKt7qYE7lrNtW_04,2070
|
|
87
|
+
moonshot/integrations/web_api/services/utils/file_manager.py,sha256=Hym1DbTQw6ndj2vtbssqYsXifDKSx-OLemKdCS208AI,1545
|
|
84
88
|
moonshot/integrations/web_api/services/utils/results_formatter.py,sha256=rFAHNOWMas_ht0BNAmsOtDcfI4-HcWWfhuJEsXRZTgw,2323
|
|
85
|
-
moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py,sha256
|
|
89
|
+
moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py,sha256=ToyyCOEzArdMS9LnLixnCUNx4TWfib8XYEf6Pki9cr4,2804
|
|
86
90
|
moonshot/integrations/web_api/status_updater/interface/benchmark_progress_callback.py,sha256=MOs_1CKpNh2m3JUAEoJfmZOBivk80DNtSnRuTCJgzJ4,350
|
|
87
91
|
moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback.py,sha256=JRczi3vCq6oPfOddPrF4OCdyHQYAVxgPWK-qOJxElKg,350
|
|
92
|
+
moonshot/integrations/web_api/temp/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
93
|
moonshot/integrations/web_api/types/types.py,sha256=AN0Xf61lx2c5AFAYoXA8mVL5iufVBpwYlIPdo8gv-ls,2395
|
|
89
94
|
moonshot/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
90
95
|
moonshot/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
|
+
moonshot/src/api/api_bookmark.py,sha256=Nr0B3S6UUnNbuvXyL-dz8IMyFxCywU1u4UL2D8TjHik,3004
|
|
91
97
|
moonshot/src/api/api_connector.py,sha256=JpwLFd7Vh1LRz6oB8fhO2iufMbSTt5RmrMe7nt56bPM,2257
|
|
92
|
-
moonshot/src/api/api_connector_endpoint.py,sha256=
|
|
93
|
-
moonshot/src/api/api_context_strategy.py,sha256=
|
|
98
|
+
moonshot/src/api/api_connector_endpoint.py,sha256=UUuHzrgoj0bWcbOXPUJh7FEg-pzBOSo6DLgwqCZnLmw,5503
|
|
99
|
+
moonshot/src/api/api_context_strategy.py,sha256=WqzUEw3f7gROJlc_G7bsGkuP3nO1HycFzn3dfcxzaoc,2153
|
|
94
100
|
moonshot/src/api/api_cookbook.py,sha256=qFItf8KLaDgbDIrv8usbbzSFnoXOYLORQ7IaDvQ5haw,5744
|
|
95
101
|
moonshot/src/api/api_dataset.py,sha256=ryBzXYe5yxGgG5Nhl6ri4GO3Mcv7rN4gEMWMQnPl6mA,1369
|
|
96
102
|
moonshot/src/api/api_environment_variables.py,sha256=ubUHvK7LyN1HhAE40ZTls6fDrbl6IYbxoPob68i4c_k,551
|
|
@@ -101,63 +107,67 @@ moonshot/src/api/api_red_teaming.py,sha256=Ar2KeGXOTkeVNvDpegGfIPpIvdEijZBcqb-4d
|
|
|
101
107
|
moonshot/src/api/api_result.py,sha256=M5zKF7ytKp237UZusLSYJ7QVfui85Ys0WEaYySGcAKw,2532
|
|
102
108
|
moonshot/src/api/api_run.py,sha256=3PrETAVcFnJ09R0-xhWiFkEfqL6eYj4B2voEGJDPznU,2936
|
|
103
109
|
moonshot/src/api/api_runner.py,sha256=cH0rxWREjc2qKmt4Tuwr-fEMrYDBE_TKRw0jOohNEgU,4179
|
|
104
|
-
moonshot/src/api/api_session.py,sha256=
|
|
110
|
+
moonshot/src/api/api_session.py,sha256=OGH05ZxAwo_hKI-RNaJ-jCp_v-zcTm-9bHUclpq2z4Q,10978
|
|
111
|
+
moonshot/src/bookmark/bookmark.py,sha256=KZoKOyJseW02IS5KqfCIMusFiNwESBxOAvOZTwO7YUw,8867
|
|
112
|
+
moonshot/src/bookmark/bookmark_arguments.py,sha256=rwgUPMXmDLNaHfJvRTR4GaZ8vwRilchzOg9bZJQoe_8,1130
|
|
105
113
|
moonshot/src/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
106
|
-
moonshot/src/configs/env_variables.py,sha256=
|
|
114
|
+
moonshot/src/configs/env_variables.py,sha256=leemw8TNM6GI_6iaajFb49zv1K3hWB0EpZfO0p9CWZQ,7100
|
|
107
115
|
moonshot/src/connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
108
|
-
moonshot/src/connectors/connector.py,sha256=
|
|
116
|
+
moonshot/src/connectors/connector.py,sha256=e0ZCX9m83ezjMiY5H8gbWE64IStsNQqxzVwGtMwShPY,13396
|
|
109
117
|
moonshot/src/connectors/connector_prompt_arguments.py,sha256=cIlAgbFk2g_XUZ0stVM904Ng2g4GYP2LyiAjktmhEQM,470
|
|
110
118
|
moonshot/src/connectors_endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
111
|
-
moonshot/src/connectors_endpoints/connector_endpoint.py,sha256=
|
|
119
|
+
moonshot/src/connectors_endpoints/connector_endpoint.py,sha256=hrSvq7iw1IigZssKTcdotkcN8stG8Ov7AlJ8xxZcAJo,9526
|
|
112
120
|
moonshot/src/connectors_endpoints/connector_endpoint_arguments.py,sha256=8WyD0EfrlhGM9rqrzoAcF-YWmSWiWdfpO91E7w6HPY0,2318
|
|
113
121
|
moonshot/src/cookbooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
|
-
moonshot/src/cookbooks/cookbook.py,sha256=
|
|
122
|
+
moonshot/src/cookbooks/cookbook.py,sha256=LjmbJtFwIPhupQlx6LjjIQLMfpwcWZKurduS8MBgqHI,9661
|
|
115
123
|
moonshot/src/cookbooks/cookbook_arguments.py,sha256=iVp3x1-wi_RL7peTSr5TWbXnjuB_w7Uj29kJrQg48Y0,1210
|
|
116
124
|
moonshot/src/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
|
-
moonshot/src/datasets/dataset.py,sha256=
|
|
125
|
+
moonshot/src/datasets/dataset.py,sha256=g8A_bP5BiXuV1gGh3Kn2mQRA2zuKlChmenjkoPQ48fA,10209
|
|
118
126
|
moonshot/src/datasets/dataset_arguments.py,sha256=b4FyLA-xBt9e6Itpx6FnTMbyHzvDVMzx4R5SNLqYoXA,1753
|
|
119
127
|
moonshot/src/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
120
|
-
moonshot/src/metrics/metric.py,sha256=
|
|
121
|
-
moonshot/src/metrics/metric_interface.py,sha256=
|
|
128
|
+
moonshot/src/metrics/metric.py,sha256=llqJYnwtllJRMfNhRRbKWjhzKymY961yR3Jw24COR-Y,7512
|
|
129
|
+
moonshot/src/metrics/metric_interface.py,sha256=RSCV8Um39Ns-SD8Os4TM1bwQl3pjaazk5bPRf55aD4Y,4027
|
|
122
130
|
moonshot/src/prompt_templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
-
moonshot/src/prompt_templates/prompt_template.py,sha256=
|
|
131
|
+
moonshot/src/prompt_templates/prompt_template.py,sha256=IT4ufLFDX43rD_Ewa1lJbYIBW4fHaTu_YyzOvvUU3Ts,3500
|
|
124
132
|
moonshot/src/recipes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
125
|
-
moonshot/src/recipes/recipe.py,sha256=
|
|
133
|
+
moonshot/src/recipes/recipe.py,sha256=cAPNAZZAqn3NYu23oV6xrf2innWTAcCSn-EB2Z-_UY8,13808
|
|
126
134
|
moonshot/src/recipes/recipe_arguments.py,sha256=7s0MnyIluBxZqaHY-sJdz5MC1c8iR35Tas4pwKpY7u8,4067
|
|
127
135
|
moonshot/src/redteaming/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
136
|
moonshot/src/redteaming/attack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
129
|
-
moonshot/src/redteaming/attack/attack_module.py,sha256=
|
|
130
|
-
moonshot/src/redteaming/attack/attack_module_arguments.py,sha256=
|
|
131
|
-
moonshot/src/redteaming/attack/context_strategy.py,sha256=
|
|
137
|
+
moonshot/src/redteaming/attack/attack_module.py,sha256=HrL7YdsW-wcFB5Dv8t3wkPvg2pf-c9Ep994qdbk1D3s,25061
|
|
138
|
+
moonshot/src/redteaming/attack/attack_module_arguments.py,sha256=L8H6poNj7xNWLUr6jfuSkwE7TNV0aTPaZBal4OvL7IA,1225
|
|
139
|
+
moonshot/src/redteaming/attack/context_strategy.py,sha256=KiAw85Pl8tuTzQ2d3CkZrjn3Ddp7BnlT5Gc67TTnq4M,4821
|
|
132
140
|
moonshot/src/redteaming/context_strategy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
133
141
|
moonshot/src/redteaming/context_strategy/context_strategy_interface.py,sha256=AdWEkXBaXE6fmVi3QashI9toWS-Vd-KnAZ0zo8TKSPA,1381
|
|
134
142
|
moonshot/src/redteaming/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
135
143
|
moonshot/src/redteaming/session/chat.py,sha256=KIfyQdc3TmTQ0WsYzXldbswt--ZA4ctLylOuDf-GRlo,7496
|
|
136
144
|
moonshot/src/redteaming/session/red_teaming_progress.py,sha256=MNnzTI98Ra4dFn5DVAFJ9Iizq6gKK2OOpQyuYMKLul0,5547
|
|
137
145
|
moonshot/src/redteaming/session/red_teaming_type.py,sha256=qqhYWyjr2v2fyKr1AD8oFA9vZJkevpwDl57Cmzz-aR8,102
|
|
138
|
-
moonshot/src/redteaming/session/session.py,sha256=
|
|
146
|
+
moonshot/src/redteaming/session/session.py,sha256=kLifZmdWfqy2IuRHJeC4WhwdnxGdf3wKvayW3Kwpbz8,29994
|
|
139
147
|
moonshot/src/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
140
|
-
moonshot/src/results/result.py,sha256=
|
|
148
|
+
moonshot/src/results/result.py,sha256=o56SdhYH-XVfpeeKhN495dJPkU035MmTjRUx48q53lo,4527
|
|
141
149
|
moonshot/src/results/result_arguments.py,sha256=mTR7yajY72PFglfAaa1ajJfvYNV4IBGLXS4VaD53-8c,1334
|
|
142
150
|
moonshot/src/runners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
143
|
-
moonshot/src/runners/runner.py,sha256=
|
|
151
|
+
moonshot/src/runners/runner.py,sha256=Wsvdzcw4KOa-ppgGVRGSK2YxLfXK-daHDw3k5jETv-4,21197
|
|
144
152
|
moonshot/src/runners/runner_arguments.py,sha256=Bg4OPSmgr9jZKNAwPH0T3epEHw-6qGrflszFc6oMyEU,1640
|
|
145
153
|
moonshot/src/runners/runner_type.py,sha256=jOfnAnaCYp-rPTRJXhM8hin_dinlR0sMwmimQXvLcJ0,100
|
|
146
154
|
moonshot/src/runs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
147
|
-
moonshot/src/runs/run.py,sha256=
|
|
155
|
+
moonshot/src/runs/run.py,sha256=QFdvWwCnqSjLrsTk3jJ1ccs3R1ZAZNvz5ls9Q_iRxO0,14132
|
|
148
156
|
moonshot/src/runs/run_arguments.py,sha256=G043ERvHIU_dd0JghboZgxDWCcjYOaDwue1ieDunDKA,6443
|
|
149
|
-
moonshot/src/runs/run_progress.py,sha256=
|
|
157
|
+
moonshot/src/runs/run_progress.py,sha256=d1BcNo6Kp4vA165TDx_xebl8JDo92aV-YutPxsgCOxE,6495
|
|
150
158
|
moonshot/src/runs/run_status.py,sha256=TRtizcDzPxf6aQ2c3OovM6IQKJ0VCBhqDWvn7UBw5Zg,251
|
|
151
159
|
moonshot/src/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
|
-
moonshot/src/storage/db_interface.py,sha256=
|
|
160
|
+
moonshot/src/storage/db_interface.py,sha256=DiiuizZcPlHrdqhesYirrKOQr-SS1N4ymbY4XXHKXfQ,5019
|
|
153
161
|
moonshot/src/storage/io_interface.py,sha256=9IpMGtsVbToWBuS-ZRnaZJTMneUV8V0drCxk-OaN3dQ,824
|
|
154
|
-
moonshot/src/storage/storage.py,sha256=
|
|
162
|
+
moonshot/src/storage/storage.py,sha256=qQrGFPVzsDwYFrBWa3XLajSjhUtQBwGg4pAr54DFC5Y,22027
|
|
155
163
|
moonshot/src/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
164
|
+
moonshot/src/utils/find_feature.py,sha256=a5CZMcDJ-Hp2OlV1fRug8Yu32_31KxlMie9lf4_ij9U,1296
|
|
156
165
|
moonshot/src/utils/import_modules.py,sha256=T9zTN59PFnvY2rjyWhSV9KSIAHxWV1pyBemF0y-hwtw,2844
|
|
157
|
-
moonshot/src/utils/
|
|
158
|
-
|
|
159
|
-
aiverify_moonshot-0.4.
|
|
160
|
-
aiverify_moonshot-0.4.
|
|
161
|
-
aiverify_moonshot-0.4.
|
|
162
|
-
aiverify_moonshot-0.4.
|
|
163
|
-
aiverify_moonshot-0.4.
|
|
166
|
+
moonshot/src/utils/log.py,sha256=JtnsCk3RodBo-BmrOfKzyILYg6jiDlrByGfbvXFoAjk,2229
|
|
167
|
+
moonshot/src/utils/timeit.py,sha256=TvuF0w8KWhp0oZFY0cUU3UY0xlGKjchb0OkfYfgVTlc,866
|
|
168
|
+
aiverify_moonshot-0.4.2.dist-info/METADATA,sha256=wCZOuFZXEuOH6psgKCe-ZQtj8dbsXPwPTnxsowc6wB0,12307
|
|
169
|
+
aiverify_moonshot-0.4.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
170
|
+
aiverify_moonshot-0.4.2.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
|
|
171
|
+
aiverify_moonshot-0.4.2.dist-info/licenses/LICENSE.md,sha256=mDOKOkWFbJmUORaAchXByEVGC1jw37QRn-zS14wY_wM,11347
|
|
172
|
+
aiverify_moonshot-0.4.2.dist-info/licenses/NOTICES.md,sha256=0Ikx6IBGGQEOJeNb2MkRoXxTXwrtlMz6EDgLBFIz6v0,179593
|
|
173
|
+
aiverify_moonshot-0.4.2.dist-info/RECORD,,
|
moonshot/__main__.py
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import warnings
|
|
3
1
|
import argparse
|
|
2
|
+
import os
|
|
4
3
|
import platform
|
|
5
4
|
import subprocess
|
|
6
|
-
import
|
|
7
|
-
import threading
|
|
5
|
+
import sys
|
|
6
|
+
import threading
|
|
7
|
+
import warnings
|
|
8
|
+
|
|
8
9
|
from dotenv import dotenv_values
|
|
10
|
+
|
|
9
11
|
from moonshot.api import api_set_environment_variables
|
|
12
|
+
from moonshot.src.utils.log import configure_logger
|
|
13
|
+
|
|
14
|
+
# Create a logger for this module
|
|
15
|
+
logger = configure_logger(__name__)
|
|
16
|
+
|
|
10
17
|
"""
|
|
11
18
|
Run the Moonshot application
|
|
12
19
|
"""
|
|
20
|
+
|
|
21
|
+
|
|
13
22
|
def run_subprocess(*args, **kwargs):
|
|
14
23
|
"""
|
|
15
24
|
Run a subprocess with the option to use shell=True on Windows.
|
|
@@ -18,6 +27,7 @@ def run_subprocess(*args, **kwargs):
|
|
|
18
27
|
kwargs["shell"] = True
|
|
19
28
|
return subprocess.run(*args, **kwargs)
|
|
20
29
|
|
|
30
|
+
|
|
21
31
|
def ms_lib_env_file(data_repo_name):
|
|
22
32
|
"""
|
|
23
33
|
Writes the env file to be used for moonshot library
|
|
@@ -25,6 +35,7 @@ def ms_lib_env_file(data_repo_name):
|
|
|
25
35
|
env_content_data = f"""
|
|
26
36
|
# For Data
|
|
27
37
|
ATTACK_MODULES="./{data_repo_name}/attack-modules"
|
|
38
|
+
BOOKMARKS="./{data_repo_name}/generated-outputs/bookmarks"
|
|
28
39
|
CONNECTORS="./{data_repo_name}/connectors"
|
|
29
40
|
CONNECTORS_ENDPOINTS="./{data_repo_name}/connectors-endpoints"
|
|
30
41
|
CONTEXT_STRATEGY="./{data_repo_name}/context-strategy"
|
|
@@ -40,7 +51,7 @@ def ms_lib_env_file(data_repo_name):
|
|
|
40
51
|
RESULTS_MODULES="./{data_repo_name}/results-modules"
|
|
41
52
|
RUNNERS="./{data_repo_name}/generated-outputs/runners"
|
|
42
53
|
RUNNERS_MODULES="./{data_repo_name}/runners-modules"
|
|
43
|
-
TOKENIZERS_PARALLELISM = false
|
|
54
|
+
TOKENIZERS_PARALLELISM = false
|
|
44
55
|
"""
|
|
45
56
|
|
|
46
57
|
env_content_web_api = """
|
|
@@ -58,6 +69,7 @@ def ms_lib_env_file(data_repo_name):
|
|
|
58
69
|
combined_content = env_content_data + env_content_web_api
|
|
59
70
|
env_file.write(combined_content.strip())
|
|
60
71
|
|
|
72
|
+
|
|
61
73
|
def ms_ui_env_file(ui_repo):
|
|
62
74
|
"""
|
|
63
75
|
Write the env file to be used with moonshot ui
|
|
@@ -71,66 +83,73 @@ def ms_ui_env_file(ui_repo):
|
|
|
71
83
|
with open(os.path.join(ui_repo, ".env"), "w") as env_file:
|
|
72
84
|
env_file.write(env_content.strip())
|
|
73
85
|
|
|
86
|
+
|
|
74
87
|
def moonshot_data_installation():
|
|
75
88
|
# Code for moonshot-data installation
|
|
76
|
-
|
|
89
|
+
logger.info("Installing Moonshot Data from GitHub")
|
|
77
90
|
repo = "https://github.com/aiverify-foundation/moonshot-data.git"
|
|
78
91
|
folder_name = repo.split("/")[-1].replace(".git", "")
|
|
79
|
-
|
|
92
|
+
|
|
80
93
|
# Check if the directory already exists
|
|
81
94
|
if not os.path.exists(folder_name):
|
|
82
|
-
|
|
95
|
+
logger.info(f"Cloning {repo}")
|
|
83
96
|
# Clone the repository
|
|
84
97
|
run_subprocess(["git", "clone", repo], check=True)
|
|
85
|
-
|
|
98
|
+
|
|
99
|
+
# Create .env to point to installed folder
|
|
100
|
+
ms_lib_env_file(folder_name)
|
|
101
|
+
|
|
86
102
|
# Change directory to the folder
|
|
87
103
|
os.chdir(folder_name)
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
logger.info(f"Installing requirements for {folder_name}")
|
|
90
106
|
# Install the requirements if they exist
|
|
91
107
|
if os.path.exists("requirements.txt"):
|
|
92
108
|
run_subprocess(["pip", "install", "-r", "requirements.txt"], check=True)
|
|
93
109
|
import nltk
|
|
94
|
-
|
|
95
|
-
nltk.download(
|
|
96
|
-
nltk.download(
|
|
97
|
-
nltk.download(
|
|
98
|
-
|
|
110
|
+
|
|
111
|
+
nltk.download("punkt")
|
|
112
|
+
nltk.download("stopwords")
|
|
113
|
+
nltk.download("averaged_perceptron_tagger")
|
|
114
|
+
nltk.download("universal_tagset")
|
|
115
|
+
|
|
99
116
|
# Change back to the base directory
|
|
100
117
|
os.chdir("..")
|
|
101
118
|
|
|
102
|
-
# Create .env to point to installed folder
|
|
103
|
-
ms_lib_env_file(folder_name)
|
|
104
119
|
else:
|
|
105
|
-
|
|
120
|
+
logger.warning(f"Directory {folder_name} already exists, skipping clone.")
|
|
121
|
+
|
|
106
122
|
|
|
107
123
|
def moonshot_ui_installation():
|
|
108
124
|
# Code for moonshot-ui installation
|
|
109
125
|
repo = "https://github.com/aiverify-foundation/moonshot-ui.git"
|
|
110
126
|
folder_name = repo.split("/")[-1].replace(".git", "")
|
|
111
|
-
|
|
127
|
+
|
|
112
128
|
# Check if the directory already exists
|
|
113
129
|
if not os.path.exists(folder_name):
|
|
114
|
-
|
|
130
|
+
logger.info(f"Cloning {repo}")
|
|
115
131
|
# Clone the repository
|
|
116
132
|
run_subprocess(["git", "clone", repo], check=True)
|
|
117
133
|
|
|
118
134
|
# Change directory to the folder
|
|
119
135
|
os.chdir(folder_name)
|
|
120
136
|
|
|
121
|
-
|
|
137
|
+
logger.info(f"Installing requirements for {folder_name}")
|
|
122
138
|
# Install the requirements if they exist
|
|
123
139
|
if os.path.exists("package.json"):
|
|
124
140
|
run_subprocess(["npm", "install"], check=True)
|
|
125
141
|
run_subprocess(["npm", "run", "build"], check=True)
|
|
126
|
-
|
|
142
|
+
|
|
127
143
|
# Change back to the base directory
|
|
128
144
|
os.chdir("..")
|
|
129
145
|
|
|
130
146
|
# Create .env for ui
|
|
131
147
|
ms_ui_env_file(folder_name)
|
|
132
148
|
else:
|
|
133
|
-
|
|
149
|
+
logger.warning(
|
|
150
|
+
f"Directory {folder_name} already exists, skipping installation."
|
|
151
|
+
)
|
|
152
|
+
|
|
134
153
|
|
|
135
154
|
def run_moonshot_ui_dev():
|
|
136
155
|
"""
|
|
@@ -140,31 +159,51 @@ def run_moonshot_ui_dev():
|
|
|
140
159
|
ui_dev_dir = os.path.join(base_directory, "moonshot-ui")
|
|
141
160
|
|
|
142
161
|
if not os.path.exists(ui_dev_dir):
|
|
143
|
-
|
|
162
|
+
logger.error(
|
|
163
|
+
"moonshot-ui does not exist. Please run with '-i moonshot-ui' to install moonshot-ui first."
|
|
164
|
+
)
|
|
144
165
|
sys.exit(1)
|
|
145
166
|
# ms_ui_env_file(ui_dev_dir)
|
|
146
|
-
run_subprocess([
|
|
167
|
+
run_subprocess(["npm", "start"], cwd=ui_dev_dir)
|
|
168
|
+
|
|
147
169
|
|
|
148
170
|
def main():
|
|
149
171
|
parser = argparse.ArgumentParser(description="Run the Moonshot application")
|
|
150
|
-
parser.add_argument(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
172
|
+
parser.add_argument(
|
|
173
|
+
"mode",
|
|
174
|
+
nargs="?",
|
|
175
|
+
choices=["web-api", "cli", "web", "help"],
|
|
176
|
+
help="Mode to run Moonshot in",
|
|
177
|
+
default=help,
|
|
178
|
+
)
|
|
179
|
+
parser.add_argument(
|
|
180
|
+
"cli_command", nargs="?", help='The CLI command to run (e.g., "interactive")'
|
|
181
|
+
)
|
|
182
|
+
parser.add_argument(
|
|
183
|
+
"-i",
|
|
184
|
+
"--install",
|
|
185
|
+
action="append",
|
|
186
|
+
choices=["moonshot-data", "moonshot-ui"],
|
|
187
|
+
help="Modules to install",
|
|
188
|
+
default=[],
|
|
189
|
+
)
|
|
190
|
+
parser.add_argument(
|
|
191
|
+
"-e", "--env", type=str, help="Path to the .env file", default=".env"
|
|
192
|
+
)
|
|
193
|
+
|
|
155
194
|
args = parser.parse_args()
|
|
156
|
-
|
|
195
|
+
|
|
157
196
|
# Handle installations based on the -i include arguments
|
|
158
|
-
if
|
|
197
|
+
if "moonshot-data" in args.install:
|
|
159
198
|
moonshot_data_installation()
|
|
160
199
|
|
|
161
|
-
if
|
|
200
|
+
if "moonshot-ui" in args.install:
|
|
162
201
|
moonshot_ui_installation()
|
|
163
202
|
|
|
164
203
|
# If mode is not specified, skip running any modes
|
|
165
204
|
if args.mode is None:
|
|
166
205
|
return
|
|
167
|
-
|
|
206
|
+
|
|
168
207
|
if args.mode == "help":
|
|
169
208
|
parser.print_help()
|
|
170
209
|
sys.exit(1)
|
|
@@ -173,18 +212,21 @@ def main():
|
|
|
173
212
|
|
|
174
213
|
if args.mode == "web-api":
|
|
175
214
|
from moonshot.integrations.web_api import __main__ as web_api
|
|
215
|
+
|
|
176
216
|
web_api.start_app()
|
|
177
217
|
elif args.mode == "web":
|
|
178
|
-
|
|
218
|
+
# Create and start the UI dev server thread
|
|
179
219
|
ui_thread = threading.Thread(target=run_moonshot_ui_dev)
|
|
180
220
|
ui_thread.start()
|
|
181
221
|
ui_thread.join(timeout=0.1) # Wait briefly for the thread to become alive
|
|
182
222
|
if not ui_thread.is_alive():
|
|
183
223
|
sys.exit(1)
|
|
184
224
|
from moonshot.integrations.web_api import __main__ as web_api
|
|
225
|
+
|
|
185
226
|
web_api.start_app()
|
|
186
227
|
elif args.mode == "cli":
|
|
187
228
|
from moonshot.integrations.cli import __main__ as cli
|
|
229
|
+
|
|
188
230
|
cli.start_app(args.cli_command)
|
|
189
231
|
|
|
190
232
|
# Handle CLI mode here, possibly also with additional arguments
|
|
@@ -193,6 +235,7 @@ def main():
|
|
|
193
235
|
parser.print_help()
|
|
194
236
|
sys.exit(1)
|
|
195
237
|
|
|
238
|
+
|
|
196
239
|
if __name__ == "__main__":
|
|
197
240
|
warnings.filterwarnings("ignore")
|
|
198
|
-
main()
|
|
241
|
+
main()
|
moonshot/api.py
CHANGED
|
@@ -86,6 +86,14 @@ from moonshot.src.api.api_session import (
|
|
|
86
86
|
api_update_prompt_template,
|
|
87
87
|
api_update_system_prompt,
|
|
88
88
|
)
|
|
89
|
+
from moonshot.src.api.api_bookmark import (
|
|
90
|
+
api_get_all_bookmarks,
|
|
91
|
+
api_get_bookmark,
|
|
92
|
+
api_insert_bookmark,
|
|
93
|
+
api_delete_bookmark,
|
|
94
|
+
api_delete_all_bookmark,
|
|
95
|
+
api_export_bookmarks,
|
|
96
|
+
)
|
|
89
97
|
|
|
90
98
|
__all__ = [
|
|
91
99
|
"api_create_connector_from_endpoint",
|
|
@@ -152,4 +160,10 @@ __all__ = [
|
|
|
152
160
|
"api_update_metric",
|
|
153
161
|
"api_update_prompt_template",
|
|
154
162
|
"api_update_system_prompt",
|
|
163
|
+
"api_get_all_bookmarks",
|
|
164
|
+
"api_get_bookmark",
|
|
165
|
+
"api_insert_bookmark",
|
|
166
|
+
"api_delete_bookmark",
|
|
167
|
+
"api_delete_all_bookmark",
|
|
168
|
+
"api_export_bookmarks",
|
|
155
169
|
]
|
|
@@ -8,6 +8,7 @@ from moonshot.integrations.cli.benchmark.cookbook import (
|
|
|
8
8
|
delete_cookbook,
|
|
9
9
|
delete_cookbook_args,
|
|
10
10
|
list_cookbooks,
|
|
11
|
+
list_cookbooks_args,
|
|
11
12
|
run_cookbook,
|
|
12
13
|
run_cookbook_args,
|
|
13
14
|
update_cookbook,
|
|
@@ -19,6 +20,7 @@ from moonshot.integrations.cli.benchmark.datasets import (
|
|
|
19
20
|
delete_dataset,
|
|
20
21
|
delete_dataset_args,
|
|
21
22
|
list_datasets,
|
|
23
|
+
list_datasets_args,
|
|
22
24
|
view_dataset,
|
|
23
25
|
view_dataset_args,
|
|
24
26
|
)
|
|
@@ -26,6 +28,7 @@ from moonshot.integrations.cli.benchmark.metrics import (
|
|
|
26
28
|
delete_metric,
|
|
27
29
|
delete_metric_args,
|
|
28
30
|
list_metrics,
|
|
31
|
+
list_metrics_args,
|
|
29
32
|
view_metric,
|
|
30
33
|
view_metric_args,
|
|
31
34
|
)
|
|
@@ -35,6 +38,7 @@ from moonshot.integrations.cli.benchmark.recipe import (
|
|
|
35
38
|
delete_recipe,
|
|
36
39
|
delete_recipe_args,
|
|
37
40
|
list_recipes,
|
|
41
|
+
list_recipes_args,
|
|
38
42
|
run_recipe,
|
|
39
43
|
run_recipe_args,
|
|
40
44
|
update_recipe,
|
|
@@ -46,10 +50,16 @@ from moonshot.integrations.cli.benchmark.result import (
|
|
|
46
50
|
delete_result,
|
|
47
51
|
delete_result_args,
|
|
48
52
|
list_results,
|
|
53
|
+
list_results_args,
|
|
49
54
|
view_result,
|
|
50
55
|
view_result_args,
|
|
51
56
|
)
|
|
52
|
-
from moonshot.integrations.cli.benchmark.run import
|
|
57
|
+
from moonshot.integrations.cli.benchmark.run import (
|
|
58
|
+
list_runs,
|
|
59
|
+
list_runs_args,
|
|
60
|
+
view_run,
|
|
61
|
+
view_run_args,
|
|
62
|
+
)
|
|
53
63
|
from moonshot.integrations.cli.benchmark.runner import (
|
|
54
64
|
delete_runner,
|
|
55
65
|
delete_runner_args,
|
|
@@ -68,26 +78,32 @@ class BenchmarkCommandSet(cmd2.CommandSet):
|
|
|
68
78
|
# List contents
|
|
69
79
|
# ------------------------------------------------------------------------------
|
|
70
80
|
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
@cmd2.with_argparser(list_cookbooks_args)
|
|
82
|
+
def do_list_cookbooks(self, args: argparse.Namespace) -> None:
|
|
83
|
+
list_cookbooks(args)
|
|
73
84
|
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
@cmd2.with_argparser(list_recipes_args)
|
|
86
|
+
def do_list_recipes(self, args: argparse.Namespace) -> None:
|
|
87
|
+
list_recipes(args)
|
|
76
88
|
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
@cmd2.with_argparser(list_results_args)
|
|
90
|
+
def do_list_results(self, args: argparse.Namespace) -> None:
|
|
91
|
+
list_results(args)
|
|
79
92
|
|
|
80
93
|
def do_list_runners(self, _: cmd2.Statement) -> None:
|
|
81
94
|
list_runners()
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
@cmd2.with_argparser(list_runs_args)
|
|
97
|
+
def do_list_runs(self, args: argparse.Namespace) -> None:
|
|
98
|
+
list_runs(args)
|
|
85
99
|
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
@cmd2.with_argparser(list_metrics_args)
|
|
101
|
+
def do_list_metrics(self, args: argparse.Namespace) -> None:
|
|
102
|
+
list_metrics(args)
|
|
88
103
|
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
@cmd2.with_argparser(list_datasets_args)
|
|
105
|
+
def do_list_datasets(self, args: argparse.Namespace) -> None:
|
|
106
|
+
list_datasets(args)
|
|
91
107
|
|
|
92
108
|
# ------------------------------------------------------------------------------
|
|
93
109
|
# Add contents
|