aiverify-moonshot 0.4.11__py3-none-any.whl → 0.5.0__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.11.dist-info → aiverify_moonshot-0.5.0.dist-info}/METADATA +3 -5
- {aiverify_moonshot-0.4.11.dist-info → aiverify_moonshot-0.5.0.dist-info}/RECORD +34 -34
- {aiverify_moonshot-0.4.11.dist-info → aiverify_moonshot-0.5.0.dist-info}/WHEEL +1 -1
- moonshot/integrations/cli/benchmark/cookbook.py +1 -5
- moonshot/integrations/cli/benchmark/recipe.py +1 -5
- moonshot/integrations/cli/cli_errors.py +3 -0
- moonshot/integrations/cli/common/connectors.py +22 -10
- moonshot/integrations/web_api/app.py +1 -1
- moonshot/integrations/web_api/schemas/endpoint_create_dto.py +1 -0
- moonshot/integrations/web_api/services/endpoint_service.py +1 -0
- moonshot/src/api/api_bookmark.py +16 -5
- moonshot/src/api/api_connector.py +3 -3
- moonshot/src/api/api_connector_endpoint.py +6 -3
- moonshot/src/api/api_context_strategy.py +2 -2
- moonshot/src/api/api_cookbook.py +6 -6
- moonshot/src/api/api_dataset.py +5 -5
- moonshot/src/api/api_environment_variables.py +3 -0
- moonshot/src/api/api_metrics.py +1 -1
- moonshot/src/api/api_prompt_template.py +9 -0
- moonshot/src/api/api_recipe.py +3 -3
- moonshot/src/api/api_red_teaming.py +4 -8
- moonshot/src/api/api_result.py +10 -6
- moonshot/src/api/api_run.py +3 -3
- moonshot/src/api/api_runner.py +7 -6
- moonshot/src/api/api_session.py +11 -7
- moonshot/src/connectors/connector.py +121 -58
- moonshot/src/connectors/connector_prompt_arguments.py +7 -4
- moonshot/src/connectors/connector_response.py +5 -10
- moonshot/src/connectors_endpoints/connector_endpoint.py +32 -20
- moonshot/src/connectors_endpoints/connector_endpoint_arguments.py +4 -1
- moonshot/src/messages_constants.py +85 -3
- {aiverify_moonshot-0.4.11.dist-info → aiverify_moonshot-0.5.0.dist-info}/licenses/AUTHORS.md +0 -0
- {aiverify_moonshot-0.4.11.dist-info → aiverify_moonshot-0.5.0.dist-info}/licenses/LICENSE.md +0 -0
- {aiverify_moonshot-0.4.11.dist-info → aiverify_moonshot-0.5.0.dist-info}/licenses/NOTICES.md +0 -0
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: aiverify-moonshot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
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/
|
|
7
7
|
Project-URL: Issues, https://github.com/aiverify-foundation/moonshot/issues
|
|
8
8
|
Author-email: AI Verify Foundation <info@aiverify.sg>
|
|
9
9
|
License: Apache-2.0
|
|
10
|
-
License-File: AUTHORS.md
|
|
11
|
-
License-File: LICENSE.md
|
|
12
|
-
License-File: NOTICES.md
|
|
13
10
|
Classifier: Development Status :: 3 - Alpha
|
|
14
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
12
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -24,6 +21,7 @@ Requires-Dist: pydantic==2.8.2
|
|
|
24
21
|
Requires-Dist: pyparsing>=3.1.4
|
|
25
22
|
Requires-Dist: python-dotenv>=1.0.1
|
|
26
23
|
Requires-Dist: python-slugify>=8.0.4
|
|
24
|
+
Requires-Dist: tenacity>=8.5.0
|
|
27
25
|
Requires-Dist: xxhash>=3.5.0
|
|
28
26
|
Provides-Extra: all
|
|
29
27
|
Requires-Dist: cmd2>=2.4.3; extra == 'all'
|
|
@@ -46,7 +44,7 @@ Description-Content-Type: text/markdown
|
|
|
46
44
|
|
|
47
45
|

