File size: 988 Bytes
b3a8821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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"