Skip to content

target

BaseTarget

Bases: ABC

The BaseTarget abstract base class defines the common interface for target classes.

Source code in src/agenteval/targets/base_target.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class BaseTarget(ABC):
    """The `BaseTarget` abstract base class defines the common interface for target
    classes.
    """

    @abstractmethod
    def invoke(self, prompt: str) -> TargetResponse:
        """Invoke the target with a prompt and return a response as a string.

        Args:
            prompt: The prompt string to pass to the target.

        Returns:
            A TargetResponse object containing the target's response string and
            any trace data (if applicable).
        """
        pass

invoke(prompt) abstractmethod

Invoke the target with a prompt and return a response as a string.

Parameters:

Name Type Description Default
prompt str

The prompt string to pass to the target.

required

Returns:

Type Description
TargetResponse

A TargetResponse object containing the target's response string and

TargetResponse

any trace data (if applicable).

Source code in src/agenteval/targets/base_target.py
16
17
18
19
20
21
22
23
24
25
26
27
@abstractmethod
def invoke(self, prompt: str) -> TargetResponse:
    """Invoke the target with a prompt and return a response as a string.

    Args:
        prompt: The prompt string to pass to the target.

    Returns:
        A TargetResponse object containing the target's response string and
        any trace data (if applicable).
    """
    pass