nikhmr1235 commited on
Commit
c7864ff
·
verified ·
1 Parent(s): 1e16f7b

fix for correct invocation of file download tool via JSON action

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -1,6 +1,6 @@
 
1
  import os
2
  import gradio as gr
3
- import requests
4
  import inspect
5
  import pandas as pd
6
  import time
@@ -12,7 +12,6 @@ from langchain.memory import ConversationSummaryMemory
12
  from typing import Any, List, Optional
13
  from langchain.agents import AgentExecutor, Agent
14
  from langchain.tools.base import BaseTool
15
- from langchain.memory import ConversationSummaryMemory
16
  from langchain.memory import ConversationSummaryBufferMemory
17
  from google.api_core import retry
18
  from google import genai
@@ -164,8 +163,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
164
  Action Input: [input_for_the_tool]
165
  Observation: [result_from_the_tool]
166
 
167
- NOTE: If the input contains the exact phrase "Attachment '{{file_name}}' available at: {{attachment_url}}" (where '{{file_name}}' and '{{attachment_url}}' are placeholders for actual values), then you may use the 'download_file_from_url' tool if needed. Otherwise, you should use the 'tavily_search' tool.
168
- for example: if task_id:cca530fc-7888-43b2-b130-b30968d8aa44, file_name:sample.jpg attachment URL will be https://agents-course-unit4-scoring.hf.space/files/cca530fc-7888-43b2-b130-b30968d8aa44 => invoke download_file_from_url(https://agents-course-unit4-scoring.hf.space/files/cca530fc-7888-43b2-b130-b30968d8aa44,sample.jpg)
 
 
 
169
 
170
 
171
  If you have sufficient information and can provide a CONCISE response, or if no tool is needed, you MUST use this precise format:
@@ -399,4 +401,4 @@ if __name__ == "__main__":
399
  print("-"*(60 + len(" App Starting ")) + "\n")
400
 
401
  print("Launching Gradio Interface for Basic Agent Evaluation...")
402
- demo.launch(debug=True, share=False)
 
1
+ import requests
2
  import os
3
  import gradio as gr
 
4
  import inspect
5
  import pandas as pd
6
  import time
 
12
  from typing import Any, List, Optional
13
  from langchain.agents import AgentExecutor, Agent
14
  from langchain.tools.base import BaseTool
 
15
  from langchain.memory import ConversationSummaryBufferMemory
16
  from google.api_core import retry
17
  from google import genai
 
163
  Action Input: [input_for_the_tool]
164
  Observation: [result_from_the_tool]
165
 
166
+ NOTE: If the input contains the exact phrase "Attachment '{{file_name}}' available at: {{attachment_url}}" (where '{{file_name}}' and '{{attachment_url}}' are placeholders for actual values), then you may use the 'file_download_tool' if needed. Otherwise, you should use the 'tavily_search' tool.
167
+ For example: if task_id:cca530fc-7888-43b2-b130-b30968d8aa44, file_name:sample.jpg attachment URL will be https://agents-course-unit4-scoring.hf.space/files/cca530fc-7888-43b2-b130-b30968d8aa44.
168
+ Then, the Action and Action Input should be:
169
+ Action: file_download_tool
170
+ Action Input: {{"url": "https://agents-course-unit4-scoring.hf.space/files/cca530fc-7888-43b2-b130-b30968d8aa44", "local_filename": "sample.jpg"}}
171
 
172
 
173
  If you have sufficient information and can provide a CONCISE response, or if no tool is needed, you MUST use this precise format:
 
401
  print("-"*(60 + len(" App Starting ")) + "\n")
402
 
403
  print("Launching Gradio Interface for Basic Agent Evaluation...")
404
+ demo.launch(debug=True, share=False)