SergeyO7 commited on
Commit
89d512b
·
verified ·
1 Parent(s): 4113b44

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +11 -4
agent.py CHANGED
@@ -1,19 +1,26 @@
1
- from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel, WikipediaSearchTool
2
  import asyncio
3
 
4
  class MagAgent:
5
  def __init__(self):
6
  """Initialize the MagAgent with search tools."""
7
  print("Initializing MagAgent with search tools...")
 
 
 
 
 
 
 
 
8
  self.agent = CodeAgent(
9
- model=OpenAIServerModel(model_id="gpt-4o"),
10
  tools=[
11
  DuckDuckGoSearchTool(),
12
  WikipediaSearchTool()
13
  ]
14
  )
15
- print("MagAgent initialized."
16
- )
17
 
18
  async def __call__(self, question: str) -> str:
19
  """Process a question asynchronously using the MagAgent."""
 
1
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, WikipediaSearchTool, HfApiModel # OpenAIServerModel
2
  import asyncio
3
 
4
  class MagAgent:
5
  def __init__(self):
6
  """Initialize the MagAgent with search tools."""
7
  print("Initializing MagAgent with search tools...")
8
+ model = HfApiModel(
9
+ max_tokens=2096,
10
+ temperature=0.5,
11
+ # model_id="gemini/gemini-2.0-flash-lite-001",
12
+ # api_key = os.environ["GEMINI_KEY"], #userdata.get("GEMINI_KEY")
13
+ model_id="https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud/",
14
+ custom_role_conversions=None,
15
+ )
16
  self.agent = CodeAgent(
17
+ model= model # OpenAIServerModel(model_id="gpt-4o"),
18
  tools=[
19
  DuckDuckGoSearchTool(),
20
  WikipediaSearchTool()
21
  ]
22
  )
23
+ print("MagAgent initialized.")
 
24
 
25
  async def __call__(self, question: str) -> str:
26
  """Process a question asynchronously using the MagAgent."""