aiverify-moonshot 0.4.10__tar.gz → 0.4.11__tar.gz

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 (207) hide show
  1. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/smoke-test-cli.yaml +5 -5
  2. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/smoke-test.yaml +24 -19
  3. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/PKG-INFO +23 -23
  4. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/README.md +1 -1
  5. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/cookbook.py +7 -6
  6. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/app.py +1 -1
  7. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/bookmark/bookmark.py +12 -5
  8. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/connectors/connector.py +6 -4
  9. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/connectors/connector_prompt_arguments.py +8 -1
  10. aiverify_moonshot-0.4.11/moonshot/src/connectors/connector_response.py +20 -0
  11. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/attack/attack_module.py +34 -7
  12. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runs/run_arguments.py +43 -20
  13. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/pyproject.toml +33 -34
  14. aiverify_moonshot-0.4.11/requirements.txt +58 -0
  15. aiverify_moonshot-0.4.10/requirements.txt +0 -58
  16. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.coveragerc +0 -0
  17. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.flake8 +0 -0
  18. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/pull_request_template.md +0 -0
  19. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/create_backup.sh +0 -0
  20. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/install_ms_service.sh +0 -0
  21. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/moonshot_env +0 -0
  22. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/moonshot_test_env +0 -0
  23. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/moonshot_ui_env +0 -0
  24. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/run_smoke_test.sh +0 -0
  25. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/scripts/start_ms_service.sh +0 -0
  26. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/docs-update.yaml +0 -0
  27. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/gh-event-notification.yaml +0 -0
  28. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/integration-test.yaml +0 -0
  29. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/nightly-build.yaml +0 -0
  30. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/pre-build-checks.yaml +0 -0
  31. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/pypi-deployment.yaml +0 -0
  32. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/sast-codeql.yaml +0 -0
  33. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/sca-scan.yaml +0 -0
  34. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.github/workflows/test-pypi-deployment.yaml +0 -0
  35. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.gitignore +0 -0
  36. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/.pre-commit-config.yaml +0 -0
  37. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/AUTHORS.md +0 -0
  38. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/LICENSE.md +0 -0
  39. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/NOTICES.md +0 -0
  40. {aiverify_moonshot-0.4.10/moonshot/src/utils → aiverify_moonshot-0.4.11/moonshot}/__init__.py +0 -0
  41. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/__main__.py +0 -0
  42. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/api.py +0 -0
  43. {aiverify_moonshot-0.4.10/moonshot/src/storage → aiverify_moonshot-0.4.11/moonshot/integrations}/__init__.py +0 -0
  44. {aiverify_moonshot-0.4.10/moonshot/src/runs → aiverify_moonshot-0.4.11/moonshot/integrations/cli}/__init__.py +0 -0
  45. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/__main__.py +0 -0
  46. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/active_session_cfg.py +0 -0
  47. {aiverify_moonshot-0.4.10/moonshot/src/runners → aiverify_moonshot-0.4.11/moonshot/integrations/cli/benchmark}/__init__.py +0 -0
  48. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/benchmark.py +0 -0
  49. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/datasets.py +0 -0
  50. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/metrics.py +0 -0
  51. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/recipe.py +0 -0
  52. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/result.py +0 -0
  53. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/run.py +0 -0
  54. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/benchmark/runner.py +0 -0
  55. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/cli.py +0 -0
  56. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/cli_errors.py +0 -0
  57. {aiverify_moonshot-0.4.10/moonshot/src/results → aiverify_moonshot-0.4.11/moonshot/integrations/cli/common}/__init__.py +0 -0
  58. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/common/common.py +0 -0
  59. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/common/connectors.py +0 -0
  60. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/common/dataset.py +0 -0
  61. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/common/display_helper.py +0 -0
  62. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/common/prompt_template.py +0 -0
  63. {aiverify_moonshot-0.4.10/moonshot/src/redteaming/session → aiverify_moonshot-0.4.11/moonshot/integrations/cli/initialisation}/__init__.py +0 -0
  64. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/initialisation/initialisation.py +0 -0
  65. {aiverify_moonshot-0.4.10/moonshot/src/redteaming/context_strategy → aiverify_moonshot-0.4.11/moonshot/integrations/cli/redteam}/__init__.py +0 -0
  66. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/redteam/attack_module.py +0 -0
  67. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/redteam/context_strategy.py +0 -0
  68. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/redteam/prompt_template.py +0 -0
  69. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/redteam/redteam.py +0 -0
  70. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/redteam/session.py +0 -0
  71. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/cli/utils/process_data.py +0 -0
  72. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/.env.dev +0 -0
  73. {aiverify_moonshot-0.4.10/moonshot/src/redteaming/attack → aiverify_moonshot-0.4.11/moonshot/integrations/web_api}/__init__.py +0 -0
  74. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/__main__.py +0 -0
  75. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/container.py +0 -0
  76. {aiverify_moonshot-0.4.10/moonshot/integrations/web_api/temp → aiverify_moonshot-0.4.11/moonshot/integrations/web_api/log}/.gitkeep +0 -0
  77. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/logging_conf.py +0 -0
  78. {aiverify_moonshot-0.4.10/moonshot/src/redteaming → aiverify_moonshot-0.4.11/moonshot/integrations/web_api/routes}/__init__.py +0 -0
  79. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/attack_modules.py +0 -0
  80. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/benchmark.py +0 -0
  81. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/benchmark_result.py +0 -0
  82. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/bookmark.py +0 -0
  83. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/context_strategy.py +0 -0
  84. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/cookbook.py +0 -0
  85. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/dataset.py +0 -0
  86. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/endpoint.py +0 -0
  87. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/metric.py +0 -0
  88. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/prompt_template.py +0 -0
  89. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/recipe.py +0 -0
  90. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/redteam.py +0 -0
  91. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/routes/runner.py +0 -0
  92. {aiverify_moonshot-0.4.10/moonshot/src/recipes → aiverify_moonshot-0.4.11/moonshot/integrations/web_api/schemas}/__init__.py +0 -0
  93. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/benchmark_runner_dto.py +0 -0
  94. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/bookmark_create_dto.py +0 -0
  95. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/cookbook_create_dto.py +0 -0
  96. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/cookbook_response_model.py +0 -0
  97. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/dataset_create_dto.py +0 -0
  98. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/dataset_response_dto.py +0 -0
  99. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/endpoint_create_dto.py +0 -0
  100. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/endpoint_response_model.py +0 -0
  101. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/prompt_response_model.py +0 -0
  102. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/prompt_template_response_model.py +0 -0
  103. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/recipe_create_dto.py +0 -0
  104. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/recipe_response_model.py +0 -0
  105. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/session_create_dto.py +0 -0
  106. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/session_prompt_dto.py +0 -0
  107. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/schemas/session_response_model.py +0 -0
  108. {aiverify_moonshot-0.4.10/moonshot/src/prompt_templates → aiverify_moonshot-0.4.11/moonshot/integrations/web_api/services}/__init__.py +0 -0
  109. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/attack_module_service.py +0 -0
  110. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/auto_red_team_test_manager.py +0 -0
  111. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/auto_red_team_test_state.py +0 -0
  112. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/base_service.py +0 -0
  113. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/benchmark_result_service.py +0 -0
  114. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/benchmark_test_manager.py +0 -0
  115. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/benchmark_test_state.py +0 -0
  116. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/benchmarking_service.py +0 -0
  117. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/bookmark_service.py +0 -0
  118. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/context_strategy_service.py +0 -0
  119. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/cookbook_service.py +0 -0
  120. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/dataset_service.py +0 -0
  121. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/endpoint_service.py +0 -0
  122. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/metric_service.py +0 -0
  123. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/prompt_template_service.py +0 -0
  124. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/recipe_service.py +0 -0
  125. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/runner_service.py +0 -0
  126. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/session_service.py +0 -0
  127. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/utils/exceptions_handler.py +0 -0
  128. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/utils/file_manager.py +0 -0
  129. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/services/utils/results_formatter.py +0 -0
  130. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/status_updater/interface/benchmark_progress_callback.py +0 -0
  131. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback.py +0 -0
  132. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py +0 -0
  133. {aiverify_moonshot-0.4.10/moonshot/integrations/web_api/log → aiverify_moonshot-0.4.11/moonshot/integrations/web_api/temp}/.gitkeep +0 -0
  134. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/integrations/web_api/types/types.py +0 -0
  135. {aiverify_moonshot-0.4.10/moonshot/src/metrics → aiverify_moonshot-0.4.11/moonshot/src}/__init__.py +0 -0
  136. {aiverify_moonshot-0.4.10/moonshot/src/datasets → aiverify_moonshot-0.4.11/moonshot/src/api}/__init__.py +0 -0
  137. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_bookmark.py +0 -0
  138. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_connector.py +0 -0
  139. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_connector_endpoint.py +0 -0
  140. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_context_strategy.py +0 -0
  141. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_cookbook.py +0 -0
  142. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_dataset.py +0 -0
  143. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_environment_variables.py +0 -0
  144. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_metrics.py +0 -0
  145. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_prompt_template.py +0 -0
  146. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_recipe.py +0 -0
  147. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_red_teaming.py +0 -0
  148. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_result.py +0 -0
  149. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_run.py +0 -0
  150. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_runner.py +0 -0
  151. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/api/api_session.py +0 -0
  152. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/bookmark/bookmark_arguments.py +0 -0
  153. {aiverify_moonshot-0.4.10/moonshot/src/cookbooks → aiverify_moonshot-0.4.11/moonshot/src/configs}/__init__.py +0 -0
  154. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/configs/env_variables.py +0 -0
  155. {aiverify_moonshot-0.4.10/moonshot/src/connectors_endpoints → aiverify_moonshot-0.4.11/moonshot/src/connectors}/__init__.py +0 -0
  156. {aiverify_moonshot-0.4.10/moonshot/src/connectors → aiverify_moonshot-0.4.11/moonshot/src/connectors_endpoints}/__init__.py +0 -0
  157. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/connectors_endpoints/connector_endpoint.py +0 -0
  158. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/connectors_endpoints/connector_endpoint_arguments.py +0 -0
  159. {aiverify_moonshot-0.4.10/moonshot/src/configs → aiverify_moonshot-0.4.11/moonshot/src/cookbooks}/__init__.py +0 -0
  160. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/cookbooks/cookbook.py +0 -0
  161. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/cookbooks/cookbook_arguments.py +0 -0
  162. {aiverify_moonshot-0.4.10/moonshot/src/api → aiverify_moonshot-0.4.11/moonshot/src/datasets}/__init__.py +0 -0
  163. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/datasets/dataset.py +0 -0
  164. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/datasets/dataset_arguments.py +0 -0
  165. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/messages_constants.py +0 -0
  166. {aiverify_moonshot-0.4.10/moonshot/src → aiverify_moonshot-0.4.11/moonshot/src/metrics}/__init__.py +0 -0
  167. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/metrics/metric.py +0 -0
  168. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/metrics/metric_interface.py +0 -0
  169. {aiverify_moonshot-0.4.10/moonshot/integrations/web_api/services → aiverify_moonshot-0.4.11/moonshot/src/prompt_templates}/__init__.py +0 -0
  170. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/prompt_templates/prompt_template.py +0 -0
  171. {aiverify_moonshot-0.4.10/moonshot/integrations/web_api/schemas → aiverify_moonshot-0.4.11/moonshot/src/recipes}/__init__.py +0 -0
  172. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/recipes/recipe.py +0 -0
  173. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/recipes/recipe_arguments.py +0 -0
  174. {aiverify_moonshot-0.4.10/moonshot/integrations/web_api/routes → aiverify_moonshot-0.4.11/moonshot/src/redteaming}/__init__.py +0 -0
  175. {aiverify_moonshot-0.4.10/moonshot/integrations/web_api → aiverify_moonshot-0.4.11/moonshot/src/redteaming/attack}/__init__.py +0 -0
  176. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/attack/attack_module_arguments.py +0 -0
  177. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/attack/context_strategy.py +0 -0
  178. {aiverify_moonshot-0.4.10/moonshot/integrations/cli/redteam → aiverify_moonshot-0.4.11/moonshot/src/redteaming/context_strategy}/__init__.py +0 -0
  179. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/context_strategy/context_strategy_interface.py +0 -0
  180. {aiverify_moonshot-0.4.10/moonshot/integrations/cli/initialisation → aiverify_moonshot-0.4.11/moonshot/src/redteaming/session}/__init__.py +0 -0
  181. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/session/chat.py +0 -0
  182. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/session/red_teaming_progress.py +0 -0
  183. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/session/red_teaming_type.py +0 -0
  184. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/redteaming/session/session.py +0 -0
  185. {aiverify_moonshot-0.4.10/moonshot/integrations/cli/common → aiverify_moonshot-0.4.11/moonshot/src/results}/__init__.py +0 -0
  186. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/results/result.py +0 -0
  187. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/results/result_arguments.py +0 -0
  188. {aiverify_moonshot-0.4.10/moonshot/integrations/cli/benchmark → aiverify_moonshot-0.4.11/moonshot/src/runners}/__init__.py +0 -0
  189. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runners/runner.py +0 -0
  190. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runners/runner_arguments.py +0 -0
  191. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runners/runner_type.py +0 -0
  192. {aiverify_moonshot-0.4.10/moonshot/integrations/cli → aiverify_moonshot-0.4.11/moonshot/src/runs}/__init__.py +0 -0
  193. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runs/run.py +0 -0
  194. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runs/run_progress.py +0 -0
  195. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/runs/run_status.py +0 -0
  196. {aiverify_moonshot-0.4.10/moonshot/integrations → aiverify_moonshot-0.4.11/moonshot/src/storage}/__init__.py +0 -0
  197. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/storage/db_interface.py +0 -0
  198. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/storage/io_interface.py +0 -0
  199. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/storage/storage.py +0 -0
  200. {aiverify_moonshot-0.4.10/moonshot → aiverify_moonshot-0.4.11/moonshot/src/utils}/__init__.py +0 -0
  201. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/utils/find_feature.py +0 -0
  202. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/utils/import_modules.py +0 -0
  203. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/utils/log.py +0 -0
  204. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/utils/pagination.py +0 -0
  205. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/moonshot/src/utils/timeit.py +0 -0
  206. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/third-party/pygments-2.18.0-py3-none-any.whl +0 -0
  207. {aiverify_moonshot-0.4.10 → aiverify_moonshot-0.4.11}/third-party/text_unidecode-1.3-py2.py3-none-any.whl +0 -0
