Spaces:
Sleeping
Sleeping
James MacQuillan
commited on
Commit
·
a3fb953
1
Parent(s):
76e8ddc
push
Browse files
app.py
CHANGED
@@ -91,7 +91,7 @@ def search(query):
|
|
91 |
return all_results
|
92 |
|
93 |
def process_query(user_input, history):
|
94 |
-
|
95 |
# Accumulate streamed content from the initial request
|
96 |
stream_search = client.chat_completion(
|
97 |
model="Qwen/Qwen2.5-72B-Instruct",
|
@@ -106,16 +106,16 @@ def process_query(user_input, history):
|
|
106 |
content = chunk.choices[0].delta.content or ''
|
107 |
streamed_search_query += content
|
108 |
|
109 |
-
|
110 |
|
111 |
# Perform the web search based on the accumulated query
|
112 |
search_results = search(streamed_search_query)
|
113 |
search_results_str = json.dumps(search_results)
|
114 |
-
|
115 |
# Create the response request with HuggingFace using search results
|
116 |
response = client.chat_completion(
|
117 |
model="Qwen/Qwen2.5-72B-Instruct",
|
118 |
-
messages=[{"role": "user", "content": f"YOU ARE IM.S, AN INVESTMENT CHATBOT BUILT BY automatedstockmining.org. Answer the user's request '{user_input}' using the following information: {search_results_str} and the chat history {history}. Provide a concise, direct answer in no more than 2-3 sentences, with appropriate emojis. If the user asks for a smart sheet, generate up to 3000 tokens analyzing all trends and patterns
|
119 |
max_tokens=3000,
|
120 |
stream=True
|
121 |
)
|
@@ -133,7 +133,6 @@ theme = gr.themes.Citrus(
|
|
133 |
)
|
134 |
|
135 |
examples = [
|
136 |
-
|
137 |
["whats the trending social sentiment like for Nvidia"],
|
138 |
["What's the latest news on Cisco Systems stock"],
|
139 |
["Analyze technical indicators for Adobe, are they presenting buy or sell signals"],
|
@@ -158,7 +157,6 @@ examples = [
|
|
158 |
["What is the latest guidance on revenue for Meta?"],
|
159 |
["What is the current beta of Amazon stock and how does it compare to the industry average?"],
|
160 |
["What are the top-rated ETFs for technology exposure this quarter?"]
|
161 |
-
|
162 |
]
|
163 |
|
164 |
chatbot = gr.Chatbot(
|
|
|
91 |
return all_results
|
92 |
|
93 |
def process_query(user_input, history):
|
94 |
+
|
95 |
# Accumulate streamed content from the initial request
|
96 |
stream_search = client.chat_completion(
|
97 |
model="Qwen/Qwen2.5-72B-Instruct",
|
|
|
106 |
content = chunk.choices[0].delta.content or ''
|
107 |
streamed_search_query += content
|
108 |
|
109 |
+
print("Search Query:", streamed_search_query) # Debugging: Check the final search term
|
110 |
|
111 |
# Perform the web search based on the accumulated query
|
112 |
search_results = search(streamed_search_query)
|
113 |
search_results_str = json.dumps(search_results)
|
114 |
+
|
115 |
# Create the response request with HuggingFace using search results
|
116 |
response = client.chat_completion(
|
117 |
model="Qwen/Qwen2.5-72B-Instruct",
|
118 |
+
messages=[{"role": "user", "content": f"YOU ARE IM.S, AN INVESTMENT CHATBOT BUILT BY automatedstockmining.org. Answer the user's request '{user_input}' using the following information: {search_results_str} and the chat history {history}. Provide a concise, direct answer in no more than 2-3 sentences, with appropriate emojis. If the user asks for a smart sheet, generate up to 3000 tokens analyzing all trends and patterns as though you are a stock analyst, look for every pattern and form conclusions."}],
|
119 |
max_tokens=3000,
|
120 |
stream=True
|
121 |
)
|
|
|
133 |
)
|
134 |
|
135 |
examples = [
|
|
|
136 |
["whats the trending social sentiment like for Nvidia"],
|
137 |
["What's the latest news on Cisco Systems stock"],
|
138 |
["Analyze technical indicators for Adobe, are they presenting buy or sell signals"],
|
|
|
157 |
["What is the latest guidance on revenue for Meta?"],
|
158 |
["What is the current beta of Amazon stock and how does it compare to the industry average?"],
|
159 |
["What are the top-rated ETFs for technology exposure this quarter?"]
|
|
|
160 |
]
|
161 |
|
162 |
chatbot = gr.Chatbot(
|