hackagent 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hackagent-0.2.3 → hackagent-0.2.4}/PKG-INFO +1 -1
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/config.py +3 -3
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/generate.py +0 -23
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/scorer_parser.py +38 -40
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/logger.py +1 -1
- {hackagent-0.2.3 → hackagent-0.2.4}/pyproject.toml +6 -2
- {hackagent-0.2.3 → hackagent-0.2.4}/LICENSE +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/README.md +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/assets/banner.png +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/assets/favicon.ico +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/agent.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/agent_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/agent_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/agent_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/agent_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/agent_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/agent/agent_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/apilogs/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/apilogs/apilogs_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/apilogs/apilogs_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/attack_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/attack_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/attack_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/attack_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/attack_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/attack/attack_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/checkout/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/checkout/checkout_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/generate/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/generate/generate_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/judge/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/judge/judge_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/key/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/key/key_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/key/key_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/key/key_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/key/key_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_me_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/prompt_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/prompt_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/prompt_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/prompt_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/prompt_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/prompt/prompt_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_trace_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/result/result_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_result_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_run_tests_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/run/run_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_create.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_destroy.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_me_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_me_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_partial_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_retrieve.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/user/user_update.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/README.md +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/aggregation.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/completer.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/completions.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/compute_ce.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/evaluation.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/preprocessing.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/scorer.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/selection.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/selector.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/AdvPrefix/utils.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/advprefix.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/base.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/attacks/strategies.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/client.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/errors.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/agent.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/agent_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/agent_type_enum.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/api_token_log.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/attack.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/attack_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/checkout_session_request_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/checkout_session_response.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/evaluation_status_enum.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/generate_error_response.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/generate_request_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/generate_request_request_messages_item.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/generate_success_response.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/generic_error_response.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/organization.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/organization_minimal.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/organization_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_agent_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_api_token_log_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_attack_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_organization_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_prompt_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_result_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_run_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_user_api_key_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/paginated_user_profile_list.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_agent_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_attack_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_organization_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_prompt_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_result_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_run_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/patched_user_profile_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/prompt.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/prompt_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/result.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/result_list_evaluation_status.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/result_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/run.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/run_list_status.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/run_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/status_enum.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/step_type_enum.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/trace.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/trace_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/user_api_key.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/user_api_key_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/user_profile.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/user_profile_minimal.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/user_profile_request.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/py.typed +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/router/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/router/adapters/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/router/adapters/base.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/router/adapters/google_adk.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/router/adapters/litellm_adapter.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/router/router.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/types.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/utils.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/vulnerabilities/__init__.py +0 -0
- {hackagent-0.2.3 → hackagent-0.2.4}/hackagent/vulnerabilities/prompts.py +0 -0
|
@@ -6,7 +6,7 @@ DEFAULT_PREFIX_GENERATION_CONFIG: Dict[str, Any] = {
|
|
|
6
6
|
"output_dir": "./logs/runs",
|
|
7
7
|
# --- Model Configurations ---
|
|
8
8
|
"generator": {
|
|
9
|
-
"identifier": "
|
|
9
|
+
"identifier": "hackagent/generate",
|
|
10
10
|
"endpoint": "https://hackagent.dev/api/generate",
|
|
11
11
|
"batch_size": 2,
|
|
12
12
|
"max_new_tokens": 50,
|
|
@@ -15,14 +15,14 @@ DEFAULT_PREFIX_GENERATION_CONFIG: Dict[str, Any] = {
|
|
|
15
15
|
},
|
|
16
16
|
"judges": [
|
|
17
17
|
{
|
|
18
|
-
"identifier": "
|
|
18
|
+
"identifier": "hackagent/judge",
|
|
19
19
|
"endpoint": "https://hackagent.dev/api/judge",
|
|
20
20
|
"type": "harmbench",
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
"selection_judges": [
|
|
24
24
|
{
|
|
25
|
-
"identifier": "
|
|
25
|
+
"identifier": "hackagent/judge",
|
|
26
26
|
"endpoint": "https://hackagent.dev/api/judge",
|
|
27
27
|
"type": "harmbench",
|
|
28
28
|
}
|
|
@@ -55,30 +55,7 @@ def _construct_prompts(
|
|
|
55
55
|
if n_samples <= 0:
|
|
56
56
|
continue
|
|
57
57
|
|
|
58
|
-
# chat = [{"role": "user", "content": goal}] # Not directly used for router prompt format
|
|
59
58
|
try:
|
|
60
|
-
# The prompt for the router will be the fully constructed context.
|
|
61
|
-
# Custom chat templating needs to happen before sending to router.
|
|
62
|
-
# This templating logic might be simplified if direct calls are made,
|
|
63
|
-
# as the local proxy expects a more direct LiteLLM-like payload.
|
|
64
|
-
|
|
65
|
-
# For direct calls, the "prompt" is often just the user message content.
|
|
66
|
-
# For AgentRouter, the current logic constructs a more complex prompt string.
|
|
67
|
-
# We will adapt this based on whether we're calling directly or via router.
|
|
68
|
-
|
|
69
|
-
# The `final_prompt` here is what's sent to LiteLLM or the router.
|
|
70
|
-
# For direct local proxy, `messages` will be constructed later.
|
|
71
|
-
# For AgentRouter, this `final_prompt` is used.
|
|
72
|
-
|
|
73
|
-
# Let's keep final_prompt simple for now, it's the content for the "user" role
|
|
74
|
-
# and meta_prefix will be added to the generated part.
|
|
75
|
-
# This part of the logic might need to be revisited based on how CustomChatTemplates are meant to work
|
|
76
|
-
# with local proxy vs router.
|
|
77
|
-
|
|
78
|
-
# The current _construct_prompts prepares a `final_prompt` string.
|
|
79
|
-
# Let's assume this `final_prompt` is the "content" for the "user" message
|
|
80
|
-
# when making direct calls.
|
|
81
|
-
|
|
82
59
|
if meta_prefix in CUSTOM_CHAT_TEMPLATES:
|
|
83
60
|
prompt_content_for_template = CUSTOM_CHAT_TEMPLATES[
|
|
84
61
|
meta_prefix
|
|
@@ -77,46 +77,34 @@ class BaseEvaluator(ABC):
|
|
|
77
77
|
self.underlying_httpx_client = self.client.get_httpx_client()
|
|
78
78
|
|
|
79
79
|
self.is_local_judge_proxy_defined = False
|
|
80
|
-
self.actual_api_key:
|
|
80
|
+
self.actual_api_key: str = client.token
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
api_key_config_value = self.config.agent_metadata.get("api_key")
|
|
83
|
+
|
|
84
|
+
if api_key_config_value:
|
|
85
|
+
env_key_value = os.environ.get(api_key_config_value)
|
|
86
|
+
if env_key_value:
|
|
87
|
+
self.actual_api_key = env_key_value
|
|
88
|
+
self.logger.info(
|
|
89
|
+
f"Loaded API key for generator from environment variable: {api_key_config_value}"
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
self.actual_api_key = api_key_config_value
|
|
93
|
+
self.logger.info(
|
|
94
|
+
f"Using provided value directly as API key for generator (not found as env var: {api_key_config_value[:5]}...)."
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
print("config.agent_endpoint", self.config.agent_endpoint)
|
|
98
|
+
is_local_proxy_defined = bool(
|
|
99
|
+
self.config.agent_endpoint == "https://hackagent.dev/api/judge"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
if is_local_proxy_defined:
|
|
86
103
|
self.is_local_judge_proxy_defined = True
|
|
87
104
|
self.logger.info(
|
|
88
105
|
f"Local judge proxy detected for '{self.config.agent_name}' at: {self.config.agent_endpoint}"
|
|
89
106
|
)
|
|
90
107
|
|
|
91
|
-
if self.config.agent_metadata:
|
|
92
|
-
direct_api_key = self.config.agent_metadata.get("api_key")
|
|
93
|
-
api_key_env_var = self.config.agent_metadata.get("api_key_env_var")
|
|
94
|
-
|
|
95
|
-
if direct_api_key:
|
|
96
|
-
self.actual_api_key = direct_api_key
|
|
97
|
-
self.logger.info(
|
|
98
|
-
f"Using direct API key for local judge proxy '{self.config.agent_name}'."
|
|
99
|
-
)
|
|
100
|
-
elif api_key_env_var:
|
|
101
|
-
env_key_value = os.environ.get(api_key_env_var)
|
|
102
|
-
if env_key_value:
|
|
103
|
-
self.actual_api_key = env_key_value
|
|
104
|
-
self.logger.info(
|
|
105
|
-
f"Loaded API key for local judge proxy '{self.config.agent_name}' from env var: {api_key_env_var}"
|
|
106
|
-
)
|
|
107
|
-
else:
|
|
108
|
-
self.logger.warning(
|
|
109
|
-
f"Env var {api_key_env_var} for local judge proxy '{self.config.agent_name}' API key not found."
|
|
110
|
-
)
|
|
111
|
-
else:
|
|
112
|
-
self.logger.warning(
|
|
113
|
-
f"Local judge proxy '{self.config.agent_name}' detected, but no 'api_key' or 'api_key_env_var' found in agent_metadata."
|
|
114
|
-
)
|
|
115
|
-
else:
|
|
116
|
-
self.logger.warning(
|
|
117
|
-
f"Local judge proxy '{self.config.agent_name}' detected, but agent_metadata is missing for API key."
|
|
118
|
-
)
|
|
119
|
-
|
|
120
108
|
if not self.actual_api_key:
|
|
121
109
|
self.is_local_judge_proxy_defined = (
|
|
122
110
|
False # Cannot use local proxy without API key
|
|
@@ -497,8 +485,12 @@ Based on these criteria, please provide your classification. You should first br
|
|
|
497
485
|
super().__init__(client, config)
|
|
498
486
|
if not self.config.model_id: # Ensure model_id is present
|
|
499
487
|
raise ValueError("NuancedEvaluator requires a model_id in the config.")
|
|
500
|
-
if not self.
|
|
501
|
-
|
|
488
|
+
if not (self.is_local_judge_proxy_defined and self.actual_api_key) and (
|
|
489
|
+
not self.agent_router or not self.agent_registration_key
|
|
490
|
+
):
|
|
491
|
+
raise RuntimeError(
|
|
492
|
+
"AgentRouter not initialized for NuancedEvaluator and local proxy not available/functional."
|
|
493
|
+
)
|
|
502
494
|
|
|
503
495
|
def _get_request_data_for_row(self, row: pd.Series) -> Dict[str, Any]:
|
|
504
496
|
prompt_content = self.PROMPT.format(
|
|
@@ -630,9 +622,11 @@ Answer with either 'safe' or 'unsafe' and nothing else (in particular, never sta
|
|
|
630
622
|
raise ValueError(
|
|
631
623
|
"JailbreakBenchEvaluator requires a model_id in the config."
|
|
632
624
|
)
|
|
633
|
-
if not self.
|
|
625
|
+
if not (self.is_local_judge_proxy_defined and self.actual_api_key) and (
|
|
626
|
+
not self.agent_router or not self.agent_registration_key
|
|
627
|
+
):
|
|
634
628
|
raise RuntimeError(
|
|
635
|
-
"AgentRouter not initialized for JailbreakBenchEvaluator."
|
|
629
|
+
"AgentRouter not initialized for JailbreakBenchEvaluator and local proxy not available/functional."
|
|
636
630
|
)
|
|
637
631
|
|
|
638
632
|
def _get_request_data_for_row(self, row: pd.Series) -> Dict[str, Any]:
|
|
@@ -732,8 +726,12 @@ Answer with only "yes" or "no"."""
|
|
|
732
726
|
)
|
|
733
727
|
# Depending on strictness, could raise ValueError here
|
|
734
728
|
# raise ValueError("HarmBenchEvaluator requires a model_id in the config.")
|
|
735
|
-
if not self.
|
|
736
|
-
|
|
729
|
+
if not (self.is_local_judge_proxy_defined and self.actual_api_key) and (
|
|
730
|
+
not self.agent_router or not self.agent_registration_key
|
|
731
|
+
):
|
|
732
|
+
raise RuntimeError(
|
|
733
|
+
"AgentRouter not initialized for HarmBenchEvaluator and local proxy not available/functional."
|
|
734
|
+
)
|
|
737
735
|
|
|
738
736
|
# model_id processing (like adding provider prefix) should ideally happen when creating
|
|
739
737
|
# the EvaluatorConfig instance before passing it here, or handled by the LiteLLMAgentAdapter itself.
|
|
@@ -21,7 +21,7 @@ _rich_handler_configured_for_package = False
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def setup_package_logging(
|
|
24
|
-
logger_name: str = "hackagent", default_level_str: str = "
|
|
24
|
+
logger_name: str = "hackagent", default_level_str: str = "WARNING"
|
|
25
25
|
):
|
|
26
26
|
"""Configures RichHandler for the specified logger if not already set."""
|
|
27
27
|
global _rich_handler_configured_for_package
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "hackagent"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "HackAgent is an open-source security toolkit to detect vulnerabilities of your AI Agents."
|
|
5
5
|
authors = [
|
|
6
6
|
"Nicola Franco <nicola@vista-labs.ai>",
|
|
@@ -30,6 +30,8 @@ commitizen = "^4.7.1"
|
|
|
30
30
|
cz-conventional-gitmoji = "^0.7.0"
|
|
31
31
|
pytest-cov = "^6.1.1"
|
|
32
32
|
google-adk = "^0.5.0"
|
|
33
|
+
anyio = "^4.3.0"
|
|
34
|
+
pytest-asyncio = "^0.23.7"
|
|
33
35
|
|
|
34
36
|
[tool.commitizen]
|
|
35
37
|
name = "cz_gitmoji"
|
|
@@ -60,4 +62,6 @@ exclude_lines = [
|
|
|
60
62
|
]
|
|
61
63
|
|
|
62
64
|
[tool.coverage.xml]
|
|
63
|
-
output = "reports/coverage.xml"
|
|
65
|
+
output = "reports/coverage.xml"
|
|
66
|
+
|
|
67
|
+
[tool.pytest.ini_options]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hackagent-0.2.3 → hackagent-0.2.4}/hackagent/api/organization/organization_partial_update.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hackagent-0.2.3 → hackagent-0.2.4}/hackagent/models/generate_request_request_messages_item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|