Skip to content

hook

Hook

An evaluation hook.

Source code in src/agenteval/hook.py
 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
class Hook:
    """An evaluation hook."""

    def pre_evaluate(test: Test, trace: Trace) -> None:
        """
        Method called before evaluation. Can be used to perform any setup tasks.

        Args:
            test (Test): The test case.
            trace (Trace): Captures steps during evaluation.
        """
        pass

    def post_evaluate(test: Test, test_result: TestResult, trace: Trace) -> None:
        """
        Method called after evaluation. This may be used to perform integration testing
        or clean up tasks.

        Args:
            test (Test): The test case.
            test_result (TestResult): The result of the test, which can be overriden
                by updating the attributes of this object.
            trace (Trace): Captures steps during evaluation.
        """
        pass

post_evaluate(test, test_result, trace)

Method called after evaluation. This may be used to perform integration testing or clean up tasks.

Parameters:

Name Type Description Default
test Test

The test case.

required
test_result TestResult

The result of the test, which can be overriden by updating the attributes of this object.

required
trace Trace

Captures steps during evaluation.

required
Source code in src/agenteval/hook.py
22
23
24
25
26
27
28
29
30
31
32
33
def post_evaluate(test: Test, test_result: TestResult, trace: Trace) -> None:
    """
    Method called after evaluation. This may be used to perform integration testing
    or clean up tasks.

    Args:
        test (Test): The test case.
        test_result (TestResult): The result of the test, which can be overriden
            by updating the attributes of this object.
        trace (Trace): Captures steps during evaluation.
    """
    pass

pre_evaluate(test, trace)

Method called before evaluation. Can be used to perform any setup tasks.

Parameters:

Name Type Description Default
test Test

The test case.

required
trace Trace

Captures steps during evaluation.

required
Source code in src/agenteval/hook.py
12
13
14
15
16
17
18
19
20
def pre_evaluate(test: Test, trace: Trace) -> None:
    """
    Method called before evaluation. Can be used to perform any setup tasks.

    Args:
        test (Test): The test case.
        trace (Trace): Captures steps during evaluation.
    """
    pass