romain-fayoux commited on
Commit
68462cd
·
verified ·
1 Parent(s): 7a26e4a

Update llm_only_agent.py

Browse files
Files changed (1) hide show
  1. llm_only_agent.py +27 -13
llm_only_agent.py CHANGED
@@ -1,16 +1,30 @@
1
  from smolagents import CodeAgent, HfApiModel, FinalAnswerTool
2
 
3
- # Basic inference model
4
- model = HfApiModel(
5
- max_tokens=2096,
6
- temperature=0.5,
7
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
8
- custom_role_conversions=None,
9
- )
10
 
11
- # Code Agent
12
- agent = CodeAgent(
13
- model=model,
14
- tools=[FinalAnswerTool()],
15
- max_steps=2
16
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from smolagents import CodeAgent, HfApiModel, FinalAnswerTool
2
 
 
 
 
 
 
 
 
3
 
4
+
5
+
6
+
7
+ class BasicAgent:
8
+ def __init__(self):
9
+
10
+ # Basic inference model
11
+ model = HfApiModel(
12
+ max_tokens=2096,
13
+ temperature=0.5,
14
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
15
+ custom_role_conversions=None,
16
+ )
17
+
18
+ # Code Agent
19
+ agent = CodeAgent(
20
+ model=model,
21
+ tools=[FinalAnswerTool()],
22
+ max_steps=2
23
+ )
24
+
25
+ print("BasicAgent initialized.")
26
+ def __call__(self, question: str) -> str:
27
+ print(f"Agent received question (first 50 chars): {question[:50]}...")
28
+ answer = agent.run(question)
29
+ print(f"Agent returning answer: {answer}")
30
+ return answer