@@ -4,10 +4,10 @@ name: Moonshot CLI Smoke Test
4
4
 
5
5
  on:
6
6
  # Runs on Pull Request Review
7
- pull_request_review:
8
- types: [submitted]
9
- branches:
10
- - 'dev_main'
7
+ pull_request:
8
+ types: [ assigned, synchronize ]
9
+ branches:
10
+ - 'dev_main'
11
11
 
12
12
  # Run this workflow manually from Actions tab
13
13
  workflow_dispatch:
@@ -35,7 +35,7 @@ concurrency:
35
35
 
36
36
  jobs:
37
37
  smoke-test:
38
-
38
+ if: (github.event_name == 'pull_request' && github.event.pull_request.assignee != null) || github.event_name == 'workflow_dispatch'
39
39
  runs-on: ubuntu-latest
40
40
  timeout-minutes: 20
41
41
 
@@ -3,11 +3,11 @@
3
3
  name: Moonshot Smoke Test
4
4
 
5
5
  on:
6
- # Runs on Pull Request Review
7
- pull_request_review:
8
- types: [submitted]
6
+ # Runs when a pull request to main is being assigned
7
+ pull_request:
8
+ types: [ assigned, synchronize ]
9
9
  branches:
10
- - 'dev_main'
10
+ - 'dev_main'
11
11
 
