data_analysis_agent2 / services /intent_classify.py
Shrouk04's picture
Update services/intent_classify.py
7b414ac verified
Raw
History Blame Contribute Delete
710 Bytes
import ollama
def classify_intent(question):
prompt = f"""
Classify the user message.
Possible labels:
- chat
- dataset_question
Rules:
chat:
- greetings
- small talk
- thanks
- introductions
- general conversation
dataset_question:
- any question requiring dataset analysis
- statistics
- charts
- correlations
- rows
- columns
- sales
- business insights
Message:
{question}
Return ONLY one label.
"""
response = ollama.chat(
model="qwen2.5:3b",
messages=[
{
"role": "user",
"content": prompt
}
]
)
return response["message"]["content"].strip().lower()