Mayur Shrivastav commited on
Commit
34f7d40
·
1 Parent(s): af74eff

updated model and requirement

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import inspect
5
  import pandas as pd
6
  from smolagents import CodeAgent, InferenceClientModel, VisitWebpageTool, DuckDuckGoSearchTool
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
9
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -15,8 +16,12 @@ class BasicAgent:
15
  print("BasicAgent initialized.")
16
  def __call__(self, question: str) -> str:
17
  print(f"Agent received question (first 50 chars): {question[:50]}...")
18
- api_key = os.getenv("HF_TOKEN")
19
- model = InferenceClientModel(api_key=api_key, model_id="Qwen/Qwen2.5-72B-Instruct" )
 
 
 
 
20
  agent = CodeAgent(
21
  model=model,
22
  tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
@@ -24,7 +29,7 @@ class BasicAgent:
24
  max_steps=20,
25
  )
26
  result = agent.run(question)
27
- fixed_answer = result.final_answer
28
  print(f"Agent returning fixed answer: {fixed_answer}")
29
  return fixed_answer
30
 
 
4
  import inspect
5
  import pandas as pd
6
  from smolagents import CodeAgent, InferenceClientModel, VisitWebpageTool, DuckDuckGoSearchTool
7
+ from smolagents import LiteLLMModel
8
  # (Keep Constants as is)
9
  # --- Constants ---
10
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
16
  print("BasicAgent initialized.")
17
  def __call__(self, question: str) -> str:
18
  print(f"Agent received question (first 50 chars): {question[:50]}...")
19
+ #api_key = os.getenv("HF_TOKEN")
20
+ api_key = os.getenv("GROK_TOKEN")
21
+ model = LiteLLMModel(
22
+ model_id="groq/llama-3.3-70b-versatile",
23
+ api_key=api_key
24
+ )
25
  agent = CodeAgent(
26
  model=model,
27
  tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
 
29
  max_steps=20,
30
  )
31
  result = agent.run(question)
32
+ fixed_answer = list(result.values())[0]
33
  print(f"Agent returning fixed answer: {fixed_answer}")
34
  return fixed_answer
35