aiverify-moonshot 0.7.1__py3-none-any.whl → 0.7.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiverify-moonshot
3
- Version: 0.7.1
3
+ Version: 0.7.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/
@@ -15,24 +15,24 @@ Classifier: License :: OSI Approved :: Apache Software License
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Requires-Python: >=3.11
18
- Requires-Dist: datasets>=2.21.0
18
+ Requires-Dist: datasets~=3.2.0
19
19
  Requires-Dist: ijson>=3.3.0
20
- Requires-Dist: jinja2>=3.1.4
21
- Requires-Dist: numpy>=1.26.4
20
+ Requires-Dist: jinja2>=3.1.6
21
+ Requires-Dist: numpy~=1.26.4
22
22
  Requires-Dist: pandas>=2.2.2
23
23
  Requires-Dist: pydantic==2.8.2
24
- Requires-Dist: pyparsing>=3.1.4
25
- Requires-Dist: python-dotenv>=1.0.1
24
+ Requires-Dist: pyparsing>=3.2.3
25
+ Requires-Dist: python-dotenv>=1.1.0
26
26
  Requires-Dist: python-multipart>=0.0.9
27
27
  Requires-Dist: python-slugify>=8.0.4
28
- Requires-Dist: tenacity>=8.5.0
28
+ Requires-Dist: tenacity~=8.5.0
29
29
  Requires-Dist: xxhash>=3.5.0
30
30
  Provides-Extra: all
31
31
  Requires-Dist: cmd2>=2.4.3; extra == 'all'
32
32
  Requires-Dist: dependency-injector>=4.41.0; extra == 'all'
33
33
  Requires-Dist: fastapi>=0.115.4; extra == 'all'
34
34
  Requires-Dist: rich>=13.8.0; extra == 'all'
35
- Requires-Dist: typing-extensions>=4.12.2; extra == 'all'
35
+ Requires-Dist: typing-extensions==4.13.2; extra == 'all'
36
36
  Requires-Dist: uvicorn>=0.30.6; extra == 'all'
37
37
  Provides-Extra: cli
38
38
  Requires-Dist: cmd2>=2.4.3; extra == 'cli'
@@ -40,7 +40,7 @@ Requires-Dist: rich>=13.8.0; extra == 'cli'
40
40
  Provides-Extra: web-api
41
41
  Requires-Dist: dependency-injector>=4.41.0; extra == 'web-api'
42
42
  Requires-Dist: fastapi>=0.115.4; extra == 'web-api'
43
- Requires-Dist: typing-extensions>=4.12.2; extra == 'web-api'
43
+ Requires-Dist: typing-extensions==4.13.2; extra == 'web-api'
44
44
  Requires-Dist: uvicorn>=0.30.6; extra == 'web-api'
45
45
  Description-Content-Type: text/markdown
46
46
 
@@ -48,7 +48,7 @@ Description-Content-Type: text/markdown
48
48
 
