Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,8 @@ search_tool = TavilySearchResults(tavily_api_key=TAVILY_API_KEY)
|
|
17 |
SYSTEM_PROMPT = """
|
18 |
You are a highly knowledgeable and reliable Crypto Trading Advisor and Analyzer.
|
19 |
Your goal is to assist users in understanding, analyzing, and making informed decisions about cryptocurrency trading.
|
20 |
-
You provide accurate, concise, and actionable advice based on real-time data, historical trends, and established best practices.
|
|
|
21 |
"""
|
22 |
|
23 |
# Fixed settings for LLM
|
@@ -55,16 +56,16 @@ def respond(message, history: list[tuple[str, str]]):
|
|
55 |
|
56 |
try:
|
57 |
# Correct method to get relevant results based on the message
|
58 |
-
search_results = search_tool.query(message)
|
59 |
-
|
|
|
|
|
60 |
search_results = []
|
61 |
|
62 |
if search_results:
|
63 |
-
|
64 |
-
search_results_text = "Here are the search results:\n"
|
65 |
for result in search_results:
|
66 |
search_results_text += f"- {result['title']}: {result['url']}\n"
|
67 |
-
# Add the search results to the messages to be used by LLM
|
68 |
messages.append({"role": "assistant", "content": search_results_text})
|
69 |
|
70 |
# Start response generation
|
|
|
17 |
SYSTEM_PROMPT = """
|
18 |
You are a highly knowledgeable and reliable Crypto Trading Advisor and Analyzer.
|
19 |
Your goal is to assist users in understanding, analyzing, and making informed decisions about cryptocurrency trading.
|
20 |
+
You provide accurate, concise, and actionable advice based on real-time data, historical trends, and established best practices.
|
21 |
+
If you are provided with relevant search results, incorporate that information into your analysis.
|
22 |
"""
|
23 |
|
24 |
# Fixed settings for LLM
|
|
|
56 |
|
57 |
try:
|
58 |
# Correct method to get relevant results based on the message
|
59 |
+
search_results = search_tool.query(message)
|
60 |
+
print(f"Search Results: {search_results}") # Debugging line
|
61 |
+
except Exception as e:
|
62 |
+
print(f"Error during search: {str(e)}")
|
63 |
search_results = []
|
64 |
|
65 |
if search_results:
|
66 |
+
search_results_text = "Here are the search results related to the bitcoin price:\n"
|
|
|
67 |
for result in search_results:
|
68 |
search_results_text += f"- {result['title']}: {result['url']}\n"
|
|
|
69 |
messages.append({"role": "assistant", "content": search_results_text})
|
70 |
|
71 |
# Start response generation
|