Spaces:
Runtime error
Runtime error
| import json | |
| import csv | |
| # General conversation dataset for chat system | |
| chat_dataset = [ | |
| # Greetings | |
| {"user": "Hello", "bot": "Hi there! How can I help you today?"}, | |
| {"user": "Hi", "bot": "Hello! What can I do for you?"}, | |
| {"user": "Good morning", "bot": "Good morning! How are you doing today?"}, | |
| {"user": "Hey", "bot": "Hey! What's on your mind?"}, | |
| # General questions | |
| {"user": "How are you?", "bot": "I'm doing great, thanks for asking! How about you?"}, | |
| {"user": "What can you do?", "bot": "I can help with questions, provide information, and have conversations. What would you like to know?"}, | |
| {"user": "Tell me about yourself", "bot": "I'm an AI assistant here to help answer your questions and chat with you. What would you like to discuss?"}, | |
| # Help requests | |
| {"user": "I need help", "bot": "I'm here to help! What do you need assistance with?"}, | |
| {"user": "Can you help me?", "bot": "Of course! I'd be happy to help. What's your question?"}, | |
| {"user": "I have a question", "bot": "Great! I'm here to answer questions. What would you like to know?"}, | |
| # Product/Service inquiries | |
| {"user": "What services do you offer?", "bot": "We offer AI-powered chat solutions for websites. Would you like to know more about our features?"}, | |
| {"user": "How does this work?", "bot": "Our system uses AI to understand and respond to customer questions. It learns from your website content to provide relevant answers."}, | |
| {"user": "Is this free?", "bot": "We offer different pricing plans. Would you like me to explain our options?"}, | |
| # Technical questions | |
| {"user": "How do I get started?", "bot": "Getting started is easy! You can sign up, add your website, and start chatting right away. Need help with any specific step?"}, | |
| {"user": "Do I need to install anything?", "bot": "No installation needed! Just add a simple code snippet to your website and you're ready to go."}, | |
| {"user": "Is it secure?", "bot": "Yes, we use secure authentication and encryption to protect your data. Security is our top priority."}, | |
| # Support | |
| {"user": "I'm having trouble", "bot": "Sorry to hear that! Can you tell me more about what's not working so I can help?"}, | |
| {"user": "Something is broken", "bot": "I'd like to help fix that. Can you describe what's happening?"}, | |
| {"user": "It's not working", "bot": "Let me help you troubleshoot. What exactly isn't working as expected?"}, | |
| # Feedback | |
| {"user": "This is great!", "bot": "Thank you! I'm glad you're enjoying it. Is there anything else I can help with?"}, | |
| {"user": "I love this", "bot": "That's wonderful to hear! Thanks for the positive feedback."}, | |
| {"user": "This is helpful", "bot": "I'm so glad it's helpful! Feel free to ask if you need anything else."}, | |
| # Complaints | |
| {"user": "This is confusing", "bot": "I understand that can be frustrating. Let me try to explain it more clearly. What part is confusing?"}, | |
| {"user": "I don't understand", "bot": "No problem! Let me break it down for you. What specifically would you like me to explain?"}, | |
| {"user": "This doesn't make sense", "bot": "I apologize for the confusion. Can you tell me what doesn't make sense so I can clarify?"}, | |
| # Goodbyes | |
| {"user": "Thanks", "bot": "You're welcome! Happy to help anytime."}, | |
| {"user": "Thank you", "bot": "My pleasure! Feel free to reach out if you need anything else."}, | |
| {"user": "Goodbye", "bot": "Goodbye! Have a great day!"}, | |
| {"user": "Bye", "bot": "Bye! Take care!"}, | |
| # Small talk | |
| {"user": "How's the weather?", "bot": "I don't have access to weather data, but I hope it's nice where you are! Is there something else I can help with?"}, | |
| {"user": "What time is it?", "bot": "I don't have access to real-time data, but you can check your device's clock. Anything else I can assist with?"}, | |
| {"user": "Tell me a joke", "bot": "Why don't scientists trust atoms? Because they make up everything! π What else can I help you with?"}, | |
| # Business hours | |
| {"user": "Are you open?", "bot": "I'm available 24/7 to help answer your questions! What can I do for you?"}, | |
| {"user": "What are your hours?", "bot": "I'm here around the clock! Feel free to ask questions anytime."}, | |
| # Contact info | |
| {"user": "How can I contact you?", "bot": "You're already chatting with me! For other inquiries, you can use our contact form or email support."}, | |
| {"user": "Do you have a phone number?", "bot": "For now, chat is the best way to reach us. Is there something specific I can help you with right here?"}, | |
| # Pricing | |
| {"user": "How much does it cost?", "bot": "We have flexible pricing plans starting from basic to enterprise. Would you like me to explain the different options?"}, | |
| {"user": "Is there a free trial?", "bot": "Yes! We offer a free trial so you can test our service. Would you like to know how to get started?"}, | |
| # Features | |
| {"user": "What features do you have?", "bot": "We offer AI chat, website integration, analytics, and customization options. Which feature interests you most?"}, | |
| {"user": "Can I customize this?", "bot": "Absolutely! You can customize the chat appearance, responses, and behavior to match your brand. Want to know more?"} | |
| ] | |
| # Save as JSON | |
| with open("chat_dataset.json", "w") as f: | |
| json.dump(chat_dataset, f, indent=2) | |
| # Save as CSV | |
| with open("chat_dataset.csv", "w", newline="", encoding="utf-8") as f: | |
| writer = csv.DictWriter(f, fieldnames=["user", "bot"]) | |
| writer.writeheader() | |
| writer.writerows(chat_dataset) | |
| print(f"β Chat dataset created with {len(chat_dataset)} conversations") | |
| print("π Files generated:") | |
| print(" - chat_dataset.json") | |
| print(" - chat_dataset.csv") | |
| print("\nπ Sample conversations:") | |
| for i, conv in enumerate(chat_dataset[:5]): | |
| print(f"{i+1}. User: {conv['user']}") | |
| print(f" Bot: {conv['bot']}") | |
| print() |