12
12
  # Run this workflow manually from Actions tab
13
13
  workflow_dispatch:
@@ -35,14 +35,13 @@ concurrency:
35
35
 
36
36
  jobs:
37
37
  smoke-test:
38
- if: (github.event_name == 'pull_request_review' && github.event.pull_request.base.ref == 'dev_main') || github.event_name == 'workflow_dispatch'
38
+ if: (github.event_name == 'pull_request' && github.event.pull_request.assignee != null) || github.event_name == 'workflow_dispatch'
39
39
  runs-on: ubuntu-latest
40
40
  timeout-minutes: 60
41
-
41
+
42
42
  steps:
43
-
44
- - name: Checkout Moonshot (Pull Request Review)
45
- if: github.event_name == 'pull_request_review'
43
+ - name: Checkout Moonshot (Pull Request)
44
+ if: github.event_name == 'pull_request'
46
45
  uses: actions/checkout@v4
47
46
  with:
48
47
  repository: ${{ github.event.pull_request.head.repo.full_name }}
@@ -67,9 +66,8 @@ jobs:
67
66
  pip install -r requirements.txt
68
67
  touch .env
69
68
  echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
70
-
71
69
  - name: Checkout Moonshot Data (Pull Request Review)
72
- if: github.event_name == 'pull_request_review'
70
+ if: github.event_name == 'pull_request'
73
71
  uses: actions/checkout@v4
