Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,8 @@ import regex
|
|
12 |
import pandas as pd
|
13 |
import torch
|
14 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, BitsAndBytesConfig
|
15 |
-
from smolagents import CodeAgent,
|
|
|
16 |
from smolagents.models import ChatMessage
|
17 |
from custom_tools import WebpageStructureAnalyzerTool
|
18 |
|
@@ -253,14 +254,14 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
253 |
combined_system_prompt = default_system_prompt + "\n\n" + my_added_prompts
|
254 |
# (4) Create the prompt templates to plug in CodeAgent
|
255 |
# default_prompt_templates = PromptTemplates()
|
256 |
-
my_prompt_templates = {"system_prompt": combined_system_prompt}
|
257 |
# "planning": default_prompt_templates["planning"],
|
258 |
# "managed_agent": default_prompt_templates["managed_agent"],
|
259 |
# "final_answer": default_prompt_templates["final_answer"]}
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
# (5) Create the CodeAgent, passing the LLM wrapper and tools
|
265 |
agent = CodeAgent(model=llm_model,
|
266 |
tools=[web_structure_analyzer_tool, wiki_tool, search_tool, python_tool, html_parse_tool],
|
|
|
12 |
import pandas as pd
|
13 |
import torch
|
14 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, BitsAndBytesConfig
|
15 |
+
from smolagents import CodeAgent, VisitWebpageTool, WebSearchTool, WikipediaSearchTool, PythonInterpreterTool
|
16 |
+
from smolagents import PromptTemplates, PlanningPromptTemplate, ManagedAgentPromptTemplate, FinalAnswerPromptTemplate
|
17 |
from smolagents.models import ChatMessage
|
18 |
from custom_tools import WebpageStructureAnalyzerTool
|
19 |
|
|
|
254 |
combined_system_prompt = default_system_prompt + "\n\n" + my_added_prompts
|
255 |
# (4) Create the prompt templates to plug in CodeAgent
|
256 |
# default_prompt_templates = PromptTemplates()
|
257 |
+
# my_prompt_templates = {"system_prompt": combined_system_prompt}
|
258 |
# "planning": default_prompt_templates["planning"],
|
259 |
# "managed_agent": default_prompt_templates["managed_agent"],
|
260 |
# "final_answer": default_prompt_templates["final_answer"]}
|
261 |
+
my_prompt_templates = PromptTemplates(system_prompt=combined_system_prompt,
|
262 |
+
planning=PlanningPromptTemplate(initial_plan="", update_plan_pre_messages="", update_plan_post_messages=""),
|
263 |
+
managed_agent=ManagedAgentPromptTemplate(task="", report=""),
|
264 |
+
final_answer=FinalAnswerPromptTemplate(pre_messages="", post_messages=""))
|
265 |
# (5) Create the CodeAgent, passing the LLM wrapper and tools
|
266 |
agent = CodeAgent(model=llm_model,
|
267 |
tools=[web_structure_analyzer_tool, wiki_tool, search_tool, python_tool, html_parse_tool],
|