Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,10 +104,25 @@ def rag_response(query):
|
|
| 104 |
# Define tools using LangChain's `tool` decorator
|
| 105 |
@tool
|
| 106 |
def knowledge_base_tool(query: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
return rag_response(query)
|
| 108 |
|
| 109 |
@tool
|
| 110 |
def google_search_tool(query: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
return google_search(query)
|
| 112 |
|
| 113 |
tools = [knowledge_base_tool, google_search_tool]
|
|
|
|
| 104 |
# Define tools using LangChain's `tool` decorator
|
| 105 |
@tool
|
| 106 |
def knowledge_base_tool(query: str):
|
| 107 |
+
"""
|
| 108 |
+
Tool function to query the knowledge base and retrieve a response.
|
| 109 |
+
Args:
|
| 110 |
+
query (str): The query to search the knowledge base.
|
| 111 |
+
Returns:
|
| 112 |
+
str: The response retrieved from the knowledge base.
|
| 113 |
+
"""
|
| 114 |
return rag_response(query)
|
| 115 |
|
| 116 |
@tool
|
| 117 |
def google_search_tool(query: str):
|
| 118 |
+
"""
|
| 119 |
+
Tool function to perform a Google search using the SERPER API.
|
| 120 |
+
Args:
|
| 121 |
+
query (str): The query to search on Google.
|
| 122 |
+
Returns:
|
| 123 |
+
list: List of snippets extracted from search results.
|
| 124 |
+
"""
|
| 125 |
+
|
| 126 |
return google_search(query)
|
| 127 |
|
| 128 |
tools = [knowledge_base_tool, google_search_tool]
|