aiverify-moonshot 0.4.0__py3-none-any.whl → 0.4.1__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.3
2
2
  Name: aiverify-moonshot
3
- Version: 0.4.0
3
+ Version: 0.4.1
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.0**
46
+ **Version 0.4.1**
47
47
 
48
48
  A simple and modular tool to evaluate any LLM application.
49
49
 
@@ -1,5 +1,5 @@
1
1
  moonshot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- moonshot/__main__.py,sha256=GQ2E_uWuv6Leaki3-77OS7n5HHQ2ZAwy4vyrrK8JJTY,7168
2
+ moonshot/__main__.py,sha256=EHvFjnZcZCQ1WZS4OYud-VkiwG1p6HjRDepBkkyZYkY,7177
3
3
  moonshot/api.py,sha256=cI2DR4xcEh5-RonG4du13Ime-uzaCrgwzUuau8WnJ7o,4405
4
4
  moonshot/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  moonshot/integrations/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -27,11 +27,11 @@ moonshot/integrations/cli/redteam/attack_module.py,sha256=p6s8XXHMTmeeBTtERQ-XlO
27
27
  moonshot/integrations/cli/redteam/context_strategy.py,sha256=bl0U8u1xS1tJewwx2Oue5yAsc7VEFullIjdKn392DG8,5132
28
28
  moonshot/integrations/cli/redteam/prompt_template.py,sha256=JNPr1GnPr4Vs1w51_jX0OIPTrv1B87rRw4oE6HxE3Y8,2075
29
29
  moonshot/integrations/cli/redteam/redteam.py,sha256=-g1hayxhJ-VRn6m6DNIn2VIs3dBP9og-J6JcFC8Y-X0,2767
30
- moonshot/integrations/cli/redteam/session.py,sha256=l2zL7AZFuHj5yWE_W974Zpr0ASzWqHqNMYzXLKCq4XI,15353
30
+ moonshot/integrations/cli/redteam/session.py,sha256=gt-NBJGGZujHT1qYgt8XS3JzZvT0TTPYmTFjSMAlmr0,15783
31
31
  moonshot/integrations/web_api/.env.dev,sha256=0z5_Ut8rF-UqFZtgjkH2qoqORhD5_nSs2w_OeX2SteI,182
32
32
  moonshot/integrations/web_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  moonshot/integrations/web_api/__main__.py,sha256=UDLKKAATJXFXB5I9VqUx4_JUfCn4xDLE0pFRsw4B3hw,1941
34
- moonshot/integrations/web_api/app.py,sha256=RiP6Z4vUwxOSnREBkpkWGMKqyWlYbI2v14fH0fkM-XM,3616
34
+ moonshot/integrations/web_api/app.py,sha256=ROPOfly753cXP2IP9GCDe18qIeDwvwsuUxMgy6NxQB4,3616
35
35
  moonshot/integrations/web_api/container.py,sha256=ziTi3yPjI-WEGZvUbMFFPi0JPSLAinkUQyPZ1vMwtdQ,5522
36
36
  moonshot/integrations/web_api/logging_conf.py,sha256=t3EGRV6tZhV732KXe8_Tiy0fiwVAWxZX5Tt8VTgrrfg,3388
37
37
  moonshot/integrations/web_api/log/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -126,8 +126,8 @@ moonshot/src/recipes/recipe.py,sha256=dBz6oXn3wB8NoomgJREVMwKRpSbtapmF5tfapfVZiy
126
126
  moonshot/src/recipes/recipe_arguments.py,sha256=7s0MnyIluBxZqaHY-sJdz5MC1c8iR35Tas4pwKpY7u8,4067
127
127
  moonshot/src/redteaming/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  moonshot/src/redteaming/attack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
- moonshot/src/redteaming/attack/attack_module.py,sha256=3awn1-OgzPDlaezkNTWfd65yuDjcVthOKTOW5_RAZOk,24734
130
- moonshot/src/redteaming/attack/attack_module_arguments.py,sha256=NyXih_LGTavy31k95-UdXK4rJqqlCOfAzPW2XNoLvCo,1216
129
+ moonshot/src/redteaming/attack/attack_module.py,sha256=MFA7102UZ_gS6xGRmYWQfA9H8n5iLe2XlFMtkNFa7fw,24752
130
+ moonshot/src/redteaming/attack/attack_module_arguments.py,sha256=L8H6poNj7xNWLUr6jfuSkwE7TNV0aTPaZBal4OvL7IA,1225
131
131
  moonshot/src/redteaming/attack/context_strategy.py,sha256=JORekUAQ_-2HPLBwErs_QP6uXCPlA_6aWhPh3gXfIYk,4684
132
132
  moonshot/src/redteaming/context_strategy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
133
  moonshot/src/redteaming/context_strategy/context_strategy_interface.py,sha256=AdWEkXBaXE6fmVi3QashI9toWS-Vd-KnAZ0zo8TKSPA,1381
@@ -155,9 +155,9 @@ moonshot/src/storage/storage.py,sha256=ipVboJNMcCDIcYJ6QMXCEFNKxKbrcL5pHROZNDokA
155
155
  moonshot/src/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
