aiverify-moonshot 0.4.0__tar.gz → 0.4.2__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.
- aiverify_moonshot-0.4.2/.github/pull_request_template.md +88 -0
- aiverify_moonshot-0.4.2/.github/workflows/sca_scan.yaml +64 -0
- aiverify_moonshot-0.4.2/.github/workflows/smoke-test.yaml +127 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/.pre-commit-config.yaml +5 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/PKG-INFO +2 -2
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/README.md +1 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/__main__.py +79 -36
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/api.py +14 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/benchmark.py +29 -13
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/cookbook.py +36 -6
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/datasets.py +33 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/metrics.py +33 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/recipe.py +36 -6
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/result.py +33 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/run.py +34 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/common/common.py +12 -6
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/common/connectors.py +73 -9
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/common/prompt_template.py +38 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/redteam/attack_module.py +75 -24
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/redteam/context_strategy.py +77 -23
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/redteam/prompt_template.py +1 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/redteam/redteam.py +52 -6
- aiverify_moonshot-0.4.2/moonshot/integrations/cli/redteam/session.py +975 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/__main__.py +2 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/app.py +6 -6
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/container.py +12 -2
- aiverify_moonshot-0.4.2/moonshot/integrations/web_api/routes/bookmark.py +173 -0
- aiverify_moonshot-0.4.2/moonshot/integrations/web_api/schemas/bookmark_create_dto.py +13 -0
- aiverify_moonshot-0.4.2/moonshot/integrations/web_api/services/bookmark_service.py +90 -0
- aiverify_moonshot-0.4.2/moonshot/integrations/web_api/services/utils/file_manager.py +52 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py +0 -1
- aiverify_moonshot-0.4.2/moonshot/src/api/api_bookmark.py +95 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_connector_endpoint.py +1 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_context_strategy.py +2 -2
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_session.py +1 -1
- aiverify_moonshot-0.4.2/moonshot/src/bookmark/bookmark.py +257 -0
- aiverify_moonshot-0.4.2/moonshot/src/bookmark/bookmark_arguments.py +38 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/configs/env_variables.py +12 -2
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/connectors/connector.py +15 -7
- aiverify_moonshot-0.4.2/moonshot/src/connectors_endpoints/connector_endpoint.py +227 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/cookbooks/cookbook.py +57 -37
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/datasets/dataset.py +9 -5
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/metrics/metric.py +8 -4
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/metrics/metric_interface.py +8 -2
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/prompt_templates/prompt_template.py +5 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/recipes/recipe.py +38 -25
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/attack/attack_module.py +19 -9
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/attack/attack_module_arguments.py +1 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/attack/context_strategy.py +6 -2
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/session/session.py +15 -11
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/results/result.py +7 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runners/runner.py +65 -42
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runs/run.py +15 -11
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runs/run_progress.py +7 -3
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/storage/db_interface.py +14 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/storage/storage.py +33 -2
- aiverify_moonshot-0.4.2/moonshot/src/utils/__init__.py +0 -0
- aiverify_moonshot-0.4.2/moonshot/src/utils/find_feature.py +45 -0
- aiverify_moonshot-0.4.2/moonshot/src/utils/log.py +66 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/utils/timeit.py +8 -1
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/pyproject.toml +2 -2
- aiverify_moonshot-0.4.0/.github/workflows/test_api.yaml +0 -44
- aiverify_moonshot-0.4.0/moonshot/integrations/cli/redteam/session.py +0 -467
- aiverify_moonshot-0.4.0/moonshot/src/connectors_endpoints/connector_endpoint.py +0 -211
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/.coveragerc +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/.flake8 +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/.gitignore +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/AUTHORS.md +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/LICENSE.md +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/NOTICES.md +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/__main__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/active_session_cfg.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/runner.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/cli.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/common/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/common/display_helper.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/initialisation/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/initialisation/initialisation.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/redteam/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/.env.dev +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/log/.gitkeep +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/logging_conf.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/attack_modules.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/benchmark.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/benchmark_result.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/context_strategy.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/cookbook.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/dataset.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/endpoint.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/metric.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/prompt_template.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/recipe.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/redteam.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/routes/runner.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/benchmark_runner_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/cookbook_create_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/cookbook_response_model.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/dataset_response_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/endpoint_create_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/endpoint_response_model.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/prompt_response_model.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/prompt_template_response_model.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/recipe_create_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/recipe_response_model.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/session_create_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/session_prompt_dto.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/schemas/session_response_model.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/attack_module_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/auto_red_team_test_manager.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/auto_red_team_test_state.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/base_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/benchmark_result_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/benchmark_test_manager.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/benchmark_test_state.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/benchmarking_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/context_strategy_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/cookbook_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/dataset_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/endpoint_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/metric_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/prompt_template_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/recipe_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/runner_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/session_service.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/utils/exceptions_handler.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/services/utils/results_formatter.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/status_updater/interface/benchmark_progress_callback.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback.py +0 -0
- /aiverify_moonshot-0.4.0/moonshot/src/__init__.py → /aiverify_moonshot-0.4.2/moonshot/integrations/web_api/temp/.gitkeep +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/web_api/types/types.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/api → aiverify_moonshot-0.4.2/moonshot/src}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/configs → aiverify_moonshot-0.4.2/moonshot/src/api}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_connector.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_cookbook.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_dataset.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_environment_variables.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_metrics.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_prompt_template.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_recipe.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_red_teaming.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_result.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_run.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/api/api_runner.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/connectors → aiverify_moonshot-0.4.2/moonshot/src/configs}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/connectors_endpoints → aiverify_moonshot-0.4.2/moonshot/src/connectors}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/connectors/connector_prompt_arguments.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/cookbooks → aiverify_moonshot-0.4.2/moonshot/src/connectors_endpoints}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/connectors_endpoints/connector_endpoint_arguments.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/datasets → aiverify_moonshot-0.4.2/moonshot/src/cookbooks}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/cookbooks/cookbook_arguments.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/metrics → aiverify_moonshot-0.4.2/moonshot/src/datasets}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/datasets/dataset_arguments.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/prompt_templates → aiverify_moonshot-0.4.2/moonshot/src/metrics}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/recipes → aiverify_moonshot-0.4.2/moonshot/src/prompt_templates}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/redteaming → aiverify_moonshot-0.4.2/moonshot/src/recipes}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/recipes/recipe_arguments.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/redteaming/attack → aiverify_moonshot-0.4.2/moonshot/src/redteaming}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/redteaming/context_strategy → aiverify_moonshot-0.4.2/moonshot/src/redteaming/attack}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/redteaming/session → aiverify_moonshot-0.4.2/moonshot/src/redteaming/context_strategy}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/context_strategy/context_strategy_interface.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/results → aiverify_moonshot-0.4.2/moonshot/src/redteaming/session}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/session/chat.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/session/red_teaming_progress.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/redteaming/session/red_teaming_type.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/runners → aiverify_moonshot-0.4.2/moonshot/src/results}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/results/result_arguments.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/runs → aiverify_moonshot-0.4.2/moonshot/src/runners}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runners/runner_arguments.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runners/runner_type.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/storage → aiverify_moonshot-0.4.2/moonshot/src/runs}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runs/run_arguments.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/runs/run_status.py +0 -0
- {aiverify_moonshot-0.4.0/moonshot/src/utils → aiverify_moonshot-0.4.2/moonshot/src/storage}/__init__.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/storage/io_interface.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/src/utils/import_modules.py +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/requirements.txt +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/third-party/pygments-2.18.0-py3-none-any.whl +0 -0
- {aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/third-party/text_unidecode-1.3-py2.py3-none-any.whl +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
[Provide a brief description of the changes or features introduced by this pull request.]
|
|
4
|
+
|
|
5
|
+
## Motivation and Context
|
|
6
|
+
|
|
7
|
+
[Explain the motivation or the context behind this pull request. Why is it necessary?]
|
|
8
|
+
|
|
9
|
+
## Type of Change
|
|
10
|
+
|
|
11
|
+
<!-- Select the appropriate type of change: -->
|
|
12
|
+
<!-- - feat: A new feature -->
|
|
13
|
+
<!-- - fix: A bug fix -->
|
|
14
|
+
<!-- - chore: Routine tasks, maintenance, or tooling changes -->
|
|
15
|
+
<!-- - docs: Documentation updates -->
|
|
16
|
+
<!-- - style: Code style changes (e.g., formatting, indentation) -->
|
|
17
|
+
<!-- - refactor: Code refactoring without changes in functionality -->
|
|
18
|
+
<!-- - test: Adding or modifying tests -->
|
|
19
|
+
<!-- - perf: Performance improvements -->
|
|
20
|
+
<!-- - ci: Changes to the CI/CD configuration or scripts -->
|
|
21
|
+
<!-- - other: Other changes that don't fit into the above categories -->
|
|
22
|
+
|
|
23
|
+
## How to Test
|
|
24
|
+
|
|
25
|
+
[Provide clear instructions on how to test and verify the changes introduced by this pull request, including any specific unit tests you have created to demonstrate your changes.]
|
|
26
|
+
|
|
27
|
+
## Checklist
|
|
28
|
+
|
|
29
|
+
Please check all the boxes that apply to this pull request using "x":
|
|
30
|
+
|
|
31
|
+
- [ ] I have tested the changes locally and verified that they work as expected.
|
|
32
|
+
- [ ] I have added or updated the necessary documentation (README, API docs, etc.).
|
|
33
|
+
- [ ] I have added appropriate unit tests or functional tests for the changes made.
|
|
34
|
+
- [ ] I have followed the project's coding conventions and style guidelines.
|
|
35
|
+
- [ ] I have rebased my branch onto the latest commit of the main branch.
|
|
36
|
+
- [ ] I have squashed or reorganized my commits into logical units.
|
|
37
|
+
- [ ] I have added any necessary dependencies or packages to the project's build configuration.
|
|
38
|
+
- [ ] I have performed a self-review of my own code.
|
|
39
|
+
- [ ] I have read, understood and agree to the Developer Certificate of Origin below, which this project utilises.
|
|
40
|
+
|
|
41
|
+
## Screenshots (if applicable)
|
|
42
|
+
|
|
43
|
+
[If the changes involve visual modifications, include screenshots or GIFs that demonstrate the changes.]
|
|
44
|
+
|
|
45
|
+
## Additional Notes
|
|
46
|
+
|
|
47
|
+
[Add any additional information or context that might be relevant to reviewers.]
|
|
48
|
+
|
|
49
|
+
<details>
|
|
50
|
+
<summary>Developer Certificate of Origin</summary>
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Developer Certificate of Origin
|
|
54
|
+
Version 1.1
|
|
55
|
+
|
|
56
|
+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
|
57
|
+
|
|
58
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
|
59
|
+
license document, but changing it is not allowed.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Developer's Certificate of Origin 1.1
|
|
63
|
+
|
|
64
|
+
By making a contribution to this project, I certify that:
|
|
65
|
+
|
|
66
|
+
(a) The contribution was created in whole or in part by me and I
|
|
67
|
+
have the right to submit it under the open source license
|
|
68
|
+
indicated in the file; or
|
|
69
|
+
|
|
70
|
+
(b) The contribution is based upon previous work that, to the best
|
|
71
|
+
of my knowledge, is covered under an appropriate open source
|
|
72
|
+
license and I have the right under that license to submit that
|
|
73
|
+
work with modifications, whether created in whole or in part
|
|
74
|
+
by me, under the same open source license (unless I am
|
|
75
|
+
permitted to submit under a different license), as indicated
|
|
76
|
+
in the file; or
|
|
77
|
+
|
|
78
|
+
(c) The contribution was provided directly to me by some other
|
|
79
|
+
person who certified (a), (b) or (c) and I have not modified
|
|
80
|
+
it.
|
|
81
|
+
|
|
82
|
+
(d) I understand and agree that this project and the contribution
|
|
83
|
+
are public and that a record of the contribution (including all
|
|
84
|
+
personal information I submit with it, including my sign-off) is
|
|
85
|
+
maintained indefinitely and may be redistributed consistent with
|
|
86
|
+
this project or the open source license(s) involved.
|
|
87
|
+
```
|
|
88
|
+
</details>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Software Composition Analysis
|
|
2
|
+
|
|
3
|
+
# Runs when a pull request review is being submitted
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
# Run this workflow manually from Actions tab
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
branch_to_test:
|
|
11
|
+
description: 'Branch or tag to run test'
|
|
12
|
+
required: true
|
|
13
|
+
default: 'main'
|
|
14
|
+
type: string
|
|
15
|
+
|
|
16
|
+
# Allow one concurrent deployment
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ github.repository }}-${{ github.workflow }}
|
|
19
|
+
cancel-in-progress: true
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
software-composition-analysis:
|
|
23
|
+
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
timeout-minutes: 10
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
|
|
29
|
+
- name: Checkout Code (Pull_Request)
|
|
30
|
+
# if: github.event_name == 'pull_request'
|
|
31
|
+
uses: actions/checkout@v3
|
|
32
|
+
with:
|
|
33
|
+
ref: ${{ github.event.pull_request.head.ref }}
|
|
34
|
+
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
35
|
+
submodules: recursive
|
|
36
|
+
|
|
37
|
+
- name: Checkout Code (Workflow_Dispatch)
|
|
38
|
+
if: github.event_name == 'workflow_dispatch'
|
|
39
|
+
uses: actions/checkout@v3
|
|
40
|
+
with:
|
|
41
|
+
ref: ${{ inputs.branch_to_test }}
|
|
42
|
+
|
|
43
|
+
- name: Set Branch Variable (Pull_Request)
|
|
44
|
+
# if: github.event_name == 'pull_request'
|
|
45
|
+
run: |
|
|
46
|
+
echo "BRANCH=branch" >> "$GITHUB_ENV"
|
|
47
|
+
|
|
48
|
+
- name: Set Branch Variable (Workflow_Dispatch)
|
|
49
|
+
if: github.event_name == 'workflow_dispatch'
|
|
50
|
+
run: |
|
|
51
|
+
echo "BRANCH=${{ inputs.branch_to_test }}" >> "$GITHUB_ENV"
|
|
52
|
+
|
|
53
|
+
- name: Setup Python 3.11
|
|
54
|
+
uses: actions/setup-python@v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: "3.11"
|
|
57
|
+
|
|
58
|
+
- name: Install & Scan MOONSHOT
|
|
59
|
+
run: |
|
|
60
|
+
python -m venv venv
|
|
61
|
+
source venv/bin/activate
|
|
62
|
+
pip install -r requirements.txt
|
|
63
|
+
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=aiverify-moonshot --detect.project.version.name=$BRANCH --detect.source.path=. --detect.code.location.name="aiverify-moonshot_$BRANCH" --detect.excluded.directories=/tests --blackduck.trust.cert=true --detect.excluded.detector.types=POETRY
|
|
64
|
+
cd ../
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Smoke Test
|
|
2
|
+
|
|
3
|
+
name: Moonshot Smoke Test
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
# Runs on Pull Request
|
|
7
|
+
pull_request:
|
|
8
|
+
# types: [submitted]
|
|
9
|
+
# branches:
|
|
10
|
+
# - 'main'
|
|
11
|
+
|
|
12
|
+
# Run this workflow manually from Actions tab
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
inputs:
|
|
15
|
+
moonshot_branch:
|
|
16
|
+
description: 'Moonshot Branch / Tag Name'
|
|
17
|
+
required: true
|
|
18
|
+
default: 'main'
|
|
19
|
+
type: string
|
|
20
|
+
moonshot_data_branch:
|
|
21
|
+
description: 'Moonshot Data Branch / Tag Name'
|
|
22
|
+
required: true
|
|
23
|
+
default: 'main'
|
|
24
|
+
type: string
|
|
25
|
+
moonshot_ui_branch:
|
|
26
|
+
description: 'Moonshot UI Branch / Tag Name'
|
|
27
|
+
required: true
|
|
28
|
+
default: 'main'
|
|
29
|
+
type: string
|
|
30
|
+
|
|
31
|
+
# Allow one concurrent deployment
|
|
32
|
+
concurrency:
|
|
33
|
+
group: ${{ github.repository }}-${{ github.workflow }}
|
|
34
|
+
cancel-in-progress: true
|
|
35
|
+
|
|
36
|
+
jobs:
|
|
37
|
+
smoke-test:
|
|
38
|
+
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
timeout-minutes: 20
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
|
|
44
|
+
- name: Checkout Moonshot (Pull Request)
|
|
45
|
+
if: github.event_name == 'pull_request'
|
|
46
|
+
uses: actions/checkout@v4
|
|
47
|
+
with:
|
|
48
|
+
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
49
|
+
ref: ${{ github.event.pull_request.head.ref }}
|
|
50
|
+
|
|
51
|
+
- name: Checkout Moonshot (Workflow Dispatch)
|
|
52
|
+
if: github.event_name == 'workflow_dispatch'
|
|
53
|
+
uses: actions/checkout@v4
|
|
54
|
+
with:
|
|
55
|
+
repository: aiverify-foundation/moonshot-data
|
|
56
|
+
ref: ${{ inputs.moonshot_branch }}
|
|
57
|
+
|
|
58
|
+
- name: Setup Python 3.11
|
|
59
|
+
uses: actions/setup-python@v4
|
|
60
|
+
with:
|
|
61
|
+
python-version: '3.11'
|
|
62
|
+
|
|
63
|
+
- name: Setup Moonshot
|
|
64
|
+
run: |
|
|
65
|
+
python -m venv venv
|
|
66
|
+
source venv/bin/activate
|
|
67
|
+
pip install -r requirements.txt
|
|
68
|
+
|
|
69
|
+
- name: Checkout Moonshot Data (Pull Request)
|
|
70
|
+
if: github.event_name == 'pull_request'
|
|
71
|
+
uses: actions/checkout@v4
|
|
72
|
+
with:
|
|
73
|
+
repository: aiverify-foundation/moonshot-data
|
|
74
|
+
ref: ${{ vars.MOONSHOT_DATA_BRANCH }}
|
|
75
|
+
path: moonshot-data
|
|
76
|
+
|
|
77
|
+
- name: Checkout Moonshot Data (Workflow Dispatch)
|
|
78
|
+
if: github.event_name == 'workflow_dispatch'
|
|
79
|
+
uses: actions/checkout@v4
|
|
80
|
+
with:
|
|
81
|
+
repository: aiverify-foundation/moonshot-data
|
|
82
|
+
ref: ${{ inputs.moonshot_data_branch }}
|
|
83
|
+
path: moonshot-data
|
|
84
|
+
|
|
85
|
+
- name: Setup Moonshot Data
|
|
86
|
+
run: |
|
|
87
|
+
source venv/bin/activate
|
|
88
|
+
cd moonshot-data
|
|
89
|
+
pip install -r requirements.txt
|
|
90
|
+
|
|
91
|
+
- name: Checkout Moonshot UI (Pull Request)
|
|
92
|
+
if: github.event_name == 'pull_request'
|
|
93
|
+
uses: actions/checkout@v4
|
|
94
|
+
with:
|
|
95
|
+
repository: aiverify-foundation/moonshot-ui
|
|
96
|
+
ref: ${{ vars.MOONSHOT_UI_BRANCH }}
|
|
97
|
+
path: moonshot-ui
|
|
98
|
+
|
|
99
|
+
- name: Checkout Moonshot UI (Workflow Dispatch)
|
|
100
|
+
if: github.event_name == 'workflow_dispatch'
|
|
101
|
+
uses: actions/checkout@v4
|
|
102
|
+
with:
|
|
103
|
+
repository: aiverify-foundation/moonshot-ui
|
|
104
|
+
ref: ${{ inputs.moonshot_ui_branch }}
|
|
105
|
+
path: moonshot-ui
|
|
106
|
+
|
|
107
|
+
- name: Setup Moonshot UI
|
|
108
|
+
run: |
|
|
109
|
+
cd moonshot-ui
|
|
110
|
+
npm ci
|
|
111
|
+
npm run build
|
|
112
|
+
cd ../
|
|
113
|
+
source venv/bin/activate
|
|
114
|
+
python -m moonshot web &
|
|
115
|
+
|
|
116
|
+
- name: Checkout Smoke Test
|
|
117
|
+
uses: actions/checkout@v4
|
|
118
|
+
with:
|
|
119
|
+
repository: aiverify-foundation/moonshot-smoke-testing
|
|
120
|
+
path: moonshot-smoke-testing
|
|
121
|
+
|
|
122
|
+
- name: Run Smoke Test
|
|
123
|
+
run: |
|
|
124
|
+
cd moonshot-smoke-testing
|
|
125
|
+
npm ci
|
|
126
|
+
npx playwright install --with-deps
|
|
127
|
+
npx playwright test tests/main-page.spec.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: aiverify-moonshot
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
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
|

|
|
45
45
|
|
|
46
|
-
**Version 0.4.
|
|
46
|
+
**Version 0.4.2**
|
|
47
47
|
|
|
48
48
|
A simple and modular tool to evaluate any LLM application.
|
|
49
49
|
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import warnings
|
|
3
1
|
import argparse
|
|
2
|
+
import os
|
|
4
3
|
import platform
|
|
5
4
|
import subprocess
|
|
6
|
-
import
|
|
7
|
-
import threading
|
|
5
|
+
import sys
|
|
6
|
+
import threading
|
|
7
|
+
import warnings
|
|
8
|
+
|
|
8
9
|
from dotenv import dotenv_values
|
|
10
|
+
|
|
9
11
|
from moonshot.api import api_set_environment_variables
|
|
12
|
+
from moonshot.src.utils.log import configure_logger
|
|
13
|
+
|
|
14
|
+
# Create a logger for this module
|
|
15
|
+
logger = configure_logger(__name__)
|
|
16
|
+
|
|
10
17
|
"""
|
|
11
18
|
Run the Moonshot application
|
|
12
19
|
"""
|
|
20
|
+
|
|
21
|
+
|
|
13
22
|
def run_subprocess(*args, **kwargs):
|
|
14
23
|
"""
|
|
15
24
|
Run a subprocess with the option to use shell=True on Windows.
|
|
@@ -18,6 +27,7 @@ def run_subprocess(*args, **kwargs):
|
|
|
18
27
|
kwargs["shell"] = True
|
|
19
28
|
return subprocess.run(*args, **kwargs)
|
|
20
29
|
|
|
30
|
+
|
|
21
31
|
def ms_lib_env_file(data_repo_name):
|
|
22
32
|
"""
|
|
23
33
|
Writes the env file to be used for moonshot library
|
|
@@ -25,6 +35,7 @@ def ms_lib_env_file(data_repo_name):
|
|
|
25
35
|
env_content_data = f"""
|
|
26
36
|
# For Data
|
|
27
37
|
ATTACK_MODULES="./{data_repo_name}/attack-modules"
|
|
38
|
+
BOOKMARKS="./{data_repo_name}/generated-outputs/bookmarks"
|
|
28
39
|
CONNECTORS="./{data_repo_name}/connectors"
|
|
29
40
|
CONNECTORS_ENDPOINTS="./{data_repo_name}/connectors-endpoints"
|
|
30
41
|
CONTEXT_STRATEGY="./{data_repo_name}/context-strategy"
|
|
@@ -40,7 +51,7 @@ def ms_lib_env_file(data_repo_name):
|
|
|
40
51
|
RESULTS_MODULES="./{data_repo_name}/results-modules"
|
|
41
52
|
RUNNERS="./{data_repo_name}/generated-outputs/runners"
|
|
42
53
|
RUNNERS_MODULES="./{data_repo_name}/runners-modules"
|
|
43
|
-
TOKENIZERS_PARALLELISM = false
|
|
54
|
+
TOKENIZERS_PARALLELISM = false
|
|
44
55
|
"""
|
|
45
56
|
|
|
46
57
|
env_content_web_api = """
|
|
@@ -58,6 +69,7 @@ def ms_lib_env_file(data_repo_name):
|
|
|
58
69
|
combined_content = env_content_data + env_content_web_api
|
|
59
70
|
env_file.write(combined_content.strip())
|
|
60
71
|
|
|
72
|
+
|
|
61
73
|
def ms_ui_env_file(ui_repo):
|
|
62
74
|
"""
|
|
63
75
|
Write the env file to be used with moonshot ui
|
|
@@ -71,66 +83,73 @@ def ms_ui_env_file(ui_repo):
|
|
|
71
83
|
with open(os.path.join(ui_repo, ".env"), "w") as env_file:
|
|
72
84
|
env_file.write(env_content.strip())
|
|
73
85
|
|
|
86
|
+
|
|
74
87
|
def moonshot_data_installation():
|
|
75
88
|
# Code for moonshot-data installation
|
|
76
|
-
|
|
89
|
+
logger.info("Installing Moonshot Data from GitHub")
|
|
77
90
|
repo = "https://github.com/aiverify-foundation/moonshot-data.git"
|
|
78
91
|
folder_name = repo.split("/")[-1].replace(".git", "")
|
|
79
|
-
|
|
92
|
+
|
|
80
93
|
# Check if the directory already exists
|
|
81
94
|
if not os.path.exists(folder_name):
|
|
82
|
-
|
|
95
|
+
logger.info(f"Cloning {repo}")
|
|
83
96
|
# Clone the repository
|
|
84
97
|
run_subprocess(["git", "clone", repo], check=True)
|
|
85
|
-
|
|
98
|
+
|
|
99
|
+
# Create .env to point to installed folder
|
|
100
|
+
ms_lib_env_file(folder_name)
|
|
101
|
+
|
|
86
102
|
# Change directory to the folder
|
|
87
103
|
os.chdir(folder_name)
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
logger.info(f"Installing requirements for {folder_name}")
|
|
90
106
|
# Install the requirements if they exist
|
|
91
107
|
if os.path.exists("requirements.txt"):
|
|
92
108
|
run_subprocess(["pip", "install", "-r", "requirements.txt"], check=True)
|
|
93
109
|
import nltk
|
|
94
|
-
|
|
95
|
-
nltk.download(
|
|
96
|
-
nltk.download(
|
|
97
|
-
nltk.download(
|
|
98
|
-
|
|
110
|
+
|
|
111
|
+
nltk.download("punkt")
|
|
112
|
+
nltk.download("stopwords")
|
|
113
|
+
nltk.download("averaged_perceptron_tagger")
|
|
114
|
+
nltk.download("universal_tagset")
|
|
115
|
+
|
|
99
116
|
# Change back to the base directory
|
|
100
117
|
os.chdir("..")
|
|
101
118
|
|
|
102
|
-
# Create .env to point to installed folder
|
|
103
|
-
ms_lib_env_file(folder_name)
|
|
104
119
|
else:
|
|
105
|
-
|
|
120
|
+
logger.warning(f"Directory {folder_name} already exists, skipping clone.")
|
|
121
|
+
|
|
106
122
|
|
|
107
123
|
def moonshot_ui_installation():
|
|
108
124
|
# Code for moonshot-ui installation
|
|
109
125
|
repo = "https://github.com/aiverify-foundation/moonshot-ui.git"
|
|
110
126
|
folder_name = repo.split("/")[-1].replace(".git", "")
|
|
111
|
-
|
|
127
|
+
|
|
112
128
|
# Check if the directory already exists
|
|
113
129
|
if not os.path.exists(folder_name):
|
|
114
|
-
|
|
130
|
+
logger.info(f"Cloning {repo}")
|
|
115
131
|
# Clone the repository
|
|
116
132
|
run_subprocess(["git", "clone", repo], check=True)
|
|
117
133
|
|
|
118
134
|
# Change directory to the folder
|
|
119
135
|
os.chdir(folder_name)
|
|
120
136
|
|
|
121
|
-
|
|
137
|
+
logger.info(f"Installing requirements for {folder_name}")
|
|
122
138
|
# Install the requirements if they exist
|
|
123
139
|
if os.path.exists("package.json"):
|
|
124
140
|
run_subprocess(["npm", "install"], check=True)
|
|
125
141
|
run_subprocess(["npm", "run", "build"], check=True)
|
|
126
|
-
|
|
142
|
+
|
|
127
143
|
# Change back to the base directory
|
|
128
144
|
os.chdir("..")
|
|
129
145
|
|
|
130
146
|
# Create .env for ui
|
|
131
147
|
ms_ui_env_file(folder_name)
|
|
132
148
|
else:
|
|
133
|
-
|
|
149
|
+
logger.warning(
|
|
150
|
+
f"Directory {folder_name} already exists, skipping installation."
|
|
151
|
+
)
|
|
152
|
+
|
|
134
153
|
|
|
135
154
|
def run_moonshot_ui_dev():
|
|
136
155
|
"""
|
|
@@ -140,31 +159,51 @@ def run_moonshot_ui_dev():
|
|
|
140
159
|
ui_dev_dir = os.path.join(base_directory, "moonshot-ui")
|
|
141
160
|
|
|
142
161
|
if not os.path.exists(ui_dev_dir):
|
|
143
|
-
|
|
162
|
+
logger.error(
|
|
163
|
+
"moonshot-ui does not exist. Please run with '-i moonshot-ui' to install moonshot-ui first."
|
|
164
|
+
)
|
|
144
165
|
sys.exit(1)
|
|
145
166
|
# ms_ui_env_file(ui_dev_dir)
|
|
146
|
-
run_subprocess([
|
|
167
|
+
run_subprocess(["npm", "start"], cwd=ui_dev_dir)
|
|
168
|
+
|
|
147
169
|
|
|
148
170
|
def main():
|
|
149
171
|
parser = argparse.ArgumentParser(description="Run the Moonshot application")
|
|
150
|
-
parser.add_argument(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
172
|
+
parser.add_argument(
|
|
173
|
+
"mode",
|
|
174
|
+
nargs="?",
|
|
175
|
+
choices=["web-api", "cli", "web", "help"],
|
|
176
|
+
help="Mode to run Moonshot in",
|
|
177
|
+
default=help,
|
|
178
|
+
)
|
|
179
|
+
parser.add_argument(
|
|
180
|
+
"cli_command", nargs="?", help='The CLI command to run (e.g., "interactive")'
|
|
181
|
+
)
|
|
182
|
+
parser.add_argument(
|
|
183
|
+
"-i",
|
|
184
|
+
"--install",
|
|
185
|
+
action="append",
|
|
186
|
+
choices=["moonshot-data", "moonshot-ui"],
|
|
187
|
+
help="Modules to install",
|
|
188
|
+
default=[],
|
|
189
|
+
)
|
|
190
|
+
parser.add_argument(
|
|
191
|
+
"-e", "--env", type=str, help="Path to the .env file", default=".env"
|
|
192
|
+
)
|
|
193
|
+
|
|
155
194
|
args = parser.parse_args()
|
|
156
|
-
|
|
195
|
+
|
|
157
196
|
# Handle installations based on the -i include arguments
|
|
158
|
-
if
|
|
197
|
+
if "moonshot-data" in args.install:
|
|
159
198
|
moonshot_data_installation()
|
|
160
199
|
|
|
161
|
-
if
|
|
200
|
+
if "moonshot-ui" in args.install:
|
|
162
201
|
moonshot_ui_installation()
|
|
163
202
|
|
|
164
203
|
# If mode is not specified, skip running any modes
|
|
165
204
|
if args.mode is None:
|
|
166
205
|
return
|
|
167
|
-
|
|
206
|
+
|
|
168
207
|
if args.mode == "help":
|
|
169
208
|
parser.print_help()
|
|
170
209
|
sys.exit(1)
|
|
@@ -173,18 +212,21 @@ def main():
|
|
|
173
212
|
|
|
174
213
|
if args.mode == "web-api":
|
|
175
214
|
from moonshot.integrations.web_api import __main__ as web_api
|
|
215
|
+
|
|
176
216
|
web_api.start_app()
|
|
177
217
|
elif args.mode == "web":
|
|
178
|
-
|
|
218
|
+
# Create and start the UI dev server thread
|
|
179
219
|
ui_thread = threading.Thread(target=run_moonshot_ui_dev)
|
|
180
220
|
ui_thread.start()
|
|
181
221
|
ui_thread.join(timeout=0.1) # Wait briefly for the thread to become alive
|
|
182
222
|
if not ui_thread.is_alive():
|
|
183
223
|
sys.exit(1)
|
|
184
224
|
from moonshot.integrations.web_api import __main__ as web_api
|
|
225
|
+
|
|
185
226
|
web_api.start_app()
|
|
186
227
|
elif args.mode == "cli":
|
|
187
228
|
from moonshot.integrations.cli import __main__ as cli
|
|
229
|
+
|
|
188
230
|
cli.start_app(args.cli_command)
|
|
189
231
|
|
|
190
232
|
# Handle CLI mode here, possibly also with additional arguments
|
|
@@ -193,6 +235,7 @@ def main():
|
|
|
193
235
|
parser.print_help()
|
|
194
236
|
sys.exit(1)
|
|
195
237
|
|
|
238
|
+
|
|
196
239
|
if __name__ == "__main__":
|
|
197
240
|
warnings.filterwarnings("ignore")
|
|
198
|
-
main()
|
|
241
|
+
main()
|
|
@@ -86,6 +86,14 @@ from moonshot.src.api.api_session import (
|
|
|
86
86
|
api_update_prompt_template,
|
|
87
87
|
api_update_system_prompt,
|
|
88
88
|
)
|
|
89
|
+
from moonshot.src.api.api_bookmark import (
|
|
90
|
+
api_get_all_bookmarks,
|
|
91
|
+
api_get_bookmark,
|
|
92
|
+
api_insert_bookmark,
|
|
93
|
+
api_delete_bookmark,
|
|
94
|
+
api_delete_all_bookmark,
|
|
95
|
+
api_export_bookmarks,
|
|
96
|
+
)
|
|
89
97
|
|
|
90
98
|
__all__ = [
|
|
91
99
|
"api_create_connector_from_endpoint",
|
|
@@ -152,4 +160,10 @@ __all__ = [
|
|
|
152
160
|
"api_update_metric",
|
|
153
161
|
"api_update_prompt_template",
|
|
154
162
|
"api_update_system_prompt",
|
|
163
|
+
"api_get_all_bookmarks",
|
|
164
|
+
"api_get_bookmark",
|
|
165
|
+
"api_insert_bookmark",
|
|
166
|
+
"api_delete_bookmark",
|
|
167
|
+
"api_delete_all_bookmark",
|
|
168
|
+
"api_export_bookmarks",
|
|
155
169
|
]
|
{aiverify_moonshot-0.4.0 → aiverify_moonshot-0.4.2}/moonshot/integrations/cli/benchmark/benchmark.py
RENAMED
|
@@ -8,6 +8,7 @@ from moonshot.integrations.cli.benchmark.cookbook import (
|
|
|
8
8
|
delete_cookbook,
|
|
9
9
|
delete_cookbook_args,
|
|
10
10
|
list_cookbooks,
|
|
11
|
+
list_cookbooks_args,
|
|
11
12
|
run_cookbook,
|
|
12
13
|
run_cookbook_args,
|
|
13
14
|
update_cookbook,
|
|
@@ -19,6 +20,7 @@ from moonshot.integrations.cli.benchmark.datasets import (
|
|
|
19
20
|
delete_dataset,
|
|
20
21
|
delete_dataset_args,
|
|
21
22
|
list_datasets,
|
|
23
|
+
list_datasets_args,
|
|
22
24
|
view_dataset,
|
|
23
25
|
view_dataset_args,
|
|
24
26
|
)
|
|
@@ -26,6 +28,7 @@ from moonshot.integrations.cli.benchmark.metrics import (
|
|
|
26
28
|
delete_metric,
|
|
27
29
|
delete_metric_args,
|
|
28
30
|
list_metrics,
|
|
31
|
+
list_metrics_args,
|
|
29
32
|
view_metric,
|
|
30
33
|
view_metric_args,
|
|
31
34
|
)
|
|
@@ -35,6 +38,7 @@ from moonshot.integrations.cli.benchmark.recipe import (
|
|
|
35
38
|
delete_recipe,
|
|
36
39
|
delete_recipe_args,
|
|
37
40
|
list_recipes,
|
|
41
|
+
list_recipes_args,
|
|
38
42
|
run_recipe,
|
|
39
43
|
run_recipe_args,
|
|
40
44
|
update_recipe,
|
|
@@ -46,10 +50,16 @@ from moonshot.integrations.cli.benchmark.result import (
|
|
|
46
50
|
delete_result,
|
|
47
51
|
delete_result_args,
|
|
48
52
|
list_results,
|
|
53
|
+
list_results_args,
|
|
49
54
|
view_result,
|
|
50
55
|
view_result_args,
|
|
51
56
|
)
|
|
52
|
-
from moonshot.integrations.cli.benchmark.run import
|
|
57
|
+
from moonshot.integrations.cli.benchmark.run import (
|
|
58
|
+
list_runs,
|
|
59
|
+
list_runs_args,
|
|
60
|
+
view_run,
|
|
61
|
+
view_run_args,
|
|
62
|
+
)
|
|
53
63
|
from moonshot.integrations.cli.benchmark.runner import (
|
|
54
64
|
delete_runner,
|
|
55
65
|
delete_runner_args,
|
|
@@ -68,26 +78,32 @@ class BenchmarkCommandSet(cmd2.CommandSet):
|
|
|
68
78
|
# List contents
|
|
69
79
|
# ------------------------------------------------------------------------------
|
|
70
80
|
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
@cmd2.with_argparser(list_cookbooks_args)
|
|
82
|
+
def do_list_cookbooks(self, args: argparse.Namespace) -> None:
|
|
83
|
+
list_cookbooks(args)
|
|
73
84
|
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
@cmd2.with_argparser(list_recipes_args)
|
|
86
|
+
def do_list_recipes(self, args: argparse.Namespace) -> None:
|
|
87
|
+
list_recipes(args)
|
|
76
88
|
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
@cmd2.with_argparser(list_results_args)
|
|
90
|
+
def do_list_results(self, args: argparse.Namespace) -> None:
|
|
91
|
+
list_results(args)
|
|
79
92
|
|
|
80
93
|
def do_list_runners(self, _: cmd2.Statement) -> None:
|
|
81
94
|
list_runners()
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
@cmd2.with_argparser(list_runs_args)
|
|
97
|
+
def do_list_runs(self, args: argparse.Namespace) -> None:
|
|
98
|
+
list_runs(args)
|
|
85
99
|
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
@cmd2.with_argparser(list_metrics_args)
|
|
101
|
+
def do_list_metrics(self, args: argparse.Namespace) -> None:
|
|
102
|
+
list_metrics(args)
|
|
88
103
|
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
@cmd2.with_argparser(list_datasets_args)
|
|
105
|
+
def do_list_datasets(self, args: argparse.Namespace) -> None:
|
|
106
|
+
list_datasets(args)
|
|
91
107
|
|
|
92
108
|
# ------------------------------------------------------------------------------
|
|
93
109
|
# Add contents
|