Mahdiyar commited on
Commit
840d305
·
1 Parent(s): dae0ada

Prompt Eng + Change to QWEN

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. app.py +8 -7
  3. helper.py +1 -0
  4. requirements.txt +2 -1
README.md CHANGED
@@ -27,7 +27,7 @@ TinyCodeAgent is an extention to [TinyAgent](https://github.com/askbudi/tinyagen
27
  You can extend it using TinyAgent Hooks system, and use it with Gradio Integration.
28
  Your agent could become a MCP Server or tool for another agent.
29
 
30
- This Project is using **Qwen/Qwen3-30B-A3B-fast** from [Nebius](https://nebius.ai/) thanks to their support.
31
 
32
 
33
  ## Benefits
 
27
  You can extend it using TinyAgent Hooks system, and use it with Gradio Integration.
28
  Your agent could become a MCP Server or tool for another agent.
29
 
30
+ This Project is using **Qwen/Qwen3-235B-A22B** from [Nebius](https://nebius.ai/) thanks to their support.
31
 
32
 
33
  ## Benefits
app.py CHANGED
@@ -92,7 +92,9 @@ class PythonCodeInterpreter:
92
  self.default_python_codes = default_python_codes
93
 
94
  self.modal_secrets = modal.Secret.from_dict(modal_secrets)
95
- self.pip_packages = list(set(["cloudpickle"]+pip_packages))
 
 
96
  self.lazy_init = lazy_init
97
  self.create_app(self.modal_secrets,self.pip_packages,self.code_tools)
98
 
@@ -100,9 +102,7 @@ class PythonCodeInterpreter:
100
  def create_app(self,modal_secrets:Dict[str,Union[str,None]],pip_packages:List[str]=[],code_tools:List[Dict[str,Any]]=[]):
101
 
102
  agent_image = modal.Image.debian_slim(python_version=self.PYTHON_VERSION).pip_install(
103
- "tinyagent-py[all]==0.0.6",
104
- "gradio",
105
- "arize-phoenix-otel",
106
  *pip_packages
107
  )
108
  self.app = modal.App(
@@ -287,13 +287,13 @@ async def run_example():
287
  tools_meta_data[metadata["name"]] = metadata
288
  template_str = load_template("./prompts/code_agent.yaml")
289
  system_prompt = render_system_prompt(template_str, tools_meta_data, {}, ["tinyagent","gradio","requests","asyncio"]) + prompt_code_example + prompt_qwen_helper
290
- agent = TinyAgent(model="openai/Qwen/Qwen3-30B-A3B-fast", api_key=api_key,
291
  model_kwargs=dict(base_url="https://api.studio.nebius.com/v1/"),
292
  logger=agent_logger,
293
  system_prompt=system_prompt,
294
 
295
  )
296
- python_interpreter = PythonCodeInterpreter(log_manager=log_manager,code_tools=tools)
297
  agent.add_tool(python_interpreter.run_python)
298
 
299
 
@@ -342,7 +342,8 @@ async def run_example():
342
  description="Chat with TinyAgent. Try asking: 'I need to know the weather and traffic in Toronto, Montreal, New York, Paris and San Francisco.'",
343
  share=False,
344
  prevent_thread_lock=True, # Critical to not block our event loop
345
- show_error=True
 
346
  )
347
  ui_logger.info("Gradio interface launched (non-blocking).")
348
 
 
92
  self.default_python_codes = default_python_codes
93
 
94
  self.modal_secrets = modal.Secret.from_dict(modal_secrets)
95
+ self.pip_packages = list(set(["cloudpickle","requests","tinyagent-py[all]==0.0.7",
96
+ "gradio",
97
+ "arize-phoenix-otel",]+pip_packages))
98
  self.lazy_init = lazy_init
99
  self.create_app(self.modal_secrets,self.pip_packages,self.code_tools)
100
 
 
102
  def create_app(self,modal_secrets:Dict[str,Union[str,None]],pip_packages:List[str]=[],code_tools:List[Dict[str,Any]]=[]):
103
 
104
  agent_image = modal.Image.debian_slim(python_version=self.PYTHON_VERSION).pip_install(
105
+
 
 
106
  *pip_packages
107
  )
108
  self.app = modal.App(
 
287
  tools_meta_data[metadata["name"]] = metadata
288
  template_str = load_template("./prompts/code_agent.yaml")
289
  system_prompt = render_system_prompt(template_str, tools_meta_data, {}, ["tinyagent","gradio","requests","asyncio"]) + prompt_code_example + prompt_qwen_helper
290
+ agent = TinyAgent(model="openai/Qwen/Qwen3-235B-A22B", api_key=api_key,
291
  model_kwargs=dict(base_url="https://api.studio.nebius.com/v1/"),
292
  logger=agent_logger,
293
  system_prompt=system_prompt,
294
 
295
  )
296
+ python_interpreter = PythonCodeInterpreter(log_manager=log_manager,code_tools=tools,pip_packages=["tinyagent-py[all]","requests","cloudpickle"])
297
  agent.add_tool(python_interpreter.run_python)
298
 
299
 
 
342
  description="Chat with TinyAgent. Try asking: 'I need to know the weather and traffic in Toronto, Montreal, New York, Paris and San Francisco.'",
343
  share=False,
344
  prevent_thread_lock=True, # Critical to not block our event loop
345
+ show_error=True,
346
+ mcp_server=True,
347
  )
348
  ui_logger.info("Gradio interface launched (non-blocking).")
349
 
helper.py CHANGED
@@ -23,6 +23,7 @@ prompt_qwen_helper = dedent("""
23
  - User can't directly see the response of run_python tool, so you need to use final_answer or ask_question whenever you want to show a response to the user.
24
  Other tools calls and their responses are not visible to the user.
25
  - run_python is a capable tool, if you need to call a function with different arguments, you can do it in one take, just like you would do in a python code you developed to be executed in one cell of Jupyter Notebook Cell.
 
26
  """)
27
 
28
  def load_template(path: str) -> str:
 
23
  - User can't directly see the response of run_python tool, so you need to use final_answer or ask_question whenever you want to show a response to the user.
24
  Other tools calls and their responses are not visible to the user.
25
  - run_python is a capable tool, if you need to call a function with different arguments, you can do it in one take, just like you would do in a python code you developed to be executed in one cell of Jupyter Notebook Cell.
26
+ - When Task is not resolvable using functions available in your python enviroment, first think about creating a new function to solve the task, then ask the user about your approach and your code, if user allowed you to use it, then define and execute your custom made function. [It is your super power, you can create functions to solve the task.]
27
  """)
28
 
29
  def load_template(path: str) -> str:
requirements.txt CHANGED
@@ -2,4 +2,5 @@ tinyagent-py[all]==0.0.7
2
  cloudpickle
3
  modal
4
  jinja2
5
- pyyaml
 
 
2
  cloudpickle
3
  modal
4
  jinja2
5
+ pyyaml
6
+ gradio[mcp]