156
  moonshot/src/utils/import_modules.py,sha256=T9zTN59PFnvY2rjyWhSV9KSIAHxWV1pyBemF0y-hwtw,2844
157
157
  moonshot/src/utils/timeit.py,sha256=Y-cO1k5tL804Ir0H6dMRz7C5d519XuR222OOfuyhocg,713
158
- aiverify_moonshot-0.4.0.dist-info/METADATA,sha256=rGKZeCdLncArWPOXvmjOcIbz-0qdk6YmtIUP8qptUYk,12307
159
- aiverify_moonshot-0.4.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
160
- aiverify_moonshot-0.4.0.dist-info/licenses/AUTHORS.md,sha256=mmAbe3i3sT8JZHJMBhxp3i1xRehV0g7WB4T_eyIBuBs,59
161
- aiverify_moonshot-0.4.0.dist-info/licenses/LICENSE.md,sha256=mDOKOkWFbJmUORaAchXByEVGC1jw37QRn-zS14wY_wM,11347
162
- aiverify_moonshot-0.4.0.dist-info/licenses/NOTICES.md,sha256=0Ikx6IBGGQEOJeNb2MkRoXxTXwrtlMz6EDgLBFIz6v0,179593
163
- aiverify_moonshot-0.4.0.dist-info/RECORD,,
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.2
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
moonshot/__main__.py CHANGED
@@ -83,6 +83,9 @@ def moonshot_data_installation():
83
83
  # Clone the repository
84
84
  run_subprocess(["git", "clone", repo], check=True)
85
85
 
86
+ # Create .env to point to installed folder
87
+ ms_lib_env_file(folder_name)
88
+
86
89
  # Change directory to the folder
87
90
  os.chdir(folder_name)
88
91
 
@@ -99,8 +102,6 @@ def moonshot_data_installation():
99
102
  # Change back to the base directory
100
103
  os.chdir("..")
101
104
 
102
- # Create .env to point to installed folder
103
- ms_lib_env_file(folder_name)
104
105
  else:
105
106
  print(f"Directory {folder_name} already exists, skipping clone.")
106
107
 
@@ -263,6 +263,9 @@ def run_attack_module(args):
263
263
  context_strategy = args.context_strategy or []
264
264
  prompt_template = [args.prompt_template] if args.prompt_template else []
265
265
  metric = [args.metric] if args.metric else []
266
+ optional_arguments = (
267
+ literal_eval(args.optional_args) if args.optional_args else {}
268
+ )
266
269
  num_of_prev_prompts = (
267
270
  args.num_of_prev_prompts
268
271
  if args.num_of_prev_prompts
@@ -288,6 +291,7 @@ def run_attack_module(args):
288
291
  "context_strategy_info": context_strategy_info,
289
292
  "prompt_template_ids": prompt_template,
290
293
  "metric_ids": metric,
294
+ "optional_params": optional_arguments,
291
295
  }
292
296
  ]
293
297
  runner_args = {}
@@ -407,7 +411,8 @@ automated_rt_session_args = cmd2.Cmd2ArgumentParser(
407
411
  description="Runs automated red teaming in the current session.",
408
412
  epilog=(
409
413
  'Example:\n run_attack_module sample_attack_module "this is my prompt" -s "test system prompt" '
410
- '-c "add_previous_prompt" -p "mmlu" -m "bleuscore"'
414
+ '-c "add_previous_prompt" -p "mmlu" -m "bleuscore" '
415
+ "-o \"{'max_number_of_iteration': 1, 'my_optional_param': 'hello world'}\""
411
416
  ),
412
417
  )
413
418
 
@@ -455,6 +460,13 @@ automated_rt_session_args.add_argument(
455
460
  "-m", "--metric", type=str, help="Name of the metric module to be used.", nargs="?"
456
461
  )
457
462
 
463
+ automated_rt_session_args.add_argument(
464
+ "-o",
465
+ "--optional_args",
466
+ type=str,
467
+ help="Optional parameters to input into the red teaming module.",
468
+ nargs="?",
469
+ )
458
470
 
459
471
  # Delete session arguments
460
472
  delete_session_args = cmd2.Cmd2ArgumentParser(
@@ -71,7 +71,7 @@ def create_app(cfg: providers.Configuration) -> CustomFastAPI:
71
71
 
72
72
  app: CustomFastAPI = CustomFastAPI(
73
73
  title="Project Moonshot",
74
- version="0.4.0",
74
+ version="0.4.1",
75
75
  **app_kwargs
76
76
  )
77
77
 
@@ -40,7 +40,7 @@ class AttackModule:
40
40
  self.db_instance = am_arguments.db_instance
41
41
  self.red_teaming_progress = am_arguments.red_teaming_progress
42
42
  self.cancel_event = am_arguments.cancel_event
43
- self.params = am_arguments.params
43
+ self.optional_params = am_arguments.optional_params
44
44
 
45
45
  @classmethod
46
46
  def load(
@@ -41,4 +41,4 @@ class AttackModuleArguments(BaseModel):
41
41
  cancel_event: asyncio.Event
42
42
 
43
43
  # a dict that contains other params that is required by the attack module (if any)
44
- params: dict = {}
44
+ optional_params: dict = {}