49
49
  ![Moonshot Logo](https://github.com/aiverify-foundation/moonshot/raw/main/misc/aiverify-moonshot-logo.png)
50
50
 
51
- **Version 0.7.1**
51
+ **Version 0.7.3**
52
52
 
53
53
  A simple and modular tool to evaluate any LLM-based AI systems.
54
54
 
@@ -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=ppmlbvde_68wbJ3oXuQvAdDAYDyhi0yy4vLe9H-29YQ,3651
37
+ moonshot/integrations/web_api/app.py,sha256=IqfAlkQsbQ9vv-1botkfw4RNubmeMJcQt4p5Yc7P7ec,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
@@ -74,12 +74,12 @@ moonshot/integrations/web_api/services/auto_red_team_test_manager.py,sha256=a_aB
74
74
  moonshot/integrations/web_api/services/auto_red_team_test_state.py,sha256=GRmvdYLwQdE8gGkYD9Sd4n__yEBajl2pRA_V0J2YObE,1952
75
75
  moonshot/integrations/web_api/services/base_service.py,sha256=_MaQEuBpRNNHXNPylZUGaUVCSA5a2jHi9NoKBpvIprs,172
76
76
  moonshot/integrations/web_api/services/benchmark_result_service.py,sha256=-oPvLL7b-pEAOeY0gwlngpgImklkUiwvPE6IJo83a7M,909
77
- moonshot/integrations/web_api/services/benchmark_test_manager.py,sha256=aPoB6hOfOYqsDliiIzZ0y6cCI0mPDXLK21j9fHXm10U,4076
77
+ moonshot/integrations/web_api/services/benchmark_test_manager.py,sha256=HSJA81F-uXu_0kvA7su8xfmLvy8aQP5Pd8xbncAtjZ8,4565
78
78
  moonshot/integrations/web_api/services/benchmark_test_state.py,sha256=MyhTxpAhhP66JF0ua1SMc_IIeIjDxQY5swOXv9cmYaY,1887
79
79
  moonshot/integrations/web_api/services/benchmarking_service.py,sha256=lJZeNTqxEPBLrZNX3Z9JIilgwetywSkv0deQkcb8mQs,1257
80
80
  moonshot/integrations/web_api/services/bookmark_service.py,sha256=jI9nXs1hjzO0CLG2LKaXSzDApLThkfCvPUkaNNV9A5A,3546
81
81
  moonshot/integrations/web_api/services/context_strategy_service.py,sha256=F6ulJbmx9ZNuUEVco6e2_rr2eLu5NV1nKDLaP6bNbP8,681
82
- moonshot/integrations/web_api/services/cookbook_service.py,sha256=wsOFN8tXvzpsm-vRlHbUwMvdtyxInB1kjoasssFtDAI,8734
82
+ moonshot/integrations/web_api/services/cookbook_service.py,sha256=glC4W-UTisqZu-Q6RVFMQ8e-kSSbgTA7tumPCPs75gk,9044
83
83
  moonshot/integrations/web_api/services/dataset_service.py,sha256=FUXLgU32nghoLWWXBA_4GzeQb8eK31tjbvLu4OJBxoc,2441
84
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
@@ -111,7 +111,7 @@ moonshot/src/api/api_recipe.py,sha256=_TJUc8vJqxu5Uti3q2GSQ2uJdj8hqNBFSvBi2NaDny
111
111
  moonshot/src/api/api_red_teaming.py,sha256=GBBy4yDAbDuUyeANkGorZJENWceNIzfg30TuiF-Av3Q,2004
112
112
  moonshot/src/api/api_result.py,sha256=xZHex_K_PbSr-65LPLr5up4lvu313-VJroR4BBR5JQk,2849
113
113
  moonshot/src/api/api_run.py,sha256=ToPYIeTPd2OaOqd20UQ_ie2BQPqLw5aZ_RwRwv9oGpU,2983
114
- moonshot/src/api/api_runner.py,sha256=spN7ogBGQN7I-c1u_UeKZ7vg02AtCuAl3dFG8CSayQU,4257
114
+ moonshot/src/api/api_runner.py,sha256=CzbY8bLXTodaHzm32BFrtYT6Mkgq_sNko7MAjWY7hO0,4557
115
115
  moonshot/src/api/api_session.py,sha256=w-mc_sj3ElQa6FPQqWbK2bFgGTu1ECwYm3tN41xFkes,11130
116
116
  moonshot/src/bookmark/bookmark.py,sha256=KOvvNE8wvdkJu9q2clte5fPLESZ2x6EuuoQkkxFxmHg,12970
117
117
  moonshot/src/bookmark/bookmark_arguments.py,sha256=Xgjx3Ek9MXwD4p1icac8nPX3KZfmYsBwR6kwPwHAngE,1622
@@ -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.7.1.dist-info/METADATA,sha256=8bfZclyjyzzKl-V0K6WoVydD-BWLzF2rBux8qR0-nmk,11170
176
- aiverify_moonshot-0.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
177
- aiverify_moonshot-0.7.1.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
178
- aiverify_moonshot-0.7.1.dist-info/licenses/LICENSE.md,sha256=53izDRmJZZCjpYGfyLqlxnGQN-aNWBxasuzuMXC5Ias,11347
179
- aiverify_moonshot-0.7.1.dist-info/licenses/NOTICES.md,sha256=3d1WLa7kMtzh79BXxXr-keSlvHo8Llb-5EkGgtRiMS0,51537
180
- aiverify_moonshot-0.7.1.dist-info/RECORD,,
175
+ aiverify_moonshot-0.7.3.dist-info/METADATA,sha256=9-TmvcZg3_DZCmRZ0K9tP8DpmffzoHXR7VZCPRQX78Y,11169
176
+ aiverify_moonshot-0.7.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
177
+ aiverify_moonshot-0.7.3.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
178
+ aiverify_moonshot-0.7.3.dist-info/licenses/LICENSE.md,sha256=53izDRmJZZCjpYGfyLqlxnGQN-aNWBxasuzuMXC5Ias,11347
179
+ aiverify_moonshot-0.7.3.dist-info/licenses/NOTICES.md,sha256=3d1WLa7kMtzh79BXxXr-keSlvHo8Llb-5EkGgtRiMS0,51537
180
+ aiverify_moonshot-0.7.3.dist-info/RECORD,,
@@ -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.7.1", **app_kwargs
74
+ title="Project Moonshot", version="0.7.3", **app_kwargs
75
75
  )