74
72
  with:
75
73
  repository: aiverify-foundation/moonshot-data
@@ -89,9 +87,8 @@ jobs:
89
87
  source venv/bin/activate
90
88
  cd moonshot-data
91
89
  pip install -r requirements.txt
92
-
93
90
  - name: Checkout Moonshot UI (Pull Request Review)
94
- if: github.event_name == 'pull_request_review'
91
+ if: github.event_name == 'pull_request'
95
92
  uses: actions/checkout@v4
96
93
  with:
97
94
  repository: aiverify-foundation/moonshot-ui
@@ -105,16 +102,22 @@ jobs:
105
102
  repository: aiverify-foundation/moonshot-ui
106
103
  ref: ${{ inputs.moonshot_ui_branch }}
107
104
  path: moonshot-ui
108
-
105
+
106
+ # Download NLTK stopwords
107
+ - name: Download NLTK stopwords
108
+ run: |
109
+ source venv/bin/activate
110
+ pip install nltk
111
+ python -c "import nltk; nltk.download('stopwords')"
112
+
109
113
  - name: Setup Moonshot UI
110
114
  run: |
111
115
  cd moonshot-ui
112
- npm ci
116
+ npm install
113
117
  npm run build
114
118
  cd ../
115
119
  source venv/bin/activate
116
120
  python -m moonshot web &
117
-
118
121
  - name: Checkout Smoke Test
119
122
  uses: actions/checkout@v4
120
123
  with:
@@ -129,7 +132,9 @@ jobs:
129
132
  MOONSHOT_URL: ${{ secrets.MOONSHOT_URL }}
130
133
  MOONSHOT_PORT_NUMBER: ${{ secrets.MOONSHOT_PORT_NUMBER }}
131
134
  run: |
135
+ source venv/bin/activate
132
136
  cd moonshot-smoke-testing
133
- npm ci
134
- npx playwright install --with-deps
135
- AZURE_OPENAI_URI="$AZURE_OPENAI_URI" AZURE_OPENAI_TOKEN="$AZURE_OPENAI_TOKEN" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" MOONSHOT_URL="$MOONSHOT_URL" MOONSHOT_PORT_NUMBER="$MOONSHOT_PORT_NUMBER" npx playwright test tests/smoke-test.spec.ts
137
+ npm install --global yarn
138
+ yarn add playwright
139
+ yarn playwright install --with-deps
140
+ AZURE_OPENAI_URI="$AZURE_OPENAI_URI" AZURE_OPENAI_TOKEN="$AZURE_OPENAI_TOKEN" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" MOONSHOT_URL="$MOONSHOT_URL" MOONSHOT_PORT_NUMBER="$MOONSHOT_PORT_NUMBER" DEBUG=pw:api npx playwright test tests/smoke-test.spec.ts
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aiverify-moonshot
3
- Version: 0.4.10
3
+ Version: 0.4.11
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,38 +15,38 @@ 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
19
- Requires-Dist: ijson==3.3.0
20
- Requires-Dist: jinja2==3.1.4
21
- Requires-Dist: numpy==1.26.4
22
- Requires-Dist: pandas==2.2.2
18
+ Requires-Dist: datasets>=2.21.0
19
+ Requires-Dist: ijson>=3.3.0
20
+ Requires-Dist: jinja2>=3.1.4
21
+ Requires-Dist: numpy>=1.26.4
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
26
- Requires-Dist: python-slugify==8.0.4
27
- Requires-Dist: xxhash==3.5.0
24
+ Requires-Dist: pyparsing>=3.1.4
25
+ Requires-Dist: python-dotenv>=1.0.1
26
+ Requires-Dist: python-slugify>=8.0.4
27
+ Requires-Dist: xxhash>=3.5.0
28
28
  Provides-Extra: all
