Update app.py
Browse files
app.py
CHANGED
@@ -73,37 +73,37 @@ def run_crypto_crew(topic):
|
|
73 |
# Chatbot Response Function
|
74 |
def respond(message, history):
|
75 |
max_tokens = 512
|
76 |
-
temperature = 0.
|
77 |
top_p = 0.95
|
78 |
frequency_penalty = 0.0
|
79 |
seed = None
|
80 |
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
yield response
|
84 |
-
else:
|
85 |
-
messages = [{"role": "system", "content": SYSTEM_PROMPT}]
|
86 |
-
for user_part, assistant_part in history:
|
87 |
-
if user_part:
|
88 |
-
messages.append({"role": "user", "content": user_part})
|
89 |
-
if assistant_part:
|
90 |
-
messages.append({"role": "assistant", "content": assistant_part})
|
91 |
-
messages.append({"role": "user", "content": message})
|
92 |
-
|
93 |
-
response = ""
|
94 |
-
for message_chunk in client.chat.completions.create(
|
95 |
-
model="meta-llama/Llama-3.3-70B-Instruct",
|
96 |
-
max_tokens=max_tokens,
|
97 |
-
stream=True,
|
98 |
-
temperature=temperature,
|
99 |
-
top_p=top_p,
|
100 |
-
frequency_penalty=frequency_penalty,
|
101 |
-
seed=seed,
|
102 |
-
messages=messages,
|
103 |
-
):
|
104 |
-
token_text = message_chunk.choices[0].delta.content
|
105 |
-
response += token_text
|
106 |
-
yield response
|
107 |
|
108 |
# Gradio UI
|
109 |
chatbot = gr.Chatbot(height=600, show_copy_button=True, placeholder="Ask about crypto trading or analysis.")
|
|
|
73 |
# Chatbot Response Function
|
74 |
def respond(message, history):
|
75 |
max_tokens = 512
|
76 |
+
temperature = 0.7
|
77 |
top_p = 0.95
|
78 |
frequency_penalty = 0.0
|
79 |
seed = None
|
80 |
|
81 |
+
# CrewAI'den gelen analiz sonuçları alınır
|
82 |
+
crew_response = run_crypto_crew(message)
|
83 |
+
|
84 |
+
# LLM ile harmanlanarak daha kapsamlı bir cevap üretilir
|
85 |
+
messages = [{"role": "system", "content": SYSTEM_PROMPT}]
|
86 |
+
for user_part, assistant_part in history:
|
87 |
+
if user_part:
|
88 |
+
messages.append({"role": "user", "content": user_part})
|
89 |
+
if assistant_part:
|
90 |
+
messages.append({"role": "assistant", "content": assistant_part})
|
91 |
+
messages.append({"role": "user", "content": f"{message}\n\nCrewAI Analysis:\n{crew_response}"})
|
92 |
+
|
93 |
+
response = ""
|
94 |
+
for message_chunk in client.chat.completions.create(
|
95 |
+
model="meta-llama/Llama-3.3-70B-Instruct",
|
96 |
+
max_tokens=max_tokens,
|
97 |
+
stream=True,
|
98 |
+
temperature=temperature,
|
99 |
+
top_p=top_p,
|
100 |
+
frequency_penalty=frequency_penalty,
|
101 |
+
seed=seed,
|
102 |
+
messages=messages,
|
103 |
+
):
|
104 |
+
token_text = message_chunk.choices[0].delta.content
|
105 |
+
response += token_text
|
106 |
yield response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
# Gradio UI
|
109 |
chatbot = gr.Chatbot(height=600, show_copy_button=True, placeholder="Ask about crypto trading or analysis.")
|