| import os | |
| from smolagents import OpenAIServerModel, Tool | |
| from agent.base_agent import BaseAgent | |
| class OpenAiAgent(BaseAgent): | |
| def __init__(self, model_name: str = "gpt-4o-mini", tools: list[Tool] | None = None, use_all_custom_tools: bool = True): | |
| super().__init__(model_name=model_name, tools=tools, use_all_custom_tools=use_all_custom_tools) | |
| self.model_name: str = model_name | |
| self.agent = self.init_agent() | |
| def get_model(self): | |
| model = OpenAIServerModel( | |
| model_id=self.model_name, | |
| temperature=0.2, | |
| api_key=os.getenv("OPENAI_API_KEY") | |
| ) | |
| return model |