29
- Requires-Dist: cmd2==2.4.3; extra == 'all'
30
- Requires-Dist: dependency-injector==4.41.0; extra == 'all'
31
- Requires-Dist: fastapi==0.112.2; extra == 'all'
32
- Requires-Dist: rich==13.8.0; extra == 'all'
33
- Requires-Dist: typing-extensions==4.12.2; extra == 'all'
34
- Requires-Dist: uvicorn==0.30.6; extra == 'all'
29
+ Requires-Dist: cmd2>=2.4.3; extra == 'all'
30
+ Requires-Dist: dependency-injector>=4.41.0; extra == 'all'
31
+ Requires-Dist: fastapi>=0.112.2; extra == 'all'
32
+ Requires-Dist: rich>=13.8.0; extra == 'all'
33
+ Requires-Dist: typing-extensions>=4.12.2; extra == 'all'
34
+ Requires-Dist: uvicorn>=0.30.6; extra == 'all'
35
35
  Provides-Extra: cli
36
- Requires-Dist: cmd2==2.4.3; extra == 'cli'
37
- Requires-Dist: rich==13.8.0; extra == 'cli'
36
+ Requires-Dist: cmd2>=2.4.3; extra == 'cli'
37
+ Requires-Dist: rich>=13.8.0; extra == 'cli'
38
38
  Provides-Extra: web-api
39
- Requires-Dist: dependency-injector==4.41.0; extra == 'web-api'
40
- Requires-Dist: fastapi==0.112.2; extra == 'web-api'
41
- Requires-Dist: typing-extensions==4.12.2; extra == 'web-api'
42
- Requires-Dist: uvicorn==0.30.6; extra == 'web-api'
39
+ Requires-Dist: dependency-injector>=4.41.0; extra == 'web-api'
40
+ Requires-Dist: fastapi>=0.112.2; extra == 'web-api'
41
+ Requires-Dist: typing-extensions>=4.12.2; extra == 'web-api'
42
+ Requires-Dist: uvicorn>=0.30.6; extra == 'web-api'
43
43
  Description-Content-Type: text/markdown
44
44
 
45
45
  <div align="center">
46
46
 
47
47
  ![Moonshot Logo](https://github.com/aiverify-foundation/moonshot/raw/main/misc/aiverify-moonshot-logo.png)
48
48
 
49
- **Version 0.4.10**
49
+ **Version 0.4.11**
50
50
 
51
51
  A simple and modular tool to evaluate any LLM application.
52
52
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![Moonshot Logo](https://github.com/aiverify-foundation/moonshot/raw/main/misc/aiverify-moonshot-logo.png)
4
4
 
5
- **Version 0.4.10**
5
+ **Version 0.4.11**
6
6
 
7
7
  A simple and modular tool to evaluate any LLM application.
8
8
 
@@ -467,7 +467,10 @@ def _display_view_cookbook(cookbook_info):
467
467
  recipes_list = api_read_recipes(recipes)
468
468
  if recipes_list:
469
469
  table = Table(
470
- title="View Cookbook", show_lines=True, expand=True, header_style="bold"
470
+ title=f'Cookbook "{name}"',
471
+ show_lines=True,
472
+ expand=True,
473
+ header_style="bold",
471
474
  )
472
475
  table.add_column("No.", width=2)
473
476
  table.add_column("Recipe", justify="left", width=78)
@@ -482,7 +485,6 @@ def _display_view_cookbook(cookbook_info):
482
485
  datasets,
483
486
  prompt_templates,
484
487
  metrics,
485
- attack_strategies,
486
488
  grading_scale,
487
489
  stats,
488
490
  ) = recipe.values()
@@ -494,9 +496,6 @@ def _display_view_cookbook(cookbook_info):
494
496
  "Prompt Templates", prompt_templates
495
497
  )
496
498
  metrics_info = display_view_list_format("Metrics", metrics)
497
- attack_strategies_info = display_view_list_format(
498
- "Attack Strategies", attack_strategies
499
- )
500
499
  grading_scale_info = _display_view_grading_scale_format(
501
500
  "Grading Scale", grading_scale
502
501
  )
@@ -506,7 +505,9 @@ def _display_view_cookbook(cookbook_info):
506
505
  f"[red]id: {id}[/red]\n\n[blue]{name}[/blue]\n{description}\n\n"
