Update app.py
Browse files
app.py
CHANGED
|
@@ -28,32 +28,31 @@ class BasicAgent:
|
|
| 28 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 29 |
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
# print(f"Agent Answer: {agent_answer}")
|
| 57 |
|
| 58 |
return fixed_answer
|
| 59 |
|
|
|
|
| 28 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 29 |
|
| 30 |
|
| 31 |
+
model = TransformersModel(
|
| 32 |
+
model_id="microsoft/phi-2", # ✅ small, reliable
|
| 33 |
+
max_new_tokens=1024,
|
| 34 |
+
temperature=0.0,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
with open("prompts.yaml", 'r') as stream:
|
| 38 |
+
prompt_templates = yaml.safe_load(stream)
|
| 39 |
+
|
| 40 |
+
agent = CodeAgent(
|
| 41 |
+
model=model,
|
| 42 |
+
# tools=[DuckDuckGoSearchTool()],
|
| 43 |
+
tools=[],
|
| 44 |
+
max_steps=5,
|
| 45 |
+
verbosity_level=1,
|
| 46 |
+
grammar=None,
|
| 47 |
+
planning_interval=None,
|
| 48 |
+
name=None,
|
| 49 |
+
description=None,
|
| 50 |
+
prompt_templates=prompt_templates
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
agent_answer = agent.run(question)
|
| 54 |
+
|
| 55 |
+
print(f"Agent Answer: {agent_answer}")
|
|
|
|
| 56 |
|
| 57 |
return fixed_answer
|
| 58 |
|