-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtypes.py
More file actions
53 lines (43 loc) · 1.78 KB
/
types.py
File metadata and controls
53 lines (43 loc) · 1.78 KB
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
48
49
50
51
52
53
"""
Parameter types
"""
import asyncio
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Literal, Optional
from eval_protocol.dataset_logger import default_logger
from eval_protocol.dataset_logger.dataset_logger import DatasetLogger
from ..models import CompletionParams, EvaluationRow, Message
from .exception_config import ExceptionHandlerConfig
ModelParam = str # gpt-4o, gpt-4o-mini, accounts/fireworks/models/llama-3.1-8b-instruct
DatasetPathParam = str
InputMessagesParam = List[Message]
EvaluationInputParam = Dict[str, Any]
RolloutProcessorInputParam = Dict[str, Any]
Dataset = List[EvaluationRow]
EvaluationTestMode = Literal["pointwise", "groupwise", "all"]
"""
"pointwise": (default) applies test function to each row (rollout result).
"groupwise": applies test function to a group of rollout results from the same original row (for use cases such as dpo/grpo).
"all": applies test function to the whole dataset.
"""
"""
Test function types
"""
TestFunction = Callable
"""
Rollout processor types
"""
@dataclass
class RolloutProcessorConfig:
completion_params: CompletionParams # input parameters for inference
mcp_config_path: str
server_script_path: Optional[str] = (
None # TODO: change from server_script_path to mcp_config_path for agent rollout processor
)
max_concurrent_rollouts: int = 8 # maximum number of concurrent rollouts
steps: int = 30 # max number of rollout steps
logger: DatasetLogger = default_logger # logger to use during rollout for mid-rollout logs
kwargs: Dict[str, Any] = field(default_factory=dict) # any additional kwargs to pass to the rollout processor
exception_handler_config: Optional[ExceptionHandlerConfig] = (
None # configuration for exception handling with backoff
)