507
506
  f"{tags_info}\n\n{categories_info}\n\n{grading_scale_info}\n\n{stats_info}"
508
507
  )
509
- contains_info = f"{datasets_info}\n\n{prompt_templates_info}\n\n{metrics_info}\n\n{attack_strategies_info}"
508
+ contains_info = (
509
+ f"{datasets_info}\n\n{prompt_templates_info}\n\n{metrics_info}"
510
+ )
510
511
 
511
512
  table.add_section()
512
513
  table.add_row(str(recipe_id), recipe_info, contains_info)
@@ -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.4.10", **app_kwargs
74
+ title="Project Moonshot", version="0.4.11", **app_kwargs
75
75
  )
76
76
 
77
77
  if cfg.cors.enabled():
@@ -11,9 +11,9 @@ from moonshot.src.messages_constants import (
11
11
  BOOKMARK_ADD_BOOKMARK_VALIDATION_ERROR,
12
12
  BOOKMARK_DELETE_ALL_BOOKMARK_ERROR,
13
13
  BOOKMARK_DELETE_ALL_BOOKMARK_SUCCESS,
14
- BOOKMARK_DELETE_BOOKMARK_FAIL,
15
14
  BOOKMARK_DELETE_BOOKMARK_ERROR,
16
15
  BOOKMARK_DELETE_BOOKMARK_ERROR_1,
16
+ BOOKMARK_DELETE_BOOKMARK_FAIL,
17
17
  BOOKMARK_DELETE_BOOKMARK_SUCCESS,
18
18
  BOOKMARK_EXPORT_BOOKMARK_ERROR,
19
19
  BOOKMARK_EXPORT_BOOKMARK_VALIDATION_ERROR,
@@ -186,7 +186,9 @@ class Bookmark:
186
186
  if (
187
187
  bookmark_info is not None
188
188
  and isinstance(bookmark_info, tuple)
189
- and all(isinstance(item, str) for item in bookmark_info)
189
+ and all(
190
+ isinstance(item, str) for item in bookmark_info[1:]
191
+ ) # Check if the rest are strings besides id
190
192
  ):
191
193
  return BookmarkArguments.from_tuple_to_dict(bookmark_info)
192
194
  else:
@@ -210,9 +212,11 @@ class Bookmark:
210
212
  """
211
213
  if isinstance(bookmark_name, str) and bookmark_name:
212
214
  try:
213
-
214
215
  bookmark_info = Storage.read_database_record(
215
- self.db_instance, (bookmark_name,), Bookmark.sql_select_bookmark_record)
216
+ self.db_instance,
217
+ (bookmark_name,),
218
+ Bookmark.sql_select_bookmark_record,
219
+ )
216
220
  if bookmark_info is not None:
217
221
  sql_delete_bookmark_record = textwrap.dedent(
218
222
  f"""
@@ -222,7 +226,10 @@ class Bookmark:
222
226
  Storage.delete_database_record_in_table(
223
227
  self.db_instance, sql_delete_bookmark_record
224
228
  )
225
- return {"success": True, "message": BOOKMARK_DELETE_BOOKMARK_SUCCESS}
229
+ return {
230
+ "success": True,
231
+ "message": BOOKMARK_DELETE_BOOKMARK_SUCCESS,
232
+ }
226
233
  else:
227
234
  return {"success": False, "message": BOOKMARK_DELETE_BOOKMARK_FAIL}
228
235
  except Exception as e:
@@ -10,6 +10,7 @@ from typing import Callable
10
10
 
11
11
  from moonshot.src.configs.env_variables import EnvVariables
12
12
  from moonshot.src.connectors.connector_prompt_arguments import ConnectorPromptArguments
13
+ from moonshot.src.connectors.connector_response import ConnectorResponse
13
14
  from moonshot.src.connectors_endpoints.connector_endpoint_arguments import (
14
15
  ConnectorEndpointArguments,
15
16
  )
@@ -168,9 +169,9 @@ class Connector:
168
169
  return wrapper
169
170
 
170
171
  @abstractmethod
171
- async def get_response(self, prompt: str) -> str:
172
+ async def get_response(self, prompt: str) -> ConnectorResponse:
172
173
  """
173
- Abstract method to be implemented by subclasses to get a response from the connector.
174
+ Abstract method to be implemented by subclasses to obtain a response from the connector.
174
175
 
175
176
  This method should asynchronously send a prompt to the connector's API and return the response.
176
177
 
@@ -178,7 +179,8 @@ class Connector:
178
179
  prompt (str): The input prompt to be sent to the connector.
179
180
 
180
181
  Returns:
181
- str: The response received from the connector.
182
+ ConnectorResponse: An instance containing the response received from the connector and any
183
+ additional metadata.
182
184
  """
183
185
  pass
184
186
 
@@ -277,7 +279,7 @@ class Connector:
277
279
  object, which is used to generate the prediction. The method also optionally takes a `prompt_callback` function,
278
280
  which is called after the prediction is generated.
279
281
 
280
- The method first prints a message indicating that it is predicting the prompt. It then records the start time
282
+ The method logs a message indicating that it is predicting the prompt. It then records the start time
281
283
  and uses the `connector` to generate a prediction for the `generated_prompt`. The duration of the prediction
282
284
  is calculated and stored in the `generated_prompt`.
283
285
 
@@ -4,14 +4,21 @@ from typing import Any
4
4
 
5
5
  from pydantic import BaseModel
6
6
 
7
+ from moonshot.src.connectors.connector_response import ConnectorResponse
8
+
7
9
 
8
10
  class ConnectorPromptArguments(BaseModel):
11
+ class Config:
12
+ arbitrary_types_allowed = True
13
+
9
14
  prompt_index: int # The index of the prompt in the dataset
10
15
 
11
16
  prompt: str # The actual prompt text
12
17
 
13
18
  target: Any # The target response for the prompt
14
19
 
15
- predicted_results: Any = "" # The predicted results, default is an empty string
20
+ predicted_results: ConnectorResponse | None = (
21
+ None # The predicted results, default is None
22
+ )
16
23
 
17
24
  duration: float = 0.0 # The duration it took to get the results, default is 0.0
@@ -0,0 +1,20 @@
1
+ class ConnectorResponse:
2
+ def __init__(self, response: str, context: list = []):
3
+ """
4
+ Initializes a ConnectorResponse instance.
5
+
6
+ Args:
7
+ response (str): The response text from the connector.
8
+ context (list, optional): Additional context or metadata related to the response. Defaults to an empty list.
9
+ """
10
+ self.response = response
11
+ self.context = context
12
+
13
+ def to_dict(self) -> dict:
14
+ """
15
+ Converts the ConnectorResponse instance to a dictionary.
16
+
17
+ Returns:
18
+ dict: A dictionary representation of the ConnectorResponse instance.
19
+ """
20
+ return {"response": self.response, "context": self.context}
@@ -31,6 +31,22 @@ class AttackModule:
31
31
  INSERT INTO {} (connection_id,context_strategy,prompt_template,attack_module,
32
32
  metric,prompt,prepared_prompt,system_prompt,predicted_result,duration,prompt_time)VALUES(?,?,?,?,?,?,?,?,?,?,?)
33
33
  """
34
+ sql_create_chat_history_table = """
35
+ CREATE TABLE IF NOT EXISTS {} (
36
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
37
+ connection_id text NOT NULL,
38
+ context_strategy text,
39
+ prompt_template text,
40
+ attack_module text,
41
+ metric text,
42
+ prompt text NOT NULL,
43
+ prepared_prompt text NOT NULL,
44
+ system_prompt text,
45
+ predicted_result text NOT NULL,
46
+ duration text NOT NULL,
47
+ prompt_time text NOT NULL
48
+ );
49
+ """
34
50
 
35
51
  def __init__(self, am_id: str, am_arguments: AttackModuleArguments | None = None):
36
52
  self.id = am_id
@@ -261,6 +277,15 @@ class AttackModule:
261
277
  list: A list of consolidated responses from the specified LLM connector.
262
278
  """
263
279
  consolidated_responses = []
280
+
281
+ # perform a check to see if the target endpoint has its table in the db. if not, create one
282
+ endpoint_id = target_llm_connector.id.replace("-", "_")
283
+ if not Storage.check_database_table_exists(self.db_instance, endpoint_id):
284
+ Storage.create_database_table(
285
+ self.db_instance,
286
+ AttackModule.sql_create_chat_history_table.format(endpoint_id),
287
+ )
288
+
264
289
  for prepared_prompt in list_of_prompts:
265
290
  if self.cancel_event.is_set():
266
291
  logger.warning(
@@ -316,6 +341,7 @@ class AttackModule:
316
341
  chat_record_tuple (tuple): A tuple containing the chat record information.
317
342
  chat_record_id (str): The ID of the chat record.
318
343
  """
344
+
319
345
  endpoint_id = chat_record_id.replace("-", "_")
320
346
  Storage.create_database_record(
321
347
  self.db_instance,
@@ -623,7 +649,8 @@ class RedTeamingPromptArguments(BaseModel):
623
649
 
624
650
  This method collects all the attributes of the RedTeamingPromptArguments instance and forms a tuple
625
651
  with the attribute values in this specific order: conn_id, cs_id, pt_id, am_id, me_id, original_prompt,
626
- connector_prompt.prompt, connector_prompt.predicted_results, connector_prompt.duration, start_time.
652
+ connector_prompt.prompt, system_prompt, connector_prompt.predicted_results.response,
653
+ connector_prompt.duration, start_time.
627
654
 
628
655
  Returns:
629
656
  tuple: A tuple representation of the RedTeamingPromptArguments instance.
@@ -637,21 +664,21 @@ class RedTeamingPromptArguments(BaseModel):
637
664
  self.original_prompt,
638
665
  self.connector_prompt.prompt,
639
666
  self.system_prompt,
640
- str(self.connector_prompt.predicted_results),
667
+ self.connector_prompt.predicted_results.response if self.connector_prompt.predicted_results else "",
641
668
  str(self.connector_prompt.duration),
642
669
  self.start_time,
643
670
  )
644
671
 
645
672
  def to_dict(self) -> dict:
646
673
  """
647
- Converts the RedTeamingPromptArguments instance into a dict.
674
+ Converts the RedTeamingPromptArguments instance into a dictionary.
648
675
 
649
- This method collects all the attributes of the RedTeamingPromptArguments instance and forms a dict
650
- with the keys: conn_id, cs_id, pt_id, am_id, me_id, original_prompt, prepared_prompt, system_prompt
676
+ This method collects all the attributes of the RedTeamingPromptArguments instance and forms a dictionary
677
+ with the keys: conn_id, cs_id, pt_id, am_id, me_id, original_prompt, system_prompt, prepared_prompt,
651
678
  response, duration, start_time.
652
679
 
653
680
  Returns:
654
- dict: A dict representation of the RedTeamingPromptArguments instance.
681
+ dict: A dictionary representation of the RedTeamingPromptArguments instance.
655
682
  """
656
683
  return {
657
684
  "conn_id": self.conn_id,
@@ -662,7 +689,7 @@ class RedTeamingPromptArguments(BaseModel):
662
689
  "original_prompt": self.original_prompt,
663
690
  "prepared_prompt": self.connector_prompt.prompt,
664
691
  "system_prompt": self.system_prompt,
665
- "response": str(self.connector_prompt.predicted_results),
692
+ "response": self.connector_prompt.predicted_results.response if self.connector_prompt.predicted_results else "",
666
693
  "duration": str(self.connector_prompt.duration),
667
694
  "start_time": self.start_time,
668
695
  }
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import ast
4
+ import json
4
5
 
5
6
  from pydantic import BaseModel
6
7
 
@@ -83,20 +84,7 @@ class RunArguments(BaseModel):
83
84
  Returns:
84
85
  tuple: A tuple containing the run arguments ready for database insertion.
85
86
  """
86
- return (
87
- self.runner_id,
88
- self.runner_type.name.lower(),
89
- str(self.runner_args),
90
- str(self.endpoints),
91
- self.results_file,
92
- self.start_time,
93
- self.end_time,
94
- self.duration,
95
- str(self.error_messages),
96
- str(self.raw_results),
97
- str(self.results),
98
- self.status.name.lower(),
99
- )
87
+ return self._to_tuple(include_run_id=False)
100
88
 
101
89
  def to_tuple(self) -> tuple:
102
90
  """
@@ -112,7 +100,42 @@ class RunArguments(BaseModel):
112
100
  Returns:
113
101
  tuple: A tuple containing the serialized attributes of the RunArguments instance.
114
102
  """
115
- return (
103
+ return self._to_tuple(include_run_id=True)
104
+
105
+ def _to_tuple(self, include_run_id: bool) -> tuple:
106
+ """
107
+ Converts the RunArguments object to a tuple format.
108
+
109
+ This method serializes the RunArguments instance into a tuple, including or excluding the run_id based on the
110
+ include_run_id parameter. It ensures that all dictionary keys are converted to strings and JSON-encodes
111
+ the raw_results and results attributes.
112
+
113
+ Args:
114
+ include_run_id (bool): A flag indicating whether to include the run_id in the resulting tuple.
115
+
116
+ Returns:
117
+ tuple: A tuple containing the serialized attributes of the RunArguments instance.
118
+ """
119
+
120
+ def convert_keys_to_str(d):
121
+ """
122
+ Recursively converts all keys in a dictionary to strings.
123
+
124
+ Args:
125
+ d (dict): The dictionary whose keys need to be converted.
126
+
127
+ Returns:
128
+ dict: A new dictionary with all keys converted to strings.
129
+ """
130
+
131
+ def convert_value(v):
132
+ if isinstance(v, dict):
133
+ return {str(k): convert_value(val) for k, val in v.items()}
134
+ return v
135
+
136
+ return {str(k): convert_value(v) for k, v in d.items()}
137
+
138
+ base_tuple = (
116
139
  self.runner_id,
117
140
  self.runner_type.name.lower(),
118
141
  str(self.runner_args),
@@ -122,11 +145,11 @@ class RunArguments(BaseModel):
122
145
  self.end_time,
123
146
  self.duration,
124
147
  str(self.error_messages),
125
- str(self.raw_results),
126
- str(self.results),
148
+ json.dumps(convert_keys_to_str(self.raw_results)),
149
+ json.dumps(self.results),
127
150
  self.status.name.lower(),
128
- self.run_id,
129
151
  )
152
+ return base_tuple + (self.run_id,) if include_run_id else base_tuple
130
153
 
131
154
  @classmethod
132
155
  def from_tuple(cls, run_record: tuple) -> RunArguments:
@@ -156,7 +179,7 @@ class RunArguments(BaseModel):
156
179
  end_time=float(run_record[7]),
157
180
  duration=run_record[8],
158
181
  error_messages=ast.literal_eval(run_record[9]),
159
- raw_results=ast.literal_eval(run_record[10]),
160
- results=ast.literal_eval(run_record[11]),
182
+ raw_results=json.loads(run_record[10]),
183
+ results=json.loads(run_record[11]),
161
184
  status=RunStatus(run_record[12]),
162
185
  )