ameglei-external commited on
Commit
09a3f13
·
verified ·
1 Parent(s): 7d4c1b9

Add prints and logging

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -67,11 +67,15 @@ class BasicAgent:
67
  def assistant(self, state: State):
68
  # System message
69
  textual_description_of_tool="""
70
- search_tool(question: str) -> str:
71
  Search info in the web.
 
 
 
72
 
73
  Args:
74
  question: Question string
 
75
 
76
  Returns:
77
  A single string containing the info from the web.
@@ -100,7 +104,9 @@ class BasicAgent:
100
  A single string containing the info from the web.
101
  """
102
  search = DuckDuckGoSearchRun()
103
- return search.invoke(question)[:max_length]
 
 
104
 
105
 
106
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
67
  def assistant(self, state: State):
68
  # System message
69
  textual_description_of_tool="""
70
+ search_tool(question: str, max_length: int = 1024) -> str:
71
  Search info in the web.
72
+ Call example:
73
+
74
+ self.search_tool("Who won the election 2008 in the USA?", max_length = 4096)
75
 
76
  Args:
77
  question: Question string
78
+ max_length: maximum chars in the output (if exceeded the first "max_length" characters will be taken)
79
 
80
  Returns:
81
  A single string containing the info from the web.
 
104
  A single string containing the info from the web.
105
  """
106
  search = DuckDuckGoSearchRun()
107
+ res = search.invoke(question)
108
+ print("Search res:", res)
109
+ return res[:max_length]
110
 
111
 
112
  def run_and_submit_all( profile: gr.OAuthProfile | None):