Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,13 +69,32 @@ def rag_response(query):
|
|
| 69 |
# Define tools using LangChain's `tool` decorator
|
| 70 |
@tool
|
| 71 |
def knowledge_base_tool(query: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
return rag_response(query)
|
| 73 |
|
|
|
|
| 74 |
@tool
|
| 75 |
def google_search_tool(query: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
return google_search(query)
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
# Create the prompt template
|
| 81 |
prompt_message = """
|
|
|
|
| 69 |
# Define tools using LangChain's `tool` decorator
|
| 70 |
@tool
|
| 71 |
def knowledge_base_tool(query: str):
|
| 72 |
+
"""
|
| 73 |
+
Tool function to query the knowledge base and retrieve a response.
|
| 74 |
+
Args:
|
| 75 |
+
query (str): The query to search the knowledge base.
|
| 76 |
+
Returns:
|
| 77 |
+
str: The response retrieved from the knowledge base.
|
| 78 |
+
"""
|
| 79 |
return rag_response(query)
|
| 80 |
|
| 81 |
+
|
| 82 |
@tool
|
| 83 |
def google_search_tool(query: str):
|
| 84 |
+
"""
|
| 85 |
+
Tool function to perform a Google search using the SERPER API.
|
| 86 |
+
Args:
|
| 87 |
+
query (str): The query to search on Google.
|
| 88 |
+
Returns:
|
| 89 |
+
list: List of snippets extracted from search results.
|
| 90 |
+
"""
|
| 91 |
return google_search(query)
|
| 92 |
|
| 93 |
+
|
| 94 |
+
tools = [
|
| 95 |
+
knowledge_base_tool,
|
| 96 |
+
google_search_tool,
|
| 97 |
+
]
|
| 98 |
|
| 99 |
# Create the prompt template
|
| 100 |
prompt_message = """
|