Business_Chatbot / tests /test_chatbot.py
Ancastal's picture
Upload folder using huggingface_hub
401b16c verified
#!/usr/bin/env python3
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
from chatbot import Chatbot
from models import ChatbotRequest
def test_chatbot():
print("🧪 Testing Chatbot System")
print("="*50)
chatbot = Chatbot()
# Test cases
test_cases = [
"Add a purchase of 20 USB drives from TechMart at €5 each",
"Sold 10 laptops to John Smith at €800 each",
"Purchase 5 office chairs from Office Supplies Co at €150 per chair",
"Show recent transactions",
"Find USB drives",
"Search TechMart",
"Meeting with new supplier scheduled for next week"
]
for i, test_message in enumerate(test_cases, 1):
print(f"\n🔍 Test {i}: {test_message}")
print("-" * 50)
request = ChatbotRequest(message=test_message)
response = chatbot.process_message(request)
print(f"Response: {response.response}")
if response.entities_extracted:
entities = response.entities_extracted
print(f"Entities: {entities.transaction_type} - {entities.product} ({entities.quantity}x) - €{entities.total_amount}")
if response.vector_stored:
print("✅ Stored in vector database")
print()
chatbot.close()
print("✅ All tests completed!")
if __name__ == "__main__":
test_chatbot()