Skip to content

Commit 388653f

Browse files
authored
fixed type hinting for better documentation (#35)
* fixed type hinting for better documentation
1 parent 46c8215 commit 388653f

13 files changed

Lines changed: 36 additions & 34 deletions

File tree

docs/getting-started/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Anyone! We had a few groups in mind when building MASEval.
1212

1313
1. Check this documentation.
1414
2. If the feature does not exist, please [open an issue on GitHub](https://github.com/parameterlab/MASEval/issues/new). Feature requests are welcome.
15-
3. Consider implementing it yourself. Check out the [contributing guide](contributing.md) for details.
15+
3. Consider implementing it yourself. Check out the [contributing guide](https://github.com/parameterlab/MASEval/blob/main/CONTRIBUTING.md) for details.
1616

1717
## Q: Can I only test multi-agent systems?
1818

maseval/benchmark/gaia2/gaia2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(
124124
fail_on_evaluation_error: bool = False,
125125
progress_bar: bool | str = True,
126126
seed: Optional[int] = None,
127-
seed_generator=None,
127+
seed_generator: Optional[SeedGenerator] = None,
128128
):
129129
"""Initialize benchmark with Gaia2-specific defaults.
130130

maseval/benchmark/macs/macs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def get_model_adapter(self, model_id, **kwargs):
6565
)
6666
from maseval.core.config import ConfigurableMixin
6767
from maseval.core.tracing import TraceableMixin
68+
from maseval.core.seeding import DefaultSeedGenerator
6869

6970

7071
# Statuses where agent is accountable (included in scoring)
@@ -147,7 +148,7 @@ def _schema_to_inputs(schema: Dict[str, Any]) -> Dict[str, Any]:
147148
}
148149
return inputs
149150

150-
def __call__(self, **kwargs) -> str:
151+
def __call__(self, **kwargs: Any) -> str:
151152
"""Execute the tool with simulated response.
152153
153154
Args:
@@ -828,7 +829,7 @@ def setup_user( # type: ignore[invalid-method-override]
828829
agent_data: Dict[str, Any],
829830
environment: MACSEnvironment,
830831
task: Task,
831-
seed_generator,
832+
seed_generator: DefaultSeedGenerator,
832833
) -> MACSUser:
833834
"""Create MACS user simulator.
834835
@@ -872,7 +873,7 @@ def setup_agents( # type: ignore[invalid-method-override]
872873
environment: MACSEnvironment,
873874
task: Task,
874875
user: Optional[User],
875-
seed_generator,
876+
seed_generator: DefaultSeedGenerator,
876877
) -> Tuple[Sequence[AgentAdapter], Dict[str, AgentAdapter]]:
877878
"""Create agents for this task. Must be implemented by subclass.
878879

maseval/benchmark/multiagentbench/multiagentbench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __init__(
9595
fail_on_evaluation_error: bool = False,
9696
progress_bar: bool | str = True,
9797
seed: Optional[int] = None,
98-
seed_generator=None,
98+
seed_generator: Optional[SeedGenerator] = None,
9999
):
100100
"""Initialize the benchmark.
101101

maseval/benchmark/tau2/tau2.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def get_model_adapter(self, model_id, **kwargs):
6868
from maseval import AgentAdapter, Benchmark, Evaluator, ModelAdapter, Task, User
6969
from maseval.core.user import AgenticLLMUser
7070
from maseval.core.callback import BenchmarkCallback
71+
from maseval.core.seeding import DefaultSeedGenerator, SeedGenerator
7172

7273
from maseval.benchmark.tau2.environment import Tau2Environment
7374
from maseval.benchmark.tau2.evaluator import Tau2Evaluator
@@ -252,7 +253,7 @@ def __init__(
252253
fail_on_evaluation_error: bool = False,
253254
progress_bar: bool | str = True,
254255
seed: Optional[int] = None,
255-
seed_generator=None,
256+
seed_generator: Optional[SeedGenerator] = None,
256257
):
257258
"""Initialize benchmark with tau2-specific defaults.
258259
@@ -328,7 +329,7 @@ def setup_user( # type: ignore[override]
328329
agent_data: Dict[str, Any],
329330
environment: Tau2Environment,
330331
task: Task,
331-
seed_generator,
332+
seed_generator: DefaultSeedGenerator,
332333
) -> Optional[User]:
333334
"""Create Tau2 user simulator.
334335
@@ -964,7 +965,7 @@ def setup_agents( # type: ignore[invalid-method-override]
964965
environment: Tau2Environment,
965966
task: Task,
966967
user: Optional[User],
967-
seed_generator,
968+
seed_generator: DefaultSeedGenerator,
968969
) -> Tuple[Sequence[AgentAdapter], Dict[str, AgentAdapter]]:
969970
"""Create the default tau2 agent.
970971

maseval/core/benchmark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def setup_evaluators(self, environment, task, agents, user, seed_generator):
740740
pass
741741

742742
@abstractmethod
743-
def get_model_adapter(self, model_id: str, **kwargs) -> ModelAdapter:
743+
def get_model_adapter(self, model_id: str, **kwargs: Any) -> ModelAdapter:
744744
"""Provide a ModelAdapter for benchmark components that require LLM access.
745745
746746
Many benchmark components beyond the agents themselves require access to language
@@ -772,7 +772,7 @@ def get_model_adapter(self, model_id: str, **kwargs) -> ModelAdapter:
772772
For proper tracing, register the adapter after creation using the kwargs:
773773
774774
```python
775-
def get_model_adapter(self, model_id: str, **kwargs) -> ModelAdapter:
775+
def get_model_adapter(self, model_id: str, **kwargs: Any) -> ModelAdapter:
776776
adapter = GoogleGenAIModelAdapter(self.client, model_id=model_id)
777777
778778
# Register for tracing if registration info provided

maseval/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def gather_config(self) -> Dict[str, Any]:
5757
task execution completes. The `gather_config()` method is called sequentially
5858
and should return static configuration data (not runtime state).
5959
60-
Attributes:
60+
Note:
6161
Components should expose their configuration through instance variables or
6262
properties that can be accessed during configuration gathering.
6363
"""

maseval/core/tracing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def gather_traces(self) -> Dict[str, Any]:
6767
traces during concurrent execution, but the `gather_traces()` method
6868
itself is called sequentially.
6969
70-
Attributes:
71-
Components can store traces in any internal data structure. Common patterns:
72-
- `self.logs = []` for invocation histories
73-
- `self._messages = MessageHistory()` for conversations
74-
- `self.logs = []` for simulator attempts
70+
Note:
71+
Components can store traces in any internal data structure. Common patterns
72+
include `self.logs = []` for invocation histories,
73+
`self._messages = MessageHistory()` for conversations,
74+
and `self.logs = []` for simulator attempts.
7575
"""
7676

7777
def gather_traces(self) -> Dict[str, Any]:

maseval/core/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .simulator import UserLLMSimulator, AgenticUserLLMSimulator
33
from .tracing import TraceableMixin
44
from .config import ConfigurableMixin
5-
from typing import Dict, Any, Optional, List, Callable
5+
from typing import Any, Dict, Optional, List, Callable
66
from abc import ABC, abstractmethod
77
from datetime import datetime
88
from enum import Enum
@@ -455,7 +455,7 @@ def __init__(
455455
scenario: str,
456456
tools: Optional[Dict[str, Callable]] = None,
457457
max_internal_steps: int = 5,
458-
**kwargs,
458+
**kwargs: Any,
459459
):
460460
"""Initialize AgenticLLMUser.
461461

maseval/interface/agents/camel.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class CamelAgentAdapter(AgentAdapter):
171171
camel-ai to be installed: `pip install maseval[camel]`
172172
"""
173173

174-
def __init__(self, agent_instance, name: str, callbacks=None):
174+
def __init__(self, agent_instance: Any, name: str, callbacks: Optional[List[Any]] = None):
175175
"""Initialize the CAMEL adapter.
176176
177177
Note: We don't call super().__init__() to avoid initializing self.logs as a list,
@@ -619,7 +619,7 @@ class CamelLLMUser(LLMUser):
619619
```
620620
"""
621621

622-
def get_tool(self):
622+
def get_tool(self) -> Any:
623623
"""Get a CAMEL-compatible tool for user interaction.
624624
625625
Returns a CAMEL FunctionTool that wraps the respond method,
@@ -687,7 +687,7 @@ class CamelAgentUser(User):
687687

688688
def __init__(
689689
self,
690-
user_agent,
690+
user_agent: Any,
691691
initial_query: str,
692692
name: str = "camel_agent_user",
693693
max_turns: int = 10,
@@ -775,7 +775,7 @@ def is_done(self) -> bool:
775775
"""
776776
return self._turn_count >= self._max_turns
777777

778-
def get_tool(self):
778+
def get_tool(self) -> Any:
779779
"""Return a CAMEL FunctionTool for agent-to-user interaction.
780780
781781
Returns:
@@ -833,8 +833,8 @@ def gather_config(self) -> Dict[str, Any]:
833833

834834

835835
def camel_role_playing_execution_loop(
836-
role_playing,
837-
task,
836+
role_playing: Any,
837+
task: Any,
838838
max_steps: int = 10,
839839
tracer: Optional["CamelRolePlayingTracer"] = None,
840840
) -> Any:
@@ -959,7 +959,7 @@ def execution_loop(self, agents, task, environment, user):
959959
```
960960
"""
961961

962-
def __init__(self, role_playing, name: str = "role_playing"):
962+
def __init__(self, role_playing: Any, name: str = "role_playing"):
963963
"""Initialize the RolePlaying tracer.
964964
965965
Args:
@@ -973,7 +973,7 @@ def __init__(self, role_playing, name: str = "role_playing"):
973973
self._termination_reason: Optional[str] = None
974974
self._step_logs: List[Dict[str, Any]] = []
975975

976-
def record_step(self, assistant_response, user_response) -> None:
976+
def record_step(self, assistant_response: Any, user_response: Any) -> None:
977977
"""Record data from a RolePlaying step.
978978
979979
Call this after each role_playing.step() to track progress.
@@ -1093,7 +1093,7 @@ def setup_agents(self, agent_data, environment, task, user):
10931093
```
10941094
"""
10951095

1096-
def __init__(self, workforce, name: str = "workforce"):
1096+
def __init__(self, workforce: Any, name: str = "workforce"):
10971097
"""Initialize the Workforce tracer.
10981098
10991099
Args:

0 commit comments

Comments
 (0)