Update intent_classification/fd_classification.py
Browse files
intent_classification/fd_classification.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
import google.generativeai as genai
|
| 2 |
-
import os
|
| 3 |
-
|
| 4 |
-
#for intent classification
|
| 5 |
-
def find_intent(user_query: str) -> bool:
|
| 6 |
-
genai.configure(api_key=os.environ.get("api_key_2"))
|
| 7 |
-
model2 = genai.GenerativeModel('gemini-
|
| 8 |
-
prompt = f"""
|
| 9 |
-
You are a helpful assistant. A user has asked the following question or made the following request:
|
| 10 |
-
|
| 11 |
-
"{user_query}"
|
| 12 |
-
|
| 13 |
-
Determine ONLY whether this query is likely about FD-based (fixed deposit backed) credit cards.
|
| 14 |
-
These cards typically do not require a credit score, are suited for users with low income, users who are new to credit cards/beginners, who have no/low credit score or students.
|
| 15 |
-
|
| 16 |
-
Respond with just "true" or "false" depending on whether the user's query is about such cards.
|
| 17 |
-
No explanation, no extra words — just true or false.
|
| 18 |
-
"""
|
| 19 |
-
response = model2.generate_content(prompt)
|
| 20 |
-
result = response.text.strip().lower()
|
| 21 |
-
return result == "true"
|
|
|
|
| 1 |
+
import google.generativeai as genai
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
#for intent classification
|
| 5 |
+
def find_intent(user_query: str) -> bool:
|
| 6 |
+
genai.configure(api_key=os.environ.get("api_key_2"))
|
| 7 |
+
model2 = genai.GenerativeModel('gemini-2.0-flash')
|
| 8 |
+
prompt = f"""
|
| 9 |
+
You are a helpful assistant. A user has asked the following question or made the following request:
|
| 10 |
+
|
| 11 |
+
"{user_query}"
|
| 12 |
+
|
| 13 |
+
Determine ONLY whether this query is likely about FD-based (fixed deposit backed) credit cards.
|
| 14 |
+
These cards typically do not require a credit score, are suited for users with low income, users who are new to credit cards/beginners, who have no/low credit score or students.
|
| 15 |
+
|
| 16 |
+
Respond with just "true" or "false" depending on whether the user's query is about such cards.
|
| 17 |
+
No explanation, no extra words — just true or false.
|
| 18 |
+
"""
|
| 19 |
+
response = model2.generate_content(prompt)
|
| 20 |
+
result = response.text.strip().lower()
|
| 21 |
+
return result == "true"
|