(self,
id: str,
worker_description: str,
get_state_fn: Callable,
action_space: List[Function],
instruction: Optional[str] = "",
)
| 17 | |
| 18 | class WorkerConfig: |
| 19 | def __init__(self, |
| 20 | id: str, |
| 21 | worker_description: str, |
| 22 | get_state_fn: Callable, |
| 23 | action_space: List[Function], |
| 24 | instruction: Optional[str] = "", |
| 25 | ): |
| 26 | |
| 27 | self.id = id # id or name of the worker |
| 28 | # worker description for the TASK GENERATOR (to give appropriate tasks) [NOT FOR THE WORKER ITSELF - WORKER WILL STILL USE AGENT DESCRIPTION] |
| 29 | self.worker_description = worker_description |
| 30 | self.instruction = instruction |
| 31 | self.get_state_fn = get_state_fn |
| 32 | self.action_space = action_space |
| 33 | |
| 34 | # setup get state function with the instructions |
| 35 | self.get_state_fn = lambda function_result, current_state: { |
| 36 | "instructions": self.instruction, # instructions are set up in the state |
| 37 | # places the rest of the output of the get_state_fn in the state |
| 38 | **get_state_fn(function_result, current_state), |
| 39 | } |
| 40 | |
| 41 | self.action_space: Dict[str, Function] = { |
| 42 | f.get_function_def()["fn_name"]: f for f in action_space |
| 43 | } |
| 44 | |
| 45 | |
| 46 | class Agent: |
nothing calls this directly
no test coverage detected