Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,33 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 41 |
|
| 42 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 43 |
try:
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
except Exception as e:
|
| 46 |
print(f"Error instantiating agent: {e}")
|
| 47 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 41 |
|
| 42 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 43 |
try:
|
| 44 |
+
|
| 45 |
+
final_answer = FinalAnswerTool()
|
| 46 |
+
model = HfApiModel(
|
| 47 |
+
max_tokens=2096,
|
| 48 |
+
temperature=0.5,
|
| 49 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 50 |
+
custom_role_conversions=None,
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
with open("prompts.yaml", 'r') as stream:
|
| 54 |
+
prompt_templates = yaml.safe_load(stream)
|
| 55 |
+
|
| 56 |
+
# We're creating our CodeAgent
|
| 57 |
+
agent = CodeAgent(
|
| 58 |
+
model=model,
|
| 59 |
+
tools=[final_answer, DuckDuckGoSearchTool], # add your tools here (don't remove final_answer)
|
| 60 |
+
max_steps=6,
|
| 61 |
+
verbosity_level=1,
|
| 62 |
+
grammar=None,
|
| 63 |
+
planning_interval=None,
|
| 64 |
+
name=None,
|
| 65 |
+
description=None,
|
| 66 |
+
prompt_templates=prompt_templates
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
#agent = BasicAgent()
|
| 71 |
except Exception as e:
|
| 72 |
print(f"Error instantiating agent: {e}")
|
| 73 |
return f"Error initializing agent: {e}", None
|