wt002 commited on
Commit
976daf1
·
verified ·
1 Parent(s): 48b54cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -30,9 +30,9 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
30
  from smolagents import Tool, CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, HfApiModel
31
 
32
 
33
- class CodeLlamaTool(Tool):
34
- name = "code_llama_tool"
35
- description = "Solves reasoning/code questions using Meta Code Llama 7B Instruct"
36
 
37
  inputs = {
38
  "question": {
@@ -43,7 +43,7 @@ class CodeLlamaTool(Tool):
43
  output_type = "string"
44
 
45
  def __init__(self):
46
- self.model_id = "codellama/CodeLlama-7b-Instruct-hf"
47
  token = os.getenv("HF_TOKEN")
48
 
49
  self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, token=token)
@@ -113,7 +113,6 @@ Answer:"""
113
  return f"Error executing code:\n{traceback.format_exc()}"
114
 
115
 
116
-
117
  #from smolagents import Tool
118
  #from langchain_community.document_loaders import WikipediaLoader
119
 
@@ -287,7 +286,7 @@ class BasicAgent:
287
  video_transcription_tool = VideoTranscriptionTool()
288
 
289
  # ✅ New Llama Tool
290
- code_llama_tool = CodeLlamaTool()
291
 
292
  system_prompt = f"""
293
  You are my general AI assistant. Your task is to answer the question I asked.
@@ -306,7 +305,7 @@ If the answer is a comma-separated list, apply the above rules for each element
306
  keywords_extract_tool, speech_to_text_tool,
307
  visit_webpage_tool, final_answer_tool,
308
  parse_excel_to_json, video_transcription_tool,
309
- code_llama_tool # 🔧 Add here
310
  ],
311
  add_base_tools=True
312
  )
 
30
  from smolagents import Tool, CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, HfApiModel
31
 
32
 
33
+ class QwenChatTool(Tool):
34
+ name = "qwen_chat_tool"
35
+ description = "Solves reasoning/code questions using Qwen1.5-7B-Chat"
36
 
37
  inputs = {
38
  "question": {
 
43
  output_type = "string"
44
 
45
  def __init__(self):
46
+ self.model_id = "Qwen/Qwen1.5-7B-Chat"
47
  token = os.getenv("HF_TOKEN")
48
 
49
  self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, token=token)
 
113
  return f"Error executing code:\n{traceback.format_exc()}"
114
 
115
 
 
116
  #from smolagents import Tool
117
  #from langchain_community.document_loaders import WikipediaLoader
118
 
 
286
  video_transcription_tool = VideoTranscriptionTool()
287
 
288
  # ✅ New Llama Tool
289
+ qwen_chat_tool = QwenChatTool()
290
 
291
  system_prompt = f"""
292
  You are my general AI assistant. Your task is to answer the question I asked.
 
305
  keywords_extract_tool, speech_to_text_tool,
306
  visit_webpage_tool, final_answer_tool,
307
  parse_excel_to_json, video_transcription_tool,
308
+ qwen_chat_tool # 🔧 Add here
309
  ],
310
  add_base_tools=True
311
  )