File size: 1,798 Bytes
c2ea5ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Perturbation Testing and Robustness Evaluation

This module handles the fourth stage of the agent monitoring pipeline:
- Testing knowledge graph robustness and reliability
- Applying various perturbation techniques (jailbreak, counterfactual bias, etc.)
- Evaluating system resistance to different types of attacks
- Generating comprehensive test reports

Architecture:
- Pure functions (recommended): Work with data dictionaries, no database dependencies
- Legacy classes (deprecated): Have database dependencies, kept for backward compatibility

Usage:
    # Pure functions (recommended)
    from agentgraph.testing import run_knowledge_graph_tests
    from agentgraph.testing import run_jailbreak_tests, run_counterfactual_bias_tests
    
    # Legacy classes (deprecated - use backend services instead)
    from agentgraph.testing import KnowledgeGraphTester
"""

# Pure functions (recommended for new code)
from .knowledge_graph_tester import run_knowledge_graph_tests, load_litellm_config

# Import pure functions from perturbation types
from .perturbation_types.jailbreak import run_jailbreak_tests, test_relation_jailbreak, load_jailbreak_techniques
from .perturbation_types.counterfactual_bias import run_counterfactual_bias_tests, test_relation_counterfactual_bias

# Import pure utility functions
from .perturbation_types.base import (
    load_techniques_from_file, validate_testing_data, prepare_testing_data
)

__all__ = [
    # Pure functions (recommended)
    'run_knowledge_graph_tests',
    'load_litellm_config', 
    'run_jailbreak_tests',
    'test_relation_jailbreak',
    'load_jailbreak_techniques',
    'run_counterfactual_bias_tests',
    'test_relation_counterfactual_bias',
    'load_techniques_from_file',
    'validate_testing_data',
    'prepare_testing_data',
]