anup220799 commited on
Commit
0c4775b
·
1 Parent(s): 06b1e2c

Update tools and CodeAgent

Browse files
Files changed (1) hide show
  1. app.py +33 -6
app.py CHANGED
@@ -21,6 +21,12 @@ search_tool = DuckDuckGoSearchTool()
21
  def rag_search(query: str) -> str:
22
  """
23
  Retrieve relevant information from the local FAISS knowledge base.
 
 
 
 
 
 
24
  """
25
 
26
  agent = GLOBAL_AGENT
@@ -40,16 +46,22 @@ def rag_search(query: str) -> str:
40
  question = item.get("Question", "")
41
  answer = item.get("Final answer", "")
42
 
43
- results.append(f"Question: {question}\nAnswer: {answer}")
 
 
44
 
45
  return "\n\n".join(results)
46
 
47
-
48
  @tool
49
  def calculator(expression: str) -> str:
50
  """
51
- Evaluate mathematical expressions.
52
- Example: 5*23+12
 
 
 
 
 
53
  """
54
 
55
  try:
@@ -62,6 +74,12 @@ def calculator(expression: str) -> str:
62
  def web_search(query: str) -> str:
63
  """
64
  Search the web for up-to-date information.
 
 
 
 
 
 
65
  """
66
 
67
  try:
@@ -73,8 +91,17 @@ def web_search(query: str) -> str:
73
 
74
 
75
  @tool
76
- def image_reader(agent, image_path=None):
77
- """Placeholder multimodal tool."""
 
 
 
 
 
 
 
 
 
78
  return "IMAGE_ANALYSIS_NOT_IMPLEMENTED"
79
 
80
 
 
21
  def rag_search(query: str) -> str:
22
  """
23
  Retrieve relevant information from the local FAISS knowledge base.
24
+
25
+ Args:
26
+ query: The question or search query to retrieve relevant documents for.
27
+
28
+ Returns:
29
+ A string containing the most relevant question-answer pairs from the knowledge base.
30
  """
31
 
32
  agent = GLOBAL_AGENT
 
46
  question = item.get("Question", "")
47
  answer = item.get("Final answer", "")
48
 
49
+ results.append(
50
+ f"Question: {question}\nAnswer: {answer}"
51
+ )
52
 
53
  return "\n\n".join(results)
54
 
 
55
  @tool
56
  def calculator(expression: str) -> str:
57
  """
58
+ Evaluate a mathematical expression.
59
+
60
+ Args:
61
+ expression: A mathematical expression such as "5*23+12".
62
+
63
+ Returns:
64
+ The computed result as a string.
65
  """
66
 
67
  try:
 
74
  def web_search(query: str) -> str:
75
  """
76
  Search the web for up-to-date information.
77
+
78
+ Args:
79
+ query: The search query.
80
+
81
+ Returns:
82
+ A short text snippet of the web search results.
83
  """
84
 
85
  try:
 
91
 
92
 
93
  @tool
94
+ def image_reader(image_path: str) -> str:
95
+ """
96
+ Analyze an image.
97
+
98
+ Args:
99
+ image_path: Path to the image file.
100
+
101
+ Returns:
102
+ A placeholder message since image analysis is not implemented.
103
+ """
104
+
105
  return "IMAGE_ANALYSIS_NOT_IMPLEMENTED"
106
 
107