KrSharangrav commited on
Commit
4ec2156
·
1 Parent(s): f89cec9

changed chatbot

Browse files
Files changed (1) hide show
  1. chatbot.py +4 -4
chatbot.py CHANGED
@@ -82,21 +82,21 @@ def chatbot_response(user_prompt):
82
  entry_user = entry.get("user", "Unknown")
83
  entry_date = entry.get("date", "Unknown")
84
 
85
- # Build a static response message with only the desired parts.
86
  ai_response = (
87
  "Let's break down this tweet-like MongoDB entry:\n\n"
88
- f"Text: {entry_text}\n"
89
  f"User: {entry_user}\n"
90
  f"Date: {entry_date}"
91
  )
92
 
93
- # Perform sentiment and topic analysis on the entry's text.
94
  sentiment_label, sentiment_confidence = analyze_sentiment(entry_text)
95
  topic_label, topic_confidence = extract_topic(entry_text)
96
 
97
  return ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence
98
  else:
99
- # For other queries, use the generative model flow.
100
  model_gen = genai.GenerativeModel("gemini-1.5-pro")
101
  ai_response_obj = model_gen.generate_content(user_prompt)
102
  ai_response = ai_response_obj.text
 
82
  entry_user = entry.get("user", "Unknown")
83
  entry_date = entry.get("date", "Unknown")
84
 
85
+ # Build a static response message with the desired formatting.
86
  ai_response = (
87
  "Let's break down this tweet-like MongoDB entry:\n\n"
88
+ f"Tweet: {entry_text}\n"
89
  f"User: {entry_user}\n"
90
  f"Date: {entry_date}"
91
  )
92
 
93
+ # Run sentiment and topic analysis on the entry's text.
94
  sentiment_label, sentiment_confidence = analyze_sentiment(entry_text)
95
  topic_label, topic_confidence = extract_topic(entry_text)
96
 
97
  return ai_response, sentiment_label, sentiment_confidence, topic_label, topic_confidence
98
  else:
99
+ # For all other queries, use the generative model flow.
100
  model_gen = genai.GenerativeModel("gemini-1.5-pro")
101
  ai_response_obj = model_gen.generate_content(user_prompt)
102
  ai_response = ai_response_obj.text