Spaces:
Runtime error
Runtime error
| from typing import Any | |
| from smolagents import CodeAgent, PromptTemplates, Model, Tool | |
| class GaiaAgent(CodeAgent): | |
| def __init__( | |
| self, | |
| tools: list[Tool], | |
| model: Model, | |
| prompt_templates: PromptTemplates | None = None, | |
| additional_authorized_imports: list[str] | None = None, | |
| planning_interval: int | None = None, | |
| executor_type: str | None = "local", | |
| executor_kwargs: dict[str, Any] | None = None, | |
| max_print_outputs_length: int | None = None, | |
| stream_outputs: bool = False, | |
| use_structured_outputs_internally: bool = False, | |
| grammar: dict[str, str] | None = None, | |
| **kwargs, | |
| ): | |
| super().__init__( | |
| tools=tools, | |
| model=model, | |
| prompt_templates=prompt_templates, | |
| additional_authorized_imports=additional_authorized_imports, | |
| planning_interval=planning_interval, | |
| executor_type=executor_type, | |
| executor_kwargs=executor_kwargs, | |
| max_print_outputs_length=max_print_outputs_length, | |
| use_structured_outputs_internally=use_structured_outputs_internally, | |
| grammar=grammar, | |
| **kwargs, | |
| ) | |
| def __call__(self, question: str, filename: str) -> str: | |
| if filename: | |
| return super().run( | |
| question, | |
| additional_args={ | |
| "filename": filename, | |
| }, | |
| ) | |
| return super().run(question) | |