aiverify-moonshot 0.4.1__py3-none-any.whl → 0.4.3__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.
Files changed (70) hide show
  1. {aiverify_moonshot-0.4.1.dist-info → aiverify_moonshot-0.4.3.dist-info}/METADATA +2 -2
  2. {aiverify_moonshot-0.4.1.dist-info → aiverify_moonshot-0.4.3.dist-info}/RECORD +70 -56
  3. moonshot/__main__.py +77 -35
  4. moonshot/api.py +16 -0
  5. moonshot/integrations/cli/benchmark/benchmark.py +29 -13
  6. moonshot/integrations/cli/benchmark/cookbook.py +62 -24
  7. moonshot/integrations/cli/benchmark/datasets.py +79 -40
  8. moonshot/integrations/cli/benchmark/metrics.py +62 -23
  9. moonshot/integrations/cli/benchmark/recipe.py +89 -69
  10. moonshot/integrations/cli/benchmark/result.py +85 -47
  11. moonshot/integrations/cli/benchmark/run.py +99 -59
  12. moonshot/integrations/cli/common/common.py +20 -6
  13. moonshot/integrations/cli/common/connectors.py +154 -74
  14. moonshot/integrations/cli/common/dataset.py +66 -0
  15. moonshot/integrations/cli/common/prompt_template.py +57 -19
  16. moonshot/integrations/cli/redteam/attack_module.py +90 -24
  17. moonshot/integrations/cli/redteam/context_strategy.py +83 -23
  18. moonshot/integrations/cli/redteam/prompt_template.py +1 -1
  19. moonshot/integrations/cli/redteam/redteam.py +52 -6
  20. moonshot/integrations/cli/redteam/session.py +565 -44
  21. moonshot/integrations/cli/utils/process_data.py +52 -0
  22. moonshot/integrations/web_api/__main__.py +2 -0
  23. moonshot/integrations/web_api/app.py +6 -6
  24. moonshot/integrations/web_api/container.py +12 -2
  25. moonshot/integrations/web_api/routes/bookmark.py +173 -0
  26. moonshot/integrations/web_api/routes/dataset.py +46 -1
  27. moonshot/integrations/web_api/schemas/bookmark_create_dto.py +13 -0
  28. moonshot/integrations/web_api/schemas/dataset_create_dto.py +18 -0
  29. moonshot/integrations/web_api/schemas/recipe_create_dto.py +0 -2
  30. moonshot/integrations/web_api/services/bookmark_service.py +94 -0
  31. moonshot/integrations/web_api/services/dataset_service.py +25 -0
  32. moonshot/integrations/web_api/services/recipe_service.py +0 -1
  33. moonshot/integrations/web_api/services/utils/file_manager.py +52 -0
  34. moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py +0 -1
  35. moonshot/integrations/web_api/temp/.gitkeep +0 -0
  36. moonshot/src/api/api_bookmark.py +95 -0
  37. moonshot/src/api/api_connector_endpoint.py +1 -1
  38. moonshot/src/api/api_context_strategy.py +2 -2
  39. moonshot/src/api/api_dataset.py +35 -0
  40. moonshot/src/api/api_recipe.py +0 -3
  41. moonshot/src/api/api_session.py +1 -1
  42. moonshot/src/bookmark/bookmark.py +257 -0
  43. moonshot/src/bookmark/bookmark_arguments.py +38 -0
  44. moonshot/src/configs/env_variables.py +12 -2
  45. moonshot/src/connectors/connector.py +15 -7
  46. moonshot/src/connectors_endpoints/connector_endpoint.py +65 -49
  47. moonshot/src/cookbooks/cookbook.py +57 -37
  48. moonshot/src/datasets/dataset.py +125 -5
  49. moonshot/src/metrics/metric.py +8 -4
  50. moonshot/src/metrics/metric_interface.py +8 -2
  51. moonshot/src/prompt_templates/prompt_template.py +5 -1
  52. moonshot/src/recipes/recipe.py +38 -40
  53. moonshot/src/recipes/recipe_arguments.py +0 -4
  54. moonshot/src/redteaming/attack/attack_module.py +18 -8
  55. moonshot/src/redteaming/attack/context_strategy.py +6 -2
  56. moonshot/src/redteaming/session/session.py +15 -11
  57. moonshot/src/results/result.py +7 -3
  58. moonshot/src/runners/runner.py +65 -42
  59. moonshot/src/runs/run.py +15 -11
  60. moonshot/src/runs/run_progress.py +7 -3
  61. moonshot/src/storage/db_interface.py +14 -0
  62. moonshot/src/storage/storage.py +33 -2
  63. moonshot/src/utils/find_feature.py +45 -0
  64. moonshot/src/utils/log.py +72 -0
  65. moonshot/src/utils/pagination.py +25 -0
  66. moonshot/src/utils/timeit.py +8 -1
  67. {aiverify_moonshot-0.4.1.dist-info → aiverify_moonshot-0.4.3.dist-info}/WHEEL +0 -0
  68. {aiverify_moonshot-0.4.1.dist-info → aiverify_moonshot-0.4.3.dist-info}/licenses/AUTHORS.md +0 -0
  69. {aiverify_moonshot-0.4.1.dist-info → aiverify_moonshot-0.4.3.dist-info}/licenses/LICENSE.md +0 -0
  70. {aiverify_moonshot-0.4.1.dist-info → aiverify_moonshot-0.4.3.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.1
3
+ Version: 0.4.3
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
  ![Moonshot Logo](https://github.com/aiverify-foundation/moonshot/raw/main/misc/aiverify-moonshot-logo.png)
45
45
 
46
- **Version 0.4.1**
46
+ **Version 0.4.3**
47
47
 
48
48
  A simple and modular tool to evaluate any LLM application.
49
49
 
@@ -1,47 +1,50 @@
1
1
  moonshot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- moonshot/__main__.py,sha256=EHvFjnZcZCQ1WZS4OYud-VkiwG1p6HjRDepBkkyZYkY,7177
3
- moonshot/api.py,sha256=cI2DR4xcEh5-RonG4du13Ime-uzaCrgwzUuau8WnJ7o,4405
2
+ moonshot/__main__.py,sha256=NB_sWjPRcwr8BbFXtih2y3fbVYPZ1YS5dI_bNNaTD3U,7551
3
+ moonshot/api.py,sha256=f7vIMlpC-1ZQsbqipe2cTlP5dwgoVujQKYNxzEKcWlg,4822
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=w3hcHd7lbNRsH7wfsqY09IqwVDIMYCYuwlznBuERlao,5818
11
- moonshot/integrations/cli/benchmark/cookbook.py,sha256=n3vLNnbIquGtE4PUv4OCJN7Sw75qnE9x7eQE2CrmIiQ,20941
12
- moonshot/integrations/cli/benchmark/datasets.py,sha256=xMTpUna08gzHcfyP97FUCoJ42LWPWVsdiPxl0TuMKr0,6000
13
- moonshot/integrations/cli/benchmark/metrics.py,sha256=AX8v1yJeYCqC3zHuTZDOQLTodvI7A-lrRABJpFu3Ly8,5117
14
- moonshot/integrations/cli/benchmark/recipe.py,sha256=FTJbsvtZloHWzpgnMGibeiiGzUCdVXE90Hn89_o2ExI,22202
15
- moonshot/integrations/cli/benchmark/result.py,sha256=RWsdcpmja5nVni_4h2zFJ3vwO_2geORoO8tx3xoI95o,8379
16
- moonshot/integrations/cli/benchmark/run.py,sha256=f5XSPivftuoW1ghyOSVxlV4Tm05iZefJuUg475Wt2sk,5122
10
+ moonshot/integrations/cli/benchmark/benchmark.py,sha256=QUxr6DU11-XeH6Y3j1uPsZsotshgy64G_cWNf0Rn2_U,6303
11
+ moonshot/integrations/cli/benchmark/cookbook.py,sha256=9mNuqsaVFCfXnLgVxJQ-fzwSgH8j082NR2gE-GPQbG8,22183
12
+ moonshot/integrations/cli/benchmark/datasets.py,sha256=E-kreuXkrNU39sFuVWGhutFHfoEhsVjFK4tmq7YQwxs,7193
13
+ moonshot/integrations/cli/benchmark/metrics.py,sha256=6wLn3WyqgUJKCRvblxiyx8X4nQ7gA1sKGcC_DNBIWBo,6351
14
+ moonshot/integrations/cli/benchmark/recipe.py,sha256=EYv94Qjq2hqn1zz9NzWaINEY9DNdY7TkSS57xHv6ymQ,22698
15
+ moonshot/integrations/cli/benchmark/result.py,sha256=U0SsjJYNQJYP_EZ3pAil4VaOQLMZHchfzq982nXU-jE,9486
16
+ moonshot/integrations/cli/benchmark/run.py,sha256=Rqdb_FspgQQhkLORjgdiyaijk7HTxM39giOzXpBXA1k,6161
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=XH0miHQvpB3SrIO3F2lX6Px6nA2x_kwlWbjxfmA3Krg,2582
20
- moonshot/integrations/cli/common/connectors.py,sha256=jooMggdYNmhMhfmI0UiuJldjAmKriL66B1QqkdD_XZE,11532
19
+ moonshot/integrations/cli/common/common.py,sha256=hSvxj-T91nhKfJtQqxrIPgYdS8P_g7wbOwpFpqBg90I,3090
20
+ moonshot/integrations/cli/common/connectors.py,sha256=8_U7KJzfsS9L13dMbouk5JKOy_ow4UhrILICCw27Q5c,13909
21
+ moonshot/integrations/cli/common/dataset.py,sha256=KZuwSV4Di7C378Aa2bRxIKCd03oo6HdMTEZpBZSQb5w,3113
21
22
  moonshot/integrations/cli/common/display_helper.py,sha256=8rVowW33XK0j0C_X_H1jUbFlFk1Y2WpzxmIUE3Ca5Co,1459
22
- moonshot/integrations/cli/common/prompt_template.py,sha256=Q_xlxI-7JorfkMqxCrdV2sE8Po0snElswxlq87GOx98,3430
23
+ moonshot/integrations/cli/common/prompt_template.py,sha256=KzawF2VaiWUKzRIrXX_TaHboiPVllSiqz5I_o2TqGiA,4812
23
24
  moonshot/integrations/cli/initialisation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
25
  moonshot/integrations/cli/initialisation/initialisation.py,sha256=zMjklhoBlYLPshe7Q16vBBbOfhbPjZc4_ooywAFp2XY,387
25
26
  moonshot/integrations/cli/redteam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- moonshot/integrations/cli/redteam/attack_module.py,sha256=p6s8XXHMTmeeBTtERQ-XlO7xgs1RoDigklgz-PNEp8M,2343
27
- moonshot/integrations/cli/redteam/context_strategy.py,sha256=bl0U8u1xS1tJewwx2Oue5yAsc7VEFullIjdKn392DG8,5132
28
- moonshot/integrations/cli/redteam/prompt_template.py,sha256=JNPr1GnPr4Vs1w51_jX0OIPTrv1B87rRw4oE6HxE3Y8,2075
29
- moonshot/integrations/cli/redteam/redteam.py,sha256=-g1hayxhJ-VRn6m6DNIn2VIs3dBP9og-J6JcFC8Y-X0,2767
30
- moonshot/integrations/cli/redteam/session.py,sha256=gt-NBJGGZujHT1qYgt8XS3JzZvT0TTPYmTFjSMAlmr0,15783
27
+ moonshot/integrations/cli/redteam/attack_module.py,sha256=sjjQdBno7rXNfrXqns55ERSfD0ZFE0CQoWOk-sTJcqo,4599
28
+ moonshot/integrations/cli/redteam/context_strategy.py,sha256=gLNgnd1oHWD1X93BQoKlR7G8b5g9P6AcKFLlE3WvETk,7065
29
+ moonshot/integrations/cli/redteam/prompt_template.py,sha256=rWINvMFLax8ynIFJoX93xsB1cWJ8-dQ1nRyqgdri2yQ,2079
30
+ moonshot/integrations/cli/redteam/redteam.py,sha256=144tVuiSWBLseC0EvvIuevHYJhqn39xvg36-1cLgGWQ,4257
31
+ moonshot/integrations/cli/redteam/session.py,sha256=auZ73LfMAGmT1jLJUjqY6oAsMWoSzHstiRGA8DKF6A4,33652
32
+ moonshot/integrations/cli/utils/process_data.py,sha256=QVL5vp2_8ZgGicmCAdeYEHkeb6f-NC775-JCzWziNiU,1901
31
33
  moonshot/integrations/web_api/.env.dev,sha256=0z5_Ut8rF-UqFZtgjkH2qoqORhD5_nSs2w_OeX2SteI,182
32
34
  moonshot/integrations/web_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- moonshot/integrations/web_api/__main__.py,sha256=UDLKKAATJXFXB5I9VqUx4_JUfCn4xDLE0pFRsw4B3hw,1941
34
- moonshot/integrations/web_api/app.py,sha256=ROPOfly753cXP2IP9GCDe18qIeDwvwsuUxMgy6NxQB4,3616
35
- moonshot/integrations/web_api/container.py,sha256=ziTi3yPjI-WEGZvUbMFFPi0JPSLAinkUQyPZ1vMwtdQ,5522
35
+ moonshot/integrations/web_api/__main__.py,sha256=MdnLi_ZF-olAAEJwTPU1iGYFYwo-fNWNT2qfchkH3y4,2050
36
+ moonshot/integrations/web_api/app.py,sha256=qsWP9KDEgt18653btn8QUP9p3YIVYymJChKPTaTufFs,3651
37
+ moonshot/integrations/web_api/container.py,sha256=DVkJG_qm7ItcG6tgMYOqIj07wpKhPWOOfy6-bEv72y4,5915
36
38
  moonshot/integrations/web_api/logging_conf.py,sha256=t3EGRV6tZhV732KXe8_Tiy0fiwVAWxZX5Tt8VTgrrfg,3388
37
39
  moonshot/integrations/web_api/log/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
40
  moonshot/integrations/web_api/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
41
  moonshot/integrations/web_api/routes/attack_modules.py,sha256=m0mGGTEHyaVld8WYHXxQ5Gm0sKdTqy_rJUrNVFcgVgw,2413
40
42
  moonshot/integrations/web_api/routes/benchmark.py,sha256=RRzouKcoVNYXm7o1LadsZTgzfmUsaYdQTC0AfsLdiC4,4163
41
43
  moonshot/integrations/web_api/routes/benchmark_result.py,sha256=WZ_dI8qT4dli9hKPNkhSwhdfz2VfW5BshirpEVEUci4,6351
44
+ moonshot/integrations/web_api/routes/bookmark.py,sha256=K-1jL0IwOYvmYpgJvU65-lRfQlQhMzJk_n-Zf92IeR0,6135
42
45
  moonshot/integrations/web_api/routes/context_strategy.py,sha256=kJTpjrwxfYGyBLY_hAgpHOMZMtjV5Z6vpu7RIdHDylg,4828
43
46
  moonshot/integrations/web_api/routes/cookbook.py,sha256=oddmcdfhgH3qZb4_ThfUk8SBKmHOt51dFlAHubQh2fQ,8648
44
- moonshot/integrations/web_api/routes/dataset.py,sha256=Pvr1WRKom9UrLzfrHozSKXKxOz9BJfbxUZ6EB-M3g10,4319
47
+ moonshot/integrations/web_api/routes/dataset.py,sha256=qtxflHRDr31W3u6voOFE5iRHsCVr0MQ35H94Pw5M1YU,6114
45
48
  moonshot/integrations/web_api/routes/endpoint.py,sha256=ZFx0WUe3-GGdmBz_hzYiOmjvJHN4PQy_8lCKJMBjxcE,10715
46
49
  moonshot/integrations/web_api/routes/metric.py,sha256=f_HHexxKUfqFE5FkeCwRh8n36H2mREtLnK2pDrw3A-w,2856
47
50
  moonshot/integrations/web_api/routes/prompt_template.py,sha256=M3adeNeWvLQJJlFQ0uZqSXEuNpTcagApnuqWvLiL1mg,4890
@@ -50,14 +53,16 @@ moonshot/integrations/web_api/routes/redteam.py,sha256=t-jNot5_PkV6f5_WBorp1HL43
50
53
  moonshot/integrations/web_api/routes/runner.py,sha256=NQdAmVIOnNgSESX3am6wAE0YLIxHYXlnQbh00_7-SD4,8438
51
54
  moonshot/integrations/web_api/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
55
  moonshot/integrations/web_api/schemas/benchmark_runner_dto.py,sha256=nfNMt_9Xg0YAL5f93dZamu7DxSLvAsz8-tdA_DTCXQQ,322
56
+ moonshot/integrations/web_api/schemas/bookmark_create_dto.py,sha256=C78vG8UG02N7Cmt6RSuS8e4sX_G-MLCiAWT-cF5BE8s,374
53
57
  moonshot/integrations/web_api/schemas/cookbook_create_dto.py,sha256=00SPVw7lEpfY9yOFdt1XkvvNAzfFRd7d7CA90qguhuQ,670
54
58
  moonshot/integrations/web_api/schemas/cookbook_response_model.py,sha256=eJtAi5cbGfSqP57qyzyeLqffPIrpM5lutqpW7_H0xLY,240
59
+ moonshot/integrations/web_api/schemas/dataset_create_dto.py,sha256=U4D_pmybKNVfdlFuOPC-tew8qs0FEz6z3dDlwY4NJW0,482
55
60
  moonshot/integrations/web_api/schemas/dataset_response_dto.py,sha256=s5x4-UXEWccWhK42E0FPXiHG6VqjuFuph-2t5atEkg4,171
56
61
  moonshot/integrations/web_api/schemas/endpoint_create_dto.py,sha256=oyw5xNsWg4GxQ5VNbSe_YqvWxE7OI3egPZINqIi3glw,646
57
62
  moonshot/integrations/web_api/schemas/endpoint_response_model.py,sha256=OmmM2uaPSgB2aqPFfkhseKkI5OKCKilXR19gDmwFlLc,321
58
63
  moonshot/integrations/web_api/schemas/prompt_response_model.py,sha256=S9PwxJERY1ppDaUKLlL9_skHcYcURIIvFnRZj24hLnE,303
59
64
  moonshot/integrations/web_api/schemas/prompt_template_response_model.py,sha256=V7znK-QjQVUXUbsmEy5hZHzjnHYCN1kDtvOxgyxF83k,195
60
- moonshot/integrations/web_api/schemas/recipe_create_dto.py,sha256=LrOzMZjBkpexcwU0nk1JPOLZHo9UP4_d_NS5cWBWkTI,1211
65
+ moonshot/integrations/web_api/schemas/recipe_create_dto.py,sha256=xXT1TlVM3jVGUH4FPrd64vRctoCV8ybnXga4Nb1VzEU,1117
61
66
  moonshot/integrations/web_api/schemas/recipe_response_model.py,sha256=qhjiMyr5fc6R3vOZlsellnX2NF5esaBeQAGQ8160mFo,217
62
67
  moonshot/integrations/web_api/schemas/session_create_dto.py,sha256=3Xhj5JOEEWwaoq1q4FZLBVUdpo59C6X6m4y_qLurEhg,493
63
68
  moonshot/integrations/web_api/schemas/session_prompt_dto.py,sha256=AcMq3UhKrZJIEYDrEfK8xPHeTNk2Ex4IDXrDWZwn6Fo,218
@@ -71,93 +76,102 @@ moonshot/integrations/web_api/services/benchmark_result_service.py,sha256=-oPvLL
71
76
  moonshot/integrations/web_api/services/benchmark_test_manager.py,sha256=zsB8zTDUvH-hT1c-rmyh71uO9ZuIxYbUP3msh8Hdkm4,4024
72
77
  moonshot/integrations/web_api/services/benchmark_test_state.py,sha256=MyhTxpAhhP66JF0ua1SMc_IIeIjDxQY5swOXv9cmYaY,1887
73
78
  moonshot/integrations/web_api/services/benchmarking_service.py,sha256=lJZeNTqxEPBLrZNX3Z9JIilgwetywSkv0deQkcb8mQs,1257
79
+ moonshot/integrations/web_api/services/bookmark_service.py,sha256=jI9nXs1hjzO0CLG2LKaXSzDApLThkfCvPUkaNNV9A5A,3546
74
80
  moonshot/integrations/web_api/services/context_strategy_service.py,sha256=6YKnnG8JlE_1nlnr4Hq7rgz-sxI6oQglK0STaWPFQxQ,710
75
81
  moonshot/integrations/web_api/services/cookbook_service.py,sha256=avAFiX_ZrBvCZcGFuZlp1Zw9AQVSdZ5ysKIS5JfIeh8,6760
76
- moonshot/integrations/web_api/services/dataset_service.py,sha256=KAyfewnP2V-6vekktVll4uM_2-tVEzLXFddBVaseB88,768
82
+ moonshot/integrations/web_api/services/dataset_service.py,sha256=WmLyREkb8N44o8gKYtryanqefNjaGMuhzp0OK-wRq04,1710
77
83
  moonshot/integrations/web_api/services/endpoint_service.py,sha256=YhcVYMOCVq7BBWPqf0Doji6YdrtnT6ykJkCjZWj-9xs,2356
78
84
  moonshot/integrations/web_api/services/metric_service.py,sha256=xWC5Dk8aiU7tuHsxYedTTrEkbA3Ug1pV2nbaBas6cAg,456
79
85
  moonshot/integrations/web_api/services/prompt_template_service.py,sha256=5ds7pKDB2R0_0slVDwsCRIpIVdsgpqhI-3wQqSYcpuE,1226
80
- moonshot/integrations/web_api/services/recipe_service.py,sha256=rOCke7_NKNKrimg-ALl3DfYFZkMGmdDt2p81y68oMbU,5520
86
+ moonshot/integrations/web_api/services/recipe_service.py,sha256=q7hN3yskWnrhR4jUxlv9vHdZLTfXzAZ44vy3HYa7P-c,5465
81
87
  moonshot/integrations/web_api/services/runner_service.py,sha256=_ljFTVtMzt3fxlY0l2252KTxgVsqoQB6vsOXBIY0PIU,4584
82
88
  moonshot/integrations/web_api/services/session_service.py,sha256=g0iMGkSAbc2Vx3c9m4aqe15LknsiHgzs7ErV1hHq5nA,13821
83
89
  moonshot/integrations/web_api/services/utils/exceptions_handler.py,sha256=anaQQYLAXzbt-cL4nAZGm1TIlP9fKt7qYE7lrNtW_04,2070
90
+ moonshot/integrations/web_api/services/utils/file_manager.py,sha256=Hym1DbTQw6ndj2vtbssqYsXifDKSx-OLemKdCS208AI,1545
84
91
  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=-72X0WhmLXdEAiaIcNjTnfIGtgE-lu4hFyhgZYGgsfk,2852
92
+ moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py,sha256=ToyyCOEzArdMS9LnLixnCUNx4TWfib8XYEf6Pki9cr4,2804
86
93
  moonshot/integrations/web_api/status_updater/interface/benchmark_progress_callback.py,sha256=MOs_1CKpNh2m3JUAEoJfmZOBivk80DNtSnRuTCJgzJ4,350
87
94
  moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback.py,sha256=JRczi3vCq6oPfOddPrF4OCdyHQYAVxgPWK-qOJxElKg,350
95
+ moonshot/integrations/web_api/temp/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
96
  moonshot/integrations/web_api/types/types.py,sha256=AN0Xf61lx2c5AFAYoXA8mVL5iufVBpwYlIPdo8gv-ls,2395
89
97
  moonshot/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
90
98
  moonshot/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
+ moonshot/src/api/api_bookmark.py,sha256=Nr0B3S6UUnNbuvXyL-dz8IMyFxCywU1u4UL2D8TjHik,3004
91
100
  moonshot/src/api/api_connector.py,sha256=JpwLFd7Vh1LRz6oB8fhO2iufMbSTt5RmrMe7nt56bPM,2257
92
- moonshot/src/api/api_connector_endpoint.py,sha256=gyjRboodnfLvnjLrt2TFY-H8kT9nwfw2holKpGgTpTQ,5506
93
- moonshot/src/api/api_context_strategy.py,sha256=kzFu0cIK-EopPkbEcoX8j6b3WqWe8excHQsbfB4eAyM,2089
101
+ moonshot/src/api/api_connector_endpoint.py,sha256=UUuHzrgoj0bWcbOXPUJh7FEg-pzBOSo6DLgwqCZnLmw,5503
102
+ moonshot/src/api/api_context_strategy.py,sha256=WqzUEw3f7gROJlc_G7bsGkuP3nO1HycFzn3dfcxzaoc,2153
94
103
  moonshot/src/api/api_cookbook.py,sha256=qFItf8KLaDgbDIrv8usbbzSFnoXOYLORQ7IaDvQ5haw,5744
95
- moonshot/src/api/api_dataset.py,sha256=ryBzXYe5yxGgG5Nhl6ri4GO3Mcv7rN4gEMWMQnPl6mA,1369
104
+ moonshot/src/api/api_dataset.py,sha256=3K6qoLWk6929OBv4W0Qx_Zqx-XgNUm5K16q-RjZBoXY,2670
96
105
  moonshot/src/api/api_environment_variables.py,sha256=ubUHvK7LyN1HhAE40ZTls6fDrbl6IYbxoPob68i4c_k,551
97
106
  moonshot/src/api/api_metrics.py,sha256=W32Jobh5wUYTsN8Jus0xGvEY1NVkvJrxZ8_a8tVuouI,1586
98
107
  moonshot/src/api/api_prompt_template.py,sha256=NsgEz9sOLLlb93CBDBPektfCDB8kviEGaG21m2onVjo,1332
99
- moonshot/src/api/api_recipe.py,sha256=kvtTlq-i5cZlr5h_CtFtTG2nf8tfcifCP3YScWeqgwY,6273
108
+ moonshot/src/api/api_recipe.py,sha256=1mU6c7OpyCUzCVqrmGoB1J2M-GhgIvvlKrjptplp5Z0,6122
100
109
  moonshot/src/api/api_red_teaming.py,sha256=Ar2KeGXOTkeVNvDpegGfIPpIvdEijZBcqb-4dDwOIRc,2019
101
110
  moonshot/src/api/api_result.py,sha256=M5zKF7ytKp237UZusLSYJ7QVfui85Ys0WEaYySGcAKw,2532
102
111
  moonshot/src/api/api_run.py,sha256=3PrETAVcFnJ09R0-xhWiFkEfqL6eYj4B2voEGJDPznU,2936
103
112
  moonshot/src/api/api_runner.py,sha256=cH0rxWREjc2qKmt4Tuwr-fEMrYDBE_TKRw0jOohNEgU,4179
104
- moonshot/src/api/api_session.py,sha256=A5e1sZR0IKvzRDQwvTSEaEyHo6xAAsywNHnbk8FdJGk,10972
113
+ moonshot/src/api/api_session.py,sha256=OGH05ZxAwo_hKI-RNaJ-jCp_v-zcTm-9bHUclpq2z4Q,10978
114
+ moonshot/src/bookmark/bookmark.py,sha256=KZoKOyJseW02IS5KqfCIMusFiNwESBxOAvOZTwO7YUw,8867
115
+ moonshot/src/bookmark/bookmark_arguments.py,sha256=rwgUPMXmDLNaHfJvRTR4GaZ8vwRilchzOg9bZJQoe_8,1130
105
116
  moonshot/src/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
- moonshot/src/configs/env_variables.py,sha256=pmscAFKpu2hUjsAlx1ki8lRI0vSOxhuMryxAzhQcDtQ,6755
117
+ moonshot/src/configs/env_variables.py,sha256=leemw8TNM6GI_6iaajFb49zv1K3hWB0EpZfO0p9CWZQ,7100
107
118
  moonshot/src/connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
- moonshot/src/connectors/connector.py,sha256=dZ4xy43YehXeRjPgpkP9AC3dxcMIvujbl9cYSJGc9Fs,13145
119
+ moonshot/src/connectors/connector.py,sha256=e0ZCX9m83ezjMiY5H8gbWE64IStsNQqxzVwGtMwShPY,13396
109
120
  moonshot/src/connectors/connector_prompt_arguments.py,sha256=cIlAgbFk2g_XUZ0stVM904Ng2g4GYP2LyiAjktmhEQM,470
110
121
  moonshot/src/connectors_endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
- moonshot/src/connectors_endpoints/connector_endpoint.py,sha256=eJ-cO-TaQ1XoH5CyIvVGw6RjkPxpcHKA08umMCEl4C8,8256
122
+ moonshot/src/connectors_endpoints/connector_endpoint.py,sha256=hrSvq7iw1IigZssKTcdotkcN8stG8Ov7AlJ8xxZcAJo,9526
112
123
  moonshot/src/connectors_endpoints/connector_endpoint_arguments.py,sha256=8WyD0EfrlhGM9rqrzoAcF-YWmSWiWdfpO91E7w6HPY0,2318
113
124
  moonshot/src/cookbooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
- moonshot/src/cookbooks/cookbook.py,sha256=3Cr5YnjBUS7fofneA2ZiB1s26vU889PhqBzo2gCGosA,8756
125
+ moonshot/src/cookbooks/cookbook.py,sha256=LjmbJtFwIPhupQlx6LjjIQLMfpwcWZKurduS8MBgqHI,9661
115
126
  moonshot/src/cookbooks/cookbook_arguments.py,sha256=iVp3x1-wi_RL7peTSr5TWbXnjuB_w7Uj29kJrQg48Y0,1210
116
127
  moonshot/src/datasets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
117
- moonshot/src/datasets/dataset.py,sha256=DInMX_IHlVAQO7PXUOoLykPQIPC0sm5tv7VuVy7zDT0,10051
128
+ moonshot/src/datasets/dataset.py,sha256=xiq2hYDkhCalddsxjt4i4ur3GlDLHL8kQtonKrpEbb8,14939
118
129
  moonshot/src/datasets/dataset_arguments.py,sha256=b4FyLA-xBt9e6Itpx6FnTMbyHzvDVMzx4R5SNLqYoXA,1753
119
130
  moonshot/src/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
- moonshot/src/metrics/metric.py,sha256=r8oWMpRBqMqVN-gRH5XZFx33-ZbOnI4PfcsZ0ktYuhc,7361
121
- moonshot/src/metrics/metric_interface.py,sha256=1VQI4hzVzZLOnihWuDvaneATiY3aUSwXcOokUhaGUFc,3859
131
+ moonshot/src/metrics/metric.py,sha256=llqJYnwtllJRMfNhRRbKWjhzKymY961yR3Jw24COR-Y,7512
132
+ moonshot/src/metrics/metric_interface.py,sha256=RSCV8Um39Ns-SD8Os4TM1bwQl3pjaazk5bPRf55aD4Y,4027
122
133
  moonshot/src/prompt_templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
- moonshot/src/prompt_templates/prompt_template.py,sha256=Q-QY9UeUEdF5wb2vUb7nhugQxcVAqRUqWvDbH_WLqtM,3370
134
+ moonshot/src/prompt_templates/prompt_template.py,sha256=IT4ufLFDX43rD_Ewa1lJbYIBW4fHaTu_YyzOvvUU3Ts,3500
124
135
  moonshot/src/recipes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
- moonshot/src/recipes/recipe.py,sha256=dBz6oXn3wB8NoomgJREVMwKRpSbtapmF5tfapfVZiy0,13064
126
- moonshot/src/recipes/recipe_arguments.py,sha256=7s0MnyIluBxZqaHY-sJdz5MC1c8iR35Tas4pwKpY7u8,4067
136
+ moonshot/src/recipes/recipe.py,sha256=PE4mimP7Y7lDanXib2uMrd9KpLWOxRdg0Cps5rLRQxU,13226
137
+ moonshot/src/recipes/recipe_arguments.py,sha256=9LdVJidB6Sci941QvnudBznvx9_NVCl8r-HvzSZInlY,3914
127
138
  moonshot/src/redteaming/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
139
  moonshot/src/redteaming/attack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
- moonshot/src/redteaming/attack/attack_module.py,sha256=MFA7102UZ_gS6xGRmYWQfA9H8n5iLe2XlFMtkNFa7fw,24752
140
+ moonshot/src/redteaming/attack/attack_module.py,sha256=HrL7YdsW-wcFB5Dv8t3wkPvg2pf-c9Ep994qdbk1D3s,25061
130
141
  moonshot/src/redteaming/attack/attack_module_arguments.py,sha256=L8H6poNj7xNWLUr6jfuSkwE7TNV0aTPaZBal4OvL7IA,1225
131
- moonshot/src/redteaming/attack/context_strategy.py,sha256=JORekUAQ_-2HPLBwErs_QP6uXCPlA_6aWhPh3gXfIYk,4684
142
+ moonshot/src/redteaming/attack/context_strategy.py,sha256=KiAw85Pl8tuTzQ2d3CkZrjn3Ddp7BnlT5Gc67TTnq4M,4821
132
143
  moonshot/src/redteaming/context_strategy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
144
  moonshot/src/redteaming/context_strategy/context_strategy_interface.py,sha256=AdWEkXBaXE6fmVi3QashI9toWS-Vd-KnAZ0zo8TKSPA,1381
134
145
  moonshot/src/redteaming/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
146
  moonshot/src/redteaming/session/chat.py,sha256=KIfyQdc3TmTQ0WsYzXldbswt--ZA4ctLylOuDf-GRlo,7496
136
147
  moonshot/src/redteaming/session/red_teaming_progress.py,sha256=MNnzTI98Ra4dFn5DVAFJ9Iizq6gKK2OOpQyuYMKLul0,5547
137
148
  moonshot/src/redteaming/session/red_teaming_type.py,sha256=qqhYWyjr2v2fyKr1AD8oFA9vZJkevpwDl57Cmzz-aR8,102
138
- moonshot/src/redteaming/session/session.py,sha256=9MefcSsL-gmy9YuofrqMYnTo7QcSOErZsYQHLCLdUa4,29794
149
+ moonshot/src/redteaming/session/session.py,sha256=kLifZmdWfqy2IuRHJeC4WhwdnxGdf3wKvayW3Kwpbz8,29994
139
150
  moonshot/src/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
140
- moonshot/src/results/result.py,sha256=GuzWGtDdrq1TlP3dSj4mQY3oQDDlmK0XKjRzWkrD8vw,4383
151
+ moonshot/src/results/result.py,sha256=o56SdhYH-XVfpeeKhN495dJPkU035MmTjRUx48q53lo,4527
141
152
  moonshot/src/results/result_arguments.py,sha256=mTR7yajY72PFglfAaa1ajJfvYNV4IBGLXS4VaD53-8c,1334
142
153
  moonshot/src/runners/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
- moonshot/src/runners/runner.py,sha256=0x3CvRGu00hlH0l7GWLSJG5x6Weq7I2E9BnqYxagmWI,20144
154
+ moonshot/src/runners/runner.py,sha256=Wsvdzcw4KOa-ppgGVRGSK2YxLfXK-daHDw3k5jETv-4,21197
144
155
  moonshot/src/runners/runner_arguments.py,sha256=Bg4OPSmgr9jZKNAwPH0T3epEHw-6qGrflszFc6oMyEU,1640
145
156
  moonshot/src/runners/runner_type.py,sha256=jOfnAnaCYp-rPTRJXhM8hin_dinlR0sMwmimQXvLcJ0,100
146
157
  moonshot/src/runs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
- moonshot/src/runs/run.py,sha256=PvHHTz0tSSLparGhssDnE3OUPWrWygfPt6m_-diVBEI,13930
158
+ moonshot/src/runs/run.py,sha256=QFdvWwCnqSjLrsTk3jJ1ccs3R1ZAZNvz5ls9Q_iRxO0,14132
148
159
  moonshot/src/runs/run_arguments.py,sha256=G043ERvHIU_dd0JghboZgxDWCcjYOaDwue1ieDunDKA,6443
149
- moonshot/src/runs/run_progress.py,sha256=zwHxdmHMPRatH96pddf5cT_PzL7hzC6zox83YqRzkJU,6350
160
+ moonshot/src/runs/run_progress.py,sha256=d1BcNo6Kp4vA165TDx_xebl8JDo92aV-YutPxsgCOxE,6495
150
161
  moonshot/src/runs/run_status.py,sha256=TRtizcDzPxf6aQ2c3OovM6IQKJ0VCBhqDWvn7UBw5Zg,251
151
162
  moonshot/src/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
152
- moonshot/src/storage/db_interface.py,sha256=Fh5ehff4aBPtci4WNQi_BB5c-4ZmS1vLVoXVFvg0994,4513
163
+ moonshot/src/storage/db_interface.py,sha256=DiiuizZcPlHrdqhesYirrKOQr-SS1N4ymbY4XXHKXfQ,5019
153
164
  moonshot/src/storage/io_interface.py,sha256=9IpMGtsVbToWBuS-ZRnaZJTMneUV8V0drCxk-OaN3dQ,824
154
- moonshot/src/storage/storage.py,sha256=ipVboJNMcCDIcYJ6QMXCEFNKxKbrcL5pHROZNDokAXA,20812
165
+ moonshot/src/storage/storage.py,sha256=qQrGFPVzsDwYFrBWa3XLajSjhUtQBwGg4pAr54DFC5Y,22027
155
166
  moonshot/src/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
+ moonshot/src/utils/find_feature.py,sha256=a5CZMcDJ-Hp2OlV1fRug8Yu32_31KxlMie9lf4_ij9U,1296
156
168
  moonshot/src/utils/import_modules.py,sha256=T9zTN59PFnvY2rjyWhSV9KSIAHxWV1pyBemF0y-hwtw,2844
157
- moonshot/src/utils/timeit.py,sha256=Y-cO1k5tL804Ir0H6dMRz7C5d519XuR222OOfuyhocg,713
158
- aiverify_moonshot-0.4.1.dist-info/METADATA,sha256=Uee0Y5Z9hf-FsSYiVQXX3HrEs6P2mszEe6N4CWi8858,12307
159
- aiverify_moonshot-0.4.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
160
- aiverify_moonshot-0.4.1.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
161
- aiverify_moonshot-0.4.1.dist-info/licenses/LICENSE.md,sha256=mDOKOkWFbJmUORaAchXByEVGC1jw37QRn-zS14wY_wM,11347
162
- aiverify_moonshot-0.4.1.dist-info/licenses/NOTICES.md,sha256=0Ikx6IBGGQEOJeNb2MkRoXxTXwrtlMz6EDgLBFIz6v0,179593
163
- aiverify_moonshot-0.4.1.dist-info/RECORD,,
169
+ moonshot/src/utils/log.py,sha256=YNgD7Eh2OT36XlmVBKCGUTAh9TRp4Akfe4kDdvHASgs,2502
170
+ moonshot/src/utils/pagination.py,sha256=5seymyRoqyENIhKllAatr1T91kMCGFslcvRnJHyMSvc,814
171
+ moonshot/src/utils/timeit.py,sha256=TvuF0w8KWhp0oZFY0cUU3UY0xlGKjchb0OkfYfgVTlc,866
172
+ aiverify_moonshot-0.4.3.dist-info/METADATA,sha256=mkhNL-IBI5FOBjjhEu9xu8eG2AsbfzHLiKGloRvbX4E,12307
173
+ aiverify_moonshot-0.4.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
174
+ aiverify_moonshot-0.4.3.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
175
+ aiverify_moonshot-0.4.3.dist-info/licenses/LICENSE.md,sha256=mDOKOkWFbJmUORaAchXByEVGC1jw37QRn-zS14wY_wM,11347
176
+ aiverify_moonshot-0.4.3.dist-info/licenses/NOTICES.md,sha256=0Ikx6IBGGQEOJeNb2MkRoXxTXwrtlMz6EDgLBFIz6v0,179593
177
+ aiverify_moonshot-0.4.3.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 os
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,67 +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
- print("Installing Moonshot Data from GitHub")
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
- print(f"Cloning {repo}")
95
+ logger.info(f"Cloning {repo}")
83
96
  # Clone the repository
84
97
  run_subprocess(["git", "clone", repo], check=True)
85
-
98
+
86
99
  # Create .env to point to installed folder
87
100
  ms_lib_env_file(folder_name)
88
-
101
+
89
102
  # Change directory to the folder
90
103
  os.chdir(folder_name)
91
104
 
92
- print(f"Installing requirements for {folder_name}")
105
+ logger.info(f"Installing requirements for {folder_name}")
93
106
  # Install the requirements if they exist
94
107
  if os.path.exists("requirements.txt"):
95
108
  run_subprocess(["pip", "install", "-r", "requirements.txt"], check=True)
96
109
  import nltk
97
- nltk.download('punkt')
98
- nltk.download('stopwords')
99
- nltk.download('averaged_perceptron_tagger')
100
- nltk.download('universal_tagset')
101
-
110
+
111
+ nltk.download("punkt")
112
+ nltk.download("stopwords")
113
+ nltk.download("averaged_perceptron_tagger")
114
+ nltk.download("universal_tagset")
115
+
102
116
  # Change back to the base directory
103
117
  os.chdir("..")
104
118
 
105
119
  else:
106
- print(f"Directory {folder_name} already exists, skipping clone.")
120
+ logger.warning(f"Directory {folder_name} already exists, skipping clone.")
121
+
107
122
 
108
123
  def moonshot_ui_installation():
109
124
  # Code for moonshot-ui installation
110
125
  repo = "https://github.com/aiverify-foundation/moonshot-ui.git"
111
126
  folder_name = repo.split("/")[-1].replace(".git", "")
112
-
127
+
113
128
  # Check if the directory already exists
114
129
  if not os.path.exists(folder_name):
115
- print(f"Cloning {repo}")
130
+ logger.info(f"Cloning {repo}")
116
131
  # Clone the repository
117
132
  run_subprocess(["git", "clone", repo], check=True)
118
133
 
119
134
  # Change directory to the folder
120
135
  os.chdir(folder_name)
121
136
 
122
- print(f"Installing requirements for {folder_name}")
137
+ logger.info(f"Installing requirements for {folder_name}")
123
138
  # Install the requirements if they exist
124
139
  if os.path.exists("package.json"):
125
140
  run_subprocess(["npm", "install"], check=True)
126
141
  run_subprocess(["npm", "run", "build"], check=True)
127
-
142
+
128
143
  # Change back to the base directory
129
144
  os.chdir("..")
130
145
 
131
146
  # Create .env for ui
132
147
  ms_ui_env_file(folder_name)
133
148
  else:
134
- print(f"Directory {folder_name} already exists, skipping installation.")
149
+ logger.warning(
150
+ f"Directory {folder_name} already exists, skipping installation."
151
+ )
152
+
135
153
 
136
154
  def run_moonshot_ui_dev():
137
155
  """
@@ -141,31 +159,51 @@ def run_moonshot_ui_dev():
141
159
  ui_dev_dir = os.path.join(base_directory, "moonshot-ui")
142
160
 
143
161
  if not os.path.exists(ui_dev_dir):
144
- print("moonshot-ui does not exist. Please run with '-i moonshot-ui' to install moonshot-ui first.")
162
+ logger.error(
163
+ "moonshot-ui does not exist. Please run with '-i moonshot-ui' to install moonshot-ui first."
164
+ )
145
165
  sys.exit(1)
146
166
  # ms_ui_env_file(ui_dev_dir)
147
- run_subprocess(['npm', 'start'], cwd=ui_dev_dir)
167
+ run_subprocess(["npm", "start"], cwd=ui_dev_dir)
168
+
148
169
 
149
170
  def main():
150
171
  parser = argparse.ArgumentParser(description="Run the Moonshot application")
151
- parser.add_argument('mode', nargs='?', choices=['web-api', 'cli', 'web', 'help'], help='Mode to run Moonshot in', default=help)
152
- parser.add_argument('cli_command', nargs='?', help='The CLI command to run (e.g., "interactive")')
153
- parser.add_argument('-i', '--install', action='append', choices=['moonshot-data', 'moonshot-ui'], help='Modules to install', default=[])
154
- parser.add_argument('-e', '--env', type=str, help='Path to the .env file', default='.env')
155
-
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
+
156
194
  args = parser.parse_args()
157
-
195
+
158
196
  # Handle installations based on the -i include arguments
159
- if 'moonshot-data' in args.install:
197
+ if "moonshot-data" in args.install:
160
198
  moonshot_data_installation()
161
199
 
162
- if 'moonshot-ui' in args.install:
200
+ if "moonshot-ui" in args.install:
163
201
  moonshot_ui_installation()
164
202
 
165
203
  # If mode is not specified, skip running any modes
166
204
  if args.mode is None:
167
205
  return
168
-
206
+
169
207
  if args.mode == "help":
170
208
  parser.print_help()
171
209
  sys.exit(1)
@@ -174,18 +212,21 @@ def main():
174
212
 
175
213
  if args.mode == "web-api":
176
214
  from moonshot.integrations.web_api import __main__ as web_api
215
+
177
216
  web_api.start_app()
178
217
  elif args.mode == "web":
179
- # Create and start the UI dev server thread
218
+ # Create and start the UI dev server thread
180
219
  ui_thread = threading.Thread(target=run_moonshot_ui_dev)
181
220
  ui_thread.start()
182
221
  ui_thread.join(timeout=0.1) # Wait briefly for the thread to become alive
183
222
  if not ui_thread.is_alive():
184
223
  sys.exit(1)
185
224
  from moonshot.integrations.web_api import __main__ as web_api
225
+
186
226
  web_api.start_app()
187
227
  elif args.mode == "cli":
188
228
  from moonshot.integrations.cli import __main__ as cli
229
+
189
230
  cli.start_app(args.cli_command)
190
231
 
191
232
  # Handle CLI mode here, possibly also with additional arguments
@@ -194,6 +235,7 @@ def main():
194
235
  parser.print_help()
195
236
  sys.exit(1)
196
237
 
238
+
197
239
  if __name__ == "__main__":
198
240
  warnings.filterwarnings("ignore")
199
- main()
241
+ main()
moonshot/api.py CHANGED
@@ -29,6 +29,7 @@ from moonshot.src.api.api_dataset import (
29
29
  api_delete_dataset,
30
30
  api_get_all_datasets,
31
31
  api_get_all_datasets_name,
32
+ api_create_datasets
32
33
  )
33
34
  from moonshot.src.api.api_environment_variables import api_set_environment_variables
34
35
  from moonshot.src.api.api_metrics import (
@@ -86,6 +87,14 @@ from moonshot.src.api.api_session import (
86
87
  api_update_prompt_template,
87
88
  api_update_system_prompt,
88
89
  )
90
+ from moonshot.src.api.api_bookmark import (
91
+ api_get_all_bookmarks,
92
+ api_get_bookmark,
93
+ api_insert_bookmark,
94
+ api_delete_bookmark,
95
+ api_delete_all_bookmark,
96
+ api_export_bookmarks,
97
+ )
89
98
 
90
99
  __all__ = [
91
100
  "api_create_connector_from_endpoint",
@@ -107,6 +116,7 @@ __all__ = [
107
116
  "api_read_cookbook",
108
117
  "api_read_cookbooks",
109
118
  "api_update_cookbook",
119
+ "api_create_datasets",
110
120
  "api_delete_dataset",
111
121
  "api_get_all_datasets",
112
122
  "api_get_all_datasets_name",
@@ -152,4 +162,10 @@ __all__ = [
152
162
  "api_update_metric",
153
163
  "api_update_prompt_template",
154
164
  "api_update_system_prompt",
165
+ "api_get_all_bookmarks",
166
+ "api_get_bookmark",
167
+ "api_insert_bookmark",
168
+ "api_delete_bookmark",
169
+ "api_delete_all_bookmark",
170
+ "api_export_bookmarks",
155
171
  ]
@@ -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 list_runs, view_run, view_run_args
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
- def do_list_cookbooks(self, _: cmd2.Statement) -> None:
72
- list_cookbooks()
81
+ @cmd2.with_argparser(list_cookbooks_args)
82
+ def do_list_cookbooks(self, args: argparse.Namespace) -> None:
83
+ list_cookbooks(args)
73
84
 
74
- def do_list_recipes(self, _: cmd2.Statement) -> None:
75
- list_recipes()
85
+ @cmd2.with_argparser(list_recipes_args)
86
+ def do_list_recipes(self, args: argparse.Namespace) -> None:
87
+ list_recipes(args)
76
88
 
77
- def do_list_results(self, _: cmd2.Statement) -> None:
78
- list_results()
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
- def do_list_runs(self, _: cmd2.Statement) -> None:
84
- list_runs()
96
+ @cmd2.with_argparser(list_runs_args)
97
+ def do_list_runs(self, args: argparse.Namespace) -> None:
98
+ list_runs(args)
85
99
 
86
- def do_list_metrics(self, _: cmd2.Statement) -> None:
87
- list_metrics()
100
+ @cmd2.with_argparser(list_metrics_args)
101
+ def do_list_metrics(self, args: argparse.Namespace) -> None:
102
+ list_metrics(args)
88
103
 
89
- def do_list_datasets(self, _: cmd2.Statement) -> None:
90
- list_datasets()
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