|
|
48
46
|
|
|
49
|
-
**Version 0.
|
|
47
|
+
**Version 0.5.0**
|
|
50
48
|
|
|
51
49
|
A simple and modular tool to evaluate any LLM application.
|
|
52
50
|
|
|
@@ -6,19 +6,19 @@ moonshot/integrations/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
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
|
-
moonshot/integrations/cli/cli_errors.py,sha256=
|
|
9
|
+
moonshot/integrations/cli/cli_errors.py,sha256=jJ15ngnVJjSByamtOE2Cx79k1mOJnAl36NbCjpPppeM,23672
|
|
10
10
|
moonshot/integrations/cli/benchmark/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
moonshot/integrations/cli/benchmark/benchmark.py,sha256=QUxr6DU11-XeH6Y3j1uPsZsotshgy64G_cWNf0Rn2_U,6303
|
|
12
|
-
moonshot/integrations/cli/benchmark/cookbook.py,sha256=
|
|
12
|
+
moonshot/integrations/cli/benchmark/cookbook.py,sha256=rT4gK88LhATFxsAxWWYExtPVT09oWPHJtJ1HQkLT3yU,29444
|
|
13
13
|
moonshot/integrations/cli/benchmark/datasets.py,sha256=Uq5XMNWUp775sz9jCZUZHHmkumPFI7cHVRueHgWm70Q,8965
|
|
14
14
|
moonshot/integrations/cli/benchmark/metrics.py,sha256=SHs-hIa4CIPyOJtxK2U4D6IRHy3ZNsRtZlAMGvF9Qxw,8310
|
|
15
|
-
moonshot/integrations/cli/benchmark/recipe.py,sha256=
|
|
15
|
+
moonshot/integrations/cli/benchmark/recipe.py,sha256=uAYTBu1EwcCBdf9Iut6eboZ6nBt5_hDwBhru50mZer0,32407
|
|
16
16
|
moonshot/integrations/cli/benchmark/result.py,sha256=TGlIuDkPB1Cfu1u2uyDsWtgQxTOoNdGDzc0vCnGC1zk,11152
|
|
17
17
|
moonshot/integrations/cli/benchmark/run.py,sha256=HBztvG_Zkg1ZAWsFv0QDE43FaEmx92vTWc4h1U3VesU,7438
|
|
18
18
|
moonshot/integrations/cli/benchmark/runner.py,sha256=Y4Vt6Qqn9QzsM6eLUM9m2_XKkW3ctu-2jMTSei_TDPU,7098
|
|
19
19
|
moonshot/integrations/cli/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
moonshot/integrations/cli/common/common.py,sha256=RjlIqV82DHVi5CeUjOkC1xYlVAq4mxelDD9MN4Tj4jU,3302
|
|
21
|
-
moonshot/integrations/cli/common/connectors.py,sha256=
|
|
21
|
+
moonshot/integrations/cli/common/connectors.py,sha256=bmdZfDHKhii3ejZb5tkT0WnoSYtAGKPk8CpBgIvI5PY,20017
|
|
22
22
|
moonshot/integrations/cli/common/dataset.py,sha256=zkVGtIJIozJPPs_Qc__Hnw1tAh_pcvYV5gqf_eOaGXQ,12749
|
|
23
23
|
moonshot/integrations/cli/common/display_helper.py,sha256=8rVowW33XK0j0C_X_H1jUbFlFk1Y2WpzxmIUE3Ca5Co,1459
|
|
24
24
|
moonshot/integrations/cli/common/prompt_template.py,sha256=2cXWeHh16EUvzYFre7juMxT2R0x3kqDJVucH0bKLmCU,6351
|
|
@@ -34,7 +34,7 @@ moonshot/integrations/cli/utils/process_data.py,sha256=QVL5vp2_8ZgGicmCAdeYEHkeb
|
|
|
34
34
|
moonshot/integrations/web_api/.env.dev,sha256=0z5_Ut8rF-UqFZtgjkH2qoqORhD5_nSs2w_OeX2SteI,182
|
|
35
35
|
moonshot/integrations/web_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
36
|
moonshot/integrations/web_api/__main__.py,sha256=MdnLi_ZF-olAAEJwTPU1iGYFYwo-fNWNT2qfchkH3y4,2050
|
|
37
|
-
moonshot/integrations/web_api/app.py,sha256=
|
|
37
|
+
moonshot/integrations/web_api/app.py,sha256=Dxq5Tt8_W3Xn8UHzcbU1pDx7QJJvByIVjg1KbgMxRT4,3651
|
|
38
38
|
moonshot/integrations/web_api/container.py,sha256=DVkJG_qm7ItcG6tgMYOqIj07wpKhPWOOfy6-bEv72y4,5915
|
|
39
39
|
moonshot/integrations/web_api/logging_conf.py,sha256=t3EGRV6tZhV732KXe8_Tiy0fiwVAWxZX5Tt8VTgrrfg,3388
|
|
40
40
|
moonshot/integrations/web_api/log/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -59,7 +59,7 @@ moonshot/integrations/web_api/schemas/cookbook_create_dto.py,sha256=00SPVw7lEpfY
|
|
|
59
59
|
moonshot/integrations/web_api/schemas/cookbook_response_model.py,sha256=J_DkyuWwNNy6_G1QT6JY-qIr0zhMkQd208wXhTA-Tao,342
|
|
60
60
|
moonshot/integrations/web_api/schemas/dataset_create_dto.py,sha256=Jr_EbIgqR7K__LQXpXSocfYLE6oN7pGRFzWcDVcFaus,963
|
|
61
61
|
moonshot/integrations/web_api/schemas/dataset_response_dto.py,sha256=s5x4-UXEWccWhK42E0FPXiHG6VqjuFuph-2t5atEkg4,171
|
|
62
|
-
moonshot/integrations/web_api/schemas/endpoint_create_dto.py,sha256=
|
|
62
|
+
moonshot/integrations/web_api/schemas/endpoint_create_dto.py,sha256=WS8AfRybrweoOgZx6K6jiNy1Z6J3IZS1PUNnrRxGKyM,678
|
|
63
63
|
moonshot/integrations/web_api/schemas/endpoint_response_model.py,sha256=OmmM2uaPSgB2aqPFfkhseKkI5OKCKilXR19gDmwFlLc,321
|
|
64
64
|
moonshot/integrations/web_api/schemas/prompt_response_model.py,sha256=S9PwxJERY1ppDaUKLlL9_skHcYcURIIvFnRZj24hLnE,303
|
|
65
65
|
moonshot/integrations/web_api/schemas/prompt_template_response_model.py,sha256=V7znK-QjQVUXUbsmEy5hZHzjnHYCN1kDtvOxgyxF83k,195
|
|
@@ -81,7 +81,7 @@ moonshot/integrations/web_api/services/bookmark_service.py,sha256=jI9nXs1hjzO0CL
|
|
|
81
81
|
moonshot/integrations/web_api/services/context_strategy_service.py,sha256=6YKnnG8JlE_1nlnr4Hq7rgz-sxI6oQglK0STaWPFQxQ,710
|
|
82
82
|
moonshot/integrations/web_api/services/cookbook_service.py,sha256=Hi6xKmChS6-fOKXoHqjOkM0cUvNCV3XaNJNVoXMbK0U,7942
|
|
83
83
|
moonshot/integrations/web_api/services/dataset_service.py,sha256=ZWb3FqyDkA0C9qhlQ3X_zR0ohAlwlLsJi-mgKLvXpnI,2407
|
|
84
|
-
moonshot/integrations/web_api/services/endpoint_service.py,sha256=
|
|
84
|
+
moonshot/integrations/web_api/services/endpoint_service.py,sha256=N5SXNAh44UNeBpMhA9baL0VZoTx4sHzpy4y7-Ch8O4E,2395
|
|
85
85
|
moonshot/integrations/web_api/services/metric_service.py,sha256=xWC5Dk8aiU7tuHsxYedTTrEkbA3Ug1pV2nbaBas6cAg,456
|
|
86
86
|
moonshot/integrations/web_api/services/prompt_template_service.py,sha256=5ds7pKDB2R0_0slVDwsCRIpIVdsgpqhI-3wQqSYcpuE,1226
|
|
87
87
|
moonshot/integrations/web_api/services/recipe_service.py,sha256=Z6cZqwFOVFaksoXK_K05rp5wdZX4qrgMFbw_6fSpjYo,6551
|
|
@@ -96,34 +96,34 @@ moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback
|
|
|
96
96
|
moonshot/integrations/web_api/temp/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
97
|
moonshot/integrations/web_api/types/types.py,sha256=AN0Xf61lx2c5AFAYoXA8mVL5iufVBpwYlIPdo8gv-ls,2395
|
|
98
98
|
moonshot/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
99
|
-
moonshot/src/messages_constants.py,sha256=
|
|
99
|
+
moonshot/src/messages_constants.py,sha256=usbvwitgRdOVY0ARdBbh9uiLNUb6WCdCuSoa64tVMhM,6936
|
|
100
100
|
moonshot/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
101
|
-
moonshot/src/api/api_bookmark.py,sha256=
|
|
102
|
-
moonshot/src/api/api_connector.py,sha256=
|
|
103
|
-
moonshot/src/api/api_connector_endpoint.py,sha256=
|
|
104
|
-
moonshot/src/api/api_context_strategy.py,sha256=
|
|
105
|
-
moonshot/src/api/api_cookbook.py,sha256=
|
|
106
|
-
moonshot/src/api/api_dataset.py,sha256=
|
|
107
|
-
moonshot/src/api/api_environment_variables.py,sha256=
|
|
108
|
-
moonshot/src/api/api_metrics.py,sha256=
|
|
109
|
-
moonshot/src/api/api_prompt_template.py,sha256=
|
|
110
|
-
moonshot/src/api/api_recipe.py,sha256=
|
|
111
|
-
moonshot/src/api/api_red_teaming.py,sha256=
|
|
112
|
-
moonshot/src/api/api_result.py,sha256=
|
|
113
|
-
moonshot/src/api/api_run.py,sha256=
|
|
114
|
-
moonshot/src/api/api_runner.py,sha256=
|
|
115
|
-
moonshot/src/api/api_session.py,sha256=
|
|
101
|
+
moonshot/src/api/api_bookmark.py,sha256=gg7uJU7ixZtmJ99S3xdgQgcznkY8SjoJaTBkSsnoWrM,3442
|
|
102
|
+
moonshot/src/api/api_connector.py,sha256=Q_of-aHPuWkbefMJq4uXctJl89G2Tt6J_HfSuf1hE6g,2234
|
|
103
|
+
moonshot/src/api/api_connector_endpoint.py,sha256=lwfhlWNBJ6QotqffmURtjRmxfzbBlSIAZupeSpMt9VU,5584
|
|
104
|
+
moonshot/src/api/api_context_strategy.py,sha256=uRIfNjKJ_Wk9nSrvbPRfrdQLpG0K6kH9rl5tmmHui40,2151
|
|
105
|
+
moonshot/src/api/api_cookbook.py,sha256=KzGCcJjpAs92FZBloojLbmi5nqK3hd_zX8m5jYWKMMM,5715
|
|
106
|
+
moonshot/src/api/api_dataset.py,sha256=i2KwnZ-6fTm_tyn8cRw8iesrGi7_Nh0-1bFuN7m0TVo,4066
|
|
107
|
+
moonshot/src/api/api_environment_variables.py,sha256=wRx6rm95ItyL_uKUAYfSjcPZNbRxKl1GGS4PpWcTE1s,712
|
|
108
|
+
moonshot/src/api/api_metrics.py,sha256=x5DiysTYQsMmcAS2y2XpgvrPobZk7GT2rhO-MaIRun4,1603
|
|
109
|
+
moonshot/src/api/api_prompt_template.py,sha256=HQUl7-HGcxA620cY0vDqqo7CoY9uONkXIOlolduIgbE,1959
|
|
110
|
+
moonshot/src/api/api_recipe.py,sha256=_TJUc8vJqxu5Uti3q2GSQ2uJdj8hqNBFSvBi2NaDnyQ,6135
|
|
111
|
+
moonshot/src/api/api_red_teaming.py,sha256=GBBy4yDAbDuUyeANkGorZJENWceNIzfg30TuiF-Av3Q,2004
|
|
112
|
+
moonshot/src/api/api_result.py,sha256=xZHex_K_PbSr-65LPLr5up4lvu313-VJroR4BBR5JQk,2849
|
|
113
|
+
moonshot/src/api/api_run.py,sha256=ToPYIeTPd2OaOqd20UQ_ie2BQPqLw5aZ_RwRwv9oGpU,2983
|
|
114
|
+
moonshot/src/api/api_runner.py,sha256=spN7ogBGQN7I-c1u_UeKZ7vg02AtCuAl3dFG8CSayQU,4257
|
|
115
|
+
moonshot/src/api/api_session.py,sha256=w-mc_sj3ElQa6FPQqWbK2bFgGTu1ECwYm3tN41xFkes,11130
|
|
116
116
|
moonshot/src/bookmark/bookmark.py,sha256=Gf9wZ5wmJUmatHChr0_3tVyUbPMfpCVeEfujQQjIv18,11867
|
|
117
117
|
moonshot/src/bookmark/bookmark_arguments.py,sha256=cB5m2zB8255WVdacmC2-ZYNyaoK4-gOM_Qwb_JDR-34,1449
|
|
118
118
|
moonshot/src/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
119
119
|
moonshot/src/configs/env_variables.py,sha256=eF__UJN37LCzIB4pv_T7G-kQHlOa657QA7IpL1d_0MM,7150
|
|
120
120
|
moonshot/src/connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
121
|
-
moonshot/src/connectors/connector.py,sha256
|
|
122
|
-
moonshot/src/connectors/connector_prompt_arguments.py,sha256=
|
|
123
|
-
moonshot/src/connectors/connector_response.py,sha256=
|
|
121
|
+
moonshot/src/connectors/connector.py,sha256=-2-vp6hPWigdEOwkHAz1SSTGwGsaraZHzHnb_9aD5HI,16272
|
|
122
|
+
moonshot/src/connectors/connector_prompt_arguments.py,sha256=aJX5Jwd9bxWWLhIntXBu5Iu3NKsOcud-dfdBJVgKK58,751
|
|
123
|
+
moonshot/src/connectors/connector_response.py,sha256=kIByU-H7A0NXRxk1Y2XPGZHSJNKzJj6BNkzXqdyZyb0,403
|
|
124
124
|
moonshot/src/connectors_endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
125
|
-
moonshot/src/connectors_endpoints/connector_endpoint.py,sha256=
|
|
126
|
-
moonshot/src/connectors_endpoints/connector_endpoint_arguments.py,sha256=
|
|
125
|
+
moonshot/src/connectors_endpoints/connector_endpoint.py,sha256=3U4030gKhvDt4e7VD3lac2FG0kxGJ0DSLPTAUKYOPEk,10018
|
|
126
|
+
moonshot/src/connectors_endpoints/connector_endpoint_arguments.py,sha256=0v9mUHki4l22CK8o8UjATAsFDza9Lutbh4QplLiDXs8,2434
|
|
127
127
|
moonshot/src/cookbooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
128
|
moonshot/src/cookbooks/cookbook.py,sha256=LjmbJtFwIPhupQlx6LjjIQLMfpwcWZKurduS8MBgqHI,9661
|
|
129
129
|
moonshot/src/cookbooks/cookbook_arguments.py,sha256=iVp3x1-wi_RL7peTSr5TWbXnjuB_w7Uj29kJrQg48Y0,1210
|
|
@@ -172,9 +172,9 @@ moonshot/src/utils/import_modules.py,sha256=T9zTN59PFnvY2rjyWhSV9KSIAHxWV1pyBemF
|
|
|
172
172
|
moonshot/src/utils/log.py,sha256=YNgD7Eh2OT36XlmVBKCGUTAh9TRp4Akfe4kDdvHASgs,2502
|
|
173
173
|
moonshot/src/utils/pagination.py,sha256=5seymyRoqyENIhKllAatr1T91kMCGFslcvRnJHyMSvc,814
|
|
174
174
|
moonshot/src/utils/timeit.py,sha256=TvuF0w8KWhp0oZFY0cUU3UY0xlGKjchb0OkfYfgVTlc,866
|
|
175
|
-
aiverify_moonshot-0.
|
|
176
|
-
aiverify_moonshot-0.
|
|
177
|
-
aiverify_moonshot-0.
|
|
178
|
-
aiverify_moonshot-0.
|
|
179
|
-
aiverify_moonshot-0.
|
|
180
|
-
aiverify_moonshot-0.
|
|
175
|
+
aiverify_moonshot-0.5.0.dist-info/METADATA,sha256=yYa9FI2r9gbSgj9FkaSHIAe12Q2navSqPBXn25Lj9RY,12344
|
|
176
|
+
aiverify_moonshot-0.5.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
177
|
+
aiverify_moonshot-0.5.0.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
|
|
178
|
+
aiverify_moonshot-0.5.0.dist-info/licenses/LICENSE.md,sha256=53izDRmJZZCjpYGfyLqlxnGQN-aNWBxasuzuMXC5Ias,11347
|
|
179
|
+
aiverify_moonshot-0.5.0.dist-info/licenses/NOTICES.md,sha256=vS1zZYAnGjCJdwQ13xv3b2zc30wOS98ZnCKluT-AhHs,123266
|
|
180
|
+
aiverify_moonshot-0.5.0.dist-info/RECORD,,
|
|
@@ -256,11 +256,7 @@ def run_cookbook(args) -> None:
|
|
|
256
256
|
if isinstance(args.random_seed, bool) or not isinstance(args.random_seed, int):
|
|
257
257
|
raise TypeError(ERROR_BENCHMARK_RUN_COOKBOOK_RANDOM_SEED_VALIDATION)
|
|
258
258
|
|
|
259
|
-
if (
|
|
260
|
-
not isinstance(args.system_prompt, str)
|
|
261
|
-
or not args.system_prompt
|
|
262
|
-
or args.system_prompt is None
|
|
263
|
-
):
|
|
259
|
+
if not isinstance(args.system_prompt, str) or args.system_prompt is None:
|
|
264
260
|
raise TypeError(ERROR_BENCHMARK_RUN_COOKBOOK_SYS_PROMPT_VALIDATION)
|
|
265
261
|
|
|
266
262
|
if (
|
|
@@ -337,11 +337,7 @@ def run_recipe(args) -> None:
|
|
|
337
337
|
if isinstance(args.random_seed, bool) or not isinstance(args.random_seed, int):
|
|
338
338
|
raise TypeError(ERROR_BENCHMARK_RUN_RECIPE_RANDOM_SEED_VALIDATION)
|
|
339
339
|
|
|
340
|
-
if (
|
|
341
|
-
not isinstance(args.system_prompt, str)
|
|
342
|
-
or not args.system_prompt
|
|
343
|
-
or args.system_prompt is None
|
|
344
|
-
):
|
|
340
|
+
if not isinstance(args.system_prompt, str) or args.system_prompt is None:
|
|
345
341
|
raise TypeError(ERROR_BENCHMARK_RUN_RECIPE_SYS_PROMPT_VALIDATION)
|
|
346
342
|
|
|
347
343
|
if (
|
|
@@ -348,6 +348,9 @@ ERROR_COMMON_ADD_ENDPOINT_MAX_CALLS_PER_SECOND_VALIDATION = "The 'max_calls_per_
|
|
|
348
348
|
ERROR_COMMON_ADD_ENDPOINT_MAX_CONCURRENCY_VALIDATION = (
|
|
349
349
|
"The 'max_concurrency' argument must be a non-empty positive integer and not None."
|
|
350
350
|
)
|
|
351
|
+
ERROR_COMMON_ADD_ENDPOINT_MODEL_VALIDATION = (
|
|
352
|
+
"The 'model' argument must be a string and not None."
|
|
353
|
+
)
|
|
351
354
|
ERROR_COMMON_ADD_ENDPOINT_PARAMS_VALIDATION = (
|
|
352
355
|
"The 'params' argument must be a string representation of a dictionary."
|
|
353
356
|
)
|
|
@@ -17,6 +17,7 @@ from moonshot.integrations.cli.cli_errors import (
|
|
|
17
17
|
ERROR_COMMON_ADD_ENDPOINT_CONNECTOR_TYPE_VALIDATION,
|
|
18
18
|
ERROR_COMMON_ADD_ENDPOINT_MAX_CALLS_PER_SECOND_VALIDATION,
|
|
19
19
|
ERROR_COMMON_ADD_ENDPOINT_MAX_CONCURRENCY_VALIDATION,
|
|
20
|
+
ERROR_COMMON_ADD_ENDPOINT_MODEL_VALIDATION,
|
|
20
21
|
ERROR_COMMON_ADD_ENDPOINT_NAME_VALIDATION,
|
|
21
22
|
ERROR_COMMON_ADD_ENDPOINT_PARAMS_VALIDATION,
|
|
22
23
|
ERROR_COMMON_ADD_ENDPOINT_TOKEN_VALIDATION,
|
|
@@ -56,6 +57,7 @@ def add_endpoint(args) -> None:
|
|
|
56
57
|
token (str): The access token for the API.
|
|
57
58
|
max_calls_per_second (int): The maximum number of API calls allowed per second.
|
|
58
59
|
max_concurrency (int): The maximum number of concurrent API calls.
|
|
60
|
+
model (str): The model used by the endpoint.
|
|
59
61
|
params (str): A string representation of a dictionary containing additional parameters for the connector.
|
|
60
62
|
|
|
61
63
|
Returns:
|
|
@@ -94,6 +96,9 @@ def add_endpoint(args) -> None:
|
|
|
94
96
|
):
|
|
95
97
|
raise TypeError(ERROR_COMMON_ADD_ENDPOINT_MAX_CONCURRENCY_VALIDATION)
|
|
96
98
|
|
|
99
|
+
if not isinstance(args.model, str) or args.model is None:
|
|
100
|
+
raise TypeError(ERROR_COMMON_ADD_ENDPOINT_MODEL_VALIDATION)
|
|
101
|
+
|
|
97
102
|
try:
|
|
98
103
|
params_dict = literal_eval(args.params)
|
|
99
104
|
except Exception:
|
|
@@ -108,6 +113,7 @@ def add_endpoint(args) -> None:
|
|
|
108
113
|
args.token,
|
|
109
114
|
args.max_calls_per_second,
|
|
110
115
|
args.max_concurrency,
|
|
116
|
+
args.model,
|
|
111
117
|
params_dict,
|
|
112
118
|
)
|
|
113
119
|
print(f"[add_endpoint]: Endpoint ({new_endpoint_id}) created.")
|
|
@@ -123,9 +129,9 @@ def list_endpoints(args) -> list | None:
|
|
|
123
129
|
moonshot.api module. It then displays the endpoints using the _display_endpoints function.
|
|
124
130
|
|
|
125
131
|
Args:
|
|
126
|
-
args: A namespace object from argparse. It should have
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
args: A namespace object from argparse. It should have the following optional attributes:
|
|
133
|
+
find (str): Optional field to find endpoint(s) with a keyword.
|
|
134
|
+
pagination (str): Optional field to paginate endpoints.
|
|
129
135
|
|
|
130
136
|
Returns:
|
|
131
137
|
list | None: A list of ConnectorEndpoint or None if there is no result.
|
|
@@ -176,9 +182,9 @@ def list_connector_types(args) -> list | None:
|
|
|
176
182
|
moonshot.api module. It then displays the connector types using the _display_connector_types function.
|
|
177
183
|
|
|
178
184
|
Args:
|
|
179
|
-
args: A namespace object from argparse. It should have
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
args: A namespace object from argparse. It should have the following optional attributes:
|
|
186
|
+
find (str): Optional field to find connector type(s) with a keyword.
|
|
187
|
+
pagination (str): Optional field to paginate connector types.
|
|
182
188
|
|
|
183
189
|
Returns:
|
|
184
190
|
list | None: A list of Connector or None if there is no result.
|
|
@@ -373,7 +379,8 @@ def _display_endpoints(endpoints_list):
|
|
|
373
379
|
|
|
374
380
|
Args:
|
|
375
381
|
endpoints_list (list): A list of endpoints. Each endpoint is a dictionary with keys 'id', 'name',
|
|
376
|
-
'connector_type', 'uri', 'token', 'max_calls_per_second', 'max_concurrency', '
|
|
382
|
+
'connector_type', 'uri', 'token', 'max_calls_per_second', 'max_concurrency', 'model', 'params',
|
|
383
|
+
and 'created_date'.
|
|
377
384
|
|
|
378
385
|
Returns:
|
|
379
386
|
None
|
|
@@ -391,7 +398,8 @@ def _display_endpoints(endpoints_list):
|
|
|
391
398
|
table.add_column("Uri", justify="left", width=10)
|
|
392
399
|
table.add_column("Token", justify="left", width=10)
|
|
393
400
|
table.add_column("Max Calls Per Second", justify="left", width=5)
|
|
394
|
-
table.add_column("Max
|
|
401
|
+
table.add_column("Max Concurrency", justify="left", width=5)
|
|
402
|
+
table.add_column("Model", justify="left", width=5)
|
|
395
403
|
table.add_column("Params", justify="left", width=30)
|
|
396
404
|
table.add_column("Created Date", justify="left", width=8)
|
|
397
405
|
|
|
@@ -404,6 +412,7 @@ def _display_endpoints(endpoints_list):
|
|
|
404
412
|
token,
|
|
405
413
|
max_calls_per_second,
|
|
406
414
|
max_concurrency,
|
|
415
|
+
model,
|
|
407
416
|
params,
|
|
408
417
|
created_date,
|
|
409
418
|
*other_args,
|
|
@@ -419,6 +428,7 @@ def _display_endpoints(endpoints_list):
|
|
|
419
428
|
token,
|
|
420
429
|
str(max_calls_per_second),
|
|
421
430
|
str(max_concurrency),
|
|
431
|
+
str(model),
|
|
422
432
|
escape(str(params)),
|
|
423
433
|
created_date,
|
|
424
434
|
)
|
|
@@ -432,7 +442,7 @@ def _display_endpoints(endpoints_list):
|
|
|
432
442
|
add_endpoint_args = cmd2.Cmd2ArgumentParser(
|
|
433
443
|
description="Add a new endpoint. The 'name' argument will be slugified to create a unique identifier.",
|
|
434
444
|
epilog="Example:\n add_endpoint openai-connector 'OpenAI GPT3.5 Turbo 1106' "
|
|
435
|
-
"MY_URI ADD_YOUR_TOKEN_HERE 1 1 \"{'temperature': 0.5
|
|
445
|
+
"MY_URI ADD_YOUR_TOKEN_HERE 1 1 'gpt-3.5-turbo-1106' \"{'temperature': 0.5}\"",
|
|
436
446
|
)
|
|
437
447
|
add_endpoint_args.add_argument(
|
|
438
448
|
"connector_type",
|
|
@@ -450,6 +460,7 @@ add_endpoint_args.add_argument(
|
|
|
450
460
|
add_endpoint_args.add_argument(
|
|
451
461
|
"max_concurrency", type=int, help="Max concurrency of the new endpoint"
|
|
452
462
|
)
|
|
463
|
+
add_endpoint_args.add_argument("model", type=str, help="Model of the new endpoint")
|
|
453
464
|
add_endpoint_args.add_argument("params", type=str, help="Params of the new endpoint")
|
|
454
465
|
|
|
455
466
|
# Update endpoint arguments
|
|
@@ -457,11 +468,12 @@ update_endpoint_args = cmd2.Cmd2ArgumentParser(
|
|
|
457
468
|
description="Update an endpoint.",
|
|
458
469
|
epilog=(
|
|
459
470
|
"Available keys:\n"
|
|
460
|
-
" name:
|
|
471
|
+
" name: Name of the endpoint\n"
|
|
461
472
|
" uri: URI of the endpoint\n"
|
|
462
473
|
" token: Token of the endpoint\n"
|
|
463
474
|
" max_calls_per_second: Rate limit for max calls per second\n"
|
|
464
475
|
" max_concurrency: Rate limit for max concurrency\n"
|
|
476
|
+
" model: Model of the endpoint\n"
|
|
465
477
|
" params: Extra arguments for the endpoint\n\n"
|
|
466
478
|
"Example:\n"
|
|
467
479
|
" update_endpoint openai-gpt4 \"[('name', 'my-special-openai-endpoint'), "
|
|
@@ -71,7 +71,7 @@ def create_app(cfg: providers.Configuration) -> CustomFastAPI:
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
app: CustomFastAPI = CustomFastAPI(
|
|
74
|
-
title="Project Moonshot", version="0.
|
|
74
|
+
title="Project Moonshot", version="0.5.0", **app_kwargs
|
|
75
75
|
)
|
|
76
76
|
|
|
77
77
|
if cfg.cors.enabled():
|
|
@@ -17,5 +17,6 @@ class EndpointUpdateDTO(ConnectorEndpointPydanticModel):
|
|
|
17
17
|
token: Optional[str] = None
|
|
18
18
|
max_calls_per_second: Optional[int] = None
|
|
19
19
|
max_concurrency: Optional[int] = None
|
|
20
|
+
model: Optional[str] = None
|
|
20
21
|
params: Optional[dict] = None
|
|
21
22
|
created_date: Optional[str] = None
|
|
@@ -13,6 +13,7 @@ class EndpointService(BaseService):
|
|
|
13
13
|
connector_type=endpoint_data.connector_type,
|
|
14
14
|
uri=endpoint_data.uri,
|
|
15
15
|
token=endpoint_data.token,
|
|
16
|
+
model=endpoint_data.model,
|
|
16
17
|
max_calls_per_second=endpoint_data.max_calls_per_second,
|
|
17
18
|
max_concurrency=endpoint_data.max_concurrency,
|
|
18
19
|
params=endpoint_data.params,
|
moonshot/src/api/api_bookmark.py
CHANGED
|
@@ -21,10 +21,15 @@ def api_insert_bookmark(
|
|
|
21
21
|
Args:
|
|
22
22
|
name (str): The unique name of the bookmark.
|
|
23
23
|
prompt (str): The associated prompt text for the bookmark.
|
|
24
|
+
prepared_prompt (str): The prepared prompt text for the bookmark.
|
|
24
25
|
response (str): The corresponding response text for the bookmark.
|
|
25
|
-
context_strategy (str): The strategy used for context management in the bookmark.
|
|
26
|
-
prompt_template (str): The template used for generating the prompt.
|
|
27
|
-
attack_module (str): The attack module linked with the bookmark.
|
|
26
|
+
context_strategy (str, optional): The strategy used for context management in the bookmark. Defaults to "".
|
|
27
|
+
prompt_template (str, optional): The template used for generating the prompt. Defaults to "".
|
|
28
|
+
attack_module (str, optional): The attack module linked with the bookmark. Defaults to "".
|
|
29
|
+
metric (str, optional): The metric associated with the bookmark. Defaults to "".
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
dict: A dictionary containing the details of the newly inserted bookmark.
|
|
28
33
|
"""
|
|
29
34
|
# Create a new BookmarkArguments object
|
|
30
35
|
bookmark_args = BookmarkArguments(
|
|
@@ -57,10 +62,10 @@ def api_get_bookmark(bookmark_name: str) -> dict:
|
|
|
57
62
|
Retrieves the details of a specific bookmark by its name.
|
|
58
63
|
|
|
59
64
|
Args:
|
|
60
|
-
bookmark_name (
|
|
65
|
+
bookmark_name (str): The name of the bookmark to retrieve.
|
|
61
66
|
|
|
62
67
|
Returns:
|
|
63
|
-
dict: The bookmark details corresponding to the provided
|
|
68
|
+
dict: The bookmark details corresponding to the provided name.
|
|
64
69
|
"""
|
|
65
70
|
return Bookmark().get_bookmark(bookmark_name)
|
|
66
71
|
|
|
@@ -71,6 +76,9 @@ def api_delete_bookmark(bookmark_name: str) -> dict:
|
|
|
71
76
|
|
|
72
77
|
Args:
|
|
73
78
|
bookmark_name (str): The name of the bookmark to be removed.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
dict: A dictionary containing the details of the deleted bookmark.
|
|
74
82
|
"""
|
|
75
83
|
return Bookmark().delete_bookmark(bookmark_name)
|
|
76
84
|
|
|
@@ -78,6 +86,9 @@ def api_delete_bookmark(bookmark_name: str) -> dict:
|
|
|
78
86
|
def api_delete_all_bookmark() -> dict:
|
|
79
87
|
"""
|
|
80
88
|
Removes all bookmarks from the database.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
dict: A dictionary indicating the result of the delete operation.
|
|
81
92
|
"""
|
|
82
93
|
return Bookmark().delete_all_bookmark()
|
|
83
94
|
|
|
@@ -13,8 +13,8 @@ def api_create_connector_from_endpoint(ep_id: str) -> Connector:
|
|
|
13
13
|
Creates a connector based on the provided endpoint ID.
|
|
14
14
|
|
|
15
15
|
This function retrieves the endpoint arguments using the provided endpoint ID and then creates a connector
|
|
16
|
-
based on those arguments. It utilizes the
|
|
17
|
-
arguments and then calls the
|
|
16
|
+
based on those arguments. It utilizes the ConnectorEndpoint's read method to fetch the endpoint
|
|
17
|
+
arguments and then calls the Connector's create method to initialize and return the connector.
|
|
18
18
|
|
|
19
19
|
Args:
|
|
20
20
|
ep_id (str): The ID of the endpoint for which to create a connector.
|
|
@@ -49,7 +49,7 @@ def api_get_all_connector_type() -> list[str]:
|
|
|
49
49
|
"""
|
|
50
50
|
Retrieves a list of all available connector types.
|
|
51
51
|
|
|
52
|
-
This function calls the
|
|
52
|
+
This function calls the Connector's get_available_items method to retrieve a list of all available
|
|
53
53
|
connector types. It returns the list of connector types.
|
|
54
54
|
|
|
55
55
|
Returns:
|
|
@@ -17,6 +17,7 @@ def api_create_endpoint(
|
|
|
17
17
|
token: str,
|
|
18
18
|
max_calls_per_second: int,
|
|
19
19
|
max_concurrency: int,
|
|
20
|
+
model: str,
|
|
20
21
|
params: dict,
|
|
21
22
|
) -> str:
|
|
22
23
|
"""
|
|
@@ -33,6 +34,7 @@ def api_create_endpoint(
|
|
|
33
34
|
token (str): The token for authentication with the connector.
|
|
34
35
|
max_calls_per_second (int): The maximum number of calls allowed per second.
|
|
35
36
|
max_concurrency (int): The maximum number of concurrent calls allowed.
|
|
37
|
+
model (str): The model used by the connector.
|
|
36
38
|
params (dict): Additional parameters for the connector.
|
|
37
39
|
|
|
38
40
|
Returns:
|
|
@@ -51,6 +53,7 @@ def api_create_endpoint(
|
|
|
51
53
|
token=token,
|
|
52
54
|
max_calls_per_second=max_calls_per_second,
|
|
53
55
|
max_concurrency=max_concurrency,
|
|
56
|
+
model=model,
|
|
54
57
|
params=params,
|
|
55
58
|
created_date="",
|
|
56
59
|
)
|
|
@@ -136,7 +139,7 @@ def api_get_all_endpoint() -> list[dict]:
|
|
|
136
139
|
"""
|
|
137
140
|
Retrieves a list of all available endpoints.
|
|
138
141
|
|
|
139
|
-
This function calls the
|
|
142
|
+
This function calls the ConnectorEndpoint's get_available_items method to retrieve a list of all available
|
|
140
143
|
endpoints and their details. It then converts each ConnectorEndpointArguments object into a dictionary for easier
|
|
141
144
|
consumption by the caller.
|
|
142
145
|
|
|
@@ -151,8 +154,8 @@ def api_get_all_endpoint_name() -> list[str]:
|
|
|
151
154
|
"""
|
|
152
155
|
Retrieves a list of all endpoint names.
|
|
153
156
|
|
|
154
|
-
This function calls the
|
|
155
|
-
endpoint names. It extracts the names from the tuple returned by
|
|
157
|
+
This function calls the ConnectorEndpoint's get_available_items method to retrieve a list of all available
|
|
158
|
+
endpoint names. It extracts the names from the tuple returned by get_available_items, which contains a list
|
|
156
159
|
of endpoint names and a list of ConnectorEndpointArguments objects.
|
|
157
160
|
|
|
158
161
|
Returns:
|
|
@@ -10,7 +10,7 @@ def api_get_all_context_strategies() -> list[str]:
|
|
|
10
10
|
"""
|
|
11
11
|
Retrieves and returns the names of all context strategies currently available.
|
|
12
12
|
|
|
13
|
-
This API endpoint interfaces with the `ContextStrategy.
|
|
13
|
+
This API endpoint interfaces with the `ContextStrategy.get_all_context_strategies` method to fetch a list
|
|
14
14
|
of all context strategy names. It's designed for clients that need to know what context strategies are available for
|
|
15
15
|
use in sessions or other components of the system.
|
|
16
16
|
|
|
@@ -48,7 +48,7 @@ def api_get_all_context_strategy_metadata() -> list[dict]:
|
|
|
48
48
|
returns a list of metadata dictionaries.
|
|
49
49
|
|
|
50
50
|
Returns:
|
|
51
|
-
list[dict]: A list of dictionaries, each representing the details of a context strategy metadata.
|
|
51
|
+
list[dict]: A list of dictionaries, each representing the details of a context strategy's metadata.
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
return [
|
moonshot/src/api/api_cookbook.py
CHANGED
|
@@ -14,7 +14,7 @@ def api_create_cookbook(name: str, description: str, recipes: list[str]) -> str:
|
|
|
14
14
|
|
|
15
15
|
This function takes the name, description, and recipes for a new cookbook as input. It then creates a new
|
|
16
16
|
CookbookArguments object with these details and an empty id. The id is left empty because it will be generated
|
|
17
|
-
from the name during the creation process. The function then calls the Cookbook's
|
|
17
|
+
from the name during the creation process. The function then calls the Cookbook's create method to
|
|
18
18
|
create the new cookbook.
|
|
19
19
|
|
|
20
20
|
Args:
|
|
@@ -43,7 +43,7 @@ def api_read_cookbook(cb_id: str) -> dict:
|
|
|
43
43
|
"""
|
|
44
44
|
Retrieves a cookbook based on the provided cookbook ID.
|
|
45
45
|
|
|
46
|
-
This function reads a cookbook using the `
|
|
46
|
+
This function reads a cookbook using the `read` method
|
|
47
47
|
of the `Cookbook` class, and converts the returned `Cookbook` object to a dictionary using its `to_dict` method.
|
|
48
48
|
|
|
49
49
|
Args:
|
|
@@ -60,7 +60,7 @@ def api_read_cookbooks(cb_ids: conlist(str, min_length=1)) -> list[dict]:
|
|
|
60
60
|
"""
|
|
61
61
|
Retrieves a list of cookbooks based on the provided list of cookbook IDs.
|
|
62
62
|
|
|
63
|
-
This function iterates over the list of provided cookbook IDs, reads each cookbook using the `
|
|
63
|
+
This function iterates over the list of provided cookbook IDs, reads each cookbook using the `read` method
|
|
64
64
|
of the `Cookbook` class, and converts the returned `Cookbook` objects to dictionaries using their `to_dict` method.
|
|
65
65
|
It then returns a list of these dictionary representations.
|
|
66
66
|
|
|
@@ -90,7 +90,7 @@ def api_update_cookbook(cb_id: str, **kwargs) -> bool:
|
|
|
90
90
|
bool: True if the cookbook was successfully updated.
|
|
91
91
|
|
|
92
92
|
Raises:
|
|
93
|
-
|
|
93
|
+
RuntimeError: If the cookbook with the given ID does not exist.
|
|
94
94
|
"""
|
|
95
95
|
# Check if the cookbook exists
|
|
96
96
|
try:
|
|
@@ -134,7 +134,7 @@ def api_get_all_cookbook() -> list[dict]:
|
|
|
134
134
|
"""
|
|
135
135
|
Retrieves all available cookbooks.
|
|
136
136
|
|
|
137
|
-
This function calls the `
|
|
137
|
+
This function calls the `get_available_items` method of the `Cookbook` class, which returns a tuple
|
|
138
138
|
containing a list of cookbook IDs and a list of `CookbookArguments` objects. The function then returns a list
|
|
139
139
|
of dictionaries, each representing a cookbook.
|
|
140
140
|
|
|
@@ -149,7 +149,7 @@ def api_get_all_cookbook_name() -> list[str]:
|
|
|
149
149
|
"""
|
|
150
150
|
Retrieves the names of all available cookbooks.
|
|
151
151
|
|
|
152
|
-
This function calls the `
|
|
152
|
+
This function calls the `get_available_items` method of the `Cookbook` class, which returns a tuple
|
|
153
153
|
containing a list of cookbook IDs and a list of `CookbookArguments` objects. The function then returns the
|
|
154
154
|
list of cookbook IDs, which are the names of the cookbooks.
|
|
155
155
|
|
moonshot/src/api/api_dataset.py
CHANGED
|
@@ -16,7 +16,7 @@ def api_delete_dataset(ds_id: str) -> bool:
|
|
|
16
16
|
ds_id (str): The unique identifier for the dataset to be deleted.
|
|
17
17
|
|
|
18
18
|
Returns:
|
|
19
|
-
bool: True if the dataset was successfully deleted.
|
|
19
|
+
bool: True if the dataset was successfully deleted, False otherwise.
|
|
20
20
|
|
|
21
21
|
Raises:
|
|
22
22
|
Exception: If the deletion process encounters an error.
|
|
@@ -27,10 +27,10 @@ def api_delete_dataset(ds_id: str) -> bool:
|
|
|
27
27
|
def api_get_all_datasets() -> list[dict]:
|
|
28
28
|
"""
|
|
29
29
|
This function retrieves all available datasets and returns them as a list of dictionaries. Each dictionary
|
|
30
|
-
represents a
|
|
30
|
+
represents a dataset and contains its information.
|
|
31
31
|
|
|
32
32
|
Returns:
|
|
33
|
-
list[dict]: A list of dictionaries, each representing a
|
|
33
|
+
list[dict]: A list of dictionaries, each representing a dataset.
|
|
34
34
|
"""
|
|
35
35
|
_, datasets = Dataset.get_available_items()
|
|
36
36
|
return [dataset.to_dict() for dataset in datasets]
|
|
@@ -38,10 +38,10 @@ def api_get_all_datasets() -> list[dict]:
|
|
|
38
38
|
|
|
39
39
|
def api_get_all_datasets_name() -> list[str]:
|
|
40
40
|
"""
|
|
41
|
-
This function retrieves all available
|
|
41
|
+
This function retrieves all available dataset names and returns them as a list.
|
|
42
42
|
|
|
43
43
|
Returns:
|
|
44
|
-
list[str]: A list of
|
|
44
|
+
list[str]: A list of dataset names.
|
|
45
45
|
"""
|
|
46
46
|
datasets_name, _ = Dataset.get_available_items()
|
|
47
47
|
return datasets_name
|
|
@@ -8,6 +8,9 @@ def api_set_environment_variables(env_vars: dict) -> None:
|
|
|
8
8
|
"""
|
|
9
9
|
Sets the environment variables for the current session.
|
|
10
10
|
|
|
11
|
+
This function takes a dictionary of environment variables and sets them for the current session
|
|
12
|
+
by loading them into the EnvironmentVars configuration.
|
|
13
|
+
|
|
11
14
|
Args:
|
|
12
15
|
env_vars (dict): A dictionary containing the environment variables to set.
|
|
13
16
|
|
moonshot/src/api/api_metrics.py
CHANGED
|
@@ -15,7 +15,7 @@ def api_delete_metric(met_id: str) -> bool:
|
|
|
15
15
|
met_id (str): The unique identifier for the metric to be deleted.
|
|
16
16
|
|
|
17
17
|
Returns:
|
|
18
|
-
bool: True if the metric was successfully deleted.
|
|
18
|
+
bool: True if the metric was successfully deleted, False otherwise.
|
|
19
19
|
|
|
20
20
|
Raises:
|
|
21
21
|
Exception: If the deletion process encounters an error.
|
|
@@ -10,6 +10,9 @@ def api_get_all_prompt_template_detail() -> list[dict]:
|
|
|
10
10
|
"""
|
|
11
11
|
Retrieves all available prompt template details and returns them as a list of dictionaries.
|
|
12
12
|
|
|
13
|
+
This function calls the `get_all_prompt_template_details` method from the `PromptTemplate` class
|
|
14
|
+
to fetch the details of all prompt templates. It then returns these details as a list of dictionaries.
|
|
15
|
+
|
|
13
16
|
Returns:
|
|
14
17
|
list[dict]: A list of dictionaries, each representing the details of a prompt template.
|
|
15
18
|
"""
|
|
@@ -20,6 +23,9 @@ def api_get_all_prompt_template_name() -> list[str]:
|
|
|
20
23
|
"""
|
|
21
24
|
Retrieves all available prompt template names and returns them as a list.
|
|
22
25
|
|
|
26
|
+
This function calls the `get_all_prompt_template_names` method from the `PromptTemplate` class
|
|
27
|
+
to fetch the names of all prompt templates. It then returns these names as a list of strings.
|
|
28
|
+
|
|
23
29
|
Returns:
|
|
24
30
|
list[str]: A list of prompt template names.
|
|
25
31
|
"""
|
|
@@ -31,6 +37,9 @@ def api_delete_prompt_template(pt_id: str) -> bool:
|
|
|
31
37
|
"""
|
|
32
38
|
Deletes a prompt template by its identifier.
|
|
33
39
|
|
|
40
|
+
This function calls the `delete` method from the `PromptTemplate` class to delete a prompt template
|
|
41
|
+
identified by its unique ID. It returns True if the deletion was successful, otherwise it raises an exception.
|
|
42
|
+
|
|
34
43
|
Args:
|
|
35
44
|
pt_id (str): The unique identifier of the prompt template to be deleted.
|
|
36
45
|
|