arijit121 commited on
Commit
e5a581c
·
1 Parent(s): c765b20
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -6,9 +6,14 @@ import requests
6
  import pandas as pd
7
  from smolagents import (
8
  CodeAgent,
9
- HfApiModel,
10
  DuckDuckGoSearchTool,
11
  )
 
 
 
 
 
 
12
  import yaml
13
 
14
  from tools.final_answer import FinalAnswerTool
@@ -25,7 +30,7 @@ def build_agent():
25
  # Model — Use the HF Inference API (free tier)
26
  # Fallback endpoint if the main model is overloaded:
27
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
28
- model = HfApiModel(
29
  max_tokens=4096,
30
  temperature=0.1,
31
  model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
 
6
  import pandas as pd
7
  from smolagents import (
8
  CodeAgent,
 
9
  DuckDuckGoSearchTool,
10
  )
11
+
12
+ # Try newer API name first, fall back to legacy
13
+ try:
14
+ from smolagents import ApiModel
15
+ except ImportError:
16
+ from smolagents import HfApiModel as ApiModel
17
  import yaml
18
 
19
  from tools.final_answer import FinalAnswerTool
 
30
  # Model — Use the HF Inference API (free tier)
31
  # Fallback endpoint if the main model is overloaded:
32
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
33
+ model = ApiModel(
34
  max_tokens=4096,
35
  temperature=0.1,
36
  model_id="Qwen/Qwen2.5-Coder-32B-Instruct",