Copy disabled (too large)
Download .txt
Showing preview only (10,215K chars total). Download the full file to get everything.
Repository: aiverify-foundation/moonshot
Branch: main
Commit: 03e9344dc9fc
Files: 436
Total size: 9.6 MB
Directory structure:
gitextract_l345h7ij/
├── .coveragerc
├── .flake8
├── .github/
│ ├── developing-workflows.md
│ ├── pull_request_template.md
│ ├── scripts/
│ │ ├── create_backup.sh
│ │ ├── install_ms_service.sh
│ │ ├── moonshot_env
│ │ ├── moonshot_test_env
│ │ ├── moonshot_ui_env
│ │ ├── run_smoke_test.sh
│ │ └── start_ms_service.sh
│ └── workflows/
│ ├── docs-update.yaml
│ ├── gh-event-notification.yaml
│ ├── integration-test.yaml
│ ├── notices-file-gen.yaml
│ ├── pre-build-checks.yaml
│ ├── pypi-deployment.yaml
│ ├── sast-codeql.yaml
│ ├── sca-scan.yaml
│ ├── sit-build.yaml
│ ├── smoke-test-cli.yaml
│ ├── smoke-test.yaml
│ ├── test-pypi-deployment.yaml
│ └── uat-build.yaml
├── .gitignore
├── .pre-commit-config.yaml
├── AUTHORS.md
├── LICENSE.md
├── NOTICES.md
├── README.md
├── assets/
│ └── style.css
├── ci/
│ ├── createBadges.py
│ ├── gen_pre_build_summ.sh
│ ├── run-codeql-summ.sh
│ ├── run-flake8.sh
│ ├── run-pip-audit.sh
│ └── run-test.sh
├── docs/
│ ├── api_reference/
│ │ ├── api_bookmark.md
│ │ ├── api_connector.md
│ │ ├── api_connector_endpoint.md
│ │ ├── api_context_strategy.md
│ │ ├── api_cookbook.md
│ │ ├── api_dataset.md
│ │ ├── api_environment_variables.md
│ │ ├── api_metrics.md
│ │ ├── api_prompt_template.md
│ │ ├── api_recipe.md
│ │ ├── api_red_teaming.md
│ │ ├── api_result.md
│ │ ├── api_run.md
│ │ ├── api_runner.md
│ │ ├── api_session.md
│ │ ├── web_api_swagger.json
│ │ └── web_api_swagger.md
│ ├── contributing.md
│ ├── faq.md
│ ├── getting_started/
│ │ ├── first_test.md
│ │ ├── overview.md
│ │ ├── quick_install.md
│ │ └── quick_start.md
│ ├── index.md
│ ├── resources/
│ │ ├── attack_modules.md
│ │ ├── cookbooks.md
│ │ ├── datasets.md
│ │ ├── jupyter_notebook.md
│ │ ├── metrics.md
│ │ └── recipes.md
│ ├── tutorial/
│ │ ├── cli/
│ │ │ ├── create_benchmark_tests.md
│ │ │ ├── create_endpoint.md
│ │ │ ├── run_benchmark_tests.md
│ │ │ └── run_red_teaming.md
│ │ ├── contributor/
│ │ │ ├── configure_web_api.md
│ │ │ └── create_connector.md
│ │ └── web-ui/
│ │ ├── benchmark.md
│ │ ├── create_cookbook.md
│ │ ├── create_endpoint.md
│ │ └── redteam.md
│ └── user_guide/
│ ├── cli/
│ │ ├── add_your_own_tests.md
│ │ ├── benchmarking.md
│ │ ├── cli_command_list.md
│ │ ├── cli_guide.md
│ │ ├── connecting_endpoints.md
│ │ └── red_teaming.md
│ └── web_ui/
│ ├── choosing_relevant_tests.md
│ ├── connecting_to_llms.md
│ ├── creating_custom_cookbooks.md
│ ├── moonshot_interface/
│ │ ├── benchmarking.md
│ │ ├── endpoint.md
│ │ ├── history.md
│ │ ├── homepage.md
│ │ ├── redteaming.md
│ │ └── utils.md
│ ├── running_benchmarks.md
│ ├── running_red_teaming.md
│ └── web_ui_guide.md
├── examples/
│ ├── config.yml
│ ├── deployment/
│ │ ├── Dockerfile
│ │ ├── docker-compose.yml
│ │ ├── kube_manifests/
│ │ │ ├── moonshot-deployment.yml
│ │ │ ├── moonshot-ingress.yml
│ │ │ ├── moonshot-ns.yml
│ │ │ └── moonshot-pvc.yml
│ │ └── run_installation_script.sh
│ └── jupyter-notebook/
│ ├── Moonshot - Benchmark Feature Walkthrough.ipynb
│ ├── Moonshot - Pre-Req - Setup.ipynb
│ ├── Tutorial 1 - Basic Workflow - Execute a Benchmark.ipynb
│ ├── Tutorial 2 - Basic Workflow - Add your own test.ipynb
│ ├── Tutorial 3 - Basic Workflow - Run Red Teaming Session.ipynb
│ ├── Tutorial 4 - Advanced Workflow - Test Custom Application.ipynb
│ ├── assets/
│ │ ├── jupyter-assets-csv-file.csv
│ │ └── jupyter-assets-custom-app.py
│ └── jupyter_notebook_env_setup.sh
├── mkdocs.yml
├── moonshot/
│ ├── __init__.py
│ ├── __main__.py
│ ├── api.py
│ ├── integrations/
│ │ ├── __init__.py
│ │ ├── cli/
│ │ │ ├── __init__.py
│ │ │ ├── __main__.py
│ │ │ ├── active_session_cfg.py
│ │ │ ├── benchmark/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── benchmark.py
│ │ │ │ ├── cookbook.py
│ │ │ │ ├── datasets.py
│ │ │ │ ├── metrics.py
│ │ │ │ ├── recipe.py
│ │ │ │ ├── result.py
│ │ │ │ ├── run.py
│ │ │ │ └── runner.py
│ │ │ ├── cli.py
│ │ │ ├── cli_errors.py
│ │ │ ├── common/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── common.py
│ │ │ │ ├── connectors.py
│ │ │ │ ├── dataset.py
│ │ │ │ ├── display_helper.py
│ │ │ │ └── prompt_template.py
│ │ │ ├── initialisation/
│ │ │ │ ├── __init__.py
│ │ │ │ └── initialisation.py
│ │ │ ├── redteam/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── attack_module.py
│ │ │ │ ├── context_strategy.py
│ │ │ │ ├── prompt_template.py
│ │ │ │ ├── redteam.py
│ │ │ │ └── session.py
│ │ │ └── utils/
│ │ │ └── process_data.py
│ │ └── web_api/
│ │ ├── __init__.py
│ │ ├── __main__.py
│ │ ├── app.py
│ │ ├── container.py
│ │ ├── log/
│ │ │ └── .gitkeep
│ │ ├── logging_conf.py
│ │ ├── routes/
│ │ │ ├── __init__.py
│ │ │ ├── attack_modules.py
│ │ │ ├── benchmark.py
│ │ │ ├── benchmark_result.py
│ │ │ ├── bookmark.py
│ │ │ ├── context_strategy.py
│ │ │ ├── cookbook.py
│ │ │ ├── dataset.py
│ │ │ ├── endpoint.py
│ │ │ ├── metric.py
│ │ │ ├── prompt_template.py
│ │ │ ├── recipe.py
│ │ │ ├── redteam.py
│ │ │ └── runner.py
│ │ ├── schemas/
│ │ │ ├── __init__.py
│ │ │ ├── benchmark_runner_dto.py
│ │ │ ├── bookmark_create_dto.py
│ │ │ ├── cookbook_create_dto.py
│ │ │ ├── cookbook_response_model.py
│ │ │ ├── dataset_create_dto.py
│ │ │ ├── dataset_response_dto.py
│ │ │ ├── endpoint_create_dto.py
│ │ │ ├── endpoint_response_model.py
│ │ │ ├── prompt_response_model.py
│ │ │ ├── prompt_template_response_model.py
│ │ │ ├── recipe_create_dto.py
│ │ │ ├── recipe_response_model.py
│ │ │ ├── session_create_dto.py
│ │ │ ├── session_prompt_dto.py
│ │ │ └── session_response_model.py
│ │ ├── services/
│ │ │ ├── __init__.py
│ │ │ ├── attack_module_service.py
│ │ │ ├── auto_red_team_test_manager.py
│ │ │ ├── auto_red_team_test_state.py
│ │ │ ├── base_service.py
│ │ │ ├── benchmark_result_service.py
│ │ │ ├── benchmark_test_manager.py
│ │ │ ├── benchmark_test_state.py
│ │ │ ├── benchmarking_service.py
│ │ │ ├── bookmark_service.py
│ │ │ ├── context_strategy_service.py
│ │ │ ├── cookbook_service.py
│ │ │ ├── dataset_service.py
│ │ │ ├── endpoint_service.py
│ │ │ ├── metric_service.py
│ │ │ ├── prompt_template_service.py
│ │ │ ├── recipe_service.py
│ │ │ ├── runner_service.py
│ │ │ ├── session_service.py
│ │ │ └── utils/
│ │ │ ├── exceptions_handler.py
│ │ │ ├── file_manager.py
│ │ │ └── results_formatter.py
│ │ ├── status_updater/
│ │ │ ├── interface/
│ │ │ │ ├── benchmark_progress_callback.py
│ │ │ │ └── redteam_progress_callback.py
│ │ │ └── moonshot_ui_webhook.py
│ │ ├── temp/
│ │ │ └── .gitkeep
│ │ └── types/
│ │ └── types.py
│ └── src/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── api_bookmark.py
│ │ ├── api_connector.py
│ │ ├── api_connector_endpoint.py
│ │ ├── api_context_strategy.py
│ │ ├── api_cookbook.py
│ │ ├── api_dataset.py
│ │ ├── api_environment_variables.py
│ │ ├── api_metrics.py
│ │ ├── api_prompt_template.py
│ │ ├── api_recipe.py
│ │ ├── api_red_teaming.py
│ │ ├── api_result.py
│ │ ├── api_run.py
│ │ ├── api_runner.py
│ │ └── api_session.py
│ ├── bookmark/
│ │ ├── bookmark.py
│ │ └── bookmark_arguments.py
│ ├── configs/
│ │ ├── __init__.py
│ │ └── env_variables.py
│ ├── connectors/
│ │ ├── __init__.py
│ │ ├── connector.py
│ │ ├── connector_prompt_arguments.py
│ │ └── connector_response.py
│ ├── connectors_endpoints/
│ │ ├── __init__.py
│ │ ├── connector_endpoint.py
│ │ └── connector_endpoint_arguments.py
│ ├── cookbooks/
│ │ ├── __init__.py
│ │ ├── cookbook.py
│ │ └── cookbook_arguments.py
│ ├── datasets/
│ │ ├── __init__.py
│ │ ├── dataset.py
│ │ └── dataset_arguments.py
│ ├── messages_constants.py
│ ├── metrics/
│ │ ├── __init__.py
│ │ ├── metric.py
│ │ └── metric_interface.py
│ ├── prompt_templates/
│ │ ├── __init__.py
│ │ └── prompt_template.py
│ ├── recipes/
│ │ ├── __init__.py
│ │ ├── recipe.py
│ │ └── recipe_arguments.py
│ ├── redteaming/
│ │ ├── __init__.py
│ │ ├── attack/
│ │ │ ├── __init__.py
│ │ │ ├── attack_module.py
│ │ │ ├── attack_module_arguments.py
│ │ │ └── context_strategy.py
│ │ ├── context_strategy/
│ │ │ ├── __init__.py
│ │ │ └── context_strategy_interface.py
│ │ └── session/
│ │ ├── __init__.py
│ │ ├── chat.py
│ │ ├── red_teaming_progress.py
│ │ ├── red_teaming_type.py
│ │ └── session.py
│ ├── results/
│ │ ├── __init__.py
│ │ ├── result.py
│ │ └── result_arguments.py
│ ├── runners/
│ │ ├── __init__.py
│ │ ├── runner.py
│ │ ├── runner_arguments.py
│ │ └── runner_type.py
│ ├── runs/
│ │ ├── __init__.py
│ │ ├── run.py
│ │ ├── run_arguments.py
│ │ ├── run_progress.py
│ │ └── run_status.py
│ ├── storage/
│ │ ├── __init__.py
│ │ ├── db_interface.py
│ │ ├── io_interface.py
│ │ └── storage.py
│ └── utils/
│ ├── __init__.py
│ ├── find_feature.py
│ ├── import_modules.py
│ ├── log.py
│ ├── pagination.py
│ └── timeit.py
├── pyproject.toml
├── pytest.ini
├── requirements.txt
├── run_unit_test.sh
├── tests/
│ ├── __init__.py
│ ├── others/
│ │ ├── __init__.py
│ │ ├── functest_api.py
│ │ ├── functest_connectors.py
│ │ ├── functest_cookbooks.py
│ │ ├── functest_datasets.py
│ │ ├── functest_metrics.py
│ │ ├── functest_recipes.py
│ │ ├── functest_results.py
│ │ ├── functest_rt_api.py
│ │ ├── functest_runner.py
│ │ └── results/
│ │ ├── my-new-runner-cookbook.json
│ │ └── my-new-runner-recipe.json
│ └── unit-tests/
│ ├── __init__.py
│ ├── cli/
│ │ ├── __init__.py
│ │ ├── test_attack_module.py
│ │ ├── test_benchmark.py
│ │ ├── test_common.py
│ │ ├── test_common_endpoints.py
│ │ ├── test_common_prompt_template.py
│ │ ├── test_cookbook.py
│ │ ├── test_datasets.py
│ │ ├── test_metrics.py
│ │ ├── test_recipe.py
│ │ ├── test_red_teaming.py
│ │ ├── test_result.py
│ │ ├── test_run.py
│ │ ├── test_runner.py
│ │ └── test_session.py
│ ├── common/
│ │ └── samples/
│ │ ├── __init__.py
│ │ ├── add_previous_prompt.py
│ │ ├── advglue.py
│ │ ├── analogical-similarity.json
│ │ ├── answer-template.json
│ │ ├── arc-challenge.json
│ │ ├── arc-easy.json
│ │ ├── arc.json
│ │ ├── bbq-lite-age-ambiguous.json
│ │ ├── bbq-lite-age-disamb.json
│ │ ├── bbq.json
│ │ ├── benchmarking-result.py
│ │ ├── benchmarking.py
│ │ ├── bertscore.py
│ │ ├── bleuscore.py
│ │ ├── charswap_attack.py
│ │ ├── chinese-safety-cookbook.json
│ │ ├── claude2-connector.py
│ │ ├── exactstrmatch.py
│ │ ├── homoglyph_attack.py
│ │ ├── huggingface-connector.py
│ │ ├── ign_test_storage.py
│ │ ├── mcq-template.json
│ │ ├── mmlu.json
│ │ ├── my-new-recipe-runner-no-db.json
│ │ ├── my-new-recipe-runner-result.json
│ │ ├── my-new-recipe-runner.json
│ │ ├── my-runner.json
│ │ ├── openai-connector.py
│ │ ├── openai-gpt35-turbo.json
│ │ ├── openai-gpt4.json
│ │ ├── redteaming.py
│ │ ├── sample-cookbook.json
│ │ ├── sample-dataset.csv
│ │ ├── sample-result.json
│ │ ├── sample_attack_module.py
│ │ ├── sample_file.py
│ │ └── tamil-language-cookbook.json
│ ├── src/
│ │ ├── __init__.py
│ │ ├── data/
│ │ │ ├── attack-modules/
│ │ │ │ └── .placeholder
│ │ │ ├── bookmarks/
│ │ │ │ └── .placeholder
│ │ │ ├── connectors/
│ │ │ │ └── .placeholder
│ │ │ ├── connectors-endpoints/
│ │ │ │ └── .placeholder
│ │ │ ├── context-strategy/
│ │ │ │ └── .placeholder
│ │ │ ├── cookbooks/
│ │ │ │ └── .placeholder
│ │ │ ├── databases/
│ │ │ │ └── .placeholder
│ │ │ ├── databases-modules/
│ │ │ │ ├── .placeholder
│ │ │ │ └── sqlite.py
│ │ │ ├── datasets/
│ │ │ │ └── .placeholder
│ │ │ ├── example/
│ │ │ │ └── .placeholder
│ │ │ ├── io-modules/
│ │ │ │ ├── __init__.py
│ │ │ │ └── jsonio.py
│ │ │ ├── metrics/
│ │ │ │ └── .placeholder
│ │ │ ├── prompt-templates/
│ │ │ │ └── .placeholder
│ │ │ ├── recipes/
│ │ │ │ └── .placeholder
│ │ │ ├── results/
│ │ │ │ └── .placeholder
│ │ │ ├── results-modules/
│ │ │ │ └── .placeholder
│ │ │ ├── runner-modules/
│ │ │ │ └── .placeholder
│ │ │ └── runners/
│ │ │ └── .placeholder
│ │ ├── importmodules/
│ │ │ ├── __init__.py
│ │ │ ├── arc-easy.json
│ │ │ └── sample_file.py
│ │ ├── logger_mock.py
│ │ ├── test-storage.py
│ │ ├── test_api_bookmark.py
│ │ ├── test_api_connector.py
│ │ ├── test_api_connector_endpoint.py
│ │ ├── test_api_context_strategy.py
│ │ ├── test_api_cookbook.py
│ │ ├── test_api_dataset.py
│ │ ├── test_api_metric.py
│ │ ├── test_api_prompt_template.py
│ │ ├── test_api_recipe.py
│ │ ├── test_api_red_teaming.py
│ │ ├── test_api_result.py
│ │ ├── test_api_run.py
│ │ ├── test_api_runner.py
│ │ ├── test_api_session.py
│ │ ├── test_bookmark.py
│ │ ├── test_bookmark_arguments.py
│ │ ├── test_connector.py
│ │ ├── test_connector_endpoint.py
│ │ ├── test_connector_endpoint_arguments.py
│ │ ├── test_connector_prompt_arguments.py
│ │ ├── test_connector_response.py
│ │ ├── test_import_modules.py
│ │ ├── test_log.py
│ │ └── test_timeit.py
│ └── web_api/
│ ├── __init__.py
│ ├── test_routes/
│ │ ├── conftest.py
│ │ ├── test_routes_attack_modules.py
│ │ ├── test_routes_benchmarks.py
│ │ ├── test_routes_bm_results.py
│ │ ├── test_routes_bookmark.py
│ │ ├── test_routes_context_strategy.py
│ │ ├── test_routes_cookbook.py
│ │ ├── test_routes_dataset.py
│ │ ├── test_routes_endpoint.py
│ │ ├── test_routes_metrics.py
│ │ ├── test_routes_prompt_template.py
│ │ ├── test_routes_recipe.py
│ │ ├── test_routes_redteam.py
│ │ └── test_routes_runner.py
│ └── test_services/
│ ├── test_service_attack_modules.py
│ ├── test_service_benchmark_result.py
│ ├── test_service_bookmark.py
│ ├── test_service_context_strategy.py
│ ├── test_service_cookbook.py
│ ├── test_service_dataset.py
│ ├── test_service_endpoint.py
│ ├── test_service_metric.py
│ ├── test_service_prompt_template.py
│ ├── test_service_recipe.py
│ ├── test_service_runner.py
│ └── test_service_session.py
└── third-party/
├── pygments-2.18.0-py3-none-any.whl
└── text_unidecode-1.3-py2.py3-none-any.whl
================================================
FILE CONTENTS
================================================
================================================
FILE: .coveragerc
================================================
# .coveragerc to control coverage.py
[run]
branch = True
cover_pylib = False
[coverage:report]
skip_empty = true
omit = /usr/*, moonshot/api.py, moonshot/src/storage/*_interface.py
exclude_lines =
@abstractmethod
@abc.abstractmethod
================================================
FILE: .flake8
================================================
[flake8]
max-line-length = 120
extend-ignore = E203
per-file-ignores = cli.py:F401 benchmark.py:F403,F405 initialisation.py:F403,F405 redteam.py:F403,F405
================================================
FILE: .github/developing-workflows.md
================================================
Developing GitHub Workflows
===========================
Follow these instructions to develop Github workflows in a non-main branch
instead of in the main branch to avoid creating unwanted commit records to
the main branch.
Workflows created in a non-main branch can only be run via CLI as follows:
`gh workflow run <workflow-name> --ref <branch-name> -f <parameter-name>=<parameter-value>`
For example, to run a workflow called License File Generation created in the ci-workflow-dev branch:
`gh workflow run 'License File Generation' --ref ci-workflow-dev -f repo=aiverify-foundation/moonshot -f branch=ci-workflow-dev`
To run the workflow via CLI, it must appear in the workflow list when you
run the following command:
`gh workflow list`
If it is not in the list, you have to trigger it once, this can be done by
creating a trigger for push in your workflow as follows and pushing a commit
to the branch. Once the workflow appears in the workflow list, you can remove
the trigger for push from your workflow.
on:
push:
branches: [ "ci-workflow-dev" ]
================================================
FILE: .github/pull_request_template.md
================================================
## Description
[Provide a brief description of the changes or features introduced by this pull request.]
## Motivation and Context
[Explain the motivation or the context behind this pull request. Why is it necessary?]
## Type of Change
<!-- Select the appropriate type of change: -->
<!-- - feat: A new feature -->
<!-- - fix: A bug fix -->
<!-- - chore: Routine tasks, maintenance, or tooling changes -->
<!-- - docs: Documentation updates -->
<!-- - style: Code style changes (e.g., formatting, indentation) -->
<!-- - refactor: Code refactoring without changes in functionality -->
<!-- - test: Adding or modifying tests -->
<!-- - perf: Performance improvements -->
<!-- - ci: Changes to the CI/CD configuration or scripts -->
<!-- - other: Other changes that don't fit into the above categories -->
## How to Test
[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.]
## Checklist
Please check all the boxes that apply to this pull request using "x":
- [ ] I have tested the changes locally and verified that they work as expected.
- [ ] I have added or updated the necessary documentation (README, API docs, etc.).
- [ ] I have added appropriate unit tests or functional tests for the changes made.
- [ ] I have followed the project's coding conventions and style guidelines.
- [ ] I have rebased my branch onto the latest commit of the main branch.
- [ ] I have squashed or reorganized my commits into logical units.
- [ ] I have added any necessary dependencies or packages to the project's build configuration.
- [ ] I have performed a self-review of my own code.
- [ ] I have read, understood and agree to the Developer Certificate of Origin below, which this project utilises.
## Screenshots (if applicable)
[If the changes involve visual modifications, include screenshots or GIFs that demonstrate the changes.]
## Additional Notes
[Add any additional information or context that might be relevant to reviewers.]
<details>
<summary>Developer Certificate of Origin</summary>
```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
</details>
================================================
FILE: .github/scripts/create_backup.sh
================================================
#!/bin/bash
BASE_DIR=~/moonshot
MOONSHOT_DIR=moonshot-sit
# Moonshot SIT dir
SIT_DIR=$BASE_DIR/$MOONSHOT_DIR
# Backup directory and the maximum number of backups
BACKUP_DIR=$BASE_DIR/backups
MAX_BACKUPS=5
# Check if the moonshot directory exists
if [ ! -d $SIT_DIR ]; then
echo "Skip backup: $SIT_DIR dir does not exist."
exit 0
fi
# Create the backup directory if it doesn't exist
mkdir -p $BACKUP_DIR
# Find the highest existing backup number
highest_backup=$(ls $BACKUP_DIR | grep -oP 'backup_\d+' | grep -oP '\d+' | sort -n | tail -1)
highest_backup=${highest_backup:-0}
# If the number of backups is less than the maximum, increment the highest backup number
if [ $(ls $BACKUP_DIR | wc -l) -lt $MAX_BACKUPS ]; then
new_backup=$((highest_backup + 1))
else
# If the number of backups is equal to the maximum, delete the oldest backup and shift the remaining backups
oldest_backup=$(ls $BACKUP_DIR | grep -oP 'backup_\d+' | grep -oP '\d+' | sort -n | head -1)
rm -rf $BACKUP_DIR/backup_$oldest_backup
for i in $(seq $((oldest_backup + 1)) $highest_backup); do
mv $BACKUP_DIR/backup_$i $BACKUP_DIR/backup_$((i - 1))
done
new_backup=$highest_backup
fi
# Create a new backup by moving the moonshot dir to the backup dir with the new backup number
mv $SIT_DIR $BACKUP_DIR/backup_$new_backup
================================================
FILE: .github/scripts/install_ms_service.sh
================================================
#!/bin/bash
# Arguments for branches, default to dev_main if not provided.
MOONSHOT_BRANCH=${1:-dev_main}
MOONSHOT_DATA_BRANCH=${2:-dev_main}
MOONSHOT_UI_BRANCH=${3:-dev_main}
BASE_DIR=~/moonshot
SCRIPTS_DIR=~/scripts
#BASE_DIR=./moonshot-test
#SCRIPTS_DIR=./.github/scripts
MOONSHOT_SIT=moonshot-sit
# Install moonshot from GitHub
# Create BASE_DIR if it does not
if [ ! -d "$BASE_DIR" ]; then
mkdir -p "$BASE_DIR"
fi
cd $BASE_DIR
# Clone the repositories from the specified branches
echo "Cloning moonshot from branch $MOONSHOT_BRANCH"
echo "Cloning moonshot-data from branch $MOONSHOT_DATA_BRANCH"
echo "Cloning moonshot-ui from branch $MOONSHOT_UI_BRANCH"
git clone --branch $MOONSHOT_BRANCH https://github.com/aiverify-foundation/moonshot.git $MOONSHOT_SIT
cd $MOONSHOT_SIT
git clone --branch $MOONSHOT_DATA_BRANCH https://github.com/aiverify-foundation/moonshot-data.git
git clone --branch $MOONSHOT_UI_BRANCH https://github.com/aiverify-foundation/moonshot-ui.git
cp $SCRIPTS_DIR/moonshot_env .env
python3 -m venv venv
source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
cd moonshot-data
pip install -r requirements.txt
# Install Node.js dependencies and build the UI
cd ../moonshot-ui
rm .env.local
cp $SCRIPTS_DIR/moonshot_ui_env .env.local
npm install
# Modify the start script in package.json
sudo apt-get install -y jq
jq '.scripts.start = "next start -H 0.0.0.0 -p 3100"' package.json > package.tmp.json && mv package.tmp.json package.json
npm run build
================================================
FILE: .github/scripts/moonshot_env
================================================
# .env for moonshot SIT
# For Data
ATTACK_MODULES="./moonshot-data/attack-modules"
BOOKMARKS="./moonshot-data/generated-outputs/bookmarks"
CONNECTORS="./moonshot-data/connectors"
CONNECTORS_ENDPOINTS="./moonshot-data/connectors-endpoints"
CONTEXT_STRATEGY="./moonshot-data/context-strategy"
COOKBOOKS="./moonshot-data/cookbooks"
DATABASES="./moonshot-data/generated-outputs/databases"
DATABASES_MODULES="./moonshot-data/databases-modules"
DATASETS="./moonshot-data/datasets"
IO_MODULES="./moonshot-data/io-modules"
METRICS="./moonshot-data/metrics"
PROMPT_TEMPLATES="./moonshot-data/prompt-templates"
RECIPES="./moonshot-data/recipes"
RESULTS="./moonshot-data/generated-outputs/results"
RESULTS_MODULES="./moonshot-data/results-modules"
RUNNERS="./moonshot-data/generated-outputs/runners"
RUNNERS_MODULES="./moonshot-data/runners-modules"
TOKENIZERS_PARALLELISM = false
# For Web API
HOST_ADDRESS=127.0.0.1 # The interface the server will bind to
HOST_PORT=5100
# URI of the Web UI webhook
MOONSHOT_UI_CALLBACK_URL=http://localhost:3100/api/v1/benchmarks/status
================================================
FILE: .github/scripts/moonshot_test_env
================================================
ADDITIONAL_PARAMETERS='{
"timeout": 300,
"allow_retries": true,
"num_of_retries": 3,
"temperature": 0.5,
"model": "gpt-4o"
}'
================================================
FILE: .github/scripts/moonshot_ui_env
================================================
# .env for moonshot-ui SIT
HOST=127.0.0.1
PORT=3100
MOONSHOT_API_URL=http://0.0.0.0:5100
================================================
FILE: .github/scripts/run_smoke_test.sh
================================================
#!/bin/bash
AZURE_OPENAI_API_KEY=$1
AZURE_OPENAI_ENDPOINT=$2
TEST_BRANCH_NAME=${3:-main}
BASE_DIR=~/moonshot
SCRIPTS_DIR=~/scripts
# Export the env variables for smoke test to use
export AZURE_OPENAI_TOKEN=$AZURE_OPENAI_API_KEY
export AZURE_OPENAI_URI=$AZURE_OPENAI_ENDPOINT
export MOONSHOT_URL="http://127.0.0.1"
export MOONSHOT_PORT_NUMBER="3100"
export ADDITIONAL_PARAMETERS="{
'timeout': 300,
'allow_retries': true,
'num_of_retries': 3,
'temperature': 0.5,
'model': 'gpt-4o'
}"
cd $BASE_DIR
if [ -d "moonshot-smoke-testing" ]; then
echo "Removing existing moonshot-smoke-testing directory..."
rm -rf moonshot-smoke-testing
fi
# Clone the smoke test repo from the specified branch
echo "Cloning moonshot-smoke-testing repo from branch $BRANCH_NAME..."
git clone --branch $TEST_BRANCH_NAME https://github.com/aiverify-foundation/moonshot-smoke-testing.git
cd moonshot-smoke-testing
npm ci
cp $SCRIPTS_DIR/moonshot_test_env .env
echo "Created .env"
cat .env
# Install Playwright (if needed)
#sudo npx playwright install-deps
### If the above didn't work, try the following:
##sudo apt-get install libatk1.0-0\
## libatk-bridge2.0-0\
## libxkbcommon0\
## libatspi2.0-0\
## libxcomposite1\
## libxdamage1\
## libxfixes3\
## libxrandr2\
## libgbml
echo "Running smoke test on moonshot at $MOONSHOT_URL:$MOONSHOT_PORT_NUMBER..."
npx playwright test tests/smoke-test.spec.ts --reporter=list
#echo "Exit code: $?"
================================================
FILE: .github/scripts/start_ms_service.sh
================================================
!/bin/bash
BASE_DIR=~/moonshot
MOONSHOT_SIT=moonshot-sit
cd $BASE_DIR/$MOONSHOT_SIT
source venv/bin/activate
python -m moonshot web
================================================
FILE: .github/workflows/docs-update.yaml
================================================
name: "Docs Update"
on:
# push:
# branches: [ "docs" ]
workflow_dispatch:
inputs:
docs_branch:
description: 'Branch to checkout docs'
required: true
default: 'docs'
type: string
workflow_call:
inputs:
docs_branch:
description: 'Branch to checkout docs'
required: true
default: 'docs'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
docs-update:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ inputs.docs_branch }}
- name: Setup python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
# Install dependencies
- name: Install mkdocs
run: |
pip install mkdocs mkdocs-material mkdocstrings mkdocstrings-python mkdocs-swagger-ui-tag
- name: Build docs
run: |
mkdocs build
- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
pages-deploy:
needs: docs-update
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
# Ensure main branch can deploy to pages in the GitHub Pages Environment settings
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
================================================
FILE: .github/workflows/gh-event-notification.yaml
================================================
name: GH Event Notification
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Get Issue details
if: ${{ github.event_name == 'issues' }}
id: issue_details
env:
TITLE: ${{ github.event.issue.title }}
run: |
echo "type=issue" >> $GITHUB_ENV
echo "title=$TITLE" >> $GITHUB_ENV
echo "user=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
echo "url=${{ github.event.issue.html_url }}" >> $GITHUB_ENV
echo "repo=${{ github.repository }}" >> $GITHUB_ENV
- name: Get PR details
if: ${{ github.event_name == 'pull_request' }}
id: pr_details
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
echo "type=pull_request" >> $GITHUB_ENV
echo "title=$TITLE" >> $GITHUB_ENV
echo "user=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
echo "url=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "repo=${{ github.repository }}" >> $GITHUB_ENV
- name: Send notification to Slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"type": "${{ env.type }}",
"title": "${{ env.title }}",
"user": "${{ env.user }}",
"repo": "${{ env.repo }}",
"url": "${{ env.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GH_NOTIF_URL }}
================================================
FILE: .github/workflows/integration-test.yaml
================================================
# Integration Test
name: Moonshot Integration Test
on:
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
moonshot_branch:
description: 'Moonshot Branch / Tag Name'
required: true
default: 'main'
type: string
moonshot_data_branch:
description: 'Moonshot Data Branch / Tag Name'
required: true
default: 'main'
type: string
moonshot_ui_branch:
description: 'Moonshot UI Branch / Tag Name'
required: true
default: 'main'
type: string
run-ui-test-with-wip-tag-only:
description: 'Only run UI Test and with @wip tag (true/false)'
required: true
default: 'false'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
ui-test-endpoint:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running UI Endpoint Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/endpoint.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-endpoint-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-endpoint-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-homepage:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running Homepage Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/homepage.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-homepage-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-homepage-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-benchmarking:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running Benchmarking UI Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/benchmarking.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-benchmarking-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-benchmarking-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-benchmarking-imda-starter-kit:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running Benchmarking UI Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/benchmarking.imda-starter-kit.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-benchmarking-imda-starter-kit-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-benchmarking-imda-starter-kit-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-red-teaming:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running Red Teaming UI Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/red_teaming.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-redteaming-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-redteaming-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-utils:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running Homepage Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/utils.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-utils-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-utils-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-history:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running Homepage Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test tests/history.spec.ts --grep-invert "@wip|@flaky"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-history-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-history-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-with-flaky-tag:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running flaky test Cases from all test cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test --grep "@flaky" --grep-invert "@wip"
- name: Print Environment Variables
if: always()
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-with-flaky-tag-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-with-flaky-tag-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
ui-test-with-wip-tag:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Run Integration UI Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
URI2: ${{ secrets.URI2 }}
TOKEN2: ${{ secrets.TOKEN2 }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
TOGETHER_TOKEN: ${{ secrets.TOGETHER_TOKEN }}
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_TOKEN: ${{ secrets.GOOGLE_TOKEN }}
H2OGPT_TOKEN: ${{ secrets.H2OGPT_TOKEN }}
id: integrationuitest
run: |
source venv/bin/activate
cd moonshot-integration-testing/ui-integration-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
echo "Running work-in-progress Test Cases"
URI="$URI" TOKEN="$TOKEN" URI2="$URI2" TOKEN2="$TOKEN2" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" TOGETHER_TOKEN="$TOGETHER_TOKEN" OPENAI_TOKEN="$OPENAI_TOKEN" AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" GOOGLE_TOKEN="$GOOGLE_TOKEN" H2OGPT_TOKEN="$H2OGPT_TOKEN" DEBUG=pw:api npx playwright test --grep "@wip"
- name: Print Environment Variables
run: env
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-with-wip-tag-only-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-integration-testing/ui-integration-testing/test-results
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-ui-test-with-wip-tag-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
##########################################################################################################################################################################
cli-test:
if: ${{ inputs.run-ui-test-with-wip-tag-only == 'false' }}
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
source venv/bin/activate
cd moonshot-ui
npm install
npm run build
cd ../
nohup python -m moonshot web > moonshot.log 2>&1 &
- name: Checkout Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-integration-testing
- name: Print Environment Variables
run: env
- name: Run Integration CLI Test
env:
AZURE_OPENAI_URI: ${{ secrets.AZURE_OPENAI_URI }}
AZURE_OPENAI_TOKEN: ${{ secrets.AZURE_OPENAI_TOKEN }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
MOONSHOT_URL: ${{ secrets.MOONSHOT_URL }}
MOONSHOT_PORT_NUMBER: ${{ secrets.MOONSHOT_PORT_NUMBER }}
CLI_DIR: ${{ secrets.CLI_DIR }}
ACTIONS_STEP_DEBUG: true
ACTIONS_RUNNER_DEBUG: true
run: |
source venv/bin/activate
cd moonshot-integration-testing/cli-integration-testing
echo "Current Directory: $(pwd)"
pip install python-dotenv
pip install pytest
pytest
- name: Upload Moonshot logs
if: always()
uses: actions/upload-artifact@v4
with:
name: Moonshot-logs-integration-cli-test-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot.log
================================================
FILE: .github/workflows/notices-file-gen.yaml
================================================
name: Notices File Generation
on:
workflow_call:
inputs:
repo:
description: 'Repository name'
required: true
default: 'aiverify-foundation/moonshot'
type: string
branch:
description: 'Branch or tag'
required: true
default: 'main'
type: string
workflow_dispatch:
inputs:
repo:
description: 'Repository name'
required: true
default: 'aiverify-foundation/moonshot'
type: string
branch:
description: 'Branch or tag'
required: true
default: 'main'
type: string
jobs:
notices-file-gen:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.branch }}
submodules: recursive
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Generate notices file
run: |
set +e
pip install -r requirements.txt
npm install
repo_name=$(echo "${{ github.event.inputs.repo }}" | awk -F'/' '{print $2}')
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-${repo_name} \
--detect.project.version.name=${{ github.event.inputs.branch }} \
--detect.source.path=. \
--detect.code.location.name="aiverify-${repo_name}_${{ github.event.inputs.branch }}" \
--detect.excluded.directories=/tests \
--blackduck.trust.cert=true \
--detect.excluded.detector.types=POETRY \
--detect.blackduck.scan.mode=RAPID \
--detect.notices.report=true \
--detect.notices.report.path=.
set -e
ls -al
cat ./*_Black_Duck_Notices_Report.txt
#
# - name: Commit notices file
# run: |
# set +e
# mv aiverify_moonshot_main_Black_Duck_Notices_Report.txt NOTICES.md
# git add NOTICES.md
# git config user.name "imda-btg"
# git config user.email "idma-btg@imda.gov.sg"
# git commit -m "update notices file"
# git push
# set -e
#
================================================
FILE: .github/workflows/pre-build-checks.yaml
================================================
# Pre-build Checks (for moonshot)
# 1. Unit tests with code coverage (pytest)
# 2. Code quality analysis (flake8)
# 3. Dependency analysis (vulnerabilities)
# 4. Dependency analysis (undesirable licenses)
# 5. Send slack notification on check results
name: Pre-Build Checks
on:
# Runs when a pull request to main is being assigned
pull_request:
types: [ assigned, synchronize ]
branches:
- 'dev_main'
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
branch_to_test:
description: 'Branch or tag to run test'
required: true
default: 'dev_main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
pre-build-checks:
# Run only when PR is assigned, even on subsequent commits (i.e. synchronize)
if: (github.event_name == 'pull_request' && github.event.pull_request.assignee != null) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Set branch variable (pull_request)
if: github.event_name == 'pull_request'
run: |
echo "MS_BRANCH=${{ github.event.pull_request.head.ref }}" >> "$GITHUB_ENV"
echo "MS_DATA_BRANCH=dev_main" >> "$GITHUB_ENV"
echo "PR_NUM=#${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
- name: Set branch variable (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo "MS_BRANCH=${{ inputs.branch_to_test }}" >> "$GITHUB_ENV"
echo "MS_DATA_BRANCH=dev_main" >> "$GITHUB_ENV"
echo "PR_NUM=#0" >> "$GITHUB_ENV"
echo "${{ inputs.branch_to_test }}"
# Checkout moonshot code
- name: Checkout code (moonshot)
uses: actions/checkout@v3
with:
ref: ${{ env.MS_BRANCH }}
submodules: recursive
- name: Setup python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
# Checkout moonshot-data code
- name: Checkout code (moonshot-data)
uses: actions/checkout@v3
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ env.MS_DATA_BRANCH }}
submodules: recursive
path: moonshot-data
# Install dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r moonshot-data/requirements.txt
pip install pytest pytest-mock pytest-html pytest-json pytest-cov coverage httpx anybadge
pip install flake8 flake8-html
# Setup .env file
- name: Setup env file
run: |
echo "# For Data
ATTACK_MODULES=\"./moonshot-data/attack-modules\"
BOOKMARKS=\"./moonshot-data/generated-outputs/bookmarks\"
CONNECTORS=\"./moonshot-data/connectors\"
CONNECTORS_ENDPOINTS=\"./moonshot-data/connectors-endpoints\"
CONTEXT_STRATEGY=\"./moonshot-data/context-strategy\"
COOKBOOKS=\"./moonshot-data/cookbooks\"
DATABASES=\"./moonshot-data/generated-outputs/databases\"
DATABASES_MODULES=\"./moonshot-data/databases-modules\"
DATASETS=\"./moonshot-data/datasets\"
IO_MODULES=\"./moonshot-data/io-modules\"
METRICS=\"./moonshot-data/metrics\"
PROMPT_TEMPLATES=\"./moonshot-data/prompt-templates\"
RECIPES=\"./moonshot-data/recipes\"
RESULTS=\"./moonshot-data/generated-outputs/results\"
RESULTS_MODULES=\"./moonshot-data/results-modules\"
RUNNERS=\"./moonshot-data/generated-outputs/runners\"
RUNNERS_MODULES=\"./moonshot-data/runners-modules\"
TOKENIZERS_PARALLELISM=false
# For Web API
HOST_ADDRESS=127.0.0.1
HOST_PORT=5000" > .env
cat .env
# Check 1: Unit tests & coverage
- name: Unit tests with coverage
id: unit_tests
if: ${{ ! cancelled() }}
timeout-minutes: 30
run: |
set +e
bash ci/run-test.sh
source ci/gen_pre_build_summ.sh test
test_status=$?
source ci/gen_pre_build_summ.sh coverage
coverage_status=$?
echo "UNIT_TESTS_STATUS=$UNITTEST_SUMMARY" >> $GITHUB_ENV
echo "CODE_COVERAGE_STATUS=$COVERAGE_SUMMARY" >> $GITHUB_ENV
set -e
if [ $test_status -ne 0 ] || [ $coverage_status -ne 0 ]; then
exit 1
fi
# Check 2: Code quality analysis (flake8)
- name: Code quality analysis (flake8)
id: code_quality
if: ${{ ! cancelled() }}
run: |
set +e
bash ci/run-flake8.sh
source ci/gen_pre_build_summ.sh lint
lint_status=$?
echo "CODE_QUALITY_STATUS=$LINT_SUMMARY" >> $GITHUB_ENV
set -e
exit $lint_status
# Check 3: Dependency vulnerability & license analysis (pip-audit)
- name: Dependency analysis (vulnerabilities & licenses)
id: dependency_analysis
if: ${{ ! cancelled() }}
run: |
set +e
bash ci/run-pip-audit.sh
source ci/gen_pre_build_summ.sh dependency
dep_status=$?
source ci/gen_pre_build_summ.sh license
lic_status=$?
echo "DEPENDENCY_STATUS=$DEPENDENCY_SUMMARY" >> $GITHUB_ENV
echo "LICENSE_STATUS=$LICENSE_SUMMARY" >> $GITHUB_ENV
set -e
if [ $dep_status -ne 0 ] || [ $lic_status -ne 0 ]; then
exit 1
fi
# - name: Capture step statuses
# if: ${{ ! cancelled() }}
# run: |
# echo "UNIT_TESTS_STATUS=${{ steps.unit_tests.outcome }}" >> $GITHUB_ENV
# echo "CODE_QUALITY_STATUS=${{ steps.code_quality.outcome }}" >> $GITHUB_ENV
# echo "DEPENDENCY_ANALYSIS_STATUS=${{ steps.dependency_analysis.outcome }}" >> $GITHUB_ENV
# Send slack notification
- name: Send slack notification
if: ${{ ! cancelled() }}
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"workflow": "${{ github.repository }} | ${{ github.workflow }} | ${{ env.PR_NUM }}",
"status": "${{ job.status }}",
"details": "${{ env.UNIT_TESTS_STATUS }} | ${{ env.CODE_COVERAGE_STATUS }} | ${{ env.CODE_QUALITY_STATUS }} | ${{ env.DEPENDENCY_STATUS }} | ${{ env.LICENSE_STATUS }}",
"ref": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
================================================
FILE: .github/workflows/pypi-deployment.yaml
================================================
# PyPi
name: PyPi Deployment
on:
# Run this workflow manually from Actions tab
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11.6"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/aiverify-moonshot
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
================================================
FILE: .github/workflows/sast-codeql.yaml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "SAST - CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "dev_main" ]
# # Trigger every Friday at 10:05pm (14:05 UTC)
# # cron: min hr day-of-mth mth day-of-week
# schedule:
# - cron: "5 14 * * 5"
workflow_dispatch:
inputs:
branch_to_test:
description: 'Branch or tag to run test'
required: true
default: 'dev_main'
type: string
workflow_call:
inputs:
branch_to_test:
description: 'Branch or tag to run test'
required: true
default: 'dev_main'
type: string
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Set branch variable (pull_request)
if: github.event_name == 'pull_request'
run: |
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> "$GITHUB_ENV"
echo "PR_NUM=#${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
- name: Set branch variable (workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo "BRANCH=${{ inputs.branch_to_test }}" >> "$GITHUB_ENV"
echo "PR_NUM=#0" >> "$GITHUB_ENV"
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}
submodules: recursive
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
id: codeql_analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Generate CodeQL Analysis Summary
id: codeql_summary
if: ${{ ! cancelled() }}
run: |
set +e
source ci/run-codeql-summ.sh
exit_code=$?
set -e
echo "CODEQL_SUMMARY=$CODEQL_SUMMARY" >> $GITHUB_ENV
exit $exit_code
env:
GH_TOKEN: ${{ github.token }}
# Send slack notification
- name: Send slack notification
if: ${{ ! cancelled() }}
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"workflow": "${{ github.repository }} - ${{ github.workflow }} - ${{ env.PR_NUM }}",
"status": "SAST: ${{ steps.codeql_summary.outcome }}",
"details": "${{ env.CODEQL_SUMMARY }}",
"ref": "${{ github.server_url }}/${{ github.repository }}/security/code-scanning"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
================================================
FILE: .github/workflows/sca-scan.yaml
================================================
name: Software Composition Analysis
# Runs when a pull request review is being submitted
on:
pull_request:
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
branch_to_test:
description: 'Branch or tag to run test'
required: true
default: 'main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
software-composition-analysis:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Code (Pull_Request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: recursive
- name: Checkout Code (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_to_test }}
- name: Set Branch Variable (Pull_Request)
if: github.event_name == 'pull_request'
run: |
echo "BRANCH=branch" >> "$GITHUB_ENV"
- name: Set Branch Variable (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo "BRANCH=${{ inputs.branch_to_test }}" >> "$GITHUB_ENV"
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install & Scan MOONSHOT (Pull_Request)
if: github.event_name == 'pull_request'
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
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 --detect.blackduck.scan.mode=RAPID
cd ../
- name: Install & Scan MOONSHOT (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
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=venv,tests --blackduck.trust.cert=true --detect.excluded.detector.types=POETRY --detect.notices.report=true --detect.notices.report.path=.
mv aiverify_moonshot_main_Black_Duck_Notices_Report.txt NOTICES.md
- name: Configure GIT (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
git config --global user.email "${{ github.actor }}"
git config --global user.name "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
shell: bash
- name: Switch to branch (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
git checkout -B notices
shell: bash
- name: Commit Notice File (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
git add .
git commit -m "Update NOTICES.md"
git push -f -u origin HEAD
shell: bash
- name: Create PR (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "Update NOTICES.md for Moonshot" --body "This PR updates Notice File for Moonshot" --base main --head notices
shell: bash
- name: Merge PR (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pr_number=$(gh pr list --state open --limit 1 --json number --jq '.[0].number')
gh pr merge $pr_number --merge --admin
shell: bash
================================================
FILE: .github/workflows/sit-build.yaml
================================================
name: SIT Build
on:
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
branch_moonshot:
description: 'moonshot branch or tag'
required: true
default: 'dev_main'
type: string
branch_moonshot_data:
description: 'moonshot-data branch or tag'
required: true
default: 'dev_main'
type: string
branch_moonshot_ui:
description: 'moonshot-ui branch or tag'
required: true
default: 'dev_main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
# Remote deployment of moonshot to SIT server
sit-build:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ap-southeast-1
# - name: S3 test
# run: |
# aws s3 ls ${{ vars.AWS_S3_PATH }}
# echo "This job's status is ${{ job.status }}."
# Deploy moonshot
- name: Backup current install
run: |
command_id=$(aws ssm send-command \
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
--document-name "AWS-RunShellScript" \
--comment "Backup current install" \
--parameters 'commands=["sudo su - ubuntu -c \". ~/scripts/create_backup.sh\""]' \
--query "Command.CommandId" \
--output text)
aws ssm wait command-executed \
--command-id "$command_id" \
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}"
status=$(aws ssm list-command-invocations \
--command-id "$command_id" \
--details \
--query "CommandInvocations[0].Status" \
--output text)
echo "Command status: $status"
- name: Install moonshot
timeout-minutes: 30
run: |
command_id=$(aws ssm send-command \
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
--document-name "AWS-RunShellScript" \
--comment "Install moonshot" \
--parameters 'commands=["sudo su - ubuntu -c \". ~/scripts/install_ms_service.sh ${{ inputs.branch_moonshot }} ${{ inputs.branch_moonshot_data }} ${{ inputs.branch_moonshot_ui }}\""]' \
--query "Command.CommandId" \
--output text)
max_attempts=20
delay=60
attempts=0
while [ $attempts -lt $max_attempts ]; do
status=$(aws ssm list-command-invocations \
--command-id "$command_id" \
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}" \
--query "CommandInvocations[0].Status" \
--output text)
if [ "$status" == "Success" ]; then
echo "Command status: $status"
exit 0
elif [ "$status" == "InProgress" ]; then
echo "Command status: $status, waiting..."
sleep $delay
attempts=$((attempts + 1))
else
echo "Command status: $status"
exit 1
fi
done
echo "Max attempts reached, exiting."
exit 1
- name: Start moonshot web
run: |
command_id=$(aws ssm send-command \
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
--document-name "AWS-RunShellScript" \
--comment "Start moonshot web" \
--parameters 'commands=["sudo systemctl restart moonshot-service"]' \
--query "Command.CommandId" \
--output text)
aws ssm wait command-executed \
--command-id "$command_id" \
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}"
status=$(aws ssm list-command-invocations \
--command-id "$command_id" \
--details \
--query "CommandInvocations[0].Status" \
--output text)
echo "Command status: $status"
# - name: Run smoke test
# timeout-minutes: 30
# run: |
# command_id=$(aws ssm send-command \
# --instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
# --document-name "AWS-RunShellScript" \
# --comment "Run smoke test" \
# --parameters 'commands=["sudo su - ubuntu -c \". ~/scripts/run_smoke_test.sh ${{ secrets.AZURE_OPENAI_TOKEN }} ${{ secrets.AZURE_OPENAI_URI }} \""]' \
# --query "Command.CommandId" \
# --output text)
#
# max_attempts=20
# delay=60
# attempts=0
#
# while [ $attempts -lt $max_attempts ]; do
# status=$(aws ssm list-command-invocations \
# --command-id "$command_id" \
# --instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}" \
# --query "CommandInvocations[0].Status" \
# --output text)
#
# if [ "$status" == "Success" ] || [ "$status" == "Failed" ]; then
# output=$(aws ssm get-command-invocation \
# --command-id "$command_id" \
# --instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}" \
# --query "StandardOutputContent" \
# --output text)
# echo "SMOKE_TEST_STATUS=$status" >> $GITHUB_ENV
# echo "Smoke test output: $output"
# echo "Command status: $status"
# if [ "$status" == "Success" ]; then
# exit 0
# else
# exit 1
# fi
# elif [ "$status" == "InProgress" ]; then
# echo "Command status: $status, waiting..."
# sleep $delay
# attempts=$((attempts + 1))
# else
# echo "Unexpected command status: $status"
# echo "SMOKE_TEST_STATUS=$status" >> $GITHUB_ENV
# exit 1
# fi
# done
#
# echo "Max attempts reached, exiting."
# echo "SMOKE_TEST_STATUS=timeout" >> $GITHUB_ENV
# exit 1
# Remote execution of integration test in SIT server
- name: Run integration test
run: |
echo "Run integration test in SIT server..."
echo "INTG_TEST_STATUS=NotRun" >> $GITHUB_ENV
# Send slack notification
- name: Send slack notification
if: ${{ ! cancelled() }}
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"workflow": "${{ github.repository }} | ${{ github.workflow }}",
"status": "${{ job.status }}",
"details": "${{ env.INTG_TEST_STATUS }}",
"ref": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
================================================
FILE: .github/workflows/smoke-test-cli.yaml
================================================
# Cli Smoke Test
name: Moonshot CLI Smoke Test
on:
# Runs on Pull Request Review
pull_request:
types: [ assigned, synchronize ]
branches:
- 'dev_main'
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
moonshot_branch:
description: 'Moonshot Branch / Tag Name'
required: true
default: 'dev_main'
type: string
moonshot_data_branch:
description: 'Moonshot Data Branch / Tag Name'
required: true
default: 'dev_main'
type: string
moonshot_ui_branch:
description: 'Moonshot UI Branch / Tag Name'
required: true
default: 'dev_main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
smoke-test:
if: (github.event_name == 'pull_request' && github.event.pull_request.assignee != null) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Pull Request Review)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Pull Request Review)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ vars.MOONSHOT_DATA_BRANCH }}
path: moonshot-data
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Pull Request Review)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ vars.MOONSHOT_UI_BRANCH }}
path: moonshot-ui
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
- name: Setup Moonshot UI
run: |
cd moonshot-ui
npm ci
npm run build
cd ../
- name: Checkout Smoke Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-smoke-testing
path: moonshot-smoke-testing
- name: Run Smoke Test
env:
AZURE_OPENAI_URI: ${{ secrets.AZURE_OPENAI_URI }}
AZURE_OPENAI_TOKEN: ${{ secrets.AZURE_OPENAI_TOKEN }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
MOONSHOT_URL: ${{ secrets.MOONSHOT_URL }}
MOONSHOT_PORT_NUMBER: ${{ secrets.MOONSHOT_PORT_NUMBER }}
CLI_DIR: ${{ secrets.CLI_DIR }}
run: |
source venv/bin/activate
cd moonshot-smoke-testing
cd tests
pip install python-dotenv
pip install pytest
pytest test_cli.py
================================================
FILE: .github/workflows/smoke-test.yaml
================================================
# Smoke Test
name: Moonshot Smoke Test
on:
# Runs when a pull request to main is being assigned
pull_request:
types: [ assigned, synchronize ]
branches:
- 'dev_main'
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
moonshot_branch:
description: 'Moonshot Branch / Tag Name'
required: true
default: 'dev_main'
type: string
moonshot_data_branch:
description: 'Moonshot Data Branch / Tag Name'
required: true
default: 'dev_main'
type: string
moonshot_ui_branch:
description: 'Moonshot UI Branch / Tag Name'
required: true
default: 'dev_main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
smoke-test:
if: (github.event_name == 'pull_request' && github.event.pull_request.assignee != null) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
# [WS-299] Remove pre-installed tools to free up space for installation of moonshot-data
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
# Required for Python
tool-cache: false
# Remove tools
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout Moonshot (Pull Request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout Moonshot (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot
ref: ${{ inputs.moonshot_branch }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Moonshot
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
touch .env
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env
- name: Checkout Moonshot Data (Pull Request Review)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ vars.MOONSHOT_DATA_BRANCH }}
path: moonshot-data
- name: Checkout Moonshot Data (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ inputs.moonshot_data_branch }}
path: moonshot-data
- name: Setup Moonshot Data
run: |
source venv/bin/activate
cd moonshot-data
pip install -r requirements.txt
- name: Checkout Moonshot UI (Pull Request Review)
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ vars.MOONSHOT_UI_BRANCH }}
path: moonshot-ui
- name: Checkout Moonshot UI (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-ui
ref: ${{ inputs.moonshot_ui_branch }}
path: moonshot-ui
# Download NLTK stopwords
- name: Download NLTK stopwords
run: |
source venv/bin/activate
pip install nltk
python -c "import nltk; nltk.download('stopwords');nltk.download('punkt');nltk.download('punkt_tab');nltk.download('averaged_perceptron_tagger_eng')"
- name: Setup Moonshot UI
run: |
cd moonshot-ui
npm install
npm run build
cd ../
source venv/bin/activate
python -m moonshot web &
- name: Checkout Smoke Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-smoke-testing
path: moonshot-smoke-testing
- name: Run Smoke Test
env:
AZURE_OPENAI_URI: ${{ secrets.AZURE_OPENAI_URI }}
AZURE_OPENAI_TOKEN: ${{ secrets.AZURE_OPENAI_TOKEN }}
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }}
MOONSHOT_URL: ${{ secrets.MOONSHOT_URL }}
MOONSHOT_PORT_NUMBER: ${{ secrets.MOONSHOT_PORT_NUMBER }}
run: |
source venv/bin/activate
cd moonshot-smoke-testing
npm ci
npx playwright install
npx playwright install-deps
npm install dotenv --save
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 --trace on
- name: Upload Playwright Traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-trace-integration-ui-test-redteaming-${{ github.run_id }}
path: |
/home/runner/work/moonshot/moonshot/moonshot-smoke-testing/test-results
================================================
FILE: .github/workflows/test-pypi-deployment.yaml
================================================
# Test PyPi
name: Test PyPi Deployment
on:
# Run this workflow manually from Actions tab
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/aiverify-moonshot
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
================================================
FILE: .github/workflows/uat-build.yaml
================================================
name: UAT Build
# Trigger when the PR to merge to main is merged
on:
pull_request:
branches:
- main
types: [closed]
jobs:
build-python-package:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
submodules: recursive
- name: Setup python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt
- name: Bump version
run: |
echo "Bump version..."
pip install bump2version
bump2version patch
- name: Generate notices file
run: |
echo "Generate notice file..."
- name: Package test PyPI
run: |
echo "Package test PyPI..."
pip install build
python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package
path: dist/
publish-to-testpypi:
needs:
- build-python-package
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/aiverify-moonshot
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download python package
uses: actions/download-artifact@v3
with:
name: python-package
path: dist/
- name: Publish to test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
# Deploy moonshot to UAT by installing moonshot package from test pypi
# deploy-to-uat:
# needs:
# - publish-to-testpypi
# runs-on: ubuntu-latest
# Run integration test
# integration-test:
# needs:
# - publish-to-testpypi:
# runs-on: ubuntu-latest
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# MacOS
*.DS_Store
# Distribution / packaging
.Python
build/
develop-eggs/
#dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
# User defined files
moonshot/data/connectors-endpoints/*.json
moonshot/data/generated-outputs/databases/*.db
moonshot/data/generated-outputs/results/*.json
moonshot/data/generated-outputs/runners/*.json
moonshot/data/sessions/*.json
# dev settings
.vscode/
# build files
dist/
*.db
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
exclude: ^tests
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
language_version: python3.11
exclude: ^tests
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
name: flake8 - Python linting
exclude: ^tests
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4
hooks:
- id: gitleaks
================================================
FILE: AUTHORS.md
================================================
# Credits
Developers
----------------
* The Moonshot Team
================================================
FILE: LICENSE.md
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2024 The Moonshot Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: NOTICES.md
================================================
Copyright 2025
[aiverify-moonshot : main]
Phase: DEVELOPMENT
Distribution: OPENSOURCE
Components:
aiohappyeyeballs 2.4.4 : Python Software Foundation License 2.0
aiohttp 3.10.11 : Apache License 2.0
aiosignal 1.3.2 : Apache License 2.0
aiverify-moonshot 0.6.0 : Apache License 2.0
annotated-types 0.7.0 : MIT License
anyio 4.6.2.post1 : MIT License
Click - Python Command Line Utility 8.1.8 : BSD 3-clause "New" or "Revised" License
cmd2 2.4.3 : MIT License
datasets 2.21.0 : Apache License 2.0
ets-labs/python-dependency-injector 4.41.0 : BSD 3-clause "New" or "Revised" License
filesystem_spec 2024.6.1 : BSD 3-clause "New" or "Revised" License
frozenlist 1.4.1 : Apache License 2.0
h11 0.14.0 : MIT License
huggingface-hub 0.25.2 : Apache License 2.0
idna 3.10 : BSD 3-clause "New" or "Revised" License
ijson 3.3.0 : BSD 3-clause "New" or "Revised" License
jinjapython 3.1.5 : BSD 3-clause "New" or "Revised" License
markdown-it-py 3.0.0 : MIT License
MarkupSafe 2.1.5 : BSD 3-clause "New" or "Revised" License
mdurl 0.1.2 : MIT License
moonshot-admin/moonshot 0.5.1 : Apache License 2.0
multi_process 0.70.16 : BSD 3-clause "New" or "Revised" License
multidict 6.1.0 : Apache License 2.0
NumPy 1.26.4 : BSD 3-clause "New" or "Revised" License
Packaging 24.2 : (BSD 2-clause "Simplified" License OR Apache License 2.0)
pandas-python 2.2.3 : BSD 3-clause "New" or "Revised" License
psf-requests 2.32.3 : Apache License 2.0
py-filelock 3.16.1 : The Unlicense
pyarrow 17.0.0 : Apache License 2.0
pydantic 2.8.2 : MIT License
pydantic-core 2.20.1 : MIT License
Pygments - Python syntax highlighter 2.18.0 : BSD 2-clause "Simplified" License
Pyparsing 3.1.4 : MIT License
pyperclip 1.9.0 : BSD 3-clause "New" or "Revised" License
Python six 1.16.0 : MIT License
Python tzdata 2024.2 : Apache License 2.0
python-attrs 24.2.0 : MIT License
python-certifi 2024.8.30 : Mozilla Public License 2.0
python-dateutil 2.9.0.post0 : (Apache License 2.0 OR BSD 3-clause "New" or "Revised" License)
python-dill 0.3.8 : BSD 3-clause "New" or "Revised" License
python-dotenv 1.0.1 : BSD 3-clause "New" or "Revised" License
python-slugify 8.0.4 : MIT License
python-typing-extensions 4.12.2 : Python Software Foundation License 2.3
python3-charset-normalizer 3.3.2 : MIT License
PyTZ - Python Time Zone Library 2024.2 : MIT License
PyYAML 6.0.2 : MIT License
rich 13.9.4 : MIT License
sniffio 1.3.1 : Apache License 2.0
Starlette 0.41.3 : BSD 3-clause "New" or "Revised" License
tenacity 8.5.0 : Apache License 2.0
text-unidecode 1.3 : Artistic License 1.0
tqdm 4.66.6 : (MIT License AND Mozilla Public License 2.0)
urllib3 2.2.3 : MIT License
uvicorn 0.30.6 : BSD 3-clause "New" or "Revised" License
wcwidth 0.2.13 : MIT License
xxhash 3.5.0 : BSD 3-clause "New" or "Revised" License
yarl 1.13.1 : Apache License 2.0
Licenses:
Apache License 2.0
(aiohttp 3.10.11, aiosignal 1.3.2, aiverify-moonshot 0.6.0, datasets 2.21.0, frozenlist 1.4.1, huggingface-hub 0.25.2, moonshot-admin/moonshot 0.5.1, multidict 6.1.0, Packaging 24.2, psf-requests 2.32.3, pyarrow 17.0.0, Python tzdata 2024.2, python-dateutil 2.9.0.post0, sniffio 1.3.1, tenacity 8.5.0, yarl 1.13.1)
Apache License
Version 2.0, January 2004
=========================
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions
granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is
based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work by
the copyright owner or by an individual or Legal Entity authorized to submit on
behalf of the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent to the
Licensor or its representatives, including but not limited to communication on
electronic mailing lists, source code control systems, and issue tracking systems
that are managed by, or on behalf of, the Licensor for the purpose of discussing
and improving the Work, but excluding communication that is conspicuously marked
or otherwise designated in writing by the copyright owner as "Not a
Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of
whom a Contribution has been received by Licensor and subsequently incorporated
within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
reproduce, prepare Derivative Works of, publicly display, publicly perform,
sublicense, and distribute the Work and such Derivative Works in Source or Object
form.
3. Grant of Patent License. Subject to the terms and conditions of this License,
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and otherwise
transfer the Work, where such license applies only to those patent claims
licensable by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s) with the Work to
which such Contribution(s) was submitted. If You institute patent litigation
against any entity (including a cross-claim or counterclaim in a lawsuit)
alleging that the Work or a Contribution incorporated within the Work constitutes
direct or contributory patent infringement, then any patent licenses granted to
You under this License for that Work shall terminate as of the date such
litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or
Derivative Works thereof in any medium, with or without modifications, and in
Source or Object form, provided that You meet the following conditions:
a. You must give any other recipients of the Work or Derivative Works a copy of
this License; and
b. You must cause any modified files to carry prominent notices stating that
You changed the files; and
c. You must retain, in the Source form of any Derivative Works that You
distribute, all copyright, patent, trademark, and attribution notices from
the Source form of the Work, excluding those notices that do not pertain to
any part of the Derivative Works; and
d. If the Work includes a "NOTICE" text file as part of its distribution, then
any Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those
notices that do not pertain to any part of the Derivative Works, in at least
one of the following places: within a NOTICE text file distributed as part of
the Derivative Works; within the Source form or documentation, if provided
along with the Derivative Works; or, within a display generated by the
Derivative Works, if and wherever such third-party notices normally appear.
The contents of the NOTICE file are for informational purposes only and do
not modify the License. You may add Your own attribution notices within
Derivative Works that You distribute, alongside or as an addendum to the
NOTICE text from the Work, provided that such additional attribution notices
cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any
Contribution intentionally submitted for inclusion in the Work by You to the
Licensor shall be under the terms and conditions of this License, without any
additional terms or conditions. Notwithstanding the above, nothing herein shall
supersede or modify the terms of any separate license agreement you may have
executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names,
trademarks, service marks, or product names of the Licensor, except as required
for reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
writing, Licensor provides the Work (and each Contributor provides its
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied, including, without limitation, any warranties or
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any risks
associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in
tort (including negligence), contract, or otherwise, unless required by
applicable law (such as deliberate and grossly negligent acts) or agreed to in
writing, shall any Contributor be liable to You for damages, including any
direct, indirect, special, incidental, or consequential damages of any character
arising as a result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill, work stoppage,
computer failure or malfunction, or any and all other commercial damages or
losses), even if such Contributor has been advised of the possibility of such
damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or
Derivative Works thereof, You may choose to offer, and charge a fee for,
acceptance of support, warranty, indemnity, or other liability obligations and/or
rights consistent with this License. However, in accepting such obligations, You
may act only on Your own behalf and on Your sole responsibility, not on behalf of
any other Contributor, and only if You agree to indemnify, defend, and hold each
Contributor harmless for any liability incurred by, or claims asserted against,
such Contributor by reason of your accepting any such warranty or additional
liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also recommend
that a file or class name and description of purpose be included on the same
"printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner] Licensed under the Apache License,
Version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
---
Artistic License 1.0
(text-unidecode 1.3)
The Artistic License
====================
Preamble
The intent of this document is to state the conditions under which a Package may
be copied, such that the Copyright Holder maintains some semblance of artistic
control over the development of the package, while giving the users of the
package the right to use and distribute the Package in a more-or-less customary
fashion, plus the right to make reasonable modifications.
Definitions:
* "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through textual
modification.
* "Standard Version" refers to such a Package if it has not been modified, or
has been modified in accordance with the wishes of the Copyright Holder.
* "Copyright Holder" is whoever is named in the copyright or copyrights for the
package.
* "You" is you, if you're thinking about copying or distributing this Package.
* "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will not
be required to justify it to the Copyright Holder, but only to the computing
community at large as a market that must bear the fee.)
* "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the Standard
Version of this Package without restriction, provided that you duplicate all of
the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such a
way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the
Package with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this Package.
You may charge any fee you choose for support of this Package. You may not charge
a fee for this Package itself. However, you may distribute this Package in
aggregate with other (possibly commercial) programs as part of a larger (possibly
commercial) software distribution provided that you do not advertise this Package
as a product of your own.
6. The scripts and library files supplied as input to or produced as output from
the programs of this Package do not automatically fall under the copyright of
this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.
7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
---
BSD 2-clause "Simplified" License
(Packaging 24.2, Pygments - Python syntax highlighter 2.18.0)
BSD Two Clause License
======================
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
---
BSD 3-clause "New" or "Revised" License
(Click - Python Command Line Utility 8.1.8, ets-labs/python-dependency-injector 4.41.0, filesystem_spec 2024.6.1, idna 3.10, ijson 3.3.0, jinjapython 3.1.5, MarkupSafe 2.1.5, multi_process 0.70.16, NumPy 1.26.4, pandas-python 2.2.3, pyperclip 1.9.0, python-dateutil 2.9.0.post0, python-dill 0.3.8, python-dotenv 1.0.1, Starlette 0.41.3, uvicorn 0.30.6, xxhash 3.5.0)
Copyright (c) <YEAR>, <OWNER>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the <ORGANIZATION> nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
MIT License
(Python six 1.16.0)
Copyright (c) 2010-2020 Benjamin Peterson
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
---
MIT License
(annotated-types 0.7.0, anyio 4.6.2.post1, cmd2 2.4.3, h11 0.14.0, markdown-it-py 3.0.0, mdurl 0.1.2, pydantic 2.8.2, pydantic-core 2.20.1, Pyparsing 3.1.4, python-attrs 24.2.0, python-slugify 8.0.4, python3-charset-normalizer 3.3.2, PyTZ - Python Time Zone Library 2024.2, PyYAML 6.0.2, rich 13.9.4, tqdm 4.66.6, urllib3 2.2.3, wcwidth 0.2.13)
The MIT License
===============
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
Mozilla Public License 2.0
(python-certifi 2024.8.30, tqdm 4.66.6)
Mozilla Public License
Version 2.0
======================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to the creation
of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used by a
Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached the notice
in Exhibit A, the Executable Form of such Source Code Form, and Modifications
of such Source Code Form, in each case including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
a.
that the initial Contributor has attached the notice described in Exhibit B
to the Covered Software; or
b.
that the Covered Software was made available under the terms of version 1.1
or earlier of the License, but not also under the terms of a Secondary
License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in a separate
file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible, whether at the
time of the initial grant or subsequently, any and all of the rights conveyed
by this License.
1.10. "Modifications"
means any of the following:
a.
any file in Source Code Form that results from an addition to, deletion
from, or modification of the contents of Covered Software; or
b.
any new file in Source Code Form that contains any Covered Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method, process, and
apparatus claims, in any patent Licensable by such Contributor that would be
infringed, but for the grant of the License, by the making, using, selling,
offering for sale, having made, import, or transfer of either its Contributions
or its Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU Lesser
General Public License, Version 2.1, the GNU Affero General Public License,
Version 3.0, or any later versions of those licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this License. For
legal entities, "You" includes any entity that controls, is controlled by, or
is under common control with You. For purposes of this definition, "control"
means (a) the power, direct or indirect, to cause the direction or management
of such entity, whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial ownership of such
entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive
license:
a.
under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available, modify,
display, perform, distribute, and otherwise exploit its Contributions,
either on an unmodified basis, with Modifications, or as part of a Larger
Work; and
b.
under Patent Claims of such Contributor to make, use, sell, offer for sale,
have made, import, and otherwise transfer either its Contributions or its
Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution become
effective for each Contribution on the date the Contributor first distributes
such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under this
License. No additional rights or licenses will be implied from the distribution
or licensing of Covered Software under this License. Notwithstanding
Section 2.1(b) above, no patent license is granted by a Contributor:
a.
for any code that a Contributor has removed from Covered Software; or
b.
for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
c.
under Patent Claims infringed by Covered Software in the absence of its
Contributions.
This License does not grant any rights in the trademarks, service marks, or
logos of any Contributor (except as may be necessary to comply with the notice
requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to distribute
the Covered Software under a subsequent version of this License (see
Section 10.2) or under the terms of a Secondary License (if permitted under the
terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its Contributions are
its original creation(s) or it has sufficient rights to grant the rights to its
Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under applicable
copyright doctrines of fair use, fair dealing, or other equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under the
terms of this License. You must inform recipients that the Source Code Form of
the Covered Software is governed by the terms of this License, and how they can
obtain a copy of this License. You may not attempt to alter or restrict the
recipients' rights in the Source Code Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
a.
such Covered Software must also be made available in Source Code Form, as
described in Section 3.1, and You must inform recipients of the Executable
Form how they can obtain a copy of such Source Code Form by reasonable
means in a timely manner, at a charge no more than the cost of distribution
to the recipient; and
b.
You may distribute such Executable Form under the terms of this License, or
sublicense it under different terms, provided that the license for the
Executable Form does not attempt to limit or alter the recipients' rights
in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for the
Covered Software. If the Larger Work is a combination of Covered Software with
a work governed by one or more Secondary Licenses, and the Covered Software is
not Incompatible With Secondary Licenses, this License permits You to
additionally distribute such Covered Software under the terms of such Secondary
License(s), so that the recipient of the Larger Work may, at their option,
further distribute the Covered Software under the terms of either this License
or such Secondary License(s).
3.4. Notices
You may not remove or alter the substance of any license notices (including
copyright notices, patent notices, disclaimers of warranty, or limitations of
liability) contained within the Source Code Form of the Covered Software,
except that You may alter any license notices to the extent required to remedy
known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support, indemnity
or liability obligations to one or more recipients of Covered Software.
However, You may do so only on Your own behalf, and not on behalf of any
Contributor. You must make it absolutely clear that any such warranty, support,
indemnity, or liability obligation is offered by You alone, and You hereby
agree to indemnify every Contributor for any liability incurred by such
Contributor as a result of warranty, support, indemnity or liability terms You
offer. You may include additional disclaimers of warranty and limitations of
liability specific to any jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this License with
respect to some or all of the Covered Software due to statute, judicial order, or
regulation then You must: (a) comply with the terms of this License to the
maximum extent possible; and (b) describe the limitations and the code they
affect. Such description must be placed in a text file included with all
distributions of the Covered Software under this License. Except to the extent
prohibited by statute or regulation, such description must be sufficiently
detailed for a recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically if You
fail to comply with any of its terms. However, if You become compliant, then
the rights granted under this License from a particular Contributor are
reinstated (a) provisionally, unless and until such Contributor explicitly and
finally terminates Your grants, and (b) on an ongoing basis, if such
Contributor fails to notify You of the non-compliance by some reasonable means
prior to 60 days after You have come back into compliance. Moreover, Your
grants from a particular Contributor are reinstated on an ongoing basis if such
Contributor notifies You of the non-compliance by some reasonable means, this
is the first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after Your
receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions, counter-claims, and
cross-claims) alleging that a Contributor Version directly or indirectly
infringes any patent, then the rights granted to You by any and all
Contributors for the Covered Software under Section 2.1 of this License shall
terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
license agreements (excluding distributors and resellers) which have been
validly granted by You or Your distributors under this License prior to
termination shall survive termination.
6. Disclaimer of Warranty
-------------------------
Covered Software is provided under this License on an "as is" basis, without
warranty of any kind, either expressed, implied, or statutory, including, without
limitation, warranties that the Covered Software is free of defects,
merchantable, fit for a particular purpose or non-infringing. The entire risk as
to the quality and performance of the Covered Software is with You. Should any
Covered Software prove defective in any respect, You (not any Contributor) assume
the cost of any necessary servicing, repair, or correction. This disclaimer of
warranty constitutes an essential part of this License. No use of any Covered
Software is authorized under this License except under this disclaimer.
7. Limitation of Liability
--------------------------
Under no circumstances and under no legal theory, whether tort (including
negligence), contract, or otherwise, shall any Contributor, or anyone who
distributes Covered Software as permitted above, be liable to You for any direct,
indirect, special, incidental, or consequential damages of any character
including, without limitation, damages for lost profits, loss of goodwill, work
stoppage, computer failure or malfunction, or any and all other commercial
damages or losses, even if such party shall have been informed of the possibility
of such damages. This limitation of liability shall not apply to liability for
death or personal injury resulting from such party's negligence to the extent
applicable law prohibits such limitation. Some jurisdictions do not allow the
exclusion or limitation of incidental or consequential damages, so this exclusion
and limitation may not apply to You.
8. Litigation
-------------
Any litigation relating to this License may be brought only in the courts of a
jurisdiction where the defendant maintains its principal place of business and
such litigation shall be governed by laws of that jurisdiction, without reference
to its conflict-of-law provisions. Nothing in this Section shall prevent a
party's ability to bring cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject matter
hereof. If any provision of this License is held to be unenforceable, such
provision shall be reformed only to the extent necessary to make it enforceable.
Any law or regulation which provides that the language of a contract shall be
construed against the drafter shall not be used to construe this License against
a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section 10.3,
no one other than the license steward has the right to modify or publish new
versions of this License. Each version will be given a distinguishing version
number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version of the
License under which You originally received the Covered Software, or under the
terms of any subsequent version published by the license steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to create a
new license for such software, you may create and use a modified version of
this License if you rename the license and remove any references to the name of
the license steward (except to note that such modified license differs from
this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the notice
described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular file, then
You may include the notice in a location (such as a LICENSE file in a relevant
directory) where a recipient would be likely to look for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as defined
by the Mozilla Public License, v. 2.0.
---
Python Software Foundation License 2.0
(aiohappyeyeballs 2.4.4)
This license was approved as the official PSF License Version 2 on October 22,
2004. The only differences between this and version 1 of the PSF license consist
of removing Python version numbers (like 2.1.1 or 2.3).
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
============================================
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"),
and the Individual or Organization ("Licensee") accessing and otherwise using
this software ("Python") in source or binary form and its associated
documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to
reproduce, analyze, test, perform and/or display publicly, prepare derivative
works, distribute, and otherwise use Python alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004 Python Software
Foundation; All Rights Reserved" are retained in Python alone or in any
derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or
incorporates Python or any part thereof, and wants to make the derivative
work available to others as provided herein, then Licensee hereby agrees to
include in any such work a brief summary of the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT
NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY
INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach
of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote products
or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee agrees to be
bound by the terms and conditions of this License Agreement.
---
Python Software Foundation License 2.3
(python-typing-extensions 4.12.2)
Python 2.3.3 license
====================
This is the official license for the Python 2.3.3 release:
--------------------------------------------------------------------------------
A. HISTORY OF THE SOFTWARE
--------------------------
--------------------------------------------------------------------------------
Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands as a
successor of a language called ABC. Guido remains Python's principal author,
although it includes many contributions from others.
In 1995, Guido continued his work on Python at the Corporation for National
Research Initiatives (CNRI, see http://www.cnri.reston.va.us) in Reston, Virginia
where he released several versions of the software.
In May 2000, Guido and the Python core development team moved to BeOpen.com to
form the BeOpen PythonLabs team. In October of the same year, the PythonLabs
team moved to Digital Creations (now Zope Corporation, see http://www.zope.com).
In 2001, the Python Software Foundation (PSF, see http://www.python.org/psf/) was
formed, a non-profit organization created specifically to own Python-related
Intellectual Property. Zope Corporation is a sponsoring member of the PSF.
All Python releases are Open Source (see http://www.opensource.org for the Open
Source Definition). Historically, most, but not all, Python releases have also
been GPL-compatible; the table below summarizes the various releases.
Release
Derived Year
Owner GPL-
from compatible? (1) 0.9.0 thru
1.2
1991-1995 CWI yes 1.3 thru 1.5.2 1.2
1995-1999 CNRI yes
1.6
1.5.2 2000
CNRI no
2.0
1.6
2000 BeOpen.com no 1.6.1
1.6
2001
CNRI yes (2)
2.1
2.0+1.6.1 2001
PSF no 2.0.1
2.0+1.6.1 2001
PSF yes 2.1.1
2.1+2.0.1 2001
PSF yes
2.2
2.1.1 2001
PSF yes 2.1.2
2.1.1 2002
PSF yes 2.1.3
2.1.2 2002
PSF yes 2.2.1
2.2
2002
PSF yes 2.2.2
2.2.1 2002
PSF yes
2.3
2.2.2 2002-2003
PSF yes 2.3.1
2.3 2002-2003
PSF yes 2.3.2
2.3.1 2002-2003
PSF yes 2.3.3
2.3.2 2002-2003
PSF yes
Footnotes:
(1) GPL-compatible doesn't mean that we're distributing Python under the
GPL. All Python licenses, unlike the GPL, let you distribute a modified
version without making your changes open source. The GPL-compatible licenses
make it possible to combine Python with other software that is released under
the GPL; the others don't.
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, because its
license has a choice of law clause. According to CNRI, however, Stallman's
lawyer has told CNRI's lawyer that 1.6.1 is "not incompatible" with the GPL.
Thanks to the many outside volunteers who have worked under Guido's direction to
make these releases possible.
--------------------------------------------------------------------------------
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
---------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
PSF LICENSE AGREEMENT FOR PYTHON 2.3
--------------------------------------------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and
the Individual or Organization ("Licensee") accessing and otherwise using Python
2.3 software in source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python 2.3 alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003 Python Software Foundation; All Rights
Reserved" are retained in Python 2.3 alone or in any derivative version prepared
by Licensee.
3. In the event Licensee prepares a derivative work that is based on or
incorporates Python 2.3 or any part thereof, and wants to make the derivative
work available to others as provided herein, then Licensee hereby agrees to
include in any such work a brief summary of the changes made to Python 2.3.
4. PSF is making Python 2.3 available to Licensee on an "AS IS" basis. PSF MAKES
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT
LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON
2.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 2.3 FOR ANY
INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING,
DISTRIBUTING, OR OTHERWISE USING PYTHON 2.3, OR ANY DERIVATIVE THEREOF, EVEN IF
ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach of
its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any relationship
of agency, partnership, or joint venture between PSF and Licensee. This License
Agreement does not grant permission to use PSF trademarks or trade name in a
trademark sense to endorse or promote products or services of Licensee, or any
third party.
8. By copying, installing or otherwise using Python 2.3, Licensee agrees to be
bound by the terms and conditions of this License Agreement.
---
The Unlicense
(py-filelock 3.16.1)
The Unlicense
=============
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to the
detriment of our heirs and successors. We intend this dedication to be an overt
act of relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org/
---
================================================
FILE: README.md
================================================
<div align="center">

**Version 0.7.6**
A simple and modular tool to evaluate any LLM-based AI systems.
[](https://www.python.org/downloads/release/python-3111/)
</div>
## 🎯 Motivation
Developed by the [AI Verify Foundation](https://aiverifyfoundation.sg/), [Moonshot](https://aiverifyfoundation.sg/project-moonshot/) is a tool to bring Benchmarking and Red-Teaming together to help AI developers, compliance teams evaluate LLM-based Apps and LLMs.
</br>
## 🚀 Why Moonshot
In the rapidly evolving landscape of Generative AI, ensuring safety, reliability, and performance of LLM applications is paramount. Moonshot addresses this critical need by providing a unified platform for:
- <b>Benchmark Tests:</b> Systematically test LLM Apps or LLMs across critical trust & safety risks using a wide array of open-source benchmark dataset and metrics, including guided workflows to implement <b>IMDA's Starter Kit for LLM-based App Testing</b>.
- <b>Red Team Attacks:</b> Proactively identify vulnerabilities and potential misuse scenarios in your LLM applications through streamlined adversarial prompting.
</br>
## 🔑 Key Features
- <b>User-friendly Interfaces:</b> Interact with Moonshot via an intuitive Web UI for visual insights, and an interactive Command Line Interface (CLI) for quick operations.
- <b>Comprehensive Benchmarking:</b>
- [View list of available datasets available](https://aiverify-foundation.github.io/moonshot/resources/datasets/)
- Test for <b>Performance</b> (e.g., accuracy, BLEU)
- Ensure <b>Trust & Safety</b> e.g., bias, toxicity, hallucination)
- Utilize built-in workflow to implement IMDA's Starter Kit for LLM-based App Testing. [View available pre-built Cookbooks](https://aiverify-foundation.github.io/moonshot/resources/cookbooks/)
- <b>Powerful Red-Teaming:</b>
- [View list of available attack modules](https://aiverify-foundation.github.io/moonshot/resources/attack_modules/)
- Simplify adversarial prompt generation using algorithmic strategies or generative LLM to uncover potential misuse.
- Leverage prompt templates, context strategies, and automated attack modules.
- <b>Customizable Recipes:</b> Build your own benchmark tests with custom datasets (input-target pairs), prompt templates (optional), evaluation metric, and grading scales. [View available pre-built Recipes](https://aiverify-foundation.github.io/moonshot/resources/recipes/)
- <b>Insightful Reporting:</b> Use our HTML reports with interactive charts for clear visualization of test results, and download detailed raw JSON results for deeper programmatic analysis.
- <b>Extensible & Modular:</b> Designed for easy extension and integration with new LLM applications, benchmarks, and attack techniques.
</br>
# Getting Started
Moonshot can be used through several interfaces:
- User-friendly Web UI - [Web UI User Guide](https://aiverify-foundation.github.io/moonshot/user_guide/web_ui/web_ui_guide/)
- Interactive Command Line Interface - [CLI User Guide](https://aiverify-foundation.github.io/moonshot/user_guide/cli/connecting_endpoints/)
- Seamless Integration into your MLOps workflow via Moonshot Library APIs or Moonshot Web APIs - [Notebook Examples](https://github.com/aiverify-foundation/moonshot/tree/main/examples/jupyter-notebook), [Web API Docs](https://aiverify-foundation.github.io/moonshot/api_reference/web_api_swagger/)
</br>
## 💻 Let's Go!
This section will guide you through getting Moonshot up and running.
</br>
### ✅ Prerequisites
1. <b>Python:</b> [Version 3.11](https://www.python.org/downloads/) is required.
2. <b>Git Version Control:</b> [Git](https://github.com/git-guides/install-git) is essential for cloning the repository.
3. <b>(Optional) Virtual Environment:</b> Highly recommended to manage dependencies.
```
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
source venv/bin/activate
```
4. If you plan to install our Web UI, you will also need [Node.js version 20.11.1 LTS](https://nodejs.org/en/blog/release/v20.11.1) and above
</br>
### ⬇️ Installation
You can install Moonshot in various ways depending on your needs
<b>1. Using `pip` (Recommended for most users)</b>
```
# Install Project Moonshot's Python Library, which includes Moonshot's full functionalities (Library APIs, CLI and Web APIs)
pip install "aiverify-moonshot[all]"
# Clone and install test assets and Web UI
python -m moonshot -i moonshot-data -i moonshot-ui
```
⚠️ You will need to have test assets from [moonshot-data](https://github.com/aiverify-foundation/moonshot-data) before you can run any tests.
🖼️ If you plan to install our Web UI, you will also need [moonshot-ui](https://github.com/aiverify-foundation/moonshot-ui)
Check out our [Installation Guide](https://aiverify-foundation.github.io/moonshot/getting_started/quick_install/) for more details.
</br>
<b>2. From Source Code (For developers and contributors)</b>
```
# To install from source code (Full functionalities)
git clone git@github.com:aiverify-foundation/moonshot.git
cd moonshot
pip install -r requirements.txt
```
If you have installation issues, please take a look at the [Troubleshooting Guide](https://aiverify-foundation.github.io/moonshot/faq/).
<details>
<summary><b>Other installation options</b></summary>
Here's a summary of other installation commands available:
```
# To install Moonshot library APIs only
pip install aiverify-moonshot
# To install Moonshot library APIs and Web APIs only
pip install "aiverify-moonshot[web-api]"
# To install Moonshot library APIs and CLI only
pip install "aiverify-moonshot[cli]"
```
Check out our [Installation Guide](https://aiverify-foundation.github.io/moonshot/getting_started/quick_install/) for more details.
</details>
</br>
### 🏃♀️ Run Moonshot
#### Running the Web UI
```
python -m moonshot web
```
Open [http://localhost:3000/](http://localhost:3000/) in a browser and you should see this homepage:

Refer to this [guide](https://aiverify-foundation.github.io/moonshot/user_guide/web_ui/moonshot_interface/homepage/) to discover the rich features available in Moonshot Web UI
</br>
#### Running the Interactive CLI
```
python -m moonshot cli interactive
```

Refer to this [Command List](https://aiverify-foundation.github.io/moonshot/user_guide/cli/cli_command_list/) to discover the list of CLI commands for Moonshot
</br></br>
# 📚 Documentation & User Guides
For detailed information on configuring, using, and extending Moonshot, please refer to our comprehensive documentation:
#### Guides for Moonshot Web UI
- [Getting Started with Moonshot Web UI](https://aiverify-foundation.github.io/moonshot/user_guide/web_ui/web_ui_guide/)
- [Creating Your Custom Cookbook via Moonshot Web UI](https://aiverify-foundation.github.io/moonshot/tutorial/web-ui/create_cookbook/)
- [Creating Your Custom Connector Endpoint via Moonshot Web UI](https://aiverify-foundation.github.io/moonshot/tutorial/web-ui/create_endpoint/)
- [Running Benchmark Test on Moonshot Web UI](https://aiverify-foundation.github.io/moonshot/getting_started/first_test/)
- [Running Red Teaming on Moonshot Web UI](https://aiverify-foundation.github.io/moonshot/tutorial/web-ui/redteam/)
#### Guides for Moonshot Interactive CLI
- [Getting Started with Moonshot Interactive CLI](https://aiverify-foundation.github.io/moonshot/user_guide/cli/connecting_endpoints/)
- [Creating Your Custom Benchmark Tests for Your RAG Apps via Moonshot Interactive CLI](https://aiverify-foundation.github.io/moonshot/tutorial/cli/create_benchmark_tests/)
- [Creating Your Custom Connector Endpoint via Moonshot Interactive CLI](https://aiverify-foundation.github.io/moonshot/tutorial/cli/create_endpoint/)
- [Running Benchmark Test on Moonshot Interactive CLI](https://aiverify-foundation.github.io/moonshot/tutorial/cli/run_benchmark_tests/)
- [Running Red Teaming on Moonshot Interactive CLI](https://aiverify-foundation.github.io/moonshot/tutorial/cli/run_red_teaming/)
#### For Users Interested in trying Out Moonshot using Jupyter Notebook
- [Moonshot Library Python Notebook Examples](https://github.com/aiverify-foundation/moonshot/tree/main/examples/jupyter-notebook)
####
</br>
## 🤝 Contribution
Moonshot is an open-source project, and we welcome contributions from the community! Whether fixing a bug, adding a new feature, improving documentation, or suggesting an enhancement, your efforts are highly valued.
Please refer to our [Contributor Guide](https://aiverify-foundation.github.io/moonshot/contributing/) for details on how to get started.
</br>
## ✨ Project Status
Moonshot is currently in beta. We are actively developing new features, improving existing ones, and enhancing stability. We encourage you to try it out and provide feedback!
</br>
## 📜 License
Moonshot is released under the [Apache Software License 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt)
</br>
================================================
FILE: assets/style.css
================================================
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
/* do not increase min-width as some may use split screens */
min-width: 800px;
color: #999;
}
h1 {
font-size: 24px;
color: black;
}
h2 {
font-size: 16px;
color: black;
}
p {
color: black;
}
a {
color: #999;
}
table {
border-collapse: collapse;
}
/******************************
* SUMMARY INFORMATION
******************************/
#environment td {
padding: 5px;
border: 1px solid #e6e6e6;
vertical-align: top;
}
#environment tr:nth-child(odd) {
background-color: #f6f6f6;
}
#environment ul {
margin: 0;
padding: 0 20px;
}
/******************************
* TEST RESULT COLORS
******************************/
span.passed,
.passed .col-result {
color: green;
}
span.skipped,
span.xfailed,
span.rerun,
.skipped .col-result,
.xfailed .col-result,
.rerun .col-result {
color: orange;
}
span.error,
span.failed,
span.xpassed,
.error .col-result,
.failed .col-result,
.xpassed .col-result {
color: red;
}
.col-links__extra {
margin-right: 3px;
}
/******************************
* RESULTS TABLE
*
* 1. Table Layout
* 2. Extra
* 3. Sorting items
*
******************************/
/*------------------
* 1. Table Layout
*------------------*/
#results-table {
border: 1px solid #e6e6e6;
color: #999;
font-size: 12px;
width: 100%;
}
#results-table th,
#results-table td {
padding: 5px;
border: 1px solid #e6e6e6;
text-align: left;
}
#results-table th {
font-weight: bold;
}
/*------------------
* 2. Extra
*------------------*/
.logwrapper {
max-height: 230px;
overflow-y: scroll;
background-color: #e6e6e6;
}
.logwrapper.expanded {
max-height: none;
}
.logwrapper.expanded .logexpander:after {
content: "collapse [-]";
}
.logwrapper .logexpander {
z-index: 1;
position: sticky;
top: 10px;
width: max-content;
border: 1px solid;
border-radius: 3px;
padding: 5px 7px;
margin: 10px 0 10px calc(100% - 80px);
cursor: pointer;
background-color: #e6e6e6;
}
.logwrapper .logexpander:after {
content: "expand [+]";
}
.logwrapper .logexpander:hover {
color: #000;
border-color: #000;
}
.logwrapper .log {
min-height: 40px;
position: relative;
top: -50px;
height: calc(100% + 50px);
border: 1px solid #e6e6e6;
color: black;
display: block;
font-family: "Courier New", Courier, monospace;
padding: 5px;
padding-right: 80px;
white-space: pre-wrap;
}
div.media {
border: 1px solid #e6e6e6;
float: right;
height: 240px;
margin: 0 5px;
overflow: hidden;
width: 320px;
}
.media-container {
display: grid;
grid-template-columns: 25px auto 25px;
align-items: center;
flex: 1 1;
overflow: hidden;
height: 200px;
}
.media-container--fullscreen {
grid-template-columns: 0px auto 0px;
}
.media-container__nav--right,
.media-container__nav--left {
text-align: center;
cursor: pointer;
}
.media-container__viewport {
cursor: pointer;
text-align: center;
height: inherit;
}
.media-container__viewport img,
.media-container__viewport video {
object-fit: cover;
width: 100%;
max-height: 100%;
}
.media__name,
.media__counter {
display: flex;
flex-direction: row;
justify-content: space-around;
flex: 0 0 25px;
align-items: center;
}
.collapsible td:not(.col-links) {
cursor: pointer;
}
.collapsible td:not(.col-links):hover::after {
color: #bbb;
font-style: italic;
cursor: pointer;
}
.col-result {
width: 130px;
}
.col-result:hover::after {
content: " (hide details)";
}
.col-result.collapsed:hover::after {
content: " (show details)";
}
#environment-header h2:hover::after {
content: " (hide details)";
color: #bbb;
font-style: italic;
cursor: pointer;
font-size: 12px;
}
#environment-header.collapsed h2:hover::after {
content: " (show details)";
color: #bbb;
font-style: italic;
cursor: pointer;
font-size: 12px;
}
/*------------------
* 3. Sorting items
*------------------*/
.sortable {
cursor: pointer;
}
.sortable.desc:after {
content: " ";
position: relative;
left: 5px;
bottom: -12.5px;
border: 10px solid #4caf50;
border-bottom: 0;
border-left-color: transparent;
border-right-color: transparent;
}
.sortable.asc:after {
content: " ";
position: relative;
left: 5px;
bottom: 12.5px;
border: 10px solid #4caf50;
border-top: 0;
border-left-color: transparent;
border-right-color: transparent;
}
.hidden, .summary__reload__button.hidden {
display: none;
}
.summary__data {
flex: 0 0 550px;
}
.summary__reload {
flex: 1 1;
display: flex;
justify-content: center;
}
.summary__reload__button {
flex: 0 0 300px;
display: flex;
color: white;
font-weight: bold;
background-color: #4caf50;
text-align: center;
justify-content: center;
align-items: center;
border-radius: 3px;
cursor: pointer;
}
.summary__reload__button:hover {
background-color: #46a049;
}
.summary__spacer {
flex: 0 0 550px;
}
.controls {
display: flex;
justify-content: space-between;
}
.filters,
.collapse {
display: flex;
align-items: center;
}
.filters button,
.collapse button {
color: #999;
border: none;
background: none;
cursor: pointer;
text-decoration: underline;
}
.filters button:hover,
.collapse button:hover {
color: #ccc;
}
.filter__label {
margin-right: 10px;
}
================================================
FILE: ci/createBadges.py
================================================
import json
import os
import re
import sys
import anybadge
def create_badges() -> None:
# Check if an argument is provided
if len(sys.argv) > 1:
badgeToCreate = sys.argv[1]
else:
print("No badgeToCreate provided")
sys.exit()
covBadgeSvg = "cov-badge.svg"
testBadgeSvg = "test-badge.svg"
lintBadgeSvg = "lint-badge.svg"
depBadgeSvg = "dep-badge.svg"
licBadgeSvg = "lic-badge.svg"
# Create coverage badge
if badgeToCreate == "coverage":
with open("coverage.json") as jsonFile:
covJson = json.load(jsonFile)
covPct = covJson["totals"]["percent_covered"]
if covPct < 20:
color = "red"
elif covPct < 70:
color = "orange_2"
else:
color = "green"
badge = anybadge.Badge(
"coverage", str(int(round(covPct))) + "%", default_color=color
)
if os.path.exists(covBadgeSvg):
os.remove(covBadgeSvg)
badge.write_badge(covBadgeSvg)
# Create test result badge
if badgeToCreate == "test":
with open("test-report.json") as jsonFile:
testJson = json.load(jsonFile)
testSummary = testJson["report"]["summary"]
testPassed = 0 if "passed" not in testSummary else testSummary["passed"]
testFailed = 0 if "failed" not in testSummary else testSummary["failed"]
print(str(testPassed) + " " + str(testFailed))
color = "green" if (testPassed != 0 and testFailed == 0) else "red"
badge = anybadge.Badge(
"tests",
str(testPassed) + " passed, " + str(testFailed) + " failed",
default_color=color,
)
if os.path.exists(testBadgeSvg):
os.remove(testBadgeSvg)
badge.write_badge(testBadgeSvg)
# Create lint (flake8) badge
if badgeToCreate == "lint":
with open("flake8-report.txt", "r") as file:
last_line = None
for line in file:
last_line = line.strip()
color = "green" if (last_line == "0") else "red"
badge = anybadge.Badge("lint", str(last_line) + " errors", default_color=color)
if os.path.exists(lintBadgeSvg):
os.remove(lintBadgeSvg)
badge.write_badge(lintBadgeSvg)
# Create dependency check badge
if badgeToCreate == "dependency":
numVul = "0"
with open("pip-audit-count.txt", "r") as file:
content = file.read()
if content.find("No known vulnerabilities found") != -1:
numVul = "0"
else:
pattern = r"Found (\d+) known vulnerabilit"
match = re.search(pattern, content)
if match:
numVul = match.group(1)
else:
numVul = None
if numVul is not None:
color = "green" if (numVul == "0") else "red"
msg = numVul + " vulnerabilities"
else:
color = "red"
msg = "error"
badge = anybadge.Badge("dependencies", msg, default_color=color)
if os.path.exists(depBadgeSvg):
os.remove(depBadgeSvg)
badge.write_badge(depBadgeSvg)
# Create license check badge
if badgeToCreate == "license":
with open("licenses-found.md", "r") as file:
content = file.read()
copyleftLic = [
"GPL",
"LGPL",
"MPL",
"AGPL",
"EUPL",
"CCDL",
"EPL",
"CC-BY-SA",
"OSL",
"CPL",
]
licFound = []
for lic in copyleftLic:
if lic in content:
licFound.append(lic)
numCopyleftLic = len(licFound)
color = "green" if (numCopyleftLic == 0) else "red"
badge = anybadge.Badge(
"licenses", str(numCopyleftLic) + " copyleft", default_color=color
)
if os.path.exists(licBadgeSvg):
os.remove(licBadgeSvg)
badge.write_badge(licBadgeSvg)
if __name__ == "__main__": # pragma: no cover
create_badges()
================================================
FILE: ci/gen_pre_build_summ.sh
================================================
#!/bin/bash
# Function to read coverage data
read_coverage() {
covPct=$(jq '.totals.percent_covered' coverage.json)
covPctRounded=$(printf "%.0f" "$covPct")
message="Coverage percentage: $covPctRounded"
echo "$message"
export COVERAGE_SUMMARY="$message"
if (( covPctRounded < 70 )); then
return 1
else
return 0
fi
}
# Function to read test data
read_test() {
testJson=$(jq '.report.summary' test-report.json)
testPassed=$(echo "$testJson" | jq '.passed // 0')
testFailed=$(echo "$testJson" | jq '.failed // 0')
message="Unit tests passed: $testPassed, failed: $testFailed"
echo "$message"
export UNITTEST_SUMMARY="$message"
if [ "$testFailed" -ne 0 ]; then
return 1
else
return 0
fi
}
# Function to read lint data
read_lint() {
last_line=$(tail -n 1 flake8-report.txt)
message="Lint errors: $last_line"
echo "$message"
export LINT_SUMMARY="$message"
if [ "$last_line" -ne 0 ]; then
return 1
else
return 0
fi
}
# Function to read dependency data
read_dependency() {
content=$(<pip-audit-count.txt)
if [[ $content == *"No known vulnerabilities found"* ]]; then
numVul=0
else
numVul=$(grep -oP 'Found \K\d+' pip-audit-count.txt)
fi
message="Dependency vulnerabilities found: $numVul"
echo "$message"
export DEPENDENCY_SUMMARY="$message"
if [ "$numVul" -ne 0 ]; then
return 1
else
return 0
fi
}
# Function to read license data
read_license() {
copyleftLic=("GPL" "LGPL" "MPL" "AGPL" "EUPL" "CCDL" "EPL" "CC-BY-SA" "OSL" "CPL")
numCopyleftLic=0
if [ -f licenses-found.md ]; then
while IFS= read -r line; do
for lic in "${copyleftLic[@]}"; do
if [[ $line == *"$lic"* ]]; then
((numCopyleftLic++))
break
fi
done
done < licenses-found.md
fi
message="Copyleft licenses found: $numCopyleftLic"
export LICENSE_SUMMARY="$message"
echo "$message"
if [ "$numCopyleftLic" -ne 0 ]; then
return 1
else
return 0
fi
}
# Main function to determine which summary to generate
gen_summary() {
if [[ $# -eq 0 ]]; then
echo "No summaryToGen provided"
exit 1
fi
summaryToGen=$1
case $summaryToGen in
"coverage")
read_coverage
;;
"test")
read_test
;;
"lint")
read_lint
;;
"dependency")
read_dependency
;;
"license")
read_license
;;
*)
echo "Unknown summary type: $summaryToGen"
exit 1
;;
esac
}
# Execute the main function
gen_summary "$@"
================================================
FILE: ci/run-codeql-summ.sh
================================================
#!/bin/bash
# Note: this script must be run using source
# Default values
REPO="aiverify-foundation/moonshot"
OUTPUT_FILE=".codeql-alerts.json"
# Parse arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
-r|--repo) REPO="$2"; shift ;;
-o|--output) OUTPUT_FILE="$2"; shift ;;
-h|--help)
echo "Usage: $0 [-r|--repo <repository>] [-o|--output <output_file>]"
return 0
;;
*) echo "Unknown parameter passed: $1"; return 1 ;;
esac
shift
done
OUTPUT_MESSAGES=""
# Check if gh command is available
if ! command -v gh &> /dev/null
then
OUTPUT_MESSAGES+="gh command could not be found. Please install GitHub CLI.\n"
return 1
fi
# Fetch CodeQL alerts
gh api -X GET "repos/$REPO/code-scanning/alerts" > "$OUTPUT_FILE"
if [ $? -ne 0 ]; then
OUTPUT_MESSAGES+="Failed to fetch CodeQL alerts.\n"
return 1
fi
# Total alert count
alerts_count=$(jq '. | length' "$OUTPUT_FILE")
OUTPUT_MESSAGES+="Total CodeQL alerts: $alerts_count\n"
# Display alerts by severity if there are any alerts
if [ "$alerts_count" -gt 0 ]; then
OUTPUT_MESSAGES+="Alerts by severity:\n"
OUTPUT_MESSAGES+="$(jq -r '.[] | .rule.severity' "$OUTPUT_FILE" | sort | uniq -c)\n"
rm "$OUTPUT_FILE"
#echo -e "$OUTPUT_MESSAGES"
echo "There are CodeQL alerts, please check Security>Code Scanning tab in the repository for more details."
export CODEQL_SUMMARY="$OUTPUT_MESSAGES"
return 2
else
rm "$OUTPUT_FILE"
echo -e "$OUTPUT_MESSAGES"
export CODEQL_SUMMARY="$OUTPUT_MESSAGES"
return 0
fi
================================================
FILE: ci/run-flake8.sh
================================================
#!/bin/bash
source_dir=moonshot
set +e
flake8 --format=html --htmldir=flake8-report --count $source_d
gitextract_l345h7ij/
├── .coveragerc
├── .flake8
├── .github/
│ ├── developing-workflows.md
│ ├── pull_request_template.md
│ ├── scripts/
│ │ ├── create_backup.sh
│ │ ├── install_ms_service.sh
│ │ ├── moonshot_env
│ │ ├── moonshot_test_env
│ │ ├── moonshot_ui_env
│ │ ├── run_smoke_test.sh
│ │ └── start_ms_service.sh
│ └── workflows/
│ ├── docs-update.yaml
│ ├── gh-event-notification.yaml
│ ├── integration-test.yaml
│ ├── notices-file-gen.yaml
│ ├── pre-build-checks.yaml
│ ├── pypi-deployment.yaml
│ ├── sast-codeql.yaml
│ ├── sca-scan.yaml
│ ├── sit-build.yaml
│ ├── smoke-test-cli.yaml
│ ├── smoke-test.yaml
│ ├── test-pypi-deployment.yaml
│ └── uat-build.yaml
├── .gitignore
├── .pre-commit-config.yaml
├── AUTHORS.md
├── LICENSE.md
├── NOTICES.md
├── README.md
├── assets/
│ └── style.css
├── ci/
│ ├── createBadges.py
│ ├── gen_pre_build_summ.sh
│ ├── run-codeql-summ.sh
│ ├── run-flake8.sh
│ ├── run-pip-audit.sh
│ └── run-test.sh
├── docs/
│ ├── api_reference/
│ │ ├── api_bookmark.md
│ │ ├── api_connector.md
│ │ ├── api_connector_endpoint.md
│ │ ├── api_context_strategy.md
│ │ ├── api_cookbook.md
│ │ ├── api_dataset.md
│ │ ├── api_environment_variables.md
│ │ ├── api_metrics.md
│ │ ├── api_prompt_template.md
│ │ ├── api_recipe.md
│ │ ├── api_red_teaming.md
│ │ ├── api_result.md
│ │ ├── api_run.md
│ │ ├── api_runner.md
│ │ ├── api_session.md
│ │ ├── web_api_swagger.json
│ │ └── web_api_swagger.md
│ ├── contributing.md
│ ├── faq.md
│ ├── getting_started/
│ │ ├── first_test.md
│ │ ├── overview.md
│ │ ├── quick_install.md
│ │ └── quick_start.md
│ ├── index.md
│ ├── resources/
│ │ ├── attack_modules.md
│ │ ├── cookbooks.md
│ │ ├── datasets.md
│ │ ├── jupyter_notebook.md
│ │ ├── metrics.md
│ │ └── recipes.md
│ ├── tutorial/
│ │ ├── cli/
│ │ │ ├── create_benchmark_tests.md
│ │ │ ├── create_endpoint.md
│ │ │ ├── run_benchmark_tests.md
│ │ │ └── run_red_teaming.md
│ │ ├── contributor/
│ │ │ ├── configure_web_api.md
│ │ │ └── create_connector.md
│ │ └── web-ui/
│ │ ├── benchmark.md
│ │ ├── create_cookbook.md
│ │ ├── create_endpoint.md
│ │ └── redteam.md
│ └── user_guide/
│ ├── cli/
│ │ ├── add_your_own_tests.md
│ │ ├── benchmarking.md
│ │ ├── cli_command_list.md
│ │ ├── cli_guide.md
│ │ ├── connecting_endpoints.md
│ │ └── red_teaming.md
│ └── web_ui/
│ ├── choosing_relevant_tests.md
│ ├── connecting_to_llms.md
│ ├── creating_custom_cookbooks.md
│ ├── moonshot_interface/
│ │ ├── benchmarking.md
│ │ ├── endpoint.md
│ │ ├── history.md
│ │ ├── homepage.md
│ │ ├── redteaming.md
│ │ └── utils.md
│ ├── running_benchmarks.md
│ ├── running_red_teaming.md
│ └── web_ui_guide.md
├── examples/
│ ├── config.yml
│ ├── deployment/
│ │ ├── Dockerfile
│ │ ├── docker-compose.yml
│ │ ├── kube_manifests/
│ │ │ ├── moonshot-deployment.yml
│ │ │ ├── moonshot-ingress.yml
│ │ │ ├── moonshot-ns.yml
│ │ │ └── moonshot-pvc.yml
│ │ └── run_installation_script.sh
│ └── jupyter-notebook/
│ ├── Moonshot - Benchmark Feature Walkthrough.ipynb
│ ├── Moonshot - Pre-Req - Setup.ipynb
│ ├── Tutorial 1 - Basic Workflow - Execute a Benchmark.ipynb
│ ├── Tutorial 2 - Basic Workflow - Add your own test.ipynb
│ ├── Tutorial 3 - Basic Workflow - Run Red Teaming Session.ipynb
│ ├── Tutorial 4 - Advanced Workflow - Test Custom Application.ipynb
│ ├── assets/
│ │ ├── jupyter-assets-csv-file.csv
│ │ └── jupyter-assets-custom-app.py
│ └── jupyter_notebook_env_setup.sh
├── mkdocs.yml
├── moonshot/
│ ├── __init__.py
│ ├── __main__.py
│ ├── api.py
│ ├── integrations/
│ │ ├── __init__.py
│ │ ├── cli/
│ │ │ ├── __init__.py
│ │ │ ├── __main__.py
│ │ │ ├── active_session_cfg.py
│ │ │ ├── benchmark/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── benchmark.py
│ │ │ │ ├── cookbook.py
│ │ │ │ ├── datasets.py
│ │ │ │ ├── metrics.py
│ │ │ │ ├── recipe.py
│ │ │ │ ├── result.py
│ │ │ │ ├── run.py
│ │ │ │ └── runner.py
│ │ │ ├── cli.py
│ │ │ ├── cli_errors.py
│ │ │ ├── common/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── common.py
│ │ │ │ ├── connectors.py
│ │ │ │ ├── dataset.py
│ │ │ │ ├── display_helper.py
│ │ │ │ └── prompt_template.py
│ │ │ ├── initialisation/
│ │ │ │ ├── __init__.py
│ │ │ │ └── initialisation.py
│ │ │ ├── redteam/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── attack_module.py
│ │ │ │ ├── context_strategy.py
│ │ │ │ ├── prompt_template.py
│ │ │ │ ├── redteam.py
│ │ │ │ └── session.py
│ │ │ └── utils/
│ │ │ └── process_data.py
│ │ └── web_api/
│ │ ├── __init__.py
│ │ ├── __main__.py
│ │ ├── app.py
│ │ ├── container.py
│ │ ├── log/
│ │ │ └── .gitkeep
│ │ ├── logging_conf.py
│ │ ├── routes/
│ │ │ ├── __init__.py
│ │ │ ├── attack_modules.py
│ │ │ ├── benchmark.py
│ │ │ ├── benchmark_result.py
│ │ │ ├── bookmark.py
│ │ │ ├── context_strategy.py
│ │ │ ├── cookbook.py
│ │ │ ├── dataset.py
│ │ │ ├── endpoint.py
│ │ │ ├── metric.py
│ │ │ ├── prompt_template.py
│ │ │ ├── recipe.py
│ │ │ ├── redteam.py
│ │ │ └── runner.py
│ │ ├── schemas/
│ │ │ ├── __init__.py
│ │ │ ├── benchmark_runner_dto.py
│ │ │ ├── bookmark_create_dto.py
│ │ │ ├── cookbook_create_dto.py
│ │ │ ├── cookbook_response_model.py
│ │ │ ├── dataset_create_dto.py
│ │ │ ├── dataset_response_dto.py
│ │ │ ├── endpoint_create_dto.py
│ │ │ ├── endpoint_response_model.py
│ │ │ ├── prompt_response_model.py
│ │ │ ├── prompt_template_response_model.py
│ │ │ ├── recipe_create_dto.py
│ │ │ ├── recipe_response_model.py
│ │ │ ├── session_create_dto.py
│ │ │ ├── session_prompt_dto.py
│ │ │ └── session_response_model.py
│ │ ├── services/
│ │ │ ├── __init__.py
│ │ │ ├── attack_module_service.py
│ │ │ ├── auto_red_team_test_manager.py
│ │ │ ├── auto_red_team_test_state.py
│ │ │ ├── base_service.py
│ │ │ ├── benchmark_result_service.py
│ │ │ ├── benchmark_test_manager.py
│ │ │ ├── benchmark_test_state.py
│ │ │ ├── benchmarking_service.py
│ │ │ ├── bookmark_service.py
│ │ │ ├── context_strategy_service.py
│ │ │ ├── cookbook_service.py
│ │ │ ├── dataset_service.py
│ │ │ ├── endpoint_service.py
│ │ │ ├── metric_service.py
│ │ │ ├── prompt_template_service.py
│ │ │ ├── recipe_service.py
│ │ │ ├── runner_service.py
│ │ │ ├── session_service.py
│ │ │ └── utils/
│ │ │ ├── exceptions_handler.py
│ │ │ ├── file_manager.py
│ │ │ └── results_formatter.py
│ │ ├── status_updater/
│ │ │ ├── interface/
│ │ │ │ ├── benchmark_progress_callback.py
│ │ │ │ └── redteam_progress_callback.py
│ │ │ └── moonshot_ui_webhook.py
│ │ ├── temp/
│ │ │ └── .gitkeep
│ │ └── types/
│ │ └── types.py
│ └── src/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── api_bookmark.py
│ │ ├── api_connector.py
│ │ ├── api_connector_endpoint.py
│ │ ├── api_context_strategy.py
│ │ ├── api_cookbook.py
│ │ ├── api_dataset.py
│ │ ├── api_environment_variables.py
│ │ ├── api_metrics.py
│ │ ├── api_prompt_template.py
│ │ ├── api_recipe.py
│ │ ├── api_red_teaming.py
│ │ ├── api_result.py
│ │ ├── api_run.py
│ │ ├── api_runner.py
│ │ └── api_session.py
│ ├── bookmark/
│ │ ├── bookmark.py
│ │ └── bookmark_arguments.py
│ ├── configs/
│ │ ├── __init__.py
│ │ └── env_variables.py
│ ├── connectors/
│ │ ├── __init__.py
│ │ ├── connector.py
│ │ ├── connector_prompt_arguments.py
│ │ └── connector_response.py
│ ├── connectors_endpoints/
│ │ ├── __init__.py
│ │ ├── connector_endpoint.py
│ │ └── connector_endpoint_arguments.py
│ ├── cookbooks/
│ │ ├── __init__.py
│ │ ├── cookbook.py
│ │ └── cookbook_arguments.py
│ ├── datasets/
│ │ ├── __init__.py
│ │ ├── dataset.py
│ │ └── dataset_arguments.py
│ ├── messages_constants.py
│ ├── metrics/
│ │ ├── __init__.py
│ │ ├── metric.py
│ │ └── metric_interface.py
│ ├── prompt_templates/
│ │ ├── __init__.py
│ │ └── prompt_template.py
│ ├── recipes/
│ │ ├── __init__.py
│ │ ├── recipe.py
│ │ └── recipe_arguments.py
│ ├── redteaming/
│ │ ├── __init__.py
│ │ ├── attack/
│ │ │ ├── __init__.py
│ │ │ ├── attack_module.py
│ │ │ ├── attack_module_arguments.py
│ │ │ └── context_strategy.py
│ │ ├── context_strategy/
│ │ │ ├── __init__.py
│ │ │ └── context_strategy_interface.py
│ │ └── session/
│ │ ├── __init__.py
│ │ ├── chat.py
│ │ ├── red_teaming_progress.py
│ │ ├── red_teaming_type.py
│ │ └── session.py
│ ├── results/
│ │ ├── __init__.py
│ │ ├── result.py
│ │ └── result_arguments.py
│ ├── runners/
│ │ ├── __init__.py
│ │ ├── runner.py
│ │ ├── runner_arguments.py
│ │ └── runner_type.py
│ ├── runs/
│ │ ├── __init__.py
│ │ ├── run.py
│ │ ├── run_arguments.py
│ │ ├── run_progress.py
│ │ └── run_status.py
│ ├── storage/
│ │ ├── __init__.py
│ │ ├── db_interface.py
│ │ ├── io_interface.py
│ │ └── storage.py
│ └── utils/
│ ├── __init__.py
│ ├── find_feature.py
│ ├── import_modules.py
│ ├── log.py
│ ├── pagination.py
│ └── timeit.py
├── pyproject.toml
├── pytest.ini
├── requirements.txt
├── run_unit_test.sh
├── tests/
│ ├── __init__.py
│ ├── others/
│ │ ├── __init__.py
│ │ ├── functest_api.py
│ │ ├── functest_connectors.py
│ │ ├── functest_cookbooks.py
│ │ ├── functest_datasets.py
│ │ ├── functest_metrics.py
│ │ ├── functest_recipes.py
│ │ ├── functest_results.py
│ │ ├── functest_rt_api.py
│ │ ├── functest_runner.py
│ │ └── results/
│ │ ├── my-new-runner-cookbook.json
│ │ └── my-new-runner-recipe.json
│ └── unit-tests/
│ ├── __init__.py
│ ├── cli/
│ │ ├── __init__.py
│ │ ├── test_attack_module.py
│ │ ├── test_benchmark.py
│ │ ├── test_common.py
│ │ ├── test_common_endpoints.py
│ │ ├── test_common_prompt_template.py
│ │ ├── test_cookbook.py
│ │ ├── test_datasets.py
│ │ ├── test_metrics.py
│ │ ├── test_recipe.py
│ │ ├── test_red_teaming.py
│ │ ├── test_result.py
│ │ ├── test_run.py
│ │ ├── test_runner.py
│ │ └── test_session.py
│ ├── common/
│ │ └── samples/
│ │ ├── __init__.py
│ │ ├── add_previous_prompt.py
│ │ ├── advglue.py
│ │ ├── analogical-similarity.json
│ │ ├── answer-template.json
│ │ ├── arc-challenge.json
│ │ ├── arc-easy.json
│ │ ├── arc.json
│ │ ├── bbq-lite-age-ambiguous.json
│ │ ├── bbq-lite-age-disamb.json
│ │ ├── bbq.json
│ │ ├── benchmarking-result.py
│ │ ├── benchmarking.py
│ │ ├── bertscore.py
│ │ ├── bleuscore.py
│ │ ├── charswap_attack.py
│ │ ├── chinese-safety-cookbook.json
│ │ ├── claude2-connector.py
│ │ ├── exactstrmatch.py
│ │ ├── homoglyph_attack.py
│ │ ├── huggingface-connector.py
│ │ ├── ign_test_storage.py
│ │ ├── mcq-template.json
│ │ ├── mmlu.json
│ │ ├── my-new-recipe-runner-no-db.json
│ │ ├── my-new-recipe-runner-result.json
│ │ ├── my-new-recipe-runner.json
│ │ ├── my-runner.json
│ │ ├── openai-connector.py
│ │ ├── openai-gpt35-turbo.json
│ │ ├── openai-gpt4.json
│ │ ├── redteaming.py
│ │ ├── sample-cookbook.json
│ │ ├── sample-dataset.csv
│ │ ├── sample-result.json
│ │ ├── sample_attack_module.py
│ │ ├── sample_file.py
│ │ └── tamil-language-cookbook.json
│ ├── src/
│ │ ├── __init__.py
│ │ ├── data/
│ │ │ ├── attack-modules/
│ │ │ │ └── .placeholder
│ │ │ ├── bookmarks/
│ │ │ │ └── .placeholder
│ │ │ ├── connectors/
│ │ │ │ └── .placeholder
│ │ │ ├── connectors-endpoints/
│ │ │ │ └── .placeholder
│ │ │ ├── context-strategy/
│ │ │ │ └── .placeholder
│ │ │ ├── cookbooks/
│ │ │ │ └── .placeholder
│ │ │ ├── databases/
│ │ │ │ └── .placeholder
│ │ │ ├── databases-modules/
│ │ │ │ ├── .placeholder
│ │ │ │ └── sqlite.py
│ │ │ ├── datasets/
│ │ │ │ └── .placeholder
│ │ │ ├── example/
│ │ │ │ └── .placeholder
│ │ │ ├── io-modules/
│ │ │ │ ├── __init__.py
│ │ │ │ └── jsonio.py
│ │ │ ├── metrics/
│ │ │ │ └── .placeholder
│ │ │ ├── prompt-templates/
│ │ │ │ └── .placeholder
│ │ │ ├── recipes/
│ │ │ │ └── .placeholder
│ │ │ ├── results/
│ │ │ │ └── .placeholder
│ │ │ ├── results-modules/
│ │ │ │ └── .placeholder
│ │ │ ├── runner-modules/
│ │ │ │ └── .placeholder
│ │ │ └── runners/
│ │ │ └── .placeholder
│ │ ├── importmodules/
│ │ │ ├── __init__.py
│ │ │ ├── arc-easy.json
│ │ │ └── sample_file.py
│ │ ├── logger_mock.py
│ │ ├── test-storage.py
│ │ ├── test_api_bookmark.py
│ │ ├── test_api_connector.py
│ │ ├── test_api_connector_endpoint.py
│ │ ├── test_api_context_strategy.py
│ │ ├── test_api_cookbook.py
│ │ ├── test_api_dataset.py
│ │ ├── test_api_metric.py
│ │ ├── test_api_prompt_template.py
│ │ ├── test_api_recipe.py
│ │ ├── test_api_red_teaming.py
│ │ ├── test_api_result.py
│ │ ├── test_api_run.py
│ │ ├── test_api_runner.py
│ │ ├── test_api_session.py
│ │ ├── test_bookmark.py
│ │ ├── test_bookmark_arguments.py
│ │ ├── test_connector.py
│ │ ├── test_connector_endpoint.py
│ │ ├── test_connector_endpoint_arguments.py
│ │ ├── test_connector_prompt_arguments.py
│ │ ├── test_connector_response.py
│ │ ├── test_import_modules.py
│ │ ├── test_log.py
│ │ └── test_timeit.py
│ └── web_api/
│ ├── __init__.py
│ ├── test_routes/
│ │ ├── conftest.py
│ │ ├── test_routes_attack_modules.py
│ │ ├── test_routes_benchmarks.py
│ │ ├── test_routes_bm_results.py
│ │ ├── test_routes_bookmark.py
│ │ ├── test_routes_context_strategy.py
│ │ ├── test_routes_cookbook.py
│ │ ├── test_routes_dataset.py
│ │ ├── test_routes_endpoint.py
│ │ ├── test_routes_metrics.py
│ │ ├── test_routes_prompt_template.py
│ │ ├── test_routes_recipe.py
│ │ ├── test_routes_redteam.py
│ │ └── test_routes_runner.py
│ └── test_services/
│ ├── test_service_attack_modules.py
│ ├── test_service_benchmark_result.py
│ ├── test_service_bookmark.py
│ ├── test_service_context_strategy.py
│ ├── test_service_cookbook.py
│ ├── test_service_dataset.py
│ ├── test_service_endpoint.py
│ ├── test_service_metric.py
│ ├── test_service_prompt_template.py
│ ├── test_service_recipe.py
│ ├── test_service_runner.py
│ └── test_service_session.py
└── third-party/
├── pygments-2.18.0-py3-none-any.whl
└── text_unidecode-1.3-py2.py3-none-any.whl
SYMBOL INDEX (1469 symbols across 230 files)
FILE: ci/createBadges.py
function create_badges (line 9) | def create_badges() -> None:
FILE: examples/jupyter-notebook/assets/jupyter-assets-custom-app.py
class MathApplicationConnector (line 17) | class MathApplicationConnector(Connector):
method __init__ (line 18) | def __init__(self, ep_arguments: ConnectorEndpointArguments):
method load_agent (line 30) | def load_agent(self):
method get_response (line 76) | async def get_response(self, prompt: str) -> ConnectorResponse:
method _process_response (line 94) | async def _process_response(self, response: Any) -> str:
FILE: moonshot/__main__.py
function run_subprocess (line 24) | def run_subprocess(*args: Any, **kwargs: Any) -> subprocess.CompletedPro...
function ms_lib_env_file (line 33) | def ms_lib_env_file(data_repo_name: str) -> None:
function ms_ui_env_file (line 75) | def ms_ui_env_file(ui_repo: str) -> None:
function download_nltk_resources (line 89) | def download_nltk_resources() -> None:
function download_spacy_model (line 119) | def download_spacy_model() -> None:
function moonshot_data_installation (line 126) | def moonshot_data_installation(unattended: bool, overwrite: bool) -> None:
function check_node (line 191) | def check_node() -> bool:
function moonshot_ui_installation (line 207) | def moonshot_ui_installation(unattended: bool, overwrite: bool) -> None:
function run_moonshot_ui (line 267) | def run_moonshot_ui() -> None:
function main (line 283) | def main() -> None:
FILE: moonshot/integrations/cli/__main__.py
function start_app (line 6) | def start_app(cli_command=None):
FILE: moonshot/integrations/cli/benchmark/benchmark.py
class BenchmarkCommandSet (line 73) | class BenchmarkCommandSet(cmd2.CommandSet):
method __init__ (line 74) | def __init__(self):
method do_list_cookbooks (line 82) | def do_list_cookbooks(self, args: argparse.Namespace) -> None:
method do_list_recipes (line 86) | def do_list_recipes(self, args: argparse.Namespace) -> None:
method do_list_results (line 90) | def do_list_results(self, args: argparse.Namespace) -> None:
method do_list_runners (line 93) | def do_list_runners(self, _: cmd2.Statement) -> None:
method do_list_runs (line 97) | def do_list_runs(self, args: argparse.Namespace) -> None:
method do_list_metrics (line 101) | def do_list_metrics(self, args: argparse.Namespace) -> None:
method do_list_datasets (line 105) | def do_list_datasets(self, args: argparse.Namespace) -> None:
method do_add_cookbook (line 113) | def do_add_cookbook(self, args: argparse.Namespace) -> None:
method do_add_recipe (line 117) | def do_add_recipe(self, args: argparse.Namespace) -> None:
method do_delete_cookbook (line 125) | def do_delete_cookbook(self, args: argparse.Namespace) -> None:
method do_delete_recipe (line 129) | def do_delete_recipe(self, args: argparse.Namespace) -> None:
method do_delete_result (line 133) | def do_delete_result(self, args: argparse.Namespace) -> None:
method do_delete_runner (line 137) | def do_delete_runner(self, args: argparse.Namespace) -> None:
method do_delete_metric (line 141) | def do_delete_metric(self, args: argparse.Namespace) -> None:
method do_delete_dataset (line 145) | def do_delete_dataset(self, args: argparse.Namespace) -> None:
method do_update_cookbook (line 153) | def do_update_cookbook(self, args: argparse.Namespace) -> None:
method do_update_recipe (line 157) | def do_update_recipe(self, args: argparse.Namespace) -> None:
method do_run_cookbook (line 165) | def do_run_cookbook(self, args: argparse.Namespace) -> None:
method do_run_recipe (line 169) | def do_run_recipe(self, args: argparse.Namespace) -> None:
method do_view_cookbook (line 177) | def do_view_cookbook(self, args: argparse.Namespace) -> None:
method do_view_recipe (line 181) | def do_view_recipe(self, args: argparse.Namespace) -> None:
method do_view_result (line 185) | def do_view_result(self, args: argparse.Namespace) -> None:
method do_view_runner (line 189) | def do_view_runner(self, args: argparse.Namespace) -> None:
method do_view_run (line 193) | def do_view_run(self, args: argparse.Namespace) -> None:
method do_view_metric (line 197) | def do_view_metric(self, args: argparse.Namespace) -> None:
method do_view_dataset (line 201) | def do_view_dataset(self, args: argparse.Namespace) -> None:
FILE: moonshot/integrations/cli/benchmark/cookbook.py
function add_cookbook (line 60) | def add_cookbook(args) -> None:
function list_cookbooks (line 112) | def list_cookbooks(args) -> list | None:
function view_cookbook (line 174) | def view_cookbook(args) -> None:
function run_cookbook (line 207) | def run_cookbook(args) -> None:
function update_cookbook (line 336) | def update_cookbook(args) -> None:
function delete_cookbook (line 384) | def delete_cookbook(args) -> None:
function _display_cookbooks (line 429) | def _display_cookbooks(cookbooks_list):
function _display_view_cookbook (line 470) | def _display_view_cookbook(cookbook_info):
function _show_cookbook_results (line 538) | def _show_cookbook_results(cookbooks, endpoints, cookbook_results, durat...
function _generate_cookbook_table (line 568) | def _generate_cookbook_table(cookbooks: list, endpoints: list, results: ...
FILE: moonshot/integrations/cli/benchmark/datasets.py
function list_datasets (line 28) | def list_datasets(args) -> list | None:
function view_dataset (line 85) | def view_dataset(args) -> None:
function delete_dataset (line 121) | def delete_dataset(args) -> None:
function _display_datasets (line 162) | def _display_datasets(datasets_list: list):
FILE: moonshot/integrations/cli/benchmark/metrics.py
function list_metrics (line 23) | def list_metrics(args) -> list | None:
function view_metric (line 81) | def view_metric(args) -> None:
function delete_metric (line 117) | def delete_metric(args) -> None:
function _display_metrics (line 154) | def _display_metrics(metrics_list: list):
FILE: moonshot/integrations/cli/benchmark/recipe.py
function add_recipe (line 65) | def add_recipe(args) -> None:
function list_recipes (line 200) | def list_recipes(args) -> list | None:
function view_recipe (line 260) | def view_recipe(args) -> None:
function run_recipe (line 288) | def run_recipe(args) -> None:
function update_recipe (line 416) | def update_recipe(args) -> None:
function delete_recipe (line 461) | def delete_recipe(args) -> None:
function _display_view_grading_scale_format (line 501) | def _display_view_grading_scale_format(title: str, grading_scale: dict) ...
function _display_view_statistics_format (line 526) | def _display_view_statistics_format(title: str, stats: dict) -> str:
function _display_recipes (line 559) | def _display_recipes(recipes_list: list) -> None:
function _show_recipe_results (line 615) | def _show_recipe_results(recipes, endpoints, recipe_results, duration):
function _generate_recipe_table (line 645) | def _generate_recipe_table(recipes: list, endpoints: list, results: dict...
FILE: moonshot/integrations/cli/benchmark/result.py
function list_results (line 31) | def list_results(args) -> list | None:
function view_result (line 88) | def view_result(args) -> None:
function delete_result (line 126) | def delete_result(args) -> None:
function _display_results (line 163) | def _display_results(results_list):
function _display_view_recipe_result (line 220) | def _display_view_recipe_result(result_info):
function _display_view_cookbook_result (line 240) | def _display_view_cookbook_result(result_info):
FILE: moonshot/integrations/cli/benchmark/run.py
function list_runs (line 26) | def list_runs(args) -> list | None:
function view_run (line 81) | def view_run(args) -> None:
function _display_runs (line 113) | def _display_runs(runs_list: list):
FILE: moonshot/integrations/cli/benchmark/runner.py
function list_runners (line 28) | def list_runners() -> None:
function view_runner (line 48) | def view_runner(args) -> None:
function delete_runner (line 75) | def delete_runner(args) -> None:
function _display_runners (line 112) | def _display_runners(
FILE: moonshot/integrations/cli/cli.py
class CommandLineInterface (line 20) | class CommandLineInterface(cmd2.Cmd):
method __init__ (line 21) | def __init__(self):
method welcome (line 26) | def welcome(self) -> None:
method default (line 41) | def default(self, statement: Statement) -> None:
method postcmd (line 51) | def postcmd(self, stop, line):
FILE: moonshot/integrations/cli/common/common.py
class CommonCommandSet (line 34) | class CommonCommandSet(cmd2.CommandSet):
method __init__ (line 35) | def __init__(self):
method do_list_connector_types (line 43) | def do_list_connector_types(self, args: argparse.Namespace) -> None:
method do_list_endpoints (line 47) | def do_list_endpoints(self, args: argparse.Namespace) -> None:
method do_list_prompt_templates (line 51) | def do_list_prompt_templates(self, args: argparse.Namespace) -> None:
method do_delete_prompt_template (line 55) | def do_delete_prompt_template(self, args: argparse.Namespace) -> None:
method do_add_endpoint (line 62) | def do_add_endpoint(self, args: argparse.Namespace) -> None:
method do_convert_dataset (line 66) | def do_convert_dataset(self, args: argparse.Namespace) -> None:
method do_download_dataset (line 70) | def do_download_dataset(self, args: argparse.Namespace) -> None:
method do_delete_endpoint (line 77) | def do_delete_endpoint(self, args: argparse.Namespace) -> None:
method do_update_endpoint (line 84) | def do_update_endpoint(self, args: argparse.Namespace) -> None:
method do_view_endpoint (line 91) | def do_view_endpoint(self, args: argparse.Namespace) -> None:
FILE: moonshot/integrations/cli/common/connectors.py
function add_endpoint (line 45) | def add_endpoint(args) -> None:
function list_endpoints (line 124) | def list_endpoints(args) -> list | None:
function list_connector_types (line 177) | def list_connector_types(args) -> list | None:
function view_endpoint (line 234) | def view_endpoint(args) -> None:
function update_endpoint (line 263) | def update_endpoint(args) -> None:
function delete_endpoint (line 307) | def delete_endpoint(args) -> None:
function _display_connector_types (line 345) | def _display_connector_types(connector_types: list) -> None:
function _display_endpoints (line 373) | def _display_endpoints(endpoints_list):
FILE: moonshot/integrations/cli/common/dataset.py
function list_datasets (line 27) | def list_datasets(args) -> list | None:
function view_dataset (line 84) | def view_dataset(args) -> None:
function delete_dataset (line 120) | def delete_dataset(args) -> None:
function convert_dataset (line 158) | def convert_dataset(args) -> None:
function download_dataset (line 186) | def download_dataset(args) -> None:
function _display_datasets (line 217) | def _display_datasets(datasets_list: list):
FILE: moonshot/integrations/cli/common/display_helper.py
function display_view_list_format (line 1) | def display_view_list_format(title: str, items: list) -> str:
function display_view_str_format (line 24) | def display_view_str_format(title: str, item: str) -> str:
FILE: moonshot/integrations/cli/common/prompt_template.py
function list_prompt_templates (line 22) | def list_prompt_templates(args) -> list | None:
function delete_prompt_template (line 76) | def delete_prompt_template(args) -> None:
function _display_prompt_templates (line 109) | def _display_prompt_templates(prompt_templates) -> None:
FILE: moonshot/integrations/cli/initialisation/initialisation.py
class InitialisationCommandSet (line 5) | class InitialisationCommandSet(cmd2.CommandSet):
method __init__ (line 6) | def __init__(self):
method do_interactive (line 9) | def do_interactive(self, _: cmd2.Statement) -> None:
FILE: moonshot/integrations/cli/redteam/attack_module.py
function list_attack_modules (line 21) | def list_attack_modules(args) -> list | None:
function delete_attack_module (line 78) | def delete_attack_module(args) -> None:
function _display_attack_modules (line 103) | def _display_attack_modules(attack_modules: list) -> None:
FILE: moonshot/integrations/cli/redteam/context_strategy.py
function use_context_strategy (line 20) | def use_context_strategy(args: argparse.Namespace) -> None:
function list_context_strategies (line 57) | def list_context_strategies(args) -> list | None:
function clear_context_strategy (line 89) | def clear_context_strategy() -> None:
function delete_context_strategy (line 107) | def delete_context_strategy(args) -> None:
function _display_context_strategies (line 129) | def _display_context_strategies(context_strategies: list) -> None:
FILE: moonshot/integrations/cli/redteam/prompt_template.py
function use_prompt_template (line 12) | def use_prompt_template(args: argparse.Namespace) -> None:
function clear_prompt_template (line 40) | def clear_prompt_template() -> None:
FILE: moonshot/integrations/cli/redteam/redteam.py
class RedTeamCommandSet (line 54) | class RedTeamCommandSet(cmd2.CommandSet):
method __init__ (line 55) | def __init__(self):
method do_new_session (line 59) | def do_new_session(self, args: argparse.Namespace) -> None:
method do_end_session (line 62) | def do_end_session(self, _: cmd2.Statement) -> None:
method do_list_sessions (line 66) | def do_list_sessions(self, args: argparse.Namespace) -> None:
method do_use_session (line 70) | def do_use_session(self, args: argparse.Namespace) -> None:
method do_use_prompt_template (line 74) | def do_use_prompt_template(self, args: argparse.Namespace) -> None:
method do_clear_prompt_template (line 77) | def do_clear_prompt_template(self, _: cmd2.Statement) -> None:
method do_list_context_strategies (line 81) | def do_list_context_strategies(self, args: argparse.Namespace) -> None:
method do_use_context_strategy (line 85) | def do_use_context_strategy(self, args: argparse.Namespace) -> None:
method do_clear_context_strategy (line 88) | def do_clear_context_strategy(self, _: cmd2.Statement) -> None:
method do_run_attack_module (line 92) | def do_run_attack_module(self, args: argparse.Namespace) -> None:
method do_list_attack_modules (line 96) | def do_list_attack_modules(self, args: argparse.Namespace) -> None:
method do_delete_session (line 100) | def do_delete_session(self, args: argparse.Namespace) -> None:
method do_delete_context_strategy (line 104) | def do_delete_context_strategy(self, args: argparse.Namespace) -> None:
method do_delete_attack_module (line 108) | def do_delete_attack_module(self, args: argparse.Namespace) -> None:
method do_add_bookmark (line 112) | def do_add_bookmark(self, args: argparse.Namespace) -> None:
method do_use_bookmark (line 116) | def do_use_bookmark(self, args: argparse.Namespace) -> None:
method do_delete_bookmark (line 120) | def do_delete_bookmark(self, args: argparse.Namespace) -> None:
method do_list_bookmarks (line 124) | def do_list_bookmarks(self, args: argparse.Namespace) -> None:
method do_view_bookmark (line 128) | def do_view_bookmark(self, args: argparse.Namespace) -> None:
method do_export_bookmarks (line 132) | def do_export_bookmarks(self, args: argparse.Namespace) -> None:
method do_show_prompts (line 135) | def do_show_prompts(self, _: cmd2.Statement) -> None:
FILE: moonshot/integrations/cli/redteam/session.py
function new_session (line 48) | def new_session(args) -> None:
function use_session (line 132) | def use_session(args) -> None:
function show_prompts (line 167) | def show_prompts() -> None:
function end_session (line 180) | def end_session() -> None:
function list_sessions (line 188) | def list_sessions(args) -> list | None:
function update_chat_display (line 244) | def update_chat_display() -> None:
function add_bookmark (line 298) | def add_bookmark(args) -> None:
function use_bookmark (line 361) | def use_bookmark(args) -> None:
function delete_bookmark (line 406) | def delete_bookmark(args) -> None:
function list_bookmarks (line 437) | def list_bookmarks(args) -> list | None:
function _display_bookmarks (line 472) | def _display_bookmarks(bookmarks_list) -> None:
function view_bookmark (line 518) | def view_bookmark(args) -> None:
function _display_bookmark (line 533) | def _display_bookmark(bookmark_info: dict) -> None:
function export_bookmarks (line 586) | def export_bookmarks(args) -> None:
function manual_red_teaming (line 600) | def manual_red_teaming(user_prompt: str) -> None:
function run_attack_module (line 657) | def run_attack_module(args):
function _reload_session (line 743) | def _reload_session(runner_id: str) -> None:
function delete_session (line 763) | def delete_session(args) -> None:
function _display_sessions (line 792) | def _display_sessions(sessions: list) -> None:
FILE: moonshot/integrations/cli/utils/process_data.py
function filter_data (line 5) | def filter_data(
FILE: moonshot/integrations/web_api/__main__.py
function start_app (line 14) | def start_app():
FILE: moonshot/integrations/web_api/app.py
class CustomFastAPI (line 32) | class CustomFastAPI(FastAPI):
function monitor_tasks (line 36) | async def monitor_tasks(loop: asyncio.AbstractEventLoop):
function lifespan (line 45) | async def lifespan(app: FastAPI):
function log_request_origin (line 51) | async def log_request_origin(
function create_app (line 60) | def create_app(cfg: providers.Configuration) -> CustomFastAPI:
FILE: moonshot/integrations/web_api/container.py
class Container (line 25) | class Container(containers.DeclarativeContainer):
FILE: moonshot/integrations/web_api/logging_conf.py
class ColorizedFormatter (line 24) | class ColorizedFormatter(logging.Formatter):
method __init__ (line 33) | def __init__(
method format (line 43) | def format(self, record: logging.LogRecord):
function create_logging_dir (line 52) | def create_logging_dir(log_file_path: str):
function configure_app_logging (line 57) | def configure_app_logging(cfg: providers.Configuration):
function create_uvicorn_log_config (line 78) | def create_uvicorn_log_config(cfg: providers.Configuration) -> UvicornLo...
FILE: moonshot/integrations/web_api/routes/attack_modules.py
function get_all_attack_module (line 13) | def get_all_attack_module(
function get_all_attack_module_metadata (line 49) | def get_all_attack_module_metadata(
FILE: moonshot/integrations/web_api/routes/benchmark.py
function benchmark_executor (line 16) | async def benchmark_executor(
function get_benchmark_progress (line 55) | def get_benchmark_progress(
function cancel_benchmark_executor (line 93) | async def cancel_benchmark_executor(
FILE: moonshot/integrations/web_api/routes/benchmark_result.py
function get_all_results (line 13) | async def get_all_results(
function get_all_results_name (line 53) | async def get_all_results_name(
function get_one_results (line 95) | async def get_one_results(
function delete_result (line 137) | def delete_result(
FILE: moonshot/integrations/web_api/routes/bookmark.py
function insert_bookmark (line 19) | def insert_bookmark(
function get_all_bookmarks (line 59) | def get_all_bookmarks(
function delete_bookmark (line 99) | def delete_bookmark(
function export_bookbookmarks (line 146) | def export_bookbookmarks(
FILE: moonshot/integrations/web_api/routes/context_strategy.py
function get_all_context_strategies (line 13) | def get_all_context_strategies(
function get_all_context_strategies_name (line 54) | def get_all_context_strategies_name(
function delete_context_strategy (line 95) | def delete_context_strategy(
FILE: moonshot/integrations/web_api/routes/cookbook.py
function create_cookbook (line 17) | def create_cookbook(
function get_all_cookbooks (line 56) | def get_all_cookbooks(
function get_all_cookbooks_name (line 113) | def get_all_cookbooks_name(
function update_cookbook (line 150) | def update_cookbook(
function delete_cookbook (line 191) | def delete_cookbook(
FILE: moonshot/integrations/web_api/routes/dataset.py
function upload_dataset (line 18) | async def upload_dataset(
function download_dataset (line 82) | def download_dataset(
function get_all_datasets (line 121) | def get_all_datasets(
function get_all_datasets_name (line 157) | def get_all_datasets_name(
function delete_dataset (line 193) | def delete_dataset(
FILE: moonshot/integrations/web_api/routes/endpoint.py
function add_new_endpoint (line 17) | def add_new_endpoint(
function get_all_endpoints (line 56) | def get_all_endpoints(
function get_all_endpoints_name (line 96) | def get_all_endpoints_name(
function get_endpoint (line 129) | def get_endpoint(
function update_endpoint (line 170) | async def update_endpoint(
function delete_endpoint (line 211) | async def delete_endpoint(
function get_all_connectors (line 250) | def get_all_connectors(
FILE: moonshot/integrations/web_api/routes/metric.py
function get_all_metrics (line 13) | def get_all_metrics(
function delete_metric (line 43) | def delete_metric(
FILE: moonshot/integrations/web_api/routes/prompt_template.py
function get_all_prompt_templates (line 14) | def get_all_prompt_templates(
function get_all_prompt_templates_names (line 52) | def get_all_prompt_templates_names(
function delete_prompt_template (line 93) | def delete_prompt_template(
FILE: moonshot/integrations/web_api/routes/recipe.py
function create_recipe (line 17) | def create_recipe(
function get_all_recipes (line 56) | def get_all_recipes(
function get_all_recipes_name (line 107) | def get_all_recipes_name(
function update_recipe (line 144) | async def update_recipe(
function delete_recipe (line 185) | def delete_recipe(
FILE: moonshot/integrations/web_api/routes/redteam.py
function healthcheck (line 20) | async def healthcheck() -> dict[str, str]:
function get_all_sessions (line 32) | async def get_all_sessions(
function get_all_sessions_name (line 63) | async def get_all_sessions_name(
function get_session_by_runner_id (line 93) | async def get_session_by_runner_id(
function create_session (line 133) | async def create_session(
function prompt (line 166) | async def prompt(
function cancel_auto_redteam (line 205) | async def cancel_auto_redteam(
function delete_session (line 237) | async def delete_session(
function set_prompt_template (line 270) | async def set_prompt_template(
function unset_prompt_template (line 305) | async def unset_prompt_template(
function set_context_strategy (line 342) | async def set_context_strategy(
function unset_context_strategy (line 381) | async def unset_context_strategy(
function set_attack_module (line 418) | async def set_attack_module(
function unset_attack_module (line 453) | async def unset_attack_module(
function set_metric (line 488) | async def set_metric(
function unset_metric (line 523) | async def unset_metric(
function set_system_prompts (line 558) | async def set_system_prompts(
function unset_system_prompts (line 577) | async def unset_system_prompts(
function close_session (line 596) | async def close_session(
FILE: moonshot/integrations/web_api/routes/runner.py
function get_all_runners (line 13) | def get_all_runners(
function get_all_runner_name (line 49) | def get_all_runner_name(
function get_runner_by_id (line 85) | def get_runner_by_id(
function delete_runner (line 124) | def delete_runner(
function get_run_details_by_runner (line 163) | def get_run_details_by_runner(
function get_runs_id_in_runner (line 206) | def get_runs_id_in_runner(
FILE: moonshot/integrations/web_api/schemas/benchmark_runner_dto.py
class BenchmarkRunnerDTO (line 4) | class BenchmarkRunnerDTO(BaseModel):
FILE: moonshot/integrations/web_api/schemas/bookmark_create_dto.py
class BookmarkCreateDTO (line 8) | class BookmarkCreateDTO(BookmarkPydanticModel):
FILE: moonshot/integrations/web_api/schemas/cookbook_create_dto.py
class CookbookCreateDTO (line 10) | class CookbookCreateDTO(CookbookPydanticModel):
class CookbookUpdateDTO (line 19) | class CookbookUpdateDTO(CookbookPydanticModel):
FILE: moonshot/integrations/web_api/schemas/cookbook_response_model.py
class CookbookResponseModel (line 8) | class CookbookResponseModel(CookbookPydanticModel):
FILE: moonshot/integrations/web_api/schemas/dataset_create_dto.py
class CSV_Dataset_DTO (line 10) | class CSV_Dataset_DTO(DatasetPydanticModel):
class HF_Dataset_DTO (line 20) | class HF_Dataset_DTO(DatasetPydanticModel):
FILE: moonshot/integrations/web_api/schemas/dataset_response_dto.py
class DatasetResponseDTO (line 4) | class DatasetResponseDTO(BaseModel):
FILE: moonshot/integrations/web_api/schemas/endpoint_create_dto.py
class EndpointCreateDTO (line 8) | class EndpointCreateDTO(ConnectorEndpointPydanticModel):
class EndpointUpdateDTO (line 12) | class EndpointUpdateDTO(ConnectorEndpointPydanticModel):
FILE: moonshot/integrations/web_api/schemas/endpoint_response_model.py
class EndpointDataModel (line 6) | class EndpointDataModel(ConnectorEndpointPydanticModel):
method mask_token (line 9) | def mask_token(self):
FILE: moonshot/integrations/web_api/schemas/prompt_response_model.py
class PromptInfo (line 6) | class PromptInfo(BaseModel):
FILE: moonshot/integrations/web_api/schemas/prompt_template_response_model.py
class PromptTemplate (line 4) | class PromptTemplate(BaseModel):
FILE: moonshot/integrations/web_api/schemas/recipe_create_dto.py
class RecipeCreateDTO (line 8) | class RecipeCreateDTO(RecipePydanticModel):
class RecipeUpdateDTO (line 21) | class RecipeUpdateDTO(RecipePydanticModel):
FILE: moonshot/integrations/web_api/schemas/recipe_response_model.py
class RecipeResponseModel (line 6) | class RecipeResponseModel(RecipePydanticModel):
FILE: moonshot/integrations/web_api/schemas/session_create_dto.py
class SessionCreateDTO (line 6) | class SessionCreateDTO(BaseModel):
FILE: moonshot/integrations/web_api/schemas/session_prompt_dto.py
class SessionPromptDTO (line 4) | class SessionPromptDTO(BaseModel):
FILE: moonshot/integrations/web_api/schemas/session_response_model.py
class ChatRecord (line 6) | class ChatRecord(BaseModel):
class SessionMetadataModel (line 20) | class SessionMetadataModel(BaseModel):
class SessionResponseModel (line 34) | class SessionResponseModel(BaseModel):
FILE: moonshot/integrations/web_api/services/attack_module_service.py
class AttackModuleService (line 6) | class AttackModuleService(BaseService):
method get_all_attack_module (line 8) | def get_all_attack_module(self) -> list[str]:
method get_all_attack_module_metadata (line 22) | def get_all_attack_module_metadata(self) -> list[dict]:
FILE: moonshot/integrations/web_api/services/auto_red_team_test_manager.py
class AutoRedTeamTestManager (line 18) | class AutoRedTeamTestManager(BaseService):
method __init__ (line 20) | def __init__(
method generate_unique_task_id (line 38) | def generate_unique_task_id(self) -> str:
method add_task (line 42) | def add_task(
method remove_task (line 47) | def remove_task(self, executor_id: str) -> None:
method cancel_task (line 50) | async def cancel_task(self, executor_id: str) -> None:
method update_progress_status (line 53) | def update_progress_status(self, updates: RedTeamTestProgress):
method on_task_completed (line 56) | def on_task_completed(self, task: asyncio.Task[Any]) -> None:
method schedule_art_task (line 59) | async def schedule_art_task(
method send_art_prompt (line 83) | async def send_art_prompt(self, art_args, active_runner: Runner, batch...
FILE: moonshot/integrations/web_api/services/auto_red_team_test_state.py
class AutoRedTeamTaskInfo (line 9) | class AutoRedTeamTaskInfo(TypedDict):
class AutoRedTeamTestState (line 15) | class AutoRedTeamTestState(BaseService):
method add_task (line 18) | def add_task(
method remove_task (line 27) | def remove_task(self, id: str) -> AutoRedTeamTaskInfo:
method cancel_task (line 30) | async def cancel_task(self, id: str) -> None:
method update_progress_status (line 40) | def update_progress_status(self, updates: RedTeamTestProgress) -> None:
method get_state (line 44) | def get_state(self) -> dict[str, AutoRedTeamTaskInfo]:
method get_progress_status (line 47) | def get_progress_status(self, id: str) -> RedTeamTestProgress | None:
method get_all_progress_status (line 52) | def get_all_progress_status(self) -> dict[str, RedTeamTestProgress]:
FILE: moonshot/integrations/web_api/services/base_service.py
class BaseService (line 4) | class BaseService:
method __init__ (line 5) | def __init__(self) -> None:
FILE: moonshot/integrations/web_api/services/benchmark_result_service.py
class BenchmarkResultService (line 7) | class BenchmarkResultService(BaseService):
method get_all_results (line 9) | def get_all_results(self) -> list[BenchmarkResult]:
method get_all_result_name (line 14) | def get_all_result_name(self) -> list[str] | None:
method get_result_by_id (line 19) | def get_result_by_id(self, result_id: str) -> BenchmarkResult:
method delete_result (line 24) | def delete_result(self, result_id: str) -> None:
FILE: moonshot/integrations/web_api/services/benchmark_test_manager.py
class BenchmarkTestManager (line 20) | class BenchmarkTestManager(BaseService):
method __init__ (line 22) | def __init__(
method generate_unique_task_id (line 33) | def generate_unique_task_id(self) -> str:
method add_task (line 37) | def add_task(
method remove_task (line 42) | def remove_task(self, executor_id: str) -> None:
method cancel_task (line 45) | async def cancel_task(self, executor_id: str) -> None:
method update_progress_status (line 48) | def update_progress_status(self, updates: TestRunProgress):
method on_task_completed (line 51) | def on_task_completed(self, task: asyncio.Task[Any]) -> None:
method run_test (line 54) | async def run_test(
method schedule_test_task (line 82) | async def schedule_test_task(
FILE: moonshot/integrations/web_api/services/benchmark_test_state.py
class BenchmarkTaskInfo (line 9) | class BenchmarkTaskInfo(TypedDict):
class BenchmarkTestState (line 15) | class BenchmarkTestState(BaseService):
method add_task (line 18) | def add_task(
method remove_task (line 27) | def remove_task(self, id: str) -> BenchmarkTaskInfo:
method cancel_task (line 30) | async def cancel_task(self, id: str) -> None:
method update_progress_status (line 40) | def update_progress_status(self, updates: TestRunProgress) -> None:
method get_state (line 43) | def get_state(self) -> dict[str, BenchmarkTaskInfo]:
method get_progress_status (line 46) | def get_progress_status(self, id: str) -> TestRunProgress | None:
method get_all_progress_status (line 51) | def get_all_progress_status(self) -> dict[str, TestRunProgress]:
FILE: moonshot/integrations/web_api/services/benchmarking_service.py
class BenchmarkingService (line 10) | class BenchmarkingService(BaseService):
method __init__ (line 12) | def __init__(self, benchmark_test_manager: BenchmarkTestManager) -> None:
method execute_cookbook (line 16) | async def execute_cookbook(self, cookbook_executor_data: BenchmarkRunn...
method execute_recipe (line 23) | async def execute_recipe(self, recipe_executor_data: BenchmarkRunnerDTO):
method cancel_executor (line 30) | async def cancel_executor(self, executor_id: str) -> None:
FILE: moonshot/integrations/web_api/services/bookmark_service.py
class BookmarkService (line 8) | class BookmarkService(BaseService):
method insert_bookmark (line 10) | def insert_bookmark(self, bookmark_data: BookmarkCreateDTO) -> dict:
method get_all_bookmarks (line 31) | def get_all_bookmarks(self, name: str | None = None) -> list[BookmarkP...
method delete_bookmarks (line 53) | def delete_bookmarks(self, all: bool = False, name: str | None = None)...
method export_bookmarks (line 80) | def export_bookmarks(self, export_file_name: str = "bookmarks") -> str:
FILE: moonshot/integrations/web_api/services/context_strategy_service.py
class ContextStrategyService (line 6) | class ContextStrategyService(BaseService):
method get_ctx_strategy (line 8) | def get_ctx_strategy(self) -> list[dict]:
method get_ctx_strategy_name (line 13) | def get_ctx_strategy_name(self) -> list[str]:
method delete_ctx_strategy (line 18) | def delete_ctx_strategy(self, ctx_strategy_name: str) -> None:
FILE: moonshot/integrations/web_api/services/cookbook_service.py
class CookbookService (line 15) | class CookbookService(BaseService):
method create_cookbook (line 17) | def create_cookbook(self, cookbook_data: CookbookCreateDTO) -> None:
method get_all_cookbooks (line 38) | def get_all_cookbooks(
method get_all_cookbooks_names (line 116) | def get_all_cookbooks_names(self) -> list[str]:
method update_cookbook (line 127) | def update_cookbook(
method delete_cookbook (line 145) | def delete_cookbook(self, cookbook_id: str) -> None:
function get_total_prompt_and_dataset_in_cookbook (line 156) | def get_total_prompt_and_dataset_in_cookbook(cookbook: Cookbook) -> tupl...
function cookbook_has_tags (line 176) | def cookbook_has_tags(tags: str, cookbook: Cookbook) -> bool:
function cookbook_has_categories (line 192) | def cookbook_has_categories(categories: str, cookbook: Cookbook) -> bool:
function cookbook_metrics_dependency (line 211) | def cookbook_metrics_dependency(cookbook: Cookbook) -> dict | None:
FILE: moonshot/integrations/web_api/services/dataset_service.py
class DatasetService (line 10) | class DatasetService(BaseService):
method convert_dataset (line 12) | def convert_dataset(self, dataset_data: CSV_Dataset_DTO) -> str:
method download_dataset (line 36) | def download_dataset(self, dataset_data: HF_Dataset_DTO) -> str:
method get_all_datasets (line 60) | def get_all_datasets(self) -> list[DatasetResponseDTO]:
method get_all_datasets_name (line 65) | def get_all_datasets_name(self) -> list[str] | None:
method delete_dataset (line 70) | def delete_dataset(self, dataset_id: str) -> None:
FILE: moonshot/integrations/web_api/services/endpoint_service.py
class EndpointService (line 8) | class EndpointService(BaseService):
method add_endpoint (line 10) | def add_endpoint(self, endpoint_data: EndpointDataModel) -> None:
method get_all_endpoints (line 23) | def get_all_endpoints(self) -> list[EndpointDataModel | None]:
method get_endpoint (line 39) | def get_endpoint(self, endpoint_id: str) -> EndpointDataModel | None:
method get_all_endpoints_names (line 44) | def get_all_endpoints_names(self) -> list[str]:
method update_endpoint (line 49) | def update_endpoint(
method delete_endpoint (line 60) | def delete_endpoint(self, endpoint_id: str) -> None:
method get_all_connectors (line 64) | def get_all_connectors(self) -> list[str]:
FILE: moonshot/integrations/web_api/services/metric_service.py
class MetricService (line 6) | class MetricService(BaseService):
method get_all_metric (line 8) | def get_all_metric(self) -> list[dict]:
method delete_metric (line 13) | def delete_metric(self, metric_id: str) -> None:
FILE: moonshot/integrations/web_api/services/prompt_template_service.py
class PromptTemplateService (line 8) | class PromptTemplateService(BaseService):
method get_prompt_templates (line 10) | def get_prompt_templates(self) -> list[dict[str, Any]]:
method get_prompt_templates_name (line 21) | def get_prompt_templates_name(self) -> list[str]:
method delete_prompt_template (line 32) | def delete_prompt_template(self, pt_id: str):
FILE: moonshot/integrations/web_api/services/recipe_service.py
class RecipeService (line 10) | class RecipeService(BaseService):
method create_recipe (line 12) | def create_recipe(self, recipe_data: RecipeCreateDTO) -> None:
method get_all_recipes (line 31) | def get_all_recipes(
method get_all_recipes_name (line 93) | def get_all_recipes_name(self) -> list[str]:
method update_recipe (line 104) | def update_recipe(self, recipe_data: RecipeUpdateDTO, recipe_id: str) ...
method delete_recipe (line 121) | def delete_recipe(self, recipe_id: str) -> None:
function get_total_prompt_in_recipe (line 132) | def get_total_prompt_in_recipe(recipe: Recipe) -> tuple[int, int]:
function get_metric_dependency_in_recipe (line 162) | def get_metric_dependency_in_recipe(recipe: Recipe) -> dict | None:
FILE: moonshot/integrations/web_api/services/runner_service.py
class RunnerService (line 11) | class RunnerService(BaseService):
method get_all_runner (line 13) | def get_all_runner(self) -> list[dict]:
method get_all_runner_name (line 24) | def get_all_runner_name(self) -> list[str]:
method get_runner_by_id (line 35) | def get_runner_by_id(self, runner_id: str) -> dict | None:
method delete_run (line 49) | def delete_run(self, runner_id: str) -> None:
method create_runner (line 59) | def create_runner(
method load_runner (line 86) | def load_runner(
method get_run_details_by_runner (line 106) | def get_run_details_by_runner(self, runner_id: str, run_id: int):
method get_runs_id_in_runner (line 133) | def get_runs_id_in_runner(self, runner_id) -> list[int]:
FILE: moonshot/integrations/web_api/services/session_service.py
class SessionService (line 20) | class SessionService(BaseService):
method __init__ (line 24) | def __init__(
method create_new_session (line 43) | def create_new_session(
method get_all_session (line 93) | def get_all_session(self) -> list[SessionMetadataModel]:
method get_all_sessions_names (line 117) | def get_all_sessions_names(self) -> list[str]:
method get_session_by_runner_id (line 130) | def get_session_by_runner_id(
method update_session_chat (line 168) | def update_session_chat(self, runner_id: str):
method delete_session (line 186) | def delete_session(self, runner_id: str) -> None:
method select_prompt_template (line 198) | def select_prompt_template(self, runner_id: str, prompt_template_name:...
method select_ctx_strategy (line 213) | def select_ctx_strategy(
method select_attack_module (line 234) | def select_attack_module(self, runner_id: str, attack_module_name: str...
method select_metric (line 247) | def select_metric(self, runner_id: str, metric_name: str = ""):
method update_system_prompt (line 260) | def update_system_prompt(self, runner_id: str, system_prompt: str = ""):
method send_prompt (line 273) | async def send_prompt(
method cancel_auto_redteam (line 333) | async def cancel_auto_redteam(self, runner_id: str):
method end_session (line 340) | async def end_session(self, runner_id: str):
FILE: moonshot/integrations/web_api/services/utils/exceptions_handler.py
class ServiceException (line 7) | class ServiceException(Exception):
method __init__ (line 11) | def __init__(
function exception_handler (line 20) | def exception_handler(func: Callable[..., Any]) -> Callable[..., Any]:
FILE: moonshot/integrations/web_api/services/utils/file_manager.py
function create_temp_dir (line 8) | def create_temp_dir(temp_file_path: str):
function copy_file (line 24) | def copy_file(file_path: str) -> str:
FILE: moonshot/integrations/web_api/services/utils/results_formatter.py
function transform_web_format (line 1) | def transform_web_format(
FILE: moonshot/integrations/web_api/status_updater/interface/benchmark_progress_callback.py
class InterfaceBenchmarkProgressCallback (line 6) | class InterfaceBenchmarkProgressCallback(ABC):
method on_progress_update (line 13) | def on_progress_update(self, progress_data: TestRunProgress) -> None:
FILE: moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback.py
class InterfaceRedTeamProgressCallback (line 6) | class InterfaceRedTeamProgressCallback(ABC):
method on_art_progress_update (line 13) | def on_art_progress_update(self, progress_data: TestRunProgress) -> None:
FILE: moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py
class MoonshotUIWebhook (line 15) | class MoonshotUIWebhook(
method __init__ (line 24) | def __init__(
method on_progress_update (line 44) | def on_progress_update(self, progress_data: TestRunProgress) -> None:
method on_art_progress_update (line 59) | def on_art_progress_update(self, progress_data: RedTeamTestProgress) -...
FILE: moonshot/integrations/web_api/types/types.py
class PromptDetails (line 7) | class PromptDetails(TypedDict):
class EndpointChatHistory (line 19) | class EndpointChatHistory(TypedDict):
class TestRunProgress (line 32) | class TestRunProgress(TypedDict):
class RedTeamTestProgress (line 48) | class RedTeamTestProgress(TypedDict):
class UvicornLoggingConfig (line 58) | class UvicornLoggingConfig(TypedDict):
class UvicornRunArgs (line 66) | class UvicornRunArgs(TypedDict, total=False):
class BenchmarkCollectionType (line 74) | class BenchmarkCollectionType(Enum):
class ResultMetadata (line 79) | class ResultMetadata(TypedDict):
class RequiredMetadata (line 92) | class RequiredMetadata(TypedDict):
class BenchmarkResult (line 96) | class BenchmarkResult(TypedDict, RequiredMetadata, total=False):
FILE: moonshot/src/api/api_bookmark.py
function api_insert_bookmark (line 5) | def api_insert_bookmark(
function api_get_all_bookmarks (line 50) | def api_get_all_bookmarks() -> list[dict]:
function api_get_bookmark (line 60) | def api_get_bookmark(bookmark_name: str) -> dict:
function api_delete_bookmark (line 73) | def api_delete_bookmark(bookmark_name: str) -> dict:
function api_delete_all_bookmark (line 86) | def api_delete_all_bookmark() -> dict:
function api_export_bookmarks (line 96) | def api_export_bookmarks(export_file_name: str = "bookmarks") -> str:
FILE: moonshot/src/api/api_connector.py
function api_create_connector_from_endpoint (line 11) | def api_create_connector_from_endpoint(ep_id: str) -> Connector:
function api_create_connectors_from_endpoints (line 29) | def api_create_connectors_from_endpoints(
function api_get_all_connector_type (line 48) | def api_get_all_connector_type() -> list[str]:
FILE: moonshot/src/api/api_connector_endpoint.py
function api_create_endpoint (line 13) | def api_create_endpoint(
function api_read_endpoint (line 64) | def api_read_endpoint(ep_id: str) -> dict:
function api_update_endpoint (line 80) | def api_update_endpoint(ep_id: str, **kwargs) -> bool:
function api_delete_endpoint (line 120) | def api_delete_endpoint(ep_id: str) -> bool:
function api_get_all_endpoint (line 138) | def api_get_all_endpoint() -> list[dict]:
function api_get_all_endpoint_name (line 153) | def api_get_all_endpoint_name() -> list[str]:
FILE: moonshot/src/api/api_context_strategy.py
function api_get_all_context_strategies (line 9) | def api_get_all_context_strategies() -> list[str]:
function api_delete_context_strategy (line 24) | def api_delete_context_strategy(cs_id: str) -> bool:
function api_get_all_context_strategy_metadata (line 43) | def api_get_all_context_strategy_metadata() -> list[dict]:
FILE: moonshot/src/api/api_cookbook.py
function api_create_cookbook (line 12) | def api_create_cookbook(name: str, description: str, recipes: list[str])...
function api_read_cookbook (line 48) | def api_read_cookbook(cb_id: str) -> dict:
function api_read_cookbooks (line 65) | def api_read_cookbooks(cb_ids: conlist(str, min_length=1)) -> list[dict]:
function api_update_cookbook (line 83) | def api_update_cookbook(cb_id: str, **kwargs) -> bool:
function api_delete_cookbook (line 134) | def api_delete_cookbook(cb_id: str) -> bool:
function api_get_all_cookbook (line 153) | def api_get_all_cookbook() -> list[dict]:
function api_get_all_cookbook_name (line 168) | def api_get_all_cookbook_name() -> list[str]:
FILE: moonshot/src/api/api_dataset.py
function api_delete_dataset (line 14) | def api_delete_dataset(ds_id: str) -> bool:
function api_get_all_datasets (line 30) | def api_get_all_datasets() -> list[dict]:
function api_get_all_datasets_name (line 42) | def api_get_all_datasets_name() -> list[str]:
function api_download_dataset (line 53) | def api_download_dataset(
function api_convert_dataset (line 86) | def api_convert_dataset(
FILE: moonshot/src/api/api_environment_variables.py
function api_set_environment_variables (line 7) | def api_set_environment_variables(env_vars: dict) -> None:
FILE: moonshot/src/api/api_metrics.py
function api_delete_metric (line 10) | def api_delete_metric(met_id: str) -> bool:
function api_get_all_metric (line 26) | def api_get_all_metric() -> list[dict]:
function api_get_all_metric_name (line 40) | def api_get_all_metric_name() -> list[str]:
FILE: moonshot/src/api/api_prompt_template.py
function api_get_all_prompt_template_detail (line 9) | def api_get_all_prompt_template_detail() -> list[dict]:
function api_get_all_prompt_template_name (line 22) | def api_get_all_prompt_template_name() -> list[str]:
function api_delete_prompt_template (line 36) | def api_delete_prompt_template(pt_id: str) -> bool:
FILE: moonshot/src/api/api_recipe.py
function api_create_recipe (line 11) | def api_create_recipe(
function api_read_recipe (line 57) | def api_read_recipe(rec_id: str) -> dict:
function api_read_recipes (line 74) | def api_read_recipes(rec_ids: conlist(str, min_length=1)) -> list[dict]:
function api_update_recipe (line 94) | def api_update_recipe(rec_id: str, **kwargs) -> bool:
function api_delete_recipe (line 131) | def api_delete_recipe(rec_id: str) -> bool:
function api_get_all_recipe (line 154) | def api_get_all_recipe() -> list[dict]:
function api_get_all_recipe_name (line 168) | def api_get_all_recipe_name() -> list[str]:
FILE: moonshot/src/api/api_red_teaming.py
function api_get_all_attack_modules (line 9) | def api_get_all_attack_modules() -> list[str]:
function api_get_all_attack_module_metadata (line 23) | def api_get_all_attack_module_metadata() -> list[dict]:
function api_delete_attack_module (line 39) | def api_delete_attack_module(am_id: str) -> bool:
FILE: moonshot/src/api/api_result.py
function api_read_result (line 10) | def api_read_result(res_id: str) -> dict:
function api_read_results (line 27) | def api_read_results(res_ids: conlist(str, min_length=1)) -> list[dict]:
function api_delete_result (line 44) | def api_delete_result(res_id: str) -> bool:
function api_get_all_result (line 63) | def api_get_all_result() -> list[dict]:
function api_get_all_result_name (line 77) | def api_get_all_result_name() -> list[str]:
FILE: moonshot/src/api/api_run.py
function api_get_all_run (line 9) | def api_get_all_run(runner_id: str = "") -> list[dict]:
function _api_get_available_runs (line 26) | def _api_get_available_runs(
FILE: moonshot/src/api/api_runner.py
function api_create_runner (line 13) | def api_create_runner(
function api_load_runner (line 59) | def api_load_runner(
function api_read_runner (line 80) | def api_read_runner(runner_id: str) -> dict:
function api_delete_runner (line 97) | def api_delete_runner(runner_id: str) -> bool:
function api_get_all_runner (line 116) | def api_get_all_runner() -> list[dict]:
function api_get_all_runner_name (line 130) | def api_get_all_runner_name() -> list[str]:
FILE: moonshot/src/api/api_session.py
function api_load_session (line 18) | def api_load_session(runner_id: str) -> dict | None:
function api_create_session (line 35) | def api_create_session(
function api_get_all_session_names (line 78) | def api_get_all_session_names() -> list[str]:
function api_get_available_session_info (line 92) | def api_get_available_session_info() -> tuple[list[str], list[dict]]:
function api_get_all_session_metadata (line 121) | def api_get_all_session_metadata() -> list[dict]:
function api_update_context_strategy (line 138) | def api_update_context_strategy(runner_id: str, context_strategy: str) -...
function api_update_cs_num_of_prev_prompts (line 159) | def api_update_cs_num_of_prev_prompts(runner_id: str, num_of_prev_prompt...
function api_update_prompt_template (line 180) | def api_update_prompt_template(runner_id: str, prompt_template: str) -> ...
function api_update_metric (line 201) | def api_update_metric(runner_id: str, metric_id: str) -> bool:
function api_update_system_prompt (line 222) | def api_update_system_prompt(runner_id: str, system_prompt: str) -> bool:
function api_update_attack_module (line 243) | def api_update_attack_module(runner_id: str, attack_module_id: str) -> b...
function api_delete_session (line 264) | def api_delete_session(runner_id: str) -> bool:
function api_get_all_chats_from_session (line 281) | def api_get_all_chats_from_session(runner_id: str) -> dict | None:
FILE: moonshot/src/bookmark/bookmark.py
class Bookmark (line 15) | class Bookmark:
method __new__ (line 77) | def __new__(cls, db_name="bookmark"):
method __init_instance (line 96) | def __init_instance(self, db_name: str = "bookmark") -> None:
method add_bookmark (line 118) | def add_bookmark(self, bookmark: BookmarkArguments) -> dict:
method get_all_bookmarks (line 158) | def get_all_bookmarks(self) -> list[dict]:
method get_bookmark (line 180) | def get_bookmark(self, bookmark_name: str) -> dict:
method delete_bookmark (line 214) | def delete_bookmark(self, bookmark_name: str) -> dict:
method delete_all_bookmark (line 264) | def delete_all_bookmark(self) -> dict:
method export_bookmarks (line 287) | def export_bookmarks(self, export_file_name: str = "bookmarks") -> str:
method close (line 342) | def close(self) -> None:
FILE: moonshot/src/bookmark/bookmark_arguments.py
class BookmarkArguments (line 8) | class BookmarkArguments(BaseModel):
method from_tuple_to_dict (line 24) | def from_tuple_to_dict(cls, values: tuple) -> dict:
FILE: moonshot/src/configs/env_variables.py
class EnvVariables (line 13) | class EnvVariables(Enum):
class EnvironmentVars (line 33) | class EnvironmentVars:
method load_env (line 126) | def load_env(env_dict: dict | None = None) -> None:
method get_file_path (line 162) | def get_file_path(file_type: str, file_name: str, ignore_existance: bo...
method get_file_directory (line 186) | def get_file_directory(file_type: str) -> list[str]:
FILE: moonshot/src/connectors/connector.py
function perform_retry_callback (line 26) | def perform_retry_callback(connector_id: str, retry_state: RetryCallStat...
function perform_retry (line 55) | def perform_retry(func):
class Connector (line 82) | class Connector:
method __init__ (line 101) | def __init__(self, ep_args: ConnectorEndpointArguments) -> None:
method _add_tokens (line 139) | async def _add_tokens(self) -> None:
method rate_limited (line 159) | def rate_limited(func: Callable) -> Callable:
method get_response (line 196) | async def get_response(self, prompt: str) -> ConnectorResponse:
method load (line 212) | def load(cls, ep_args: ConnectorEndpointArguments) -> Connector:
method create (line 251) | def create(ep_args: ConnectorEndpointArguments) -> Connector:
method get_available_items (line 282) | def get_available_items() -> list[str]:
method get_prediction (line 311) | async def get_prediction(
method set_system_prompt (line 393) | def set_system_prompt(self, system_prompt: str) -> None:
FILE: moonshot/src/connectors/connector_prompt_arguments.py
class ConnectorPromptArguments (line 10) | class ConnectorPromptArguments(BaseModel):
class Config (line 11) | class Config:
FILE: moonshot/src/connectors/connector_response.py
class ConnectorResponse (line 4) | class ConnectorResponse(BaseModel):
method to_dict (line 8) | def to_dict(self) -> dict:
FILE: moonshot/src/connectors_endpoints/connector_endpoint.py
class ConnectorEndpoint (line 17) | class ConnectorEndpoint:
method create (line 37) | def create(ep_args: ConnectorEndpointArguments) -> str:
method read (line 86) | def read(ep_id: constr(min_length=1)) -> ConnectorEndpointArguments:
method _read_endpoint (line 123) | def _read_endpoint(ep_id: str) -> dict:
method update (line 152) | def update(ep_args: ConnectorEndpointArguments) -> bool:
method delete (line 194) | def delete(ep_id: constr(min_length=1)) -> bool:
method get_available_items (line 222) | def get_available_items() -> tuple[list[str], list[ConnectorEndpointAr...
FILE: moonshot/src/connectors_endpoints/connector_endpoint_arguments.py
class ConnectorEndpointArguments (line 4) | class ConnectorEndpointArguments(BaseModel):
method to_dict (line 33) | def to_dict(self) -> dict:
FILE: moonshot/src/cookbooks/cookbook.py
class Cookbook (line 18) | class Cookbook:
method __init__ (line 19) | def __init__(self, cb_args: CookbookArguments) -> None:
method load (line 28) | def load(cls, cb_id: str) -> Cookbook:
method create (line 44) | def create(cb_args: CookbookArguments) -> str:
method read (line 96) | def read(cb_id: str) -> CookbookArguments:
method _read_cookbook (line 131) | def _read_cookbook(cb_id: str) -> dict:
method update (line 152) | def update(cb_args: CookbookArguments) -> bool:
method delete (line 192) | def delete(cb_id: str) -> bool:
method get_available_items (line 217) | def get_available_items() -> tuple[list[str], list[CookbookArguments]]:
method get_categories_in_recipes (line 253) | def get_categories_in_recipes(recipes: list[str]) -> list[str]:
method get_tags_in_recipes (line 263) | def get_tags_in_recipes(recipes: list[str]) -> list[str]:
FILE: moonshot/src/cookbooks/cookbook_arguments.py
class CookbookArguments (line 4) | class CookbookArguments(BaseModel):
method to_dict (line 19) | def to_dict(self) -> dict:
FILE: moonshot/src/datasets/dataset.py
class Dataset (line 20) | class Dataset:
method create (line 26) | def create(ds_args: DatasetArguments) -> str:
method convert_data (line 80) | def convert_data(csv_file_path: str) -> Iterator[dict]:
method download_hf (line 116) | def download_hf(**hf_args) -> Iterator[dict]:
method read (line 146) | def read(ds_id: str) -> DatasetArguments:
method _read_dataset (line 175) | def _read_dataset(ds_id: str) -> dict:
method delete (line 220) | def delete(ds_id: str) -> bool:
method get_cache_information (line 246) | def get_cache_information() -> dict:
method write_cache_information (line 272) | def write_cache_information(cache_info: dict) -> None:
method get_available_items (line 291) | def get_available_items(
method _get_or_update_dataset_info (line 350) | def _get_or_update_dataset_info(
FILE: moonshot/src/datasets/dataset_arguments.py
class DatasetArguments (line 6) | class DatasetArguments(BaseModel):
class Config (line 7) | class Config:
method to_dict (line 34) | def to_dict(self) -> dict:
FILE: moonshot/src/metrics/metric.py
class Metric (line 17) | class Metric:
method load (line 22) | def load(cls, met_id: str) -> Metric:
method delete (line 49) | def delete(met_id: str) -> bool:
method get_cache_information (line 75) | def get_cache_information() -> dict:
method write_cache_information (line 103) | def write_cache_information(cache_info: dict) -> None:
method get_available_items (line 122) | def get_available_items() -> tuple[list[str], list[dict]]:
method _get_or_update_metrics_info (line 165) | def _get_or_update_metrics_info(
FILE: moonshot/src/metrics/metric_interface.py
class MetricInterface (line 13) | class MetricInterface:
method get_metadata (line 19) | def get_metadata(self) -> dict | None:
method get_results (line 30) | async def get_results(
method get_metrics_configuration (line 62) | def get_metrics_configuration(self, met_id: str) -> dict:
FILE: moonshot/src/prompt_templates/prompt_template.py
class PromptTemplate (line 13) | class PromptTemplate:
method __init__ (line 14) | def __init__(self):
method get_all_prompt_template_names (line 18) | def get_all_prompt_template_names() -> list[str]:
method get_all_prompt_template_details (line 35) | def get_all_prompt_template_details() -> list[dict]:
method delete (line 64) | def delete(pt_id: str) -> bool:
method process_prompt_pt (line 90) | def process_prompt_pt(user_prompt: str, prompt_template_name: str) -> ...
FILE: moonshot/src/recipes/recipe.py
class Recipe (line 18) | class Recipe:
method __init__ (line 19) | def __init__(self, rec_args: RecipeArguments) -> None:
method load (line 32) | def load(cls, rec_id: str) -> Recipe:
method create (line 49) | def create(rec_args: RecipeArguments) -> str:
method read (line 108) | def read(rec_id: str) -> RecipeArguments:
method _get_datasets_prompt_counts (line 140) | def _get_datasets_prompt_counts() -> dict:
method _read_recipe (line 158) | def _read_recipe(rec_id: str, dataset_prompts_count: dict) -> dict:
method update (line 205) | def update(rec_args: RecipeArguments) -> bool:
method delete (line 254) | def delete(rec_id: str) -> bool:
method get_available_items (line 280) | def get_available_items() -> tuple[list[str], list[RecipeArguments]]:
method check_file_exists (line 319) | def check_file_exists(
FILE: moonshot/src/recipes/recipe_arguments.py
class RecipeArguments (line 6) | class RecipeArguments(BaseModel):
method __init__ (line 36) | def __init__(self, **data: Any):
method get_start_of_grading_scale (line 40) | def get_start_of_grading_scale(self, item: tuple[str, list[int]]) -> int:
method validate_grading_scale (line 54) | def validate_grading_scale(self) -> None:
method to_dict (line 88) | def to_dict(self) -> dict:
FILE: moonshot/src/redteaming/attack/attack_module.py
class AttackModule (line 27) | class AttackModule:
method __init__ (line 51) | def __init__(self, am_id: str, am_arguments: AttackModuleArguments | N...
method load (line 67) | def load(
method get_metadata (line 98) | def get_metadata(self) -> dict:
method _generate_prompts (line 108) | async def _generate_prompts(
method _send_prompt_to_all_llm_default (line 170) | async def _send_prompt_to_all_llm_default(self) -> list:
method _send_prompt_to_all_llm (line 204) | async def _send_prompt_to_all_llm(self, list_of_prompts: list) -> list:
method _send_prompt_to_single_llm (line 263) | async def _send_prompt_to_single_llm(
method _write_record_to_db (line 332) | def _write_record_to_db(
method execute (line 353) | async def execute(self) -> Any:
method _generate_predictions (line 363) | async def _generate_predictions(
method load_modules (line 406) | def load_modules(self) -> None:
method get_cache_information (line 433) | def get_cache_information() -> dict:
method write_cache_information (line 459) | def write_cache_information(cache_info: dict) -> None:
method get_available_items (line 478) | def get_available_items() -> tuple[list[str], list[dict]]:
method _get_or_update_attack_module_info (line 523) | def _get_or_update_attack_module_info(
method get_attack_module_req_and_config (line 559) | def get_attack_module_req_and_config(self) -> dict:
method delete (line 599) | def delete(am_id: str) -> bool:
class RedTeamingPromptArguments (line 625) | class RedTeamingPromptArguments(BaseModel):
method to_tuple (line 646) | def to_tuple(self) -> tuple:
method to_dict (line 674) | def to_dict(self) -> dict:
FILE: moonshot/src/redteaming/attack/attack_module_arguments.py
class AttackModuleArguments (line 9) | class AttackModuleArguments(BaseModel):
class Config (line 10) | class Config:
FILE: moonshot/src/redteaming/attack/context_strategy.py
class ContextStrategy (line 15) | class ContextStrategy:
method __init__ (line 16) | def __init__(self, cs_id: str) -> None:
method load (line 20) | def load(cls, cs_id: str) -> ContextStrategy:
method get_all_context_strategies (line 48) | def get_all_context_strategies() -> list[str]:
method delete (line 68) | def delete(cs_id: str) -> bool:
method process_prompt_cs (line 95) | def process_prompt_cs(
FILE: moonshot/src/redteaming/context_strategy/context_strategy_interface.py
class ContextStrategyInterface (line 6) | class ContextStrategyInterface:
method get_metadata (line 9) | def get_metadata(self) -> dict | None:
method add_in_context (line 20) | def add_in_context(
method get_number_of_prev_prompts (line 36) | def get_number_of_prev_prompts(self, no_prev_prompts: int) -> int:
FILE: moonshot/src/redteaming/session/chat.py
class ChatRecord (line 11) | class ChatRecord:
method __init__ (line 12) | def __init__(
method to_dict (line 40) | def to_dict(self) -> dict[str, str]:
class Chat (line 63) | class Chat:
method __init__ (line 74) | def __init__(
method to_dict (line 129) | def to_dict(self) -> dict[str, Union[str, list[dict[str, str]]]]:
method load_chat_history (line 150) | def load_chat_history(session_db_instance: DBInterface, chat_id: str) ...
method get_n_chat_history (line 179) | def get_n_chat_history(
FILE: moonshot/src/redteaming/session/red_teaming_progress.py
class RedTeamingProgress (line 6) | class RedTeamingProgress:
method __init__ (line 9) | def __init__(
method update_red_teaming_chats (line 25) | def update_red_teaming_chats(
method reset_chats (line 74) | def reset_chats(self) -> None:
method update_red_teaming_progress (line 80) | def update_red_teaming_progress(self) -> None:
method notify_progress (line 102) | def notify_progress(self) -> None:
method get_dict (line 110) | def get_dict(self) -> dict:
FILE: moonshot/src/redteaming/session/red_teaming_type.py
class RedTeamingType (line 4) | class RedTeamingType(Enum):
FILE: moonshot/src/redteaming/session/session.py
class SessionMetadata (line 26) | class SessionMetadata:
method __init__ (line 28) | def __init__(
method to_dict (line 52) | def to_dict(self) -> dict:
method to_tuple (line 72) | def to_tuple(self) -> tuple:
method from_tuple (line 93) | def from_tuple(cls, data_tuple: tuple) -> SessionMetadata:
method check_type (line 129) | def check_type(self, checked_attribute: Any, expected_type: type) -> Any:
class Session (line 150) | class Session:
method __init__ (line 202) | def __init__(
method load (line 331) | def load(database_instance: DBInterface | None) -> dict | None:
method run (line 371) | async def run(self) -> list | None:
method cancel (line 472) | def cancel(self) -> None:
method check_redteaming_type (line 486) | def check_redteaming_type(self) -> RedTeamingType:
method update_context_strategy (line 510) | def update_context_strategy(
method update_cs_num_of_prev_prompts (line 544) | def update_cs_num_of_prev_prompts(
method update_prompt_template (line 571) | def update_prompt_template(
method update_metric (line 605) | def update_metric(
method update_system_prompt (line 637) | def update_system_prompt(
method update_attack_module (line 664) | def update_attack_module(
method delete (line 698) | def delete(database_instance: DBInterface | None) -> bool:
method get_session_chats (line 733) | def get_session_chats(database_instance: DBInterface | None) -> dict:
method check_file_exists (line 761) | def check_file_exists(
FILE: moonshot/src/results/result.py
class Result (line 15) | class Result:
method read (line 18) | def read(result_id: str) -> dict:
method _read_result (line 46) | def _read_result(result_id: str) -> dict:
method delete (line 70) | def delete(result_id: str) -> bool:
method get_available_items (line 96) | def get_available_items() -> tuple[list[str], list[dict]]:
FILE: moonshot/src/results/result_arguments.py
class ResultArguments (line 8) | class ResultArguments(BaseModel):
method to_dict (line 25) | def to_dict(self) -> dict:
FILE: moonshot/src/runners/runner.py
class Runner (line 22) | class Runner:
method __init__ (line 42) | def __init__(self, runner_args: RunnerArguments) -> None:
method load (line 56) | def load(
method create (line 99) | def create(cls, runner_args: RunnerArguments) -> Runner:
method read (line 169) | def read(runner_id: str) -> RunnerArguments:
method _read_runner (line 200) | def _read_runner(runner_id: str) -> dict:
method delete (line 222) | def delete(runner_id: str) -> bool:
method get_available_items (line 250) | def get_available_items() -> tuple[list[str], list[RunnerArguments]]:
method close (line 285) | async def close(self) -> None:
method cancel (line 299) | async def cancel(self) -> None:
method run_recipes (line 315) | async def run_recipes(
method run_cookbooks (line 377) | async def run_cookbooks(
method run_red_teaming (line 440) | async def run_red_teaming(
FILE: moonshot/src/runners/runner_arguments.py
class RunnerArguments (line 8) | class RunnerArguments(BaseModel):
method to_dict (line 30) | def to_dict(self) -> dict:
FILE: moonshot/src/runners/runner_type.py
class RunnerType (line 4) | class RunnerType(Enum):
FILE: moonshot/src/runs/run.py
class Run (line 22) | class Run:
method __init__ (line 56) | def __init__(
method load (line 94) | def load(database_instance: DBInterface | None, run_id: int | None) ->...
method get_all_runs (line 134) | def get_all_runs(database_instance: DBInterface) -> list[RunArguments]:
method cancel (line 168) | def cancel(self) -> None:
method run (line 181) | async def run(self) -> ResultArguments | None:
method _load_module (line 325) | def _load_module(self, arg_key: str, env_var: str):
FILE: moonshot/src/runs/run_arguments.py
class RunArguments (line 13) | class RunArguments(BaseModel):
class Config (line 14) | class Config:
method to_dict (line 45) | def to_dict(self) -> dict:
method to_create_tuple (line 74) | def to_create_tuple(self) -> tuple:
method to_tuple (line 89) | def to_tuple(self) -> tuple:
method _to_tuple (line 105) | def _to_tuple(self, include_run_id: bool) -> tuple:
method from_tuple (line 155) | def from_tuple(cls, run_record: tuple) -> RunArguments:
FILE: moonshot/src/runs/run_progress.py
class RunProgress (line 13) | class RunProgress:
method __init__ (line 20) | def __init__(
method notify_error (line 36) | def notify_error(self, error_message: str) -> None:
method notify_progress (line 53) | def notify_progress(self, **kwargs) -> None:
method get_dict (line 123) | def get_dict(self) -> dict:
FILE: moonshot/src/runs/run_status.py
class RunStatus (line 4) | class RunStatus(Enum):
FILE: moonshot/src/storage/db_interface.py
class DBInterface (line 7) | class DBInterface:
method create_connection (line 9) | def create_connection(self) -> Any | None:
method close_connection (line 20) | def close_connection(self) -> None:
method create_table (line 28) | def create_table(self, create_table_sql: str) -> None:
method create_record (line 42) | def create_record(self, record: tuple, create_record_sql: str) -> None:
method read_record (line 57) | def read_record(self, record: tuple, read_record_sql: str) -> tuple | ...
method read_records (line 72) | def read_records(self, read_records_sql: str) -> list[tuple] | None:
method update_record (line 89) | def update_record(self, record: tuple, update_record_sql: str) -> None:
method delete_records_in_table (line 104) | def delete_records_in_table(self, delete_record_sql: str) -> None:
method check_database_table_exists (line 118) | def check_database_table_exists(self, table_name: str) -> bool:
method delete_database_table (line 131) | def delete_database_table(self, delete_table_sql: str) -> None:
FILE: moonshot/src/storage/io_interface.py
class IOInterface (line 5) | class IOInterface:
method create_file (line 7) | def create_file(self, data: dict) -> Any | None:
method create_file_with_iterator (line 20) | def create_file_with_iterator(
method read_file (line 37) | def read_file(self, filepath: str) -> dict | None:
FILE: moonshot/src/storage/storage.py
class Config (line 16) | class Config:
class Storage (line 20) | class Storage:
method create_object (line 23) | def create_object(
method create_object_with_iterator (line 69) | def create_object_with_iterator(
method read_object_with_iterator (line 121) | def read_object_with_iterator(
method read_object (line 175) | def read_object(
method delete_object (line 212) | def delete_object(obj_type: str, obj_id: str, obj_extension: str) -> b...
method count_objects (line 235) | def count_objects(
method get_objects (line 260) | def get_objects(obj_type: str, obj_extension: str) -> Iterator[str]:
method get_creation_datetime (line 282) | def get_creation_datetime(
method get_file_hash (line 305) | def get_file_hash(obj_type: str, obj_id: str, obj_extension: str) -> str:
method get_filepath (line 328) | def get_filepath(
method is_object_exists (line 353) | def is_object_exists(obj_type: str, obj_id: str, obj_extension: str) -...
method create_database_connection (line 372) | def create_database_connection(
method close_database_connection (line 413) | def close_database_connection(database_instance: DBInterface) -> None:
method create_database_table (line 429) | def create_database_table(
method create_database_record (line 451) | def create_database_record(
method read_database_record (line 475) | def read_database_record(
method read_database_records (line 499) | def read_database_records(
method update_database_record (line 523) | def update_database_record(
method delete_database_record_in_table (line 546) | def delete_database_record_in_table(
method check_database_table_exists (line 570) | def check_database_table_exists(
method delete_database_table (line 593) | def delete_database_table(
FILE: moonshot/src/utils/find_feature.py
function find_keyword (line 4) | def find_keyword(
FILE: moonshot/src/utils/import_modules.py
function create_module_spec (line 8) | def create_module_spec(module_name: str, module_file_path: str) -> None ...
function import_module_from_spec (line 42) | def import_module_from_spec(module_spec: ModuleSpec) -> ModuleType | None:
function get_instance (line 60) | def get_instance(id: str, filepath: str) -> Any:
FILE: moonshot/src/utils/log.py
function configure_logger (line 6) | def configure_logger(name: str):
FILE: moonshot/src/utils/pagination.py
function get_paginated_lists (line 1) | def get_paginated_lists(page_size: int, list_of_items: list) -> list:
FILE: moonshot/src/utils/timeit.py
function timeit (line 10) | def timeit(func):
FILE: tests/others/functest_connectors.py
function test_create_connector_endpoint (line 17) | def test_create_connector_endpoint():
function test_read_connector_endpoint (line 30) | def test_read_connector_endpoint():
function test_update_connector_endpoint (line 34) | def test_update_connector_endpoint():
function test_delete_connector_endpoint (line 40) | def test_delete_connector_endpoint():
function test_get_all_connector_endpoint (line 56) | def test_get_all_connector_endpoint():
function test_get_all_connector_endpoint_name (line 60) | def test_get_all_connector_endpoint_name():
function test_create_connector_from_ep (line 64) | def test_create_connector_from_ep():
function test_create_connectors_from_eps (line 90) | def test_create_connectors_from_eps():
function test_get_all_connector_type (line 120) | def test_get_all_connector_type():
function test_run_connector_endpoints_api (line 124) | def test_run_connector_endpoints_api():
function test_run_connector_api (line 157) | def test_run_connector_api():
FILE: tests/others/functest_cookbooks.py
function test_create_cookbook (line 15) | def test_create_cookbook():
function test_read_cookbook (line 23) | def test_read_cookbook():
function test_read_cookbooks (line 27) | def test_read_cookbooks():
function test_update_cookbook (line 37) | def test_update_cookbook():
function test_delete_cookbook (line 45) | def test_delete_cookbook():
function test_get_all_cookbook (line 61) | def test_get_all_cookbook():
function test_get_all_cookbook_name (line 65) | def test_get_all_cookbook_name():
function test_run_cookbook_api (line 69) | def test_run_cookbook_api():
FILE: tests/others/functest_datasets.py
function test_delete_datasets (line 7) | def test_delete_datasets():
function test_get_all_datasets (line 28) | def test_get_all_datasets():
function test_get_all_datasets_name (line 32) | def test_get_all_datasets_name():
function test_run_datasets_api (line 36) | def test_run_datasets_api():
FILE: tests/others/functest_metrics.py
function test_get_all_metrics (line 7) | def test_get_all_metrics():
function test_delete_metric (line 12) | def test_delete_metric():
function test_run_metric_api (line 32) | def test_run_metric_api():
FILE: tests/others/functest_recipes.py
function test_create_recipe (line 15) | def test_create_recipe():
function test_read_recipe (line 35) | def test_read_recipe():
function test_read_recipes (line 39) | def test_read_recipes():
function test_update_recipe (line 47) | def test_update_recipe():
function test_delete_recipe (line 58) | def test_delete_recipe():
function test_get_all_recipe (line 74) | def test_get_all_recipe():
function test_get_all_recipe_name (line 78) | def test_get_all_recipe_name():
function test_run_recipe_api (line 82) | def test_run_recipe_api():
FILE: tests/others/functest_results.py
function test_read_result (line 15) | def test_read_result():
function test_read_results (line 29) | def test_read_results():
function test_delete_result (line 39) | def test_delete_result():
function test_get_all_result (line 62) | def test_get_all_result():
function test_get_all_result_name (line 66) | def test_get_all_result_name():
function test_run_result_api (line 70) | def test_run_result_api():
FILE: tests/others/functest_rt_api.py
function test_create_runner (line 30) | def test_create_runner(name: str):
function runner_callback_fn (line 38) | def runner_callback_fn(progress_args: dict):
function run_manual_and_automated_rt (line 43) | def run_manual_and_automated_rt():
function run_manual_rt (line 103) | def run_manual_rt():
function run_automated_rt (line 137) | def run_automated_rt():
function test_art_and_cancel (line 178) | def test_art_and_cancel():
function test_session_apis (line 216) | def test_session_apis(runner_id: str):
function test_attack_apis (line 255) | def test_attack_apis():
FILE: tests/others/functest_runner.py
function runner_callback_fn (line 12) | def runner_callback_fn(progress_args: dict):
function test_create_runner (line 17) | def test_create_runner(name: str):
function test_load_runner (line 34) | def test_load_runner(runner_id: str):
function test_run_benchmark_recipe_runner_and_cancel (line 46) | def test_run_benchmark_recipe_runner_and_cancel(runner_id: str):
function test_run_benchmark_cookbook_runner_and_cancel (line 66) | def test_run_benchmark_cookbook_runner_and_cancel(runner_id: str):
function test_run_benchmark_recipe_runner (line 86) | def test_run_benchmark_recipe_runner(runner_id: str):
function test_run_benchmark_cookbook_runner (line 98) | def test_run_benchmark_cookbook_runner(runner_id: str):
function test_run_automated_redteaming_runner (line 110) | def test_run_automated_redteaming_runner(runner_id: str):
function test_read_runner (line 129) | def test_read_runner(runner_id: str):
function test_delete_runner (line 132) | def test_delete_runner(runner_id: str):
function test_get_all_runner (line 147) | def test_get_all_runner():
function test_get_all_runner_name (line 150) | def test_get_all_runner_name():
function test_run_runner_api (line 156) | def test_run_runner_api():
function test_get_all_run (line 201) | def test_get_all_run(runner_id: str):
function test_run_api (line 204) | def test_run_api():
FILE: tests/unit-tests/cli/test_attack_module.py
class TestCollectionCliAttackModule (line 10) | class TestCollectionCliAttackModule:
method init (line 12) | def init(self):
method test_list_attack_modules (line 406) | def test_list_attack_modules(self,
FILE: tests/unit-tests/cli/test_common_endpoints.py
class TestCollectionCliConnectors (line 21) | class TestCollectionCliConnectors:
method init (line 23) | def init(self):
method test_add_endpoint (line 529) | def test_add_endpoint(
method test_list_endpoints (line 973) | def test_list_endpoints(
method test_list_endpoints_filtered (line 1191) | def test_list_endpoints_filtered(
method test_view_endpoints (line 1289) | def test_view_endpoints(
method test_update_endpoint (line 1438) | def test_update_endpoint(
method test_delete_endpoint (line 1516) | def test_delete_endpoint(
method test_delete_endpoint_confirm_yes (line 1542) | def test_delete_endpoint_confirm_yes(self, mock_delete, mock_input):
method test_delete_endpoint_confirm_no (line 1557) | def test_delete_endpoint_confirm_no(self, mock_delete, mock_input):
method test_delete_endpoint_cancelled_output (line 1573) | def test_delete_endpoint_cancelled_output(
method test_list_connector_type (line 1846) | def test_list_connector_type(
method test_list_connector_types_filtered (line 2003) | def test_list_connector_types_filtered(
FILE: tests/unit-tests/cli/test_common_prompt_template.py
class TestCollectionCliPromptTemplate (line 11) | class TestCollectionCliPromptTemplate:
method init (line 13) | def init(self):
method test_list_prompt_templates (line 331) | def test_list_prompt_templates(
method test_list_prompt_templates_filtered (line 652) | def test_list_prompt_templates_filtered(
method test_delete_prompt_template (line 736) | def test_delete_prompt_template(self, mock_api_delete_prompt_template,...
method test_delete_prompt_template_confirm_yes (line 755) | def test_delete_prompt_template_confirm_yes(self, mock_delete, mock_in...
method test_delete_prompt_template_confirm_no (line 766) | def test_delete_prompt_template_confirm_no(self, mock_delete, mock_inp...
method test_delete_prompt_template_cancelled_output (line 778) | def test_delete_prompt_template_cancelled_output(self, mock_delete, mo...
FILE: tests/unit-tests/cli/test_cookbook.py
class TestCollectionCliCookbook (line 16) | class TestCollectionCliCookbook:
method init (line 40) | def init(self):
method test_add_cookbook (line 267) | def test_add_cookbook(
method test_list_cookbooks (line 553) | def test_list_cookbooks(
method test_list_cookbooks_filtered (line 648) | def test_list_cookbooks_filtered(
method test_view_cookbook (line 802) | def test_view_cookbook(
method test_run_cookbook (line 1562) | def test_run_cookbook(
method test_update_cookbook (line 1776) | def test_update_cookbook(
method test_delete_cookbook (line 1858) | def test_delete_cookbook(
method test_delete_cookbook_confirm_yes (line 1886) | def test_delete_cookbook_confirm_yes(self, mock_delete, mock_input):
method test_delete_cookbook_confirm_no (line 1901) | def test_delete_cookbook_confirm_no(self, mock_delete, mock_input):
method test_delete_cookbook_cancelled_output (line 1917) | def test_delete_cookbook_cancelled_output(
FILE: tests/unit-tests/cli/test_datasets.py
class TestCollectionCliDataset (line 12) | class TestCollectionCliDataset:
method init (line 40) | def init(self):
method test_list_datasets (line 283) | def test_list_datasets(
method test_list_datasets_filtered (line 378) | def test_list_datasets_filtered(
method test_view_dataset (line 499) | def test_view_dataset(
method test_delete_dataset (line 587) | def test_delete_dataset(
method test_delete_dataset_confirm_yes (line 615) | def test_delete_dataset_confirm_yes(self, mock_delete, mock_input):
method test_delete_dataset_confirm_no (line 630) | def test_delete_dataset_confirm_no(self, mock_delete, mock_input):
method test_delete_dataset_cancelled_output (line 646) | def test_delete_dataset_cancelled_output(self, mock_delete, mock_print...
FILE: tests/unit-tests/cli/test_metrics.py
class TestCollectionCliMetrics (line 12) | class TestCollectionCliMetrics:
method init (line 30) | def init(self):
method test_list_metrics (line 273) | def test_list_metrics(
method test_list_metrics_filtered (line 368) | def test_list_metrics_filtered(
method test_view_metric (line 489) | def test_view_metric(
method test_delete_metric (line 577) | def test_delete_metric(
method test_delete_metric_confirm_yes (line 605) | def test_delete_metric_confirm_yes(self, mock_delete, mock_input):
method test_delete_metric_confirm_no (line 620) | def test_delete_metric_confirm_no(self, mock_delete, mock_input):
method test_delete_metric_cancelled_output (line 636) | def test_delete_metric_cancelled_output(self, mock_delete, mock_print,...
FILE: tests/unit-tests/cli/test_recipe.py
class TestCollectionCliRecipe (line 16) | class TestCollectionCliRecipe:
method init (line 60) | def init(self):
method test_add_recipe (line 929) | def test_add_recipe(
method test_list_recipes (line 1208) | def test_list_recipes(
method test_list_recipes_filtered (line 1303) | def test_list_recipes_filtered(
method test_view_recipe (line 1406) | def test_view_recipe(
method test_run_recipe (line 2166) | def test_run_recipe(
method test_update_recipe (line 2380) | def test_update_recipe(
method test_delete_recipe (line 2462) | def test_delete_recipe(
method test_delete_recipe_confirm_yes (line 2488) | def test_delete_recipe_confirm_yes(self, mock_delete, mock_input):
method test_delete_recipe_confirm_no (line 2501) | def test_delete_recipe_confirm_no(self, mock_delete, mock_input):
method test_delete_recipe_cancelled_output (line 2515) | def test_delete_recipe_cancelled_output(self, mock_delete, mock_print,...
FILE: tests/unit-tests/cli/test_red_teaming.py
function cli (line 15) | def cli():
function run_command (line 18) | def run_command(cli: CommandLineInterface, command_list: list = []):
function run_command_table (line 22) | def run_command_table(cli, command):
function perform_assertion (line 27) | def perform_assertion(cli, command_list, expected_output, capsys):
function perform_assertion_function_output (line 35) | def perform_assertion_function_output(expected_output, returned_results,...
class TestRedTeamingCLI (line 47) | class TestRedTeamingCLI:
method init (line 49) | def init(self):
method test_new_session (line 254) | def test_new_session(self, cli, command_list, expected_output, capsys):
method test_use_session (line 288) | def test_use_session(self, cli, command_list, expected_output, capsys):
method test_set_context_strategy (line 325) | def test_set_context_strategy(self, cli, command_list, expected_output...
method test_set_prompt_template (line 351) | def test_set_prompt_template(self, cli, command_list, expected_output,...
method test_clear_context_strategy (line 376) | def test_clear_context_strategy(self, cli, command_list, expected_outp...
method test_clear_prompt_template (line 402) | def test_clear_prompt_template(self, cli, command_list, expected_outpu...
method test_list_attack_modules (line 434) | def test_list_attack_modules(self, cli, command_list, expected_output,...
method test_list_attack_modules_output (line 447) | def test_list_attack_modules_output(self, function_args, expected_outp...
method test_list_context_strategies (line 482) | def test_list_context_strategies(self, cli, command_list, expected_out...
method test_list_context_strategies_output (line 495) | def test_list_context_strategies_output(self, function_args, expected_...
method test_list_sessions (line 534) | def test_list_sessions(self, cli, command_list, expected_output, capsys):
method test_list_sessions_output (line 548) | def test_list_sessions_output(self, function_args, expected_output, ca...
method test_automated_red_teaming (line 659) | def test_automated_red_teaming(self, cli, command_list, expected_outpu...
FILE: tests/unit-tests/cli/test_result.py
class TestCollectionCliResult (line 12) | class TestCollectionCliResult:
method init (line 256) | def init(self):
method test_list_results (line 499) | def test_list_results(
method test_list_results_filtered (line 594) | def test_list_results_filtered(
method test_view_result (line 766) | def test_view_result(
method test_delete_result (line 854) | def test_delete_result(
method test_delete_result_confirm_yes (line 880) | def test_delete_result_confirm_yes(self, mock_delete, mock_input):
method test_delete_result_confirm_no (line 893) | def test_delete_result_confirm_no(self, mock_delete, mock_input):
method test_delete_result_cancelled_output (line 907) | def test_delete_result_cancelled_output(self, mock_delete, mock_print,...
FILE: tests/unit-tests/cli/test_run.py
class TestCollectionCliRun (line 9) | class TestCollectionCliRun:
method init (line 58) | def init(self):
method test_list_runs (line 301) | def test_list_runs(
method test_list_runs_filtered (line 396) | def test_list_runs_filtered(
method test_view_run (line 499) | def test_view_run(
FILE: tests/unit-tests/cli/test_runner.py
class TestCollectionCliRunner (line 12) | class TestCollectionCliRunner:
method init (line 86) | def init(self):
method test_view_runner (line 233) | def test_view_runner(
method test_delete_runner (line 351) | def test_delete_runner(
method test_delete_runner_confirm_yes (line 377) | def test_delete_runner_confirm_yes(self, mock_delete, mock_input):
method test_delete_runner_confirm_no (line 390) | def test_delete_runner_confirm_no(self, mock_delete, mock_input):
method test_delete_runner_cancelled_output (line 404) | def test_delete_runner_cancelled_output(self, mock_delete, mock_print,...
FILE: tests/unit-tests/cli/test_session.py
class TestCollectionCliSession (line 10) | class TestCollectionCliSession:
method init (line 12) | def init(self):
method test_new_session_create_runner (line 164) | def test_new_session_create_runner(self, mock_api_load_session, mock_a...
method test_new_session_load_runner (line 291) | def test_new_session_load_runner(self, mock_api_load_session, mock_api...
method test_use_session (line 348) | def test_use_session(self, mock_api_load_session, mock_api_load_runner...
method test_delete_session (line 411) | def test_delete_session(self, mock_api_delete_session, argparse_value,...
method test_delete_session_confirm_yes (line 429) | def test_delete_session_confirm_yes(self, mock_api_delete_session, moc...
method test_delete_session_confirm_no (line 440) | def test_delete_session_confirm_no(self, mock_api_delete_session, mock...
method test_delete_session_confirm_cancelled (line 452) | def test_delete_session_confirm_cancelled(self, mock_api_delete_sessio...
method test_list_sessions (line 850) | def test_list_sessions(self,
FILE: tests/unit-tests/common/samples/add_previous_prompt.py
class SampleContextStrategy (line 7) | class SampleContextStrategy(ContextStrategyInterface):
method __init__ (line 14) | def __init__(self, cs_id: str):
method get_metadata (line 20) | def get_metadata(self) -> dict | None:
method add_in_context (line 32) | def add_in_context(
FILE: tests/unit-tests/common/samples/advglue.py
class AdvGlueExactMatch (line 8) | class AdvGlueExactMatch(MetricInterface):
method __init__ (line 9) | def __init__(self):
method get_metadata (line 19) | def get_metadata(self) -> dict | None:
method get_results (line 31) | async def get_results(
FILE: tests/unit-tests/common/samples/benchmarking-result.py
class BenchmarkingResult (line 14) | class BenchmarkingResult:
method generate (line 15) | def generate(self, runner_results: ResultArguments) -> ResultArguments...
method _generate_metadata (line 71) | def _generate_metadata(self, results_args: ResultArguments) -> dict:
method _generate_result (line 105) | def _generate_result(self, result_args: ResultArguments) -> dict:
method _generate_cookbooks_result (line 143) | def _generate_cookbooks_result(self, cookbooks: list[str], results: di...
method _initialize_cookbook_dict (line 170) | def _initialize_cookbook_dict(self, cookbook: str) -> dict:
method _populate_cookbook_details_and_summary (line 190) | def _populate_cookbook_details_and_summary(
method _get_worst_grade (line 241) | def _get_worst_grade(
method _generate_recipes_result (line 282) | def _generate_recipes_result(self, recipes: list[str], results: dict) ...
method _get_unique_sets (line 321) | def _get_unique_sets(
method _initialize_recipe_dict (line 347) | def _initialize_recipe_dict(self, recipe: str, recipe_grading_scale: d...
method _populate_recipe_details_and_summary (line 371) | def _populate_recipe_details_and_summary(
method _calculate_prompts_and_grades (line 421) | def _calculate_prompts_and_grades(
method _get_grading_criteria_value (line 484) | def _get_grading_criteria_value(self, metrics: list[dict]) -> float | ...
method _determine_grade (line 511) | def _determine_grade(
FILE: tests/unit-tests/common/samples/benchmarking.py
class Benchmarking (line 35) | class Benchmarking:
method generate (line 48) | async def generate(
method _run_cookbook (line 262) | async def _run_cookbook(self, cookbook_name: str) -> dict:
method _run_recipe (line 345) | async def _run_recipe(self, recipe_name: str) -> dict:
method _run_generator_pipeline (line 519) | async def _run_generator_pipeline(self, cancel_event: asyncio.Event) -...
method _generate_prompts (line 636) | async def _generate_prompts(self) -> AsyncGenerator[PromptArguments, N...
method _get_dataset_prompts (line 715) | async def _get_dataset_prompts(
method _yield_prompt_arguments (line 757) | async def _yield_prompt_arguments(
method _generate_predictions (line 798) | async def _generate_predictions(
method _process_single_prompt (line 841) | async def _process_single_prompt(
class PromptArguments (line 922) | class PromptArguments(BaseModel):
method to_tuple (line 939) | def to_tuple(self) -> tuple:
method from_tuple (line 970) | def from_tuple(cls, cache_record: tuple) -> PromptArguments:
FILE: tests/unit-tests/common/samples/bertscore.py
class BertScore (line 9) | class BertScore(MetricInterface):
method __init__ (line 16) | def __init__(self):
method get_metadata (line 22) | def get_metadata(self) -> dict | None:
method get_results (line 34) | async def get_results(
FILE: tests/unit-tests/common/samples/bleuscore.py
class BleuScore (line 10) | class BleuScore(MetricInterface):
method __init__ (line 11) | def __init__(self):
method get_metadata (line 17) | def get_metadata(self) -> dict | None:
method get_results (line 29) | async def get_results(
FILE: tests/unit-tests/common/samples/charswap_attack.py
class CharSwapGenerator (line 15) | class CharSwapGenerator(AttackModule):
method __init__ (line 16) | def __init__(self, am_id: str, am_arguments: AttackModuleArguments | N...
method get_metadata (line 26) | def get_metadata(self) -> dict:
method get_n_random (line 43) | def get_n_random(self, low: int, high: int, n: int) -> list:
method execute (line 57) | async def execute(self):
method perform_attack_manually (line 68) | async def perform_attack_manually(self) -> list:
FILE: tests/unit-tests/common/samples/claude2-connector.py
class Claude2Connector (line 16) | class Claude2Connector(Connector):
method __init__ (line 17) | def __init__(self, ep_arguments: ConnectorEndpointArguments):
method get_response (line 29) | async def get_response(self, prompt: str) -> str:
method _process_response (line 54) | async def _process_response(self, response: Completion) -> str:
FILE: tests/unit-tests/common/samples/exactstrmatch.py
class ExactStrMatch (line 8) | class ExactStrMatch(MetricInterface):
method __init__ (line 9) | def __init__(self):
method get_metadata (line 18) | def get_metadata(self) -> dict | None:
method get_results (line 30) | async def get_results(
FILE: tests/unit-tests/common/samples/homoglyph_attack.py
class HomoglyphGenerator (line 12) | class HomoglyphGenerator(AttackModule):
method __init__ (line 13) | def __init__(self, am_id: str, am_arguments: AttackModuleArguments | N...
method get_metadata (line 24) | def get_metadata(self) -> dict:
method execute (line 41) | async def execute(self):
method perform_attack_manually (line 52) | async def perform_attack_manually(self) -> list:
FILE: tests/unit-tests/common/samples/huggingface-connector.py
class HuggingFaceConnector (line 15) | class HuggingFaceConnector(Connector):
method __init__ (line 16) | def __init__(self, ep_arguments: ConnectorEndpointArguments):
method get_response (line 22) | async def get_response(self, prompt: str) -> str:
method _prepare_headers (line 42) | def _prepare_headers(self) -> dict:
method _process_response (line 59) | async def _process_response(self, response: ClientResponse) -> str:
FILE: tests/unit-tests/common/samples/ign_test_storage.py
class ObjectInstance (line 11) | class ObjectInstance:
method __init__ (line 12) | def __init__(self, obj_filepath: str):
method create_file (line 15) | def create_file(self, obj_info: dict) -> bool:
method read_file_iterator (line 19) | def read_file_iterator(
method read_file (line 26) | def read_file(self) -> bool:
class TestCollectionStorage (line 30) | class TestCollectionStorage:
method init (line 37) | def init(self):
method test_create_object (line 552) | def test_create_object(
method test_create_object_exceptions (line 790) | def test_create_object_exceptions(
method test_read_object_with_iterator (line 884) | def test_read_object_with_iterator(
method test_read_object_with_iterator_invalid_filepath (line 1182) | def test_read_object_with_iterator_invalid_filepath(
method test_read_object_with_iterator_exceptions (line 1402) | def test_read_object_with_iterator_exceptions(
method test_read_object (line 1504) | def test_read_object(
method test_read_object_invalid_filepath (line 1797) | def test_read_object_invalid_filepath(
method test_read_object_exceptions (line 1988) | def test_read_object_exceptions(
method test_delete_object (line 2068) | def test_delete_object(
method test_is_object_exists (line 2152) | def test_is_object_exists(
method test_get_objects (line 2226) | def test_get_objects(self, mocker, obj_type, obj_extension, expected_d...
method test_get_objects_invalid_arguments (line 2397) | def test_get_objects_invalid_arguments(
FILE: tests/unit-tests/common/samples/openai-connector.py
class OpenAIConnector (line 14) | class OpenAIConnector(Connector):
method __init__ (line 15) | def __init__(self, ep_arguments: ConnectorEndpointArguments):
method get_response (line 30) | async def get_response(self, prompt: str) -> str:
method _process_response (line 64) | async def _process_response(self, response: Any) -> str:
FILE: tests/unit-tests/common/samples/redteaming.py
class RedTeaming (line 29) | class RedTeaming:
method generate (line 56) | async def generate(
method run_automated_red_teaming (line 100) | async def run_automated_red_teaming(self):
method run_manual_red_teaming (line 175) | async def run_manual_red_teaming(self) -> dict:
method _generate_prompts (line 220) | async def _generate_prompts(
method _generate_predictions (line 278) | async def _generate_predictions(
method _write_record_to_db (line 313) | def _write_record_to_db(
method load_modules (line 332) | def load_modules(self) -> None:
class RedTeamingPromptArguments (line 354) | class RedTeamingPromptArguments(BaseModel):
method to_tuple (line 369) | def to_tuple(self) -> tuple:
method to_dict (line 396) | def to_dict(self) -> dict:
FILE: tests/unit-tests/common/samples/sample_attack_module.py
class SampleAttackModule (line 5) | class SampleAttackModule(AttackModule):
method __init__ (line 6) | def __init__(self, am_id: str, am_arguments: AttackModuleArguments | N...
method get_metadata (line 12) | def get_metadata(self) -> dict:
method execute (line 29) | async def execute(self):
method perform_attack_manually (line 40) | async def perform_attack_manually(self) -> list:
FILE: tests/unit-tests/common/samples/sample_file.py
class OpenAIConnector (line 15) | class OpenAIConnector(Connector):
method __init__ (line 16) | def __init__(self, ep_arguments: ConnectorEndpointArguments):
method get_response (line 28) | async def get_response(self, prompt: str) -> str:
method _process_response (line 62) | async def _process_response(self, response: Any) -> str:
FILE: tests/unit-tests/src/data/databases-modules/sqlite.py
class SQLite (line 6) | class SQLite(DBInterface):
method __init__ (line 7) | def __init__(self, db_path: str):
method create_connection (line 11) | def create_connection(self) -> bool:
method close_connection (line 36) | def close_connection(self) -> None:
method create_table (line 57) | def create_table(self, create_table_sql: str) -> None:
method create_record (line 80) | def create_record(self, record: tuple, create_record_sql: str) -> tupl...
method read_record (line 118) | def read_record(self, record: tuple, read_record_sql: str) -> tuple | ...
method read_records (line 146) | def read_records(self, read_records_sql: str) -> list[tuple] | None:
method update_record (line 171) | def update_record(self, record: tuple, update_record_sql: str) -> None:
method delete_record_by_id (line 195) | def delete_record_by_id(self, record_id: int, delete_record_sql: str) ...
method delete_records_in_table (line 220) | def delete_records_in_table(self, delete_record_sql: str) -> None:
method check_database_table_exists (line 244) | def check_database_table_exists(self, table_name: str) -> bool | None:
method delete_database_table (line 273) | def delete_database_table(self, delete_table_sql: str) -> None:
FILE: tests/unit-tests/src/data/io-modules/jsonio.py
class JsonIO (line 9) | class JsonIO(IOInterface):
method __init__ (line 10) | def __init__(self, json_path: str):
method create_file (line 19) | def create_file(self, data: dict) -> bool:
method read_file (line 37) | def read_file(self) -> dict | None:
method read_file_iterator (line 53) | def read_file_iterator(
method read_file_raw (line 94) | def read_file_raw(self) -> TextIOWrapper | None:
class GeneratorIO (line 108) | class GeneratorIO:
method __init__ (line 117) | def __init__(self, file: TextIOWrapper, item_path: str):
method __iter__ (line 128) | def __iter__(self):
method __next__ (line 137) | def __next__(self):
FILE: tests/unit-tests/src/importmodules/sample_file.py
class OpenAIConnector (line 15) | class OpenAIConnector(Connector):
method __init__ (line 16) | def __init__(self, ep_arguments: ConnectorEndpointArguments):
method get_response (line 28) | async def get_response(self, prompt: str) -> str:
method _process_response (line 62) | async def _process_response(self, response: Any) -> str:
FILE: tests/unit-tests/src/logger_mock.py
class LoggerMock (line 1) | class LoggerMock:
method __init__ (line 9) | def __init__(self):
method debug (line 21) | def debug(self, msg):
method info (line 30) | def info(self, msg):
method warning (line 39) | def warning(self, msg):
method error (line 48) | def error(self, msg):
method critical (line 57) | def critical(self, msg):
FILE: tests/unit-tests/src/test-storage.py
function init (line 12) | def init():
function mock_get_instance (line 32) | def mock_get_instance():
function test_create_object_with_iterator (line 36) | def test_create_object_with_iterator(mock_get_instance):
FILE: tests/unit-tests/src/test_api_bookmark.py
class TestCollectionApiBookmark (line 19) | class TestCollectionApiBookmark:
method init (line 21) | def init(self):
method test_api_insert_bookmark (line 895) | def test_api_insert_bookmark(self, input_args, expected_dict):
method test_api_get_all_bookmark (line 915) | def test_api_get_all_bookmark(self):
method test_api_get_bookmark (line 961) | def test_api_get_bookmark(self, bookmark_name, expected_result, mocker):
method test_api_delete_bookmark (line 995) | def test_api_delete_bookmark(self, bookmark_name, expected_result):
method test_api_delete_all_bookmark (line 1004) | def test_api_delete_all_bookmark(self):
method test_api_export_bookmarks (line 1026) | def test_api_export_bookmarks(self, export_file_name, expected_output):
FILE: tests/unit-tests/src/test_api_connector.py
class TestCollectionApiConnector (line 16) | class TestCollectionApiConnector:
method init (line 18) | def init(self):
method test_api_create_connector_from_endpoint (line 117) | def test_api_create_connector_from_endpoint(self, ep_id, expected_dict):
method test_api_create_connectors_from_endpoints (line 282) | def test_api_create_connectors_from_endpoints(self, ep_ids, expected_d...
method test_api_get_all_connector_type (line 320) | def test_api_get_all_connector_type(self):
FILE: tests/unit-tests/src/test_api_connector_endpoint.py
class TestCollectionApiConnectorEndpoint (line 19) | class TestCollectionApiConnectorEndpoint:
method init (line 21) | def init(self):
method test_api_create_endpoint (line 406) | def test_api_create_endpoint(self, input_args, expected_dict):
method test_api_read_endpoint (line 562) | def test_api_read_endpoint(self, ep_id: str, expected_dict: dict):
method test_api_update_endpoint (line 769) | def test_api_update_endpoint(self, ep_id: str, ep_dict: dict, expected...
method test_api_delete_endpoint (line 876) | def test_api_delete_endpoint(self, ep_id: str, expected_dict: dict):
method test_api_get_all_endpoint (line 927) | def test_api_get_all_endpoint(self):
method test_api_get_all_endpoint_name (line 983) | def test_api_get_all_endpoint_name(self):
FILE: tests/unit-tests/src/test_api_context_strategy.py
class TestCollectionApiContextStrategy (line 15) | class TestCollectionApiContextStrategy:
method init (line 17) | def init(self):
method test_api_get_all_context_strategies (line 46) | def test_api_get_all_context_strategies(self):
method test_api_delete_context_strategy (line 132) | def test_api_delete_context_strategy(self, cs_id, expected_dict):
method test_api_get_all_context_strategy_metadata (line 174) | def test_api_get_all_context_strategy_metadata(self):
FILE: tests/unit-tests/src/test_api_cookbook.py
class TestCollectionApiCookbook (line 19) | class TestCollectionApiCookbook:
method init (line 21) | def init(self):
method test_api_create_cookbook (line 281) | def test_api_create_cookbook(self, input_args, expected_dict):
method test_api_read_cookbook (line 410) | def test_api_read_cookbook(self, cookbook_id: str, expected_dict: dict):
method test_api_read_cookbooks (line 582) | def test_api_read_cookbooks(self, cookbook_ids: list[str], expected_di...
method test_api_update_cookbook (line 758) | def test_api_update_cookbook(
method test_api_delete_cookbook (line 867) | def test_api_delete_cookbook(self, cookbook_id: str, expected_dict: di...
method test_api_get_all_cookbook (line 910) | def test_api_get_all_cookbook(self):
method test_api_get_all_cookbook_name (line 940) | def test_api_get_all_cookbook_name(self):
FILE: tests/unit-tests/src/test_api_dataset.py
class TestCollectionApiDataset (line 18) | class TestCollectionApiDataset:
method init (line 20) | def init(self):
method test_api_get_all_datasets (line 53) | def test_api_get_all_datasets(self):
method test_api_delete_dataset (line 153) | def test_api_delete_dataset(self, dataset_id, expected_dict):
method test_api_convert_dataset (line 221) | def test_api_convert_dataset(self, dataset_details, expected_result):
method test_api_download_dataset (line 265) | def test_api_download_dataset(self, dataset_details, expected_result):
FILE: tests/unit-tests/src/test_api_metric.py
class TestCollectionApiMetric (line 15) | class TestCollectionApiMetric:
method init (line 17) | def init(self):
method test_api_get_all_metric (line 48) | def test_api_get_all_metric(self):
method test_api_delete_metric (line 134) | def test_api_delete_metric(self, metric_id, expected_dict):
method test_api_get_all_metric_name (line 182) | def test_api_get_all_metric_name(self):
FILE: tests/unit-tests/src/test_api_prompt_template.py
class TestCollectionApiPromptTemplate (line 15) | class TestCollectionApiPromptTemplate:
method init (line 17) | def init(self):
method test_api_get_all_prompt_template_name (line 45) | def test_api_get_all_prompt_template_name(self):
method test_api_delete_prompt_template (line 131) | def test_api_delete_prompt_template(self, template_id, expected_result):
method test_api_get_all_prompt_template_detail (line 166) | def test_api_get_all_prompt_template_detail(self):
FILE: tests/unit-tests/src/test_api_recipe.py
class TestCollectionApiRecipe (line 19) | class TestCollectionApiRecipe:
method init (line 21) | def init(self):
method test_api_create_recipe (line 754) | def test_api_create_recipe(self, input_args, expected_dict):
method test_api_read_recipe (line 918) | def test_api_read_recipe(self, recipe_id: str, expected_dict: dict):
method test_api_read_recipes (line 1106) | def test_api_read_recipes(self, recipe_ids: list[str], expected_dict: ...
method test_api_update_recipe (line 1282) | def test_api_update_recipe(
method test_api_delete_recipe (line 1391) | def test_api_delete_recipe(self, recipe_id: str, expected_dict: dict):
method test_api_get_all_recipe (line 1434) | def test_api_get_all_recipe(self):
method test_api_get_all_recipe_name (line 1482) | def test_api_get_all_recipe_name(self):
FILE: tests/unit-tests/src/test_api_red_teaming.py
class TestCollectionApiAttackModule (line 15) | class TestCollectionApiAttackModule:
method init (line 17) | def init(self):
method test_api_get_all_attack_modules (line 47) | def test_api_get_all_attack_modules(self):
method test_api_delete_attack_module (line 133) | def test_api_delete_attack_module(self, am_id, expected_dict):
method test_api_get_all_attack_module_metadata (line 175) | def test_api_get_all_attack_module_metadata(self):
FILE: tests/unit-tests/src/test_api_result.py
class TestCollectionApiResult (line 17) | class TestCollectionApiResult:
method init (line 19) | def init(self):
method test_api_read_result (line 218) | def test_api_read_result(self, result_id: str, expected_dict: dict):
method test_api_read_results (line 490) | def test_api_read_results(self, result_ids: list[str], expected_dict: ...
method test_api_delete_result (line 594) | def test_api_delete_result(self, result_id: str, expected_dict: dict):
method test_api_get_all_result (line 637) | def test_api_get_all_result(self):
method test_api_get_all_result_name (line 762) | def test_api_get_all_result_name(self):
FILE: tests/unit-tests/src/test_api_run.py
class TestCollectionApiRun (line 11) | class TestCollectionApiRun:
method init (line 13) | def init(self):
method test_api_get_all_run (line 51) | def test_api_get_all_run(self):
method test_api_get_all_run_with_id (line 230) | def test_api_get_all_run_with_id(self, runner_id, expected_dict):
method test_api_get_all_run_no_db (line 251) | def test_api_get_all_run_no_db(self):
FILE: tests/unit-tests/src/test_api_runner.py
class TestCollectionApiRunner (line 19) | class TestCollectionApiRunner:
method init (line 21) | def init(self):
method test_api_create_runner (line 310) | def test_api_create_runner(self, input_args, expected_dict):
method test_load_runner (line 515) | def test_load_runner(self, runner_id, progress_callback_func, expected...
method test_api_read_runner (line 620) | def test_api_read_runner(self, runner_id: str, expected_dict: dict):
method test_api_delete_runner (line 727) | def test_api_delete_runner(self, runner_id: str, expected_dict: dict):
method test_api_get_all_runner (line 770) | def test_api_get_all_runner(self):
method test_api_get_all_runner_name (line 800) | def test_api_get_all_runner_name(self):
FILE: tests/unit-tests/src/test_api_session.py
class TestCollectionApiSession (line 27) | class TestCollectionApiSession:
method init (line 29) | def init(self):
method test_api_create_session (line 375) | def test_api_create_session(self, input_args, expected_dict):
method test_load_session (line 519) | def test_load_session(self, runner_id, expected_dict):
method test_api_get_all_session_names (line 549) | def test_api_get_all_session_names(self):
method test_api_get_all_session_info (line 569) | def test_api_get_all_session_info(self):
method test_api_get_all_session_metadata (line 607) | def test_api_get_all_session_metadata(self):
method test_api_update_context_strategy (line 745) | def test_api_update_context_strategy(
method test_api_update_cs_num_of_prev_prompts (line 893) | def test_api_update_cs_num_of_prev_prompts(
method test_api_update_prompt_template (line 1041) | def test_api_update_prompt_template(
method test_api_update_metric (line 1189) | def test_api_update_metric(
method test_api_update_system_prompt (line 1337) | def test_api_update_system_prompt(
method test_api_update_attack_module (line 1485) | def test_api_update_attack_module(
method test_api_delete_session (line 1594) | def test_api_delete_session(self, session_id, expected_dict):
method test_api_get_all_chats_from_session (line 1700) | def test_api_get_all_chats_from_session(self, session_id, expected_dict):
FILE: tests/unit-tests/src/test_bookmark.py
class TestCollectionBookmark (line 10) | class TestCollectionBookmark:
method test_add_bookmark (line 59) | def test_add_bookmark(
method test_get_all_bookmarks (line 176) | def test_get_all_bookmarks(
method test_get_bookmark (line 384) | def test_get_bookmark(
method test_delete_bookmark (line 499) | def test_delete_bookmark(
method test_delete_all_bookmark (line 567) | def test_delete_all_bookmark(
method test_export_bookmarks (line 699) | def test_export_bookmarks(
method test_export_bookmarks_invalid_filename (line 780) | def test_export_bookmarks_invalid_filename(
method test_export_bookmarks_exception (line 821) | def test_export_bookmarks_exception(
method test_close (line 858) | def test_close(self, mock_close_database_connection):
method test_close_no_db_instance (line 876) | def test_close_no_db_instance(self, mock_close_database_connection):
method test_close_multiple_times (line 893) | def test_close_multiple_times(self, mock_close_database_connection):
method test_bookmark_singleton (line 916) | def test_bookmark_singleton(self):
FILE: tests/unit-tests/src/test_bookmark_arguments.py
class TestCollectionBookmarkArguments (line 7) | class TestCollectionBookmarkArguments:
method test_create_bookmark_arguments (line 8) | def test_create_bookmark_arguments(self):
method test_create_bookmark_arguments_invalid (line 40) | def test_create_bookmark_arguments_invalid(
method test_from_tuple_to_dict (line 56) | def test_from_tuple_to_dict(self):
method test_from_tuple_to_dict_insufficient_values (line 86) | def test_from_tuple_to_dict_insufficient_values(self):
FILE: tests/unit-tests/src/test_connector.py
function connector (line 36) | def connector():
function generated_prompt (line 53) | def generated_prompt():
class MockConnector (line 57) | class MockConnector:
method __init__ (line 58) | def __init__(self, max_attempts=3):
method mock_func_perm_failure (line 66) | async def mock_func_perm_failure(self, *args, **kwargs):
method mock_func (line 71) | async def mock_func(self, *args, **kwargs):
class TestConnector (line 95) | class TestConnector(Connector):
method __init__ (line 96) | def __init__(self, ep_args, rate_limiter, tokens):
method get_response (line 103) | async def get_response(self, prompt: str):
class TestCollectionConnector (line 108) | class TestCollectionConnector:
method test_perform_retry_callback (line 140) | def test_perform_retry_callback(
method test_perform_retry (line 191) | async def test_perform_retry(self, max_attempts, expected_attempts, sh...
method test_perform_retry_exceeds_retries (line 229) | async def test_perform_retry_exceeds_retries(self, max_attempts):
method test_rate_limited (line 262) | async def test_rate_limited(
method test_rate_limited_concurrent (line 323) | async def test_rate_limited_concurrent(
method test_load_success (line 400) | def test_load_success(self, ep_args, filepath_return_val, connector_re...
method test_load_error (line 560) | def test_load_error(
method test_create_success (line 620) | def test_create_success(self, ep_args, load_return_val):
method test_create_error (line 672) | def test_create_error(
method test_create_load_exception (line 689) | def test_create_load_exception(self, mocker):
method test_get_available_items (line 729) | def test_get_available_items(self, mock_get_objects, mocked_files, exp...
method test_get_available_items_exception (line 750) | def test_get_available_items_exception(
method test_get_prediction (line 961) | async def test_get_prediction(
method test_get_prediction_exception (line 1075) | async def test_get_prediction_exception(
method test_set_system_prompt_success (line 1123) | def test_set_system_prompt_success(self, system_prompt):
method test_set_system_prompt_error (line 1155) | def test_set_system_prompt_error(
FILE: tests/unit-tests/src/test_connector_endpoint.py
class TestCollectionConnectorEndpoint (line 25) | class TestCollectionConnectorEndpoint:
method test_create_success (line 77) | def test_create_success(self, mock_create_object, ep_args, expected_ep...
method test_create_invalid_values (line 147) | def test_create_invalid_values(
method test_create_failure (line 175) | def test_create_failure(
method test_read_success (line 222) | def test_read_success(
method test_read_invalid_values (line 250) | def test_read_invalid_values(
method test_read_endpoint_returns_none (line 274) | def test_read_endpoint_returns_none(
method test_read_endpoint_throws_exception (line 303) | def test_read_endpoint_throws_exception(
method test_update_success (line 355) | def test_update_success(self, mock_create_object, ep_args, expected_re...
method test_update_exception (line 399) | def test_update_exception(
method test_update_invalid_arguments (line 450) | def test_update_invalid_arguments(
method test_delete_success (line 467) | def test_delete_success(self, mock_delete_object, ep_id, expected_resu...
method test_delete_invalid_arguments (line 487) | def test_delete_invalid_arguments(self, invalid_ep_id, expected_result):
method test_delete_exception (line 499) | def test_delete_exception(self, mock_delete_object, ep_id, mocked_exce...
method test_get_available_items (line 568) | def test_get_available_items(
method test_get_available_items_exception (line 602) | def test_get_available_items_exception(
FILE: tests/unit-tests/src/test_connector_endpoint_arguments.py
class TestCollectionConnectorEndpointArguments (line 9) | class TestCollectionConnectorEndpointArguments:
method test_create_connector_endpoint_arguments (line 102) | def test_create_connector_endpoint_arguments(
method test_create_connector_endpoint_arguments_1 (line 166) | def test_create_connector_endpoint_arguments_1(
method test_create_connector_endpoint_arguments_invalid (line 893) | def test_create_connector_endpoint_arguments_invalid(
method test_to_dict (line 965) | def test_to_dict(
FILE: tests/unit-tests/src/test_connector_prompt_arguments.py
class TestCollectionConnectorPromptArguments (line 8) | class TestCollectionConnectorPromptArguments:
method test_create_connector_prompt_arguments (line 27) | def test_create_connector_prompt_arguments(
method test_create_connector_prompt_arguments_1 (line 51) | def test_create_connector_prompt_arguments_1(self, prompt_index, promp...
method test_create_connector_prompt_arguments_invalid (line 78) | def test_create_connector_prompt_arguments_invalid(
method test_create_connector_prompt_arguments_invalid_1 (line 101) | def test_create_connector_prompt_arguments_invalid_1(
FILE: tests/unit-tests/src/test_connector_response.py
class TestCollectionConnectorResponse (line 7) | class TestCollectionConnectorResponse:
method test_create_connector_response (line 19) | def test_create_connector_response(self, response, context):
method test_create_connector_response_1 (line 31) | def test_create_connector_response_1(self, response):
method test_create_connector_response_invalid (line 51) | def test_create_connector_response_invalid(self, response, context):
method test_to_dict (line 66) | def test_to_dict(self, response, context):
method test_to_dict_1 (line 79) | def test_to_dict_1(self, response):
FILE: tests/unit-tests/src/test_import_modules.py
class TestCollectionImportModules (line 15) | class TestCollectionImportModules:
method test_create_module_spec (line 48) | def test_create_module_spec(self, module_name, module_file_path, expec...
method test_import_module_from_spec (line 67) | def test_import_module_from_spec(self):
method test_import_module_from_spec_errors (line 87) | def test_import_module_from_spec_errors(self, module_spec, expected_re...
method test_get_instance (line 120) | def test_get_instance(self, id, filepath, expected_result):
FILE: tests/unit-tests/src/test_log.py
class TestCollectionLog (line 8) | class TestCollectionLog:
method test_configure_logger (line 24) | def test_configure_logger(self, log_name, expected_log_name):
method test_configure_logger_log_level (line 48) | def test_configure_logger_log_level(self, mocker, environ_value, expec...
method test_configure_logger_log_to_file (line 67) | def test_configure_logger_log_to_file(self, mocker, environ_value, exp...
method test_configure_logger_log_name (line 100) | def test_configure_logger_log_name(self, mocker, environ_value, expect...
FILE: tests/unit-tests/src/test_timeit.py
class TestCollectionTimeitMethod (line 6) | class TestCollectionTimeitMethod:
method test_time_class_method (line 7) | def test_time_class_method(self, mocker):
FILE: tests/unit-tests/web_api/test_routes/conftest.py
function mock_bm_test_state (line 22) | def mock_bm_test_state():
function mock_cs_service (line 26) | def mock_cs_service():
function mock_am_service (line 30) | def mock_am_service():
function mock_bm_service (line 34) | def mock_bm_service():
function mock_dataset_service (line 38) | def mock_dataset_service():
function mock_endpoint_service (line 42) | def mock_endpoint_service():
function mock_bm_result_service (line 46) | def mock_bm_result_service():
function mock_runner_service (line 50) | def mock_runner_service():
function mock_pt_service (line 54) | def mock_pt_service():
function mock_cookbook_service (line 58) | def mock_cookbook_service():
function mock_recipe_service (line 62) | def mock_recipe_service():
function mock_metric_service (line 66) | def mock_metric_service():
function mock_session_service (line 70) | def mock_session_service():
function mock_bookmark_service (line 74) | def mock_bookmark_service():
function test_client (line 78) | def test_client(
FILE: tests/unit-tests/web_api/test_routes/test_routes_attack_modules.py
function test_get_all_attack_module (line 12) | def test_get_all_attack_module(test_client, mock_am_service, attack_modu...
function test_get_all_attack_module_metadata (line 33) | def test_get_all_attack_module_metadata(test_client, mock_am_service, ex...
FILE: tests/unit-tests/web_api/test_routes/test_routes_benchmarks.py
function test_execute_benchmark_cb (line 104) | def test_execute_benchmark_cb(test_client, mock_bm_service, benchmark_da...
function test_get_benchmark_progress (line 133) | def test_get_benchmark_progress(test_client, mock_bm_test_state, excepti...
function test_cancel_benchmark (line 148) | def test_cancel_benchmark(test_client, mock_bm_service, runner_id, excep...
FILE: tests/unit-tests/web_api/test_routes/test_routes_bm_results.py
function test_get_all_benchmark_results (line 13) | def test_get_all_benchmark_results(test_client, mock_bm_result_service, ...
function test_get_all_results_name (line 32) | def test_get_all_results_name(test_client, mock_bm_result_service, mock_...
function test_get_one_benchmark_results (line 56) | def test_get_one_benchmark_results(test_client, mock_bm_result_service, ...
function test_delete_result (line 75) | def test_delete_result(test_client, mock_bm_result_service, result_id, e...
FILE: tests/unit-tests/web_api/test_routes/test_routes_bookmark.py
function test_get_all_bookmarks (line 66) | def test_get_all_bookmarks(test_client, mock_bookmark_service, bookmark_...
function test_insert_bookmark (line 140) | def test_insert_bookmark(test_client, mock_bookmark_service, bookmark_da...
function test_delete_bookmark (line 213) | def test_delete_bookmark(test_client, mock_bookmark_service, delete_all,...
FILE: tests/unit-tests/web_api/test_routes/test_routes_context_strategy.py
function test_get_all_context_strategies (line 22) | def test_get_all_context_strategies(test_client, mock_cs_service, contex...
function test_get_all_context_strategies_name (line 44) | def test_get_all_context_strategies_name(test_client, mock_cs_service, c...
function test_delete_context_strategy (line 66) | def test_delete_context_strategy(test_client, mock_cs_service, strategy_...
FILE: tests/unit-tests/web_api/test_routes/test_routes_cookbook.py
function test_create_cookbook (line 169) | def test_create_cookbook(test_client, mock_cookbook_service, cookbook_da...
function test_get_cookbooks (line 404) | def test_get_cookbooks(test_client, mock_cookbook_service, query_string,...
function test_get_all_cookbooks_name (line 443) | def test_get_all_cookbooks_name(test_client, mock_cookbook_service, mock...
function test_update_cookbook (line 488) | def test_update_cookbook(test_client, mock_cookbook_service, cookbook_id...
function test_delete_cookbook (line 512) | def test_delete_cookbook(test_client, mock_cookbook_service, cb_id, serv...
FILE: tests/unit-tests/web_api/test_routes/test_routes_dataset.py
function test_get_all_datasets (line 43) | def test_get_all_datasets(test_client, mock_dataset_service, mockdata, e...
function test_get_all_dataset_names (line 64) | def test_get_all_dataset_names(test_client, mock_dataset_service, mockda...
function test_delete_dataset (line 85) | def test_delete_dataset(test_client, mock_dataset_service, dataset_id, e...
function test_download_dataset (line 159) | def test_download_dataset(test_client, mock_dataset_service, dataset_dat...
function test_convert_dataset (line 224) | def test_convert_dataset(test_client, mock_dataset_service, file_name, f...
FILE: tests/unit-tests/web_api/test_routes/test_routes_endpoint.py
function test_create_endpoint (line 84) | def test_create_endpoint(
function test_get_all_endpoints (line 194) | def test_get_all_endpoints(
function test_get_all_endpoints_name (line 264) | def test_get_all_endpoints_name(
function test_get_endpoint (line 347) | def test_get_endpoint(
function test_update_endpoint (line 415) | def test_update_endpoint(
function test_delete_endpoint (line 472) | def test_delete_endpoint(
function test_get_connectors (line 539) | def test_get_connectors(
FILE: tests/unit-tests/web_api/test_routes/test_routes_metrics.py
function test_get_metrics (line 33) | def test_get_metrics(test_client, mock_metric_service, metrics_data, exc...
function test_delete_metric (line 55) | def test_delete_metric(test_client, mock_metric_service, metric_id, exce...
FILE: tests/unit-tests/web_api/test_routes/test_routes_prompt_template.py
function test_get_all_prompt_templates (line 16) | def test_get_all_prompt_templates(test_client, mock_pt_service, template...
function test_get_all_prompt_templates_names (line 39) | def test_get_all_prompt_templates_names(test_client, mock_pt_service, te...
function test_delete_prompt_template (line 61) | def test_delete_prompt_template(test_client, mock_pt_service, pt_name, e...
FILE: tests/unit-tests/web_api/test_routes/test_routes_recipe.py
function test_create_recipe (line 165) | def test_create_recipe(test_client, mock_recipe_service, recipe_data, ex...
function test_get_all_recipes (line 578) | def test_get_all_recipes(test_client, mock_recipe_service, query_string,...
function test_get_all_recipes_name (line 615) | def test_get_all_recipes_name(test_client, mock_recipe_service ,mock_ret...
function test_update_recipe (line 660) | def test_update_recipe(test_client, mock_recipe_service, recipe_id, reci...
function test_delete_recipe (line 684) | def test_delete_recipe(test_client, mock_recipe_service, recipe_id, serv...
FILE: tests/unit-tests/web_api/test_routes/test_routes_redteam.py
function test_get_all_sessions (line 81) | def test_get_all_sessions(test_client, mock_session_service, mock_respon...
function test_create_session (line 145) | def test_create_session(test_client, mock_session_service, session_data,...
function test_delete_session (line 170) | def test_delete_session(test_client, mock_session_service, session_id, e...
function test_send_prompt (line 219) | def test_send_prompt(test_client, mock_session_service, session_id, prom...
function test_cancel_redteam (line 243) | def test_cancel_redteam(test_client, mock_session_service, session_id, e...
function test_set_prompt_template (line 266) | def test_set_prompt_template(test_client, mock_session_service, runner_i...
function test_unset_prompt_template (line 287) | def test_unset_prompt_template(test_client, mock_session_service, runner...
function test_set_context_strategy (line 309) | def test_set_context_strategy(test_client, mock_session_service, runner_...
function test_unset_context_strategy (line 330) | def test_unset_context_strategy(test_client, mock_session_service, runne...
function test_set_attack_module (line 351) | def test_set_attack_module(test_client, mock_session_service, runner_id,...
function test_unset_attack_module (line 372) | def test_unset_attack_module(test_client, mock_session_service, runner_i...
function test_set_metric (line 393) | def test_set_metric(test_client, mock_session_service, runner_id, metric...
function test_unset_metric (line 414) | def test_unset_metric(test_client, mock_session_service, runner_id, metr...
function test_set_system_prompt (line 456) | def test_set_system_prompt(test_client, mock_session_service, runner_id,...
function test_unset_system_prompt (line 477) | def test_unset_system_prompt(test_client, mock_session_service, runner_i...
function test_close_session (line 498) | def test_close_session(test_client, mock_session_service, runner_id, exc...
FILE: tests/unit-tests/web_api/test_routes/test_routes_runner.py
function test_get_all_runners (line 66) | def test_get_all_runners(test_client, mock_runner_service, runner_data, ...
function test_get_all_runner_name (line 88) | def test_get_all_runner_name(test_client, mock_runner_service, runner_da...
function test_get_runner_by_id (line 147) | def test_get_runner_by_id(test_client, mock_runner_service, runner_id, r...
function test_delete_runner (line 169) | def test_delete_runner(test_client, mock_runner_service, runner_id, exce...
function test_get_run_details_by_runner (line 222) | def test_get_run_details_by_runner(test_client, mock_runner_service, run...
function test_get_run_ids_in_runner (line 248) | def test_get_run_ids_in_runner(test_client, mock_runner_service ,runner_...
FILE: tests/unit-tests/web_api/test_services/test_service_attack_modules.py
function attack_module_service (line 22) | def attack_module_service():
function test_get_all_attack_module_success (line 27) | def test_get_all_attack_module_success(mock_moonshot_api, attack_module_...
function test_get_all_attack_module_metadata_success (line 37) | def test_get_all_attack_module_metadata_success(mock_moonshot_api, attac...
function test_get_all_attack_module_exceptions (line 48) | def test_get_all_attack_module_exceptions(mock_moonshot_api, exception, ...
function test_get_all_attack_module_metadata_exceptions (line 60) | def test_get_all_attack_module_metadata_exceptions(mock_moonshot_api, ex...
FILE: tests/unit-tests/web_api/test_services/test_service_benchmark_result.py
function benchmark_result_service (line 42) | def benchmark_result_service():
function test_get_all_results_success (line 46) | def test_get_all_results_success(mock_moonshot_api, benchmark_result_ser...
function test_get_all_result_name_success (line 56) | def test_get_all_result_name_success(mock_moonshot_api, benchmark_result...
function test_get_result_by_id_success (line 66) | def test_get_result_by_id_success(mock_moonshot_api, benchmark_result_se...
function test_delete_result_success (line 76) | def test_delete_result_success(mock_moonshot_api, benchmark_result_servi...
function test_get_all_results_exceptions (line 85) | def test_get_all_results_exceptions(mock_moonshot_api, exception, error_...
function test_get_all_result_name_exceptions (line 97) | def test_get_all_result_name_exceptions(mock_moonshot_api, exception, er...
function test_get_result_by_id_exceptions (line 109) | def test_get_result_by_id_exceptions(mock_moonshot_api, exception, error...
function test_delete_result_exceptions (line 121) | def test_delete_result_exceptions(mock_moonshot_api, exception, error_co...
FILE: tests/unit-tests/web_api/test_services/test_service_bookmark.py
function bookmark_service (line 55) | def bookmark_service():
function test_get_all_bookmarks_success (line 59) | def test_get_all_bookmarks_success(mock_moonshot_api, bookmark_service):
function test_get_all_bookmarks_exceptions (line 70) | def test_get_all_bookmarks_exceptions(mock_moonshot_api, exception, erro...
function test_insert_bookmark_success (line 80) | def test_insert_bookmark_success(mock_moonshot_api, bookmark_service):
function test_insert_bookmark_exceptions (line 90) | def test_insert_bookmark_exceptions(mock_moonshot_api, exception, error_...
function test_delete_bookmark_success (line 100) | def test_delete_bookmark_success(mock_moonshot_api, bookmark_service):
function test_delete_all_bookmarks_success (line 109) | def test_delete_all_bookmarks_success(mock_moonshot_api, bookmark_service):
function test_delete_bookmarks_no_params (line 118) | def test_delete_bookmarks_no_params(mock_moonshot_api, bookmark_service):
function test_delete_bookmarks_exceptions (line 129) | def test_delete_bookmarks_exceptions(mock_moonshot_api, exception, error...
FILE: tests/unit-tests/web_api/test_services/test_service_context_strategy.py
function context_strategy_service (line 29) | def context_strategy_service():
function test_get_ctx_strategy_success (line 33) | def test_get_ctx_strategy_success(mock_moonshot_api, context_strategy_se...
function test_get_ctx_strategy_name_success (line 43) | def test_get_ctx_strategy_name_success(mock_moonshot_api, context_strate...
function test_delete_ctx_strategy_success (line 53) | def test_delete_ctx_strategy_success(mock_moonshot_api, context_strategy...
function test_get_ctx_strategy_exceptions (line 62) | def test_get_ctx_strategy_exceptions(mock_moonshot_api, exception, error...
function test_get_ctx_strategy_name_exceptions (line 74) | def test_get_ctx_strategy_name_exceptions(mock_moonshot_api, exception, ...
function test_delete_ctx_strategy_exceptions (line 86) | def test_delete_ctx_strategy_exceptions(mock_moonshot_api, exception, er...
FILE: tests/unit-tests/web_api/test_services/test_service_cookbook.py
function cookbook_service (line 64) | def cookbook_service():
function test_get_all_cookbooks_success (line 68) | def test_get_all_cookbooks_success(mock_moonshot_api, cookbook_service):
function test_get_all_cookbooks_names_success (line 79) | def test_get_all_cookbooks_names_success(mock_moonshot_api, cookbook_ser...
function test_get_all_cookbooks_exceptions (line 90) | def test_get_all_cookbooks_exceptions(mock_moonshot_api, exception, erro...
function test_get_all_cookbooks_names_exceptions (line 102) | def test_get_all_cookbooks_names_exceptions(mock_moonshot_api, exception...
function test_create_cookbook_success (line 113) | def test_create_cookbook_success(mock_moonshot_api, cookbook_service):
function test_update_cookbook_success (line 125) | def test_update_cookbook_success(mock_moonshot_api, cookbook_service):
function test_delete_cookbook_success (line 140) | def test_delete_cookbook_success(mock_moonshot_api, cookbook_service):
function test_create_cookbook_exceptions (line 149) | def test_create_cookbook_exceptions(mock_moonshot_api, exception, error_...
function test_update_cookbook_exceptions (line 160) | def test_update_cookbook_exceptions(mock_moonshot_api, exception, error_...
function test_delete_cookbook_exceptions (line 171) | def test_delete_cookbook_exceptions(mock_moonshot_api, exception, error_...
FILE: tests/unit-tests/web_api/test_services/test_service_dataset.py
function dataset_service (line 57) | def dataset_service():
function test_get_all_datasets_success (line 61) | def test_get_all_datasets_success(mock_moonshot_api, dataset_service):
function test_get_all_datasets_name_success (line 71) | def test_get_all_datasets_name_success(mock_moonshot_api, dataset_service):
function test_delete_dataset_success (line 81) | def test_delete_dataset_success(mock_moonshot_api, dataset_service):
function test_get_all_datasets_exceptions (line 90) | def test_get_all_datasets_exceptions(mock_moonshot_api, exception, error...
function test_get_all_datasets_name_exceptions (line 102) | def test_get_all_datasets_name_exceptions(mock_moonshot_api, exception, ...
function test_delete_dataset_exceptions (line 114) | def test_delete_dataset_exceptions(mock_moonshot_api, exception, error_c...
function test_download_dataset_success (line 126) | def test_download_dataset_success(mock_copy_file, mock_moonshot_api):
function test_convert_dataset_success (line 152) | def test_convert_dataset_success(mock_copy_file, mock_moonshot_api):
FILE: tests/unit-tests/web_api/test_services/test_service_endpoint.py
function endpoint_service (line 56) | def endpoint_service():
function test_get_all_endpoints_success (line 61) | def test_get_all_endpoints_success(mock_moonshot_api, endpoint_service):
function test_get_all_endpoints_names_success (line 75) | def test_get_all_endpoints_names_success(mock_moonshot_api, endpoint_ser...
function test_get_all_connectors_success (line 86) | def test_get_all_connectors_success(mock_moonshot_api, endpoint_service):
function test_get_all_endpoints_exceptions (line 106) | def test_get_all_endpoints_exceptions(
function test_get_all_endpoints_names_exceptions (line 120) | def test_get_all_endpoints_names_exceptions(
function test_get_all_connectors_exceptions (line 134) | def test_get_all_connectors_exceptions(
function test_create_endpoint_success (line 147) | def test_create_endpoint_success(mock_moonshot_api, endpoint_service):
function test_update_endpoint_success (line 165) | def test_update_endpoint_success(mock_moonshot_api, endpoint_service):
function test_delete_endpoint_success (line 176) | def test_delete_endpoint_success(mock_moonshot_api, endpoint_service):
function test_create_endpoint_exception (line 186) | def test_create_endpoint_exception(
function test_update_endpoint_exception (line 200) | def test_update_endpoint_exception(
function test_delete_endpoint_exception (line 214) | def test_delete_endpoint_exception(
FILE: tests/unit-tests/web_api/test_services/test_service_metric.py
function metric_service (line 28) | def metric_service():
function test_get_all_metric_success (line 32) | def test_get_all_metric_success(mock_moonshot_api, metric_service):
function test_delete_metric_success (line 42) | def test_delete_metric_success(mock_moonshot_api, metric_service):
function test_get_all_metric_exceptions (line 51) | def test_get_all_metric_exceptions(mock_moonshot_api, exception, error_c...
function test_delete_metric_exceptions (line 63) | def test_delete_metric_exceptions(mock_moonshot_api, exception, error_co...
FILE: tests/unit-tests/web_api/test_services/test_service_prompt_template.py
function prompt_template_service (line 29) | def prompt_template_service():
function test_get_prompt_templates_success (line 33) | def test_get_prompt_templates_success(mock_moonshot_api, prompt_template...
function test_get_prompt_templates_name_success (line 43) | def test_get_prompt_templates_name_success(mock_moonshot_api, prompt_tem...
function test_delete_prompt_template_success (line 53) | def test_delete_prompt_template_success(mock_moonshot_api, prompt_templa...
function test_get_prompt_templates_exceptions (line 62) | def test_get_prompt_templates_exceptions(mock_moonshot_api, exception, e...
function test_get_prompt_templates_name_exceptions (line 74) | def test_get_prompt_templates_name_exceptions(mock_moonshot_api, excepti...
function test_delete_prompt_template_exceptions (line 86) | def test_delete_prompt_template_exceptions(mock_moonshot_api, exception,...
FILE: tests/unit-tests/web_api/test_services/test_service_recipe.py
function recipe_service (line 60) | def recipe_service():
function test_get_all_recipes_success (line 64) | def test_get_all_recipes_success(mock_moonshot_api, recipe_service):
function test_get_all_recipes_name_success (line 75) | def test_get_all_recipes_name_success(mock_moonshot_api, recipe_service):
function test_get_all_recipes_exceptions (line 86) | def test_get_all_recipes_exceptions(mock_moonshot_api, exception, error_...
function test_get_all_recipes_name_exceptions (line 97) | def test_get_all_recipes_name_exceptions(mock_moonshot_api, exception, e...
function test_create_recipe_success (line 107) | def test_create_recipe_success(mock_moonshot_api, recipe_service):
function test_update_recipe_success (line 124) | def test_update_recipe_success(mock_moonshot_api, recipe_service):
function test_delete_recipe_success (line 135) | def test_delete_recipe_success(mock_moonshot_api, recipe_service):
function test_create_recipe_exceptions (line 144) | def test_create_recipe_exceptions(mock_moonshot_api, exception, error_co...
function test_update_recipe_exceptions (line 155) | def test_update_recipe_exceptions(mock_moonshot_api, exception, error_co...
function test_delete_recipe_exceptions (line 166) | def test_delete_recipe_exceptions(mock_moonshot_api, exception, error_co...
FILE: tests/unit-tests/web_api/test_services/test_service_runner.py
function runner_service (line 58) | def runner_service():
function test_get_all_runner_success (line 62) | def test_get_all_runner_success(mock_moonshot_api, runner_service):
function test_get_all_runner_name_success (line 72) | def test_get_all_runner_name_success(mock_moonshot_api, runner_service):
function test_get_runner_by_id_success (line 82) | def test_get_runner_by_id_success(mock_moonshot_api, runner_service):
function test_delete_run_success (line 92) | def test_delete_run_success(mock_moonshot_api, runner_service):
function test_get_all_runner_exceptions (line 101) | def test_get_all_runner_exceptions(mock_moonshot_api, exception, error_c...
function test_get_all_runner_name_exceptions (line 113) | def test_get_all_runner_name_exceptions(mock_moonshot_api, exception, er...
function test_get_runner_by_id_exceptions (line 125) | def test_get_runner_by_id_exceptions(mock_moonshot_api, exception, error...
function test_delete_run_exceptions (line 137) | def test_delete_run_exceptions(mock_moonshot_api, exception, error_code,...
FILE: tests/unit-tests/web_api/test_services/test_service_session.py
function session_service (line 50) | def session_service():
function test_get_all_session_success (line 53) | def test_get_all_session_success(mock_moonshot_api, session_service):
function test_get_all_sessions_names_success (line 63) | def test_get_all_sessions_names_success(mock_moonshot_api, session_servi...
function test_get_all_session_exception (line 74) | def test_get_all_session_exception(mock_moonshot_api, session_service, e...
function test_get_all_sessions_names_exception (line 85) | def test_get_all_sessions_names_exception(mock_moonshot_api, session_ser...
function test_delete_session_success (line 95) | def test_delete_session_success(mock_moonshot_api, session_service):
function test_delete_session_exception (line 105) | def test_delete_session_exception(mock_moonshot_api, session_service, ex...
function test_select_prompt_template_success (line 116) | def test_select_prompt_template_success(mock_moonshot_api, session_servi...
function test_select_context_strategy_success (line 128) | def test_select_context_strategy_success(mock_moonshot_api, session_serv...
function test_select_attack_module_success (line 140) | def test_select_attack_module_success(mock_moonshot_api, session_service):
function test_select_metric_success (line 152) | def test_select_metric_success(mock_moonshot_api, session_service):
function test_update_system_prompt_success (line 164) | def test_update_system_prompt_success(mock_moonshot_api, session_service):
function test_cancel_auto_redteam_success (line 176) | async def test_cancel_auto_redteam_success(session_service):
function test_end_session_success (line 186) | async def test_end_session_success(session_service):
Copy disabled (too large)
Download .json
Condensed preview — 436 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (10,682K chars).
[
{
"path": ".coveragerc",
"chars": 241,
"preview": "# .coveragerc to control coverage.py\n[run]\nbranch = True\ncover_pylib = False\n\n[coverage:report]\nskip_empty = true\nomit ="
},
{
"path": ".flake8",
"chars": 155,
"preview": "[flake8]\nmax-line-length = 120\nextend-ignore = E203\n\nper-file-ignores = cli.py:F401 benchmark.py:F403,F405 initialisatio"
},
{
"path": ".github/developing-workflows.md",
"chars": 1093,
"preview": "Developing GitHub Workflows\n===========================\nFollow these instructions to develop Github workflows in a non-m"
},
{
"path": ".github/pull_request_template.md",
"chars": 3525,
"preview": "## Description\n\n[Provide a brief description of the changes or features introduced by this pull request.]\n\n## Motivation"
},
{
"path": ".github/scripts/create_backup.sh",
"chars": 1319,
"preview": "#!/bin/bash\n\nBASE_DIR=~/moonshot\nMOONSHOT_DIR=moonshot-sit\n\n# Moonshot SIT dir\nSIT_DIR=$BASE_DIR/$MOONSHOT_DIR\n\n# Backup"
},
{
"path": ".github/scripts/install_ms_service.sh",
"chars": 1516,
"preview": "#!/bin/bash\n\n# Arguments for branches, default to dev_main if not provided.\nMOONSHOT_BRANCH=${1:-dev_main}\nMOONSHOT_DATA"
},
{
"path": ".github/scripts/moonshot_env",
"chars": 1065,
"preview": "# .env for moonshot SIT\n\n# For Data\nATTACK_MODULES=\"./moonshot-data/attack-modules\"\nBOOKMARKS=\"./moonshot-data/generated"
},
{
"path": ".github/scripts/moonshot_test_env",
"chars": 136,
"preview": "ADDITIONAL_PARAMETERS='{\n \"timeout\": 300,\n \"allow_retries\": true,\n \"num_of_retries\": 3,\n \"temperature\": 0.5,\n \"mode"
},
{
"path": ".github/scripts/moonshot_ui_env",
"chars": 90,
"preview": "# .env for moonshot-ui SIT\n\nHOST=127.0.0.1\nPORT=3100\nMOONSHOT_API_URL=http://0.0.0.0:5100\n"
},
{
"path": ".github/scripts/run_smoke_test.sh",
"chars": 1497,
"preview": "#!/bin/bash\n\nAZURE_OPENAI_API_KEY=$1\nAZURE_OPENAI_ENDPOINT=$2\nTEST_BRANCH_NAME=${3:-main}\n\nBASE_DIR=~/moonshot\nSCRIPTS_D"
},
{
"path": ".github/scripts/start_ms_service.sh",
"chars": 136,
"preview": "!/bin/bash\n\nBASE_DIR=~/moonshot\nMOONSHOT_SIT=moonshot-sit\n\ncd $BASE_DIR/$MOONSHOT_SIT\n\nsource venv/bin/activate\npython -"
},
{
"path": ".github/workflows/docs-update.yaml",
"chars": 1838,
"preview": "name: \"Docs Update\"\n\non:\n# push:\n# branches: [ \"docs\" ]\n\n workflow_dispatch:\n inputs:\n docs_branch:\n "
},
{
"path": ".github/workflows/gh-event-notification.yaml",
"chars": 1578,
"preview": "name: GH Event Notification\n\non:\n issues:\n types: [opened]\n pull_request:\n types: [opened]\n\njobs:\n notify:\n "
},
{
"path": ".github/workflows/integration-test.yaml",
"chars": 48806,
"preview": "# Integration Test\n\nname: Moonshot Integration Test\n\non:\n\n # Run this workflow manually from Actions tab\n workflow_dis"
},
{
"path": ".github/workflows/notices-file-gen.yaml",
"chars": 2511,
"preview": "name: Notices File Generation\n\non:\n workflow_call:\n inputs:\n repo:\n description: 'Repository name'\n "
},
{
"path": ".github/workflows/pre-build-checks.yaml",
"chars": 6736,
"preview": "# Pre-build Checks (for moonshot)\n# 1. Unit tests with code coverage (pytest)\n# 2. Code quality analysis (flake8)\n# 3. D"
},
{
"path": ".github/workflows/pypi-deployment.yaml",
"chars": 2656,
"preview": "# PyPi\nname: PyPi Deployment\n\non:\n\n # Run this workflow manually from Actions tab\n workflow_dispatch:\n\n# Allow one con"
},
{
"path": ".github/workflows/sast-codeql.yaml",
"chars": 6339,
"preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
},
{
"path": ".github/workflows/sca-scan.yaml",
"chars": 4431,
"preview": "name: Software Composition Analysis\n\n# Runs when a pull request review is being submitted\non: \n pull_request:\n\n # Run "
},
{
"path": ".github/workflows/sit-build.yaml",
"chars": 7058,
"preview": "\nname: SIT Build\n\non:\n\n # Run this workflow manually from Actions tab\n workflow_dispatch:\n inputs:\n branch_moo"
},
{
"path": ".github/workflows/smoke-test-cli.yaml",
"chars": 4464,
"preview": "# Cli Smoke Test\n\nname: Moonshot CLI Smoke Test\n\non:\n # Runs on Pull Request Review\n pull_request:\n types: [ assign"
},
{
"path": ".github/workflows/smoke-test.yaml",
"chars": 5400,
"preview": "# Smoke Test\n\nname: Moonshot Smoke Test\n\non:\n # Runs when a pull request to main is being assigned\n pull_request:\n t"
},
{
"path": ".github/workflows/test-pypi-deployment.yaml",
"chars": 1456,
"preview": "# Test PyPi\nname: Test PyPi Deployment\n\non:\n\n # Run this workflow manually from Actions tab\n workflow_dispatch:\n\n# All"
},
{
"path": ".github/workflows/uat-build.yaml",
"chars": 2042,
"preview": "name: UAT Build\n\n# Trigger when the PR to merge to main is merged\non:\n pull_request:\n branches:\n - main\n typ"
},
{
"path": ".gitignore",
"chars": 3383,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# MacOS\n*.DS_Store\n\n# Di"
},
{
"path": ".pre-commit-config.yaml",
"chars": 566,
"preview": "repos:\n- repo: https://github.com/pycqa/isort\n rev: 5.12.0\n hooks:\n - id: isort\n name: isort (python"
},
{
"path": "AUTHORS.md",
"chars": 59,
"preview": "# Credits\n\nDevelopers\n----------------\n* The Moonshot Team\n"
},
{
"path": "LICENSE.md",
"chars": 11347,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "NOTICES.md",
"chars": 50882,
"preview": "Copyright 2025\r\n\r\n[aiverify-moonshot : main]\r\n\r\nPhase: DEVELOPMENT\r\nDistribution: OPENSOURCE\r\n\r\nComponents: \r\n\r\naiohappy"
},
{
"path": "README.md",
"chars": 9293,
"preview": "<div align=\"center\">\n\n -> None:\n # Check if an argument is"
},
{
"path": "ci/gen_pre_build_summ.sh",
"chars": 2533,
"preview": "#!/bin/bash\n\n# Function to read coverage data\nread_coverage() {\n covPct=$(jq '.totals.percent_covered' coverage.json)\n "
},
{
"path": "ci/run-codeql-summ.sh",
"chars": 1530,
"preview": "#!/bin/bash\n\n# Note: this script must be run using source\n\n# Default values\nREPO=\"aiverify-foundation/moonshot\"\nOUTPUT_F"
},
{
"path": "ci/run-flake8.sh",
"chars": 281,
"preview": "#!/bin/bash\nsource_dir=moonshot\n\nset +e\nflake8 --format=html --htmldir=flake8-report --count $source_dir > flake8-repor"
},
{
"path": "ci/run-pip-audit.sh",
"chars": 1596,
"preview": "#!/bin/bash\n\n# create venv for ci\npython3 -m venv ci-venv\nsource ci-venv/bin/activate\n\npip install --upgrade pip > /dev/"
},
{
"path": "ci/run-test.sh",
"chars": 430,
"preview": "#!/bin/bash\nsource_dir=moonshot\n\nif [ \"$1\" == \"-m\" ]; then\n test_cmd=\"python3 -m pytest\"\nelse\n test_cmd=pytest\nfi\n\nset"
},
{
"path": "docs/api_reference/api_bookmark.md",
"chars": 33,
"preview": "::: moonshot.src.api.api_bookmark"
},
{
"path": "docs/api_reference/api_connector.md",
"chars": 34,
"preview": "::: moonshot.src.api.api_connector"
},
{
"path": "docs/api_reference/api_connector_endpoint.md",
"chars": 43,
"preview": "::: moonshot.src.api.api_connector_endpoint"
},
{
"path": "docs/api_reference/api_context_strategy.md",
"chars": 41,
"preview": "::: moonshot.src.api.api_context_strategy"
},
{
"path": "docs/api_reference/api_cookbook.md",
"chars": 33,
"preview": "::: moonshot.src.api.api_cookbook"
},
{
"path": "docs/api_reference/api_dataset.md",
"chars": 32,
"preview": "::: moonshot.src.api.api_dataset"
},
{
"path": "docs/api_reference/api_environment_variables.md",
"chars": 46,
"preview": "::: moonshot.src.api.api_environment_variables"
},
{
"path": "docs/api_reference/api_metrics.md",
"chars": 32,
"preview": "::: moonshot.src.api.api_metrics"
},
{
"path": "docs/api_reference/api_prompt_template.md",
"chars": 40,
"preview": "::: moonshot.src.api.api_prompt_template"
},
{
"path": "docs/api_reference/api_recipe.md",
"chars": 31,
"preview": "::: moonshot.src.api.api_recipe"
},
{
"path": "docs/api_reference/api_red_teaming.md",
"chars": 36,
"preview": "::: moonshot.src.api.api_red_teaming"
},
{
"path": "docs/api_reference/api_result.md",
"chars": 31,
"preview": "::: moonshot.src.api.api_result"
},
{
"path": "docs/api_reference/api_run.md",
"chars": 28,
"preview": "::: moonshot.src.api.api_run"
},
{
"path": "docs/api_reference/api_runner.md",
"chars": 31,
"preview": "::: moonshot.src.api.api_runner"
},
{
"path": "docs/api_reference/api_session.md",
"chars": 32,
"preview": "::: moonshot.src.api.api_session"
},
{
"path": "docs/api_reference/web_api_swagger.json",
"chars": 92869,
"preview": "{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Project Moonshot\",\"version\":\"0.4.0\"},\"paths\":{\"/\":{\"get\":{\"tags\":[\"Red Teaming\"],\"su"
},
{
"path": "docs/api_reference/web_api_swagger.md",
"chars": 199,
"preview": "#\nTo evaluate the Swagger documentation, initiate the Moonshot web API and navigate to [127.0.0.1:5000/docs](http://127."
},
{
"path": "docs/contributing.md",
"chars": 9021,
"preview": "# Moonshot Contribution Guide\n\n## Welcome\n\nWelcome to Moonshot's Contributor Guide!\n\nWe always welcome community contrib"
},
{
"path": "docs/faq.md",
"chars": 9586,
"preview": "# FAQ\n\nJump to:\n- [Issues with installing Moonshot](#installing-moonshot)\n- [Issues caused by updating Moonshot](#updati"
},
{
"path": "docs/getting_started/first_test.md",
"chars": 5781,
"preview": "# Running your first test\n\n## Objective\n\nIn this guide, you will learn how to\n\n1. Launch Moonshot UI \n2. Run tests using"
},
{
"path": "docs/getting_started/overview.md",
"chars": 3582,
"preview": "# Moonshot\n\nDeveloped by the [AI Verify Foundation](https://aiverifyfoundation.sg/?utm_source=Github&utm_medium=referral"
},
{
"path": "docs/getting_started/quick_install.md",
"chars": 4708,
"preview": "# Installing Moonshot for User Interface\n\n## Dependencies needed for installation\n\nThis project <span style=\"color:red;\""
},
{
"path": "docs/getting_started/quick_start.md",
"chars": 284,
"preview": "!!! note\n\n Users are encouraged to install using the latest release on `pypi`.\n\n<object data=\"../quick-start-guide.pd"
},
{
"path": "docs/index.md",
"chars": 827,
"preview": "#\n\n\n\n# Welcome to Moonshot's Documentation\n\n**Moonshot** is a tool des"
},
{
"path": "docs/resources/attack_modules.md",
"chars": 3892,
"preview": "# List of Attack Modules\n\n| Name | Description |\n|------|-------------|\n| Character Swap Attack | This module tests for "
},
{
"path": "docs/resources/cookbooks.md",
"chars": 3073,
"preview": "# List of Cookbooks\n\n| Name | Description | Recipes |\n|------|-------------|---------|\n| Easy test sets for Common Risks"
},
{
"path": "docs/resources/datasets.md",
"chars": 19399,
"preview": "# List of Datasets\n\n| Name | Description | License | Reference |\n|------|-------------|---------|-----------|\n| squad-sh"
},
{
"path": "docs/resources/jupyter_notebook.md",
"chars": 1440,
"preview": "Here are some examples of how you can run Moonshot using Jupyter Notebook.\n\n\n[Moonshot Benchmark Feature Walkthrough](ht"
},
{
"path": "docs/resources/metrics.md",
"chars": 2152,
"preview": "# List of Metrics\n\n| Name | Description |\n|------|-------------|\n| Attack Success Rate | Attack success rate measures ho"
},
{
"path": "docs/resources/recipes.md",
"chars": 15495,
"preview": "# List of Recipes\n\n| Name | Description | Datasets | Metrics | Prompt Templates |\n|------|-------------|----------|-----"
},
{
"path": "docs/tutorial/cli/create_benchmark_tests.md",
"chars": 1706,
"preview": "In this tutorial, you will learn how to create a custom cookbook via our command line interface. A cookbook is a collect"
},
{
"path": "docs/tutorial/cli/create_endpoint.md",
"chars": 1087,
"preview": "In this tutorial, you will learn how to configure and seamlessly connect Moonshot to your AI systems. A connector endpoi"
},
{
"path": "docs/tutorial/cli/run_benchmark_tests.md",
"chars": 2001,
"preview": "In this tutorial, you will learn how to run a benchmark in Moonshot. Benchmarks are a set of \"exam questions\" that can h"
},
{
"path": "docs/tutorial/cli/run_red_teaming.md",
"chars": 2183,
"preview": "In this tutorial, you will learn how to conduct red teaming using Moonshot's command line interface. Red teaming serves "
},
{
"path": "docs/tutorial/contributor/configure_web_api.md",
"chars": 3294,
"preview": "# Running Moonshot as a Web API\n\nMoonshot Web API is built using FastAPI. This guide will help you get started and confi"
},
{
"path": "docs/tutorial/contributor/create_connector.md",
"chars": 4119,
"preview": "Currently, the most straightforward way is to duplicate an existing connector module, and modify the codes. This feature"
},
{
"path": "docs/tutorial/web-ui/benchmark.md",
"chars": 3856,
"preview": "\nIn this tutorial, you will learn how to run a benchmark in Moonshot. Benchmarks are a set of \"exam questions\" that can "
},
{
"path": "docs/tutorial/web-ui/create_cookbook.md",
"chars": 1131,
"preview": "In this tutorial, you will learn how to create a custom cookbook via our web interface. A cookbook is a collection of on"
},
{
"path": "docs/tutorial/web-ui/create_endpoint.md",
"chars": 956,
"preview": "In this tutorial, you will learn how to configure and seamlessly connect Moonshot to your AI systems. A connector endpoi"
},
{
"path": "docs/tutorial/web-ui/redteam.md",
"chars": 3251,
"preview": "In this tutorial, you will learn how to conduct red teaming. Red teaming serves as a crucial process to induce your LLMs"
},
{
"path": "docs/user_guide/cli/add_your_own_tests.md",
"chars": 5742,
"preview": "# Add Your Own Benchmark Tests\n\nIn this tutorial, we will be going through the steps required to add new test using CLI."
},
{
"path": "docs/user_guide/cli/benchmarking.md",
"chars": 7706,
"preview": "# Execute Existing Tests\nIn this section, we will be going through the steps required to run a test in CLI.\n\nTo run a te"
},
{
"path": "docs/user_guide/cli/cli_command_list.md",
"chars": 23301,
"preview": "# List of CLI Commands\n\n| Command | Description | Parameters |\n|---------|-------------|------------|\n| add_cookbook<br>"
},
{
"path": "docs/user_guide/cli/cli_guide.md",
"chars": 4914,
"preview": "# Running Moonshot via CLI\n\nTwo modes are available on the Moonshot CLI: Command-Based Mode and Interactive Mode.\n\n<deta"
},
{
"path": "docs/user_guide/cli/connecting_endpoints.md",
"chars": 3159,
"preview": "In this section, we will be going through the steps required to create a connector endpoint.\n\nBefore we jump into execut"
},
{
"path": "docs/user_guide/cli/red_teaming.md",
"chars": 6533,
"preview": "# Run Red Teaming Sessions\nIn this section, we will be going through the steps required to run red teaming sessions.\n\nTo"
},
{
"path": "docs/user_guide/web_ui/choosing_relevant_tests.md",
"chars": 2435,
"preview": "# Choosing Relevant Tests\n\n1. Click on ‘Get Started’ \n\n.png)\n\n2. This pag"
},
{
"path": "docs/user_guide/web_ui/connecting_to_llms.md",
"chars": 3146,
"preview": "# Connecting to LLMs\n\n1. This page shows you the connector endpoints available to be tested. Moonshot comes with pre-con"
},
{
"path": "docs/user_guide/web_ui/creating_custom_cookbooks.md",
"chars": 1344,
"preview": "# Creating Custom Cookbooks\n\nUsing the recipes available on Moonshot, you can easily curate custom cookbooks to suit you"
},
{
"path": "docs/user_guide/web_ui/moonshot_interface/benchmarking.md",
"chars": 736,
"preview": "When you click on the benchmarking icon, you will be directed to this page.\n\n\n\nTh"
},
{
"path": "docs/user_guide/web_ui/moonshot_interface/endpoint.md",
"chars": 3423,
"preview": "This page is the page when you click on the endpoints icon.\n\n\n\n## Form Field Infor"
},
{
"path": "docs/user_guide/web_ui/moonshot_interface/history.md",
"chars": 611,
"preview": "Upon clicking the history icon, you'll be navigated to a this history page.\n\nThis page provides you with the option to r"
},
{
"path": "docs/user_guide/web_ui/moonshot_interface/homepage.md",
"chars": 2826,
"preview": "\n\n\nThe Moonshot landing page appears when you first launch the UI.\n\n## Sidebar\n\nThe sid"
},
{
"path": "docs/user_guide/web_ui/moonshot_interface/redteaming.md",
"chars": 606,
"preview": "When you click on the red teaming icon, you will be directed to this page.\n\n\n\nT"
},
{
"path": "docs/user_guide/web_ui/moonshot_interface/utils.md",
"chars": 309,
"preview": "When you click on the utils icon, you will be directed to this page.\n\nBy clicking, you can access the list of available "
},
{
"path": "docs/user_guide/web_ui/running_benchmarks.md",
"chars": 2232,
"preview": "# Running Benchmarks\n\n1. Before you can start running benchmarks, provide the following info. These will be included in "
},
{
"path": "docs/user_guide/web_ui/running_red_teaming.md",
"chars": 6164,
"preview": "# Red Teaming\n\n1. Click on ‘Discover new vulnerabilities’ to start a new red teaming session. \n\n  {\n . ./env/bin/activate\n}\n\n# Check if Python is installed\nif ! command -v python &> /dev/null\nthen\n echo"
},
{
"path": "mkdocs.yml",
"chars": 4502,
"preview": "site_name: Moonshot\nrepo_url: https://github.com/aiverify-foundation/moonshot\n\nplugins:\n - search\n - mkdocstrings\n - "
},
{
"path": "moonshot/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/__main__.py",
"chars": 12056,
"preview": "import argparse\nimport os\nimport platform\nimport shutil\nimport subprocess\nimport sys\nimport threading\nimport warnings\nfr"
},
{
"path": "moonshot/api.py",
"chars": 4877,
"preview": "from moonshot.src.api.api_bookmark import (\n api_delete_all_bookmark,\n api_delete_bookmark,\n api_export_bookmar"
},
{
"path": "moonshot/integrations/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/cli/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/cli/__main__.py",
"chars": 652,
"preview": "import warnings\n\nfrom moonshot.integrations.cli.cli import CommandLineInterface\n\n\ndef start_app(cli_command=None):\n \""
},
{
"path": "moonshot/integrations/cli/active_session_cfg.py",
"chars": 20,
"preview": "active_session = {}\n"
},
{
"path": "moonshot/integrations/cli/benchmark/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/cli/benchmark/benchmark.py",
"chars": 6303,
"preview": "import argparse\n\nimport cmd2\n\nfrom moonshot.integrations.cli.benchmark.cookbook import (\n add_cookbook,\n add_cookb"
},
{
"path": "moonshot/integrations/cli/benchmark/cookbook.py",
"chars": 30259,
"preview": "import asyncio\nfrom ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\nf"
},
{
"path": "moonshot/integrations/cli/benchmark/datasets.py",
"chars": 8965,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/benchmark/metrics.py",
"chars": 8310,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/benchmark/recipe.py",
"chars": 32920,
"preview": "import asyncio\nfrom ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\nf"
},
{
"path": "moonshot/integrations/cli/benchmark/result.py",
"chars": 11223,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/benchmark/run.py",
"chars": 7438,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/benchmark/runner.py",
"chars": 7098,
"preview": "import cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.api import (\n api_delete_run"
},
{
"path": "moonshot/integrations/cli/cli.py",
"chars": 2769,
"preview": "import cmd2\nfrom cmd2 import Statement\nfrom rich.console import Console\n\nfrom moonshot.integrations.cli.active_session_c"
},
{
"path": "moonshot/integrations/cli/cli_errors.py",
"chars": 24030,
"preview": "# ------------------------------------------------------------------------------\n# Benchmark - add_cookbook\n# ----------"
},
{
"path": "moonshot/integrations/cli/common/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/cli/common/common.py",
"chars": 3302,
"preview": "import argparse\n\nimport cmd2\n\nfrom moonshot.integrations.cli.common.connectors import (\n add_endpoint,\n add_endpoi"
},
{
"path": "moonshot/integrations/cli/common/connectors.py",
"chars": 20017,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.markup import escape\nfrom rich.tabl"
},
{
"path": "moonshot/integrations/cli/common/dataset.py",
"chars": 12646,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/common/display_helper.py",
"chars": 1459,
"preview": "def display_view_list_format(title: str, items: list) -> str:\n \"\"\"\n Format a list of items for display.\n\n This "
},
{
"path": "moonshot/integrations/cli/common/prompt_template.py",
"chars": 6351,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/initialisation/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/cli/initialisation/initialisation.py",
"chars": 387,
"preview": "import cmd2\n\n\n@cmd2.with_default_category(\"Initialisation\")\nclass InitialisationCommandSet(cmd2.CommandSet):\n def __i"
},
{
"path": "moonshot/integrations/cli/redteam/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/cli/redteam/attack_module.py",
"chars": 5886,
"preview": "from ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n\nfrom moonshot.a"
},
{
"path": "moonshot/integrations/cli/redteam/context_strategy.py",
"chars": 7065,
"preview": "import argparse\nfrom ast import literal_eval\n\nimport cmd2\nfrom rich.console import Console\nfrom rich.table import Table\n"
},
{
"path": "moonshot/integrations/cli/redteam/prompt_template.py",
"chars": 2079,
"preview": "import argparse\n\nimport cmd2\nfrom rich.console import Console\n\nfrom moonshot.api import api_update_prompt_template\nfrom "
},
{
"path": "moonshot/integrations/cli/redteam/redteam.py",
"chars": 4257,
"preview": "import argparse\n\nimport cmd2\n\nfrom moonshot.integrations.cli.redteam.attack_module import (\n delete_attack_module,\n "
},
{
"path": "moonshot/integrations/cli/redteam/session.py",
"chars": 37784,
"preview": "import asyncio\nfrom ast import literal_eval\n\nimport cmd2\nfrom rich.columns import Columns\nfrom rich.console import Conso"
},
{
"path": "moonshot/integrations/cli/utils/process_data.py",
"chars": 1901,
"preview": "from moonshot.src.utils.find_feature import find_keyword\nfrom moonshot.src.utils.pagination import get_paginated_lists\n\n"
},
{
"path": "moonshot/integrations/web_api/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/web_api/__main__.py",
"chars": 2050,
"preview": "import logging\nimport os\n\nimport uvicorn\nfrom dotenv import dotenv_values, load_dotenv\n\nfrom .app import create_app\nfrom"
},
{
"path": "moonshot/integrations/web_api/app.py",
"chars": 3651,
"preview": "import asyncio\nimport logging\nfrom contextlib import asynccontextmanager\nfrom typing import Awaitable, Callable\n\nfrom de"
},
{
"path": "moonshot/integrations/web_api/container.py",
"chars": 5915,
"preview": "import importlib.resources\n\nfrom dependency_injector import containers, providers\n\nfrom .services.attack_module_service "
},
{
"path": "moonshot/integrations/web_api/log/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/web_api/logging_conf.py",
"chars": 3388,
"preview": "import logging\nimport os\nimport sys\nfrom logging.handlers import RotatingFileHandler\nfrom typing import Literal\n\nfrom de"
},
{
"path": "moonshot/integrations/web_api/routes/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/web_api/routes/attack_modules.py",
"chars": 2413,
"preview": "from dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends, HTTPException\n\nfrom ..con"
},
{
"path": "moonshot/integrations/web_api/routes/benchmark.py",
"chars": 4163,
"preview": "from dependency_injector.wiring import Provide, inject\r\nfrom fastapi import APIRouter, Depends, HTTPException\r\n\r\nfrom .."
},
{
"path": "moonshot/integrations/web_api/routes/benchmark_result.py",
"chars": 6352,
"preview": "from dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends, HTTPException\n\nfrom ..con"
},
{
"path": "moonshot/integrations/web_api/routes/bookmark.py",
"chars": 6318,
"preview": "from typing import Optional\n\nfrom dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depen"
},
{
"path": "moonshot/integrations/web_api/routes/context_strategy.py",
"chars": 4822,
"preview": "from dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends, HTTPException\n\nfrom ..con"
},
{
"path": "moonshot/integrations/web_api/routes/cookbook.py",
"chars": 8648,
"preview": "from typing import Optional\n\nfrom dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depen"
},
{
"path": "moonshot/integrations/web_api/routes/dataset.py",
"chars": 8238,
"preview": "import os\nimport tempfile\n\nfrom dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends"
},
{
"path": "moonshot/integrations/web_api/routes/endpoint.py",
"chars": 10715,
"preview": "from typing import Optional\n\nfrom dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depen"
},
{
"path": "moonshot/integrations/web_api/routes/metric.py",
"chars": 2856,
"preview": "from dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends, HTTPException\n\nfrom ..con"
},
{
"path": "moonshot/integrations/web_api/routes/prompt_template.py",
"chars": 4891,
"preview": "from dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends, HTTPException\n\nfrom ..con"
},
{
"path": "moonshot/integrations/web_api/routes/recipe.py",
"chars": 8455,
"preview": "from typing import Optional\n\nfrom dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depen"
},
{
"path": "moonshot/integrations/web_api/routes/redteam.py",
"chars": 24541,
"preview": "import logging\r\n\r\nfrom dependency_injector.wiring import Provide, inject\r\nfrom fastapi import APIRouter, Body, Depends, "
},
{
"path": "moonshot/integrations/web_api/routes/runner.py",
"chars": 8438,
"preview": "from dependency_injector.wiring import Provide, inject\nfrom fastapi import APIRouter, Depends, HTTPException\n\nfrom ..con"
},
{
"path": "moonshot/integrations/web_api/schemas/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/web_api/schemas/benchmark_runner_dto.py",
"chars": 369,
"preview": "from pydantic import BaseModel, ConfigDict, Field\n\n\nclass BenchmarkRunnerDTO(BaseModel):\n model_config = ConfigDict(f"
},
{
"path": "moonshot/integrations/web_api/schemas/bookmark_create_dto.py",
"chars": 374,
"preview": "from typing import Optional\n\nfrom moonshot.src.bookmark.bookmark_arguments import (\n BookmarkArguments as BookmarkPyd"
},
{
"path": "moonshot/integrations/web_api/schemas/cookbook_create_dto.py",
"chars": 829,
"preview": "from typing import Optional\n\nfrom pydantic import Field\n\nfrom moonshot.src.cookbooks.cookbook_arguments import (\n Coo"
},
{
"path": "moonshot/integrations/web_api/schemas/cookbook_response_model.py",
"chars": 332,
"preview": "from typing import Optional\n\nfrom moonshot.src.cookbooks.cookbook_arguments import (\n CookbookArguments as CookbookPy"
},
{
"path": "moonshot/integrations/web_api/schemas/dataset_create_dto.py",
"chars": 907,
"preview": "from typing import Any, Optional\n\nfrom pydantic import Field\n\nfrom moonshot.src.datasets.dataset_arguments import (\n "
},
{
"path": "moonshot/integrations/web_api/schemas/dataset_response_dto.py",
"chars": 171,
"preview": "from pydantic import BaseModel\n\n\nclass DatasetResponseDTO(BaseModel):\n id: str\n name: str\n description: str\n "
},
{
"path": "moonshot/integrations/web_api/schemas/endpoint_create_dto.py",
"chars": 678,
"preview": "from typing import Optional\n\nfrom moonshot.src.connectors_endpoints.connector_endpoint_arguments import (\n ConnectorE"
},
{
"path": "moonshot/integrations/web_api/schemas/endpoint_response_model.py",
"chars": 321,
"preview": "from moonshot.src.connectors_endpoints.connector_endpoint_arguments import (\r\n ConnectorEndpointArguments as Connecto"
},
{
"path": "moonshot/integrations/web_api/schemas/prompt_response_model.py",
"chars": 302,
"preview": "from pydantic import BaseModel, RootModel\n\nfrom ..schemas.session_response_model import ChatRecord\n\n\nclass PromptInfo(Ba"
},
{
"path": "moonshot/integrations/web_api/schemas/prompt_template_response_model.py",
"chars": 195,
"preview": "from pydantic import BaseModel, RootModel\n\n\nclass PromptTemplate(BaseModel):\n name: str\n description: str\n temp"
},
{
"path": "moonshot/integrations/web_api/schemas/recipe_create_dto.py",
"chars": 1118,
"preview": "from typing import Optional\n\nfrom pydantic import Field\n\nfrom moonshot.src.recipes.recipe_arguments import RecipeArgumen"
},
{
"path": "moonshot/integrations/web_api/schemas/recipe_response_model.py",
"chars": 257,
"preview": "from typing import Optional\n\nfrom moonshot.src.recipes.recipe_arguments import RecipeArguments as RecipePydanticModel\n\n\n"
},
{
"path": "moonshot/integrations/web_api/schemas/session_create_dto.py",
"chars": 493,
"preview": "from typing import Optional\n\nfrom pydantic import BaseModel, ConfigDict, Field\n\n\nclass SessionCreateDTO(BaseModel):\n "
},
{
"path": "moonshot/integrations/web_api/schemas/session_prompt_dto.py",
"chars": 218,
"preview": "from pydantic import BaseModel, ConfigDict, Field\n\n\nclass SessionPromptDTO(BaseModel):\n model_config = ConfigDict(fro"
},
{
"path": "moonshot/integrations/web_api/schemas/session_response_model.py",
"chars": 1021,
"preview": "from typing import Dict, List, Optional\n\nfrom pydantic import BaseModel, Field\n\n\nclass ChatRecord(BaseModel):\n conn_i"
},
{
"path": "moonshot/integrations/web_api/services/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "moonshot/integrations/web_api/services/attack_module_service.py",
"chars": 1358,
"preview": "from .... import api as moonshot_api\nfrom .base_service import BaseService\nfrom .utils.exceptions_handler import excepti"
},
{
"path": "moonshot/integrations/web_api/services/auto_red_team_test_manager.py",
"chars": 3113,
"preview": "import asyncio\nimport uuid\nfrom typing import Any\n\nfrom dependency_injector.wiring import inject\n\nfrom moonshot.src.runn"
},
{
"path": "moonshot/integrations/web_api/services/auto_red_team_test_state.py",
"chars": 1952,
"preview": "import asyncio\nfrom typing import Any, TypedDict\n\nfrom moonshot.integrations.web_api.services.base_service import BaseSe"
},
{
"path": "moonshot/integrations/web_api/services/base_service.py",
"chars": 172,
"preview": "import logging\n\n\nclass BaseService:\n def __init__(self) -> None:\n self.logger = logging.getLogger(\n "
},
{
"path": "moonshot/integrations/web_api/services/benchmark_result_service.py",
"chars": 909,
"preview": "from .... import api as moonshot_api\nfrom ..services.base_service import BaseService\nfrom ..services.utils.exceptions_ha"
},
{
"path": "moonshot/integrations/web_api/services/benchmark_test_manager.py",
"chars": 4565,
"preview": "import asyncio\nimport uuid\nimport traceback\nfrom typing import Any\n\nfrom dependency_injector.wiring import inject\n\nfrom "
},
{
"path": "moonshot/integrations/web_api/services/benchmark_test_state.py",
"chars": 1887,
"preview": "import asyncio\nfrom typing import Any, TypedDict\n\nfrom moonshot.integrations.web_api.services.base_service import BaseSe"
},
{
"path": "moonshot/integrations/web_api/services/benchmarking_service.py",
"chars": 1257,
"preview": "from dependency_injector.wiring import inject\r\n\r\nfrom ..schemas.benchmark_runner_dto import BenchmarkRunnerDTO\r\nfrom ..s"
},
{
"path": "moonshot/integrations/web_api/services/bookmark_service.py",
"chars": 3546,
"preview": "from .... import api as moonshot_api\nfrom ..schemas.bookmark_create_dto import BookmarkCreateDTO, BookmarkPydanticModel\n"
},
{
"path": "moonshot/integrations/web_api/services/context_strategy_service.py",
"chars": 681,
"preview": "from .... import api as moonshot_api\nfrom ..services.utils.exceptions_handler import exception_handler\nfrom .base_servic"
},
{
"path": "moonshot/integrations/web_api/services/cookbook_service.py",
"chars": 9044,
"preview": "from moonshot.src.cookbooks.cookbook_arguments import CookbookArguments as Cookbook\nfrom moonshot.src.recipes.recipe_arg"
},
{
"path": "moonshot/integrations/web_api/services/dataset_service.py",
"chars": 2441,
"preview": "from .... import api as moonshot_api\nfrom ..schemas.dataset_create_dto import CSV_Dataset_DTO, HF_Dataset_DTO\nfrom ..sch"
},
{
"path": "moonshot/integrations/web_api/services/endpoint_service.py",
"chars": 2395,
"preview": "from .... import api as moonshot_api\nfrom ..schemas.endpoint_create_dto import EndpointUpdateDTO\nfrom ..schemas.endpoint"
},
{
"path": "moonshot/integrations/web_api/services/metric_service.py",
"chars": 456,
"preview": "from .... import api as moonshot_api\nfrom ..services.base_service import BaseService\nfrom ..services.utils.exceptions_ha"
},
{
"path": "moonshot/integrations/web_api/services/prompt_template_service.py",
"chars": 1226,
"preview": "from typing import Any\n\nfrom .... import api as moonshot_api\nfrom ..services.utils.exceptions_handler import exception_h"
},
{
"path": "moonshot/integrations/web_api/services/recipe_service.py",
"chars": 7539,
"preview": "from moonshot.src.recipes.recipe_arguments import RecipeArguments as Recipe\n\nfrom .... import api as moonshot_api\nfrom ."
},
{
"path": "moonshot/integrations/web_api/services/runner_service.py",
"chars": 4584,
"preview": "from typing import Callable\n\nfrom moonshot.src.runners.runner import Runner\n\nfrom .... import api as moonshot_api\nfrom ."
}
]
// ... and 236 more files (download for full content)
About this extraction
This page contains the full source code of the aiverify-foundation/moonshot GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 436 files (9.6 MB), approximately 2.5M tokens, and a symbol index with 1469 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.