Sulaiman8's picture
Update intent_classification/fd_classification.py
b3a8821 verified
Raw
History Blame Contribute Delete
988 Bytes
import google.generativeai as genai
import os
#for intent classification
def find_intent(user_query: str) -> bool:
genai.configure(api_key=os.environ.get("api_key_2"))
model2 = genai.GenerativeModel('gemini-2.0-flash')
prompt = f"""
You are a helpful assistant. A user has asked the following question or made the following request:
"{user_query}"
Determine ONLY whether this query is likely about FD-based (fixed deposit backed) credit cards.
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.
Respond with just "true" or "false" depending on whether the user's query is about such cards.
No explanation, no extra words — just true or false.
"""
response = model2.generate_content(prompt)
result = response.text.strip().lower()
return result == "true"