forked from recursiveai/flow_benchmark_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark_agent.py
35 lines (24 loc) · 956 Bytes
/
benchmark_agent.py
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
# Copyright 2024 Recursive AI
from abc import ABC, abstractmethod
from .benchmark import Benchmark
from .benchmark_case import BenchmarkCase, BenchmarkCaseResponse
class BenchmarkAgent(ABC):
"""
Interface used to define the semantic agents.
Agents implementing this interface are able to run semantic benchmarks, i.e.,
benchmarks that take a text query as input and produce a text response as output.
"""
@abstractmethod
async def run_benchmark_case(self, case: BenchmarkCase) -> BenchmarkCaseResponse:
raise NotImplementedError()
async def before_run(self, benchmark: Benchmark) -> None:
pass
async def before_case(self, case: BenchmarkCase) -> None:
pass
async def after_case(self, case: BenchmarkCase) -> None:
pass
async def after_run(self, benchmark: Benchmark) -> None:
pass
@property
def name(self) -> str:
return self.__class__.__name__