File size: 644 Bytes
37c9a6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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