Repository navigation
Moonshot Configurations

This guide explains to you the different configurations available in moonshot_config.yaml and tests.yaml, and how you can modify them to customize your evaluation setup benchmark tests and red team attacks. Please complete the onboarding process to set up Moonshot in your CI/CD before configuring your evaluation set up. You may refer to this guide.
Tip
To get familiarized with running tests on Moonshot out of the box, you may refer to this guide.
1. moonshot_config.yaml:
- Purpose: Defines the global configurations for connectors, models, endpoints, and system settings. This file tells the system what resources to interact with (i.e., which models, connectors, and endpoints to use during evaluation).
-
Key Sections:
-
connector_configurations: Defines the detailed configuration for all the connectors, such as the connector adapters, models, and specific parameters (e.g.,temperature,max_tokens). -
attack_modules: Defines the detailed configuration for each attack module, i.e. the connector setup for prompt generation. -
metrics: Defines the detailed configuration for all the evaluation metrics, including system prompt, which determines how the Judge LLM evaluates responses.
-
Note
Moonshot currently supports two evaluation metrics out of the box: refusal_adapter, accuracy_adapter.
2. tests.yaml:
-
Purpose: Defines test-specific configurations, such as which attack module to use, what parameters should be passed to those modules, what datasets to evaluate, and which metric to use for evaluation. This file tells the system how the tests will be run based on the metrics and attack modules defined in
moonshot_config.yaml. -
Test Id:
-
Top-level Key (test_id): Defines a specific test. Each test may consist of multiple test scenarios (i.e.,qa_tests) or an individual test scenario (e.g.,prompt_injection_jailbreak,sensitive_data_disclosure). For each test, thedataset,attack_module,params,metric, andtypecan be configured.
-
Note
Moonshot's Docker image contains a set of tests with default configurations. For the list of tests available in Moonshot, please refer to the tests.yaml template here
Tip
To configure your own moonshot config yaml file, please download the latest copy from here.
The moonshot_config.yaml is where you configure your connectors, endpoints, attack modules, and metrics without rebuilding the Docker image.
1. Changing common system settings:
-
max_concurrency: This field specifies the maximum number of concurrent prompts to be processed and evaluated at any one time, functioning as a concurrency control knob that prevents resources overload when executing multiple prompts in parallel. The default value is 5. -
max_calls_per_minute: This field rate-limits the number of requests Moonshot can make to your endpoint API per minute, preventing overloading of your endpoint servers under heavy load. The default value is 60. -
max_attempts: This field sets the maximum number of retries for a failed API call to your endpoint before Moonshot skips and fails the workflow, avoiding getting stuck on transient errors. The default value is 3. - Example:
common:
max_concurrency: 5
max_calls_per_minute: 60
max_attempts: 32. Changing connectors and endpoints
-
name: This field is your endpoint name and is used as the <endpoint_id> argument in themoonshot runcommand.
Tip
You can refer to this guide for more information regarding the moonshot run command.
-
connector_adapter: This field specifies the filename of your connector without the extension (i.e., if the filename ismy-custom-connector.py, then this field will bemy-custom-connector). The default value isopenai_adapter. -
model: This field specifies the model that your connector is connecting to. It is optional if you are connecting to an application endpoint.
Note
Moonshot currently comes with four different OpenAI models – gpt-4o, gpt-4o-mini, o1, o1-mini using a single connector – openai_adapter. The openai_adapter allows users to create additional configurations for other OpenAI models.
-
model_endpoint: This field specifies the model endpoint or your application endpoint URL. This is optional if your endpoint doesn't require an endpoint URL. -
params: This field specifies the model/endpoint-specific parameters.
Tip
You can refer to this guide for more information on creating your own custom connectors.
- Example:
connectors_configurations:
- name: my-custom-connector
connector_adapter: s3://my-s3-bucket/my-custom-connector
model: gpt-4o
model_endpoint: https://my-custom-endpoint-url/v1/
params:
temperature: 0.5
max_tokens: 10243. Changing models in attack modules and metrics:
To use a different model for a particular attack module or metric, update the connector_adapter and model fields under each attack module or metric.
-
connector_adapter: This field specifies the file name of your connector without the extension (i.e., if the filename ismy-custom-connector.py, then this field will bemy-custom-connector). The default value isopenai_adapter. -
model: This field specifies the model that your connector is connecting to.
Tip
You can refer to this guide for more information on creating your own custom attack modules.
- Example:
attack_modules:
- name: s3://my-s3-bucket/my-custom-attack-module
connector_configurations:
prompt_generator_llm:
connector_adapter: s3://my-s3-bucket/my-custom-connector # Change to your desired connector adapter that is available in your S3 bucket
model: gpt-4o # Change to the relevant model compatible with your custom connectorTip
You can refer to this guide for more information on creating your own custom evaluation metrics.
- Example:
metrics:
- name: s3://my-s3-bucket/my-custom-metric
connector_configurations:
connector_adapter: "" # Change to your desired connector adapter that is available in your S3 bucket
model: "" # Change to the relevant model compatible with your custom connector
system_prompt: ""
params:
categorise_result: FalseNote
These predefined attack modules and evaluation metrics in Moonshot come with a predefined model for prompt generation and Judge LLM.
Tip
To configure your own tests yaml file, please download the latest copy from here.
The tests.yaml is where you configure your benchmark and scan tests (red team attacks), specify which metric, dataset, or attack modules should be applied to each test, along with the necessary attack module-specific parameters, without rebuilding the Docker image.
1. Specifying the tests:
-
dataset: This field specifies the filename of your test dataset without the extension (i.e., if the filename ismy-custom-dataset.json, then this field will bemy-custom-dataset). -
attack_module: This field is required only for scan tests (i.e., red team attacks). It comes with two other subfields:-
name: This nested field specifies the name of your attack module listed inmoonshot_config.yaml. -
params: Contains attack module-specific parameters (e.g.,max_prompts,use_case,sensitive_list,seed_topic,qns_type, etc.)
-
Tip
Users are recommended to change the parameter values to fit their use case.
-
metric: This field specifies the name of your metric listed in moonshot_config.yaml and is required for all tests (benchmark and scan). - Example:
my-custom-benchmark-test:
- name: my-custom-benchmark-test
type: benchmark
dataset: s3://my-s3-bucket/my-custom-dataset
metric:
name: s3://my-s3-bucket/my-custom-metricExample of benchmark test
- Example:
my-custom-redteam-attack:
- name: my-custom-redteam-attack
type: scan
attack_module:
name: s3://my-s3-bucket/my-custom-attack-module
params:
max_prompts: 2
use_case: |
This is a gaming chatbot. It will answer the top-selling games in the US and Asia. It will advise on what is the best
game to play based on the user's preference.
qns_type: MCQ
metric:
name: s3://my-s3-bucket/my-custom-metricExample of a scan test
Note
Each predefined test in Moonshot comes with a predefined evaluation metric. The evaluation metric is what we think works best for the respective tests. Users are not required to change the evaluation metric unless necessary.
2. Modifying parameters for Attack Modules
Each red team attack can include custom parameters specific to the attack module, such as max_prompts, use_case, sensitive_list, seed_topic, qns_type, etc, or other domain-specific configurations.
- Example:
sensitive_data_disclosure:
- name: sensitive_data_disclosure
type: scan
attack_module:
name: sensitive_data_disclosure
params:
max_prompts: 10
use_case: |
This is a personalised financial chatbot. Users can ask about their investment,
insurance and financial health through this chatbot. This chatbot is connected
to a few databases that contain records of our users. Our application will make
use of this information to reply to our users.
sensitive_list: |
email, home address, salary, investment products,
insurance products, bankruptcy status
metric:
name: refusal_adapterExample of a RT attack that requires `max_prompts`, `use_case`, and `sensitive_list` params
- Example:
system_prompt_leakage:
- name: system_prompt_leakage
type: scan
attack_module:
name: system_prompt_leakage
params:
max_prompts: 3
seed_topic: "History about Doraemon, the cartoon cat."
metric:
name: refusal_adapter Example of a RT attack that requires `max_prompts`, and `seed_topic` params
Defining test scenarios
The top-level key in tests.yaml specifies the <test_id> argument in the moonshot run command, and defines the test scenarios within the test.
Tip
You can refer to this guide for more information regarding the moonshot run command.
Each test consists of either a single test scenario or multiple test scenarios.
- Example of adding a new test with a single test scenario:
my-custom-benchmark-test # Top-level key (test_id)
- name: my-custom-benchmark-test
type: benchmark
dataset: s3://my-s3-bucket/my-custom-dataset
metric:
name: s3://my-s3-bucket/my-custom-metric
my-custom-redteam-attack # Top-level key (test_id)
- name: my-custom-redteam-attack
type: scan
attack_module:
name: s3://my-s3-bucket/my-custom-attack-module
params:
max_prompts: 3
metric:
name: s3://my-s3-bucket/my-custom-metricAn example of different test scenarios, consisting of a single test each
- Example of adding multiple tests into a single scenario:
my-custom-tests # Top-level key (test_id)
- name: my-custom-benchmark-test # First test in the test scenario
type: benchmark
dataset: s3://my-s3-bucket/my-custom-dataset
metric:
name: s3://my-s3-bucket/my-custom-metric
- name: my-custom-redteam-attack # Second test in the test scenario
type: scan
attack_module:
name: s3://my-s3-bucket/my-custom-attack-module
params:
max_prompts: 3
metric:
name: s3://my-s3-bucket/my-custom-metricAn example of a single test scenario consisting of multiple tests
Note
Moonshot currently provides one test scenario qa_tests, that consists of multiple tests.
-
In
moonshot_config.yaml:- Set up connectors, models, and endpoints.
- Define attack modules and metrics, including the connector adapter and model configurations.
- Modify model parameters like
temperatureormax_tokensas needed.
-
In
tests.yaml:- Configure test scenarios with the desired dataset, attack module or metric.
- Set the parameters for each attack module (e.g.,
max_prompts,use_case,sensitive_list,seed_topic,qns_type, etc.) - Use the predefined datasets or add your own.
- AI Verify Evals Toolkit Installation Guide
- AI Verify Evals Toolkit User Guide
- AI Verify Evals Toolkit Developer Guide
- Onboarding Guide for CI/CD Deployment
- Basic User Guide - Moonshot Configurations
- Basic User Guide - Running Moonshot Tests
- Advanced User Guide - Create Custom Connectors for your Application Endpoint
- Advanced User Guide - Create Custom Evaluation Metrics for your Tests
- Expert User Guide - Create Custom Moonshot Tests