76
76
 
77
77
  if cfg.cors.enabled():
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import uuid
3
+ import traceback
3
4
  from typing import Any
4
5
 
5
6
  from dependency_injector.wiring import inject
@@ -82,12 +83,20 @@ class BenchmarkTestManager(BaseService):
82
83
  self, input_data: BenchmarkRunnerDTO, benchmark_type: BenchmarkCollectionType
83
84
  ) -> str:
84
85
  task_id = self.generate_unique_task_id()
85
- runner = self.runner_service.create_runner(
86
- input_data.run_name,
87
- input_data.endpoints,
88
- input_data.description,
89
- self.progress_status_updater.on_progress_update,
90
- )
86
+ try:
87
+ runner = self.runner_service.create_runner(
88
+ input_data.run_name,
89
+ input_data.endpoints,
90
+ input_data.description,
91
+ self.progress_status_updater.on_progress_update,
92
+ )
93
+ except ValueError as e:
94
+ self.logger.error("Failed to create runner - Error: %s, Stacktrace: %s", e, traceback.print_exc())
95
+ raise ValueError("Failed to create runner due to invalid input.")
96
+ except Exception as e:
97
+ self.logger.error("Failed to create runner - Error: %s, Stacktrace: %s", e, traceback.print_exc())
98
+ raise Exception(f"Unexpected error in core library - {e}")
99
+
91
100
  benchmark_coroutine = self.run_test(input_data, benchmark_type, runner)
92
101
 
93
102
  task = asyncio.create_task(benchmark_coroutine, name=task_id)
@@ -21,6 +21,13 @@ class CookbookService(BaseService):
21
21
  Args:
22
22
  cookbook_data (CookbookCreateDTO): Data transfer object containing cookbook details.
23
23
  """
24
+ try:
25
+ existing_cookbook = moonshot_api.api_read_cookbook(cookbook_data.name)
26
+ if existing_cookbook:
27
+ raise ValueError("Cookbook with this name already exists.")
28
+ except Exception:
29
+ # If cookbook does not exist, continue to create
30
+ pass
24
31
  moonshot_api.api_create_cookbook(
25
32
  name=cookbook_data.name,
26
33
  description=cookbook_data.description,
@@ -37,6 +37,14 @@ def api_create_runner(
37
37
  # We do not need to provide the id.
38
38
  # This is because during creating:
39
39
  # 1. the id is slugify from the name and stored as id.
40
+ # Validate arguments
41
+ if not name.strip():
42
+ raise ValueError("Runner name must not be empty.")
43
+
44
+ if not endpoints or not isinstance(endpoints, list) \
45
+ or not all([e.strip() for e in endpoints]):
46
+ raise ValueError("Endpoints must be a non-empty list of strings.")
47
+
40
48
  runner_args = RunnerArguments(
41
49
  id="",
42
50
  name=name,