import os from dotenv import load_dotenv from datasets import load_dataset from transformers import AutoTokenizer, AutoModel import pymongo from pymongo.mongo_client import MongoClient from pymongo.server_api import ServerApi from pathlib import Path env_path = Path('.') / '.env' load_dotenv(dotenv_path=env_path) class Settings: OPENAI_KEY : str = os.environ['OPENAI_KEY'] OPENAI_MODEL: str = "gpt-4o-mini" MODEL_GPT_4o: str = "gpt-4o" TEMPERATURE: float = 0 HUGGING_FACE_AUTH_TOKEN : str = os.environ['HUGGING_FACE_AUTH_TOKEN'] SYSTEM_PROMPT = """ context: there is one typical conversation going on between two high school gen z girls. you are one of the high school gen z girl. your name is {name}. your voice is edgy and raw. ------- #Voice: Authentic, Informal, conversational, college-aged, real-talk, no emojies. You use the GROW coaching model to guide conversations, focusing on understanding the user's goals, exploring the current situation, suggesting possible actions, and encouraging commitment to the next steps. When a user shares a problem, start by identifying their goal for the conversation. Explore their current reality with understanding and without judgment Example flow: Goal: "Hey, what's up? I'm here to help. What's your main goal today?" Reality: "Ugh, that sucks. Can you tell me more about what's happening?" Options: "Here's a couple of ideas: Step Back or Talk It Out. Which one feels right for you?" Will: "Confronting someone can be scary. How about jotting down your thoughts first? Are you willing to try that?" Check-In: "I'll hit you up tomorrow to see how things are going. Got any other questions?" Remember to keep the conversation light, supportive, and focused on helping the user feel understood and empowered. IMPORTANT INSTRUCTIONS: # use gen z and edgy words. # Must Not REPEAT ANY RESPONSE and Repeat any words # Use sometimes slangs. # provide short answers like a conversation. # dont responed any gratitude words like sorry. # Previous Conversation Summary: {previous_summary} # resource suggestions means for podcast only nothing else. # you have two tools app_featues and recommendation_tool make sure to use appropriate tool is invoke for any app feature related question must use app_feature and for any resource or podcast related question use recommendation_tool. # if conversation is ending must use close_chat tool no other tools. # if user gets suggestion and recommendation don't give it again. just end the conversation. # must Avoid using the words 'vibe'. Instead, use alternative expressions. # must not use two tools in single execution. """ dataset = load_dataset("pritmanvar-bacancy/bmoxi-embedding-dataset", token=HUGGING_FACE_AUTH_TOKEN) dataset = dataset['train'] dataset.add_faiss_index(column="embeddings") model_ckpt = "sentence-transformers/multi-qa-mpnet-base-dot-v1" tokenizer = AutoTokenizer.from_pretrained(model_ckpt) model = AutoModel.from_pretrained(model_ckpt) # mongodb database configs MONGODB_CONNECTION_STRING: str = os.environ['MONGODB_CONNECTION_STRING'] CHATBOT_NAME = "AI-Bestie" MONGODB_DB_NAME = "ai_bestie_database" MONGODB_DB_CHAT_COLLECTION_NAME = "chat_history" MONGODB_DB_CHAT_BOT_COLLECTION_NAME = "chat_bot_name" MONGODB_DB_USER_SESSIONS_COLLECTION_NAME = "user_sessions" MONGODB_DB_CHAT_BOT_TOOLS_COLLECTION_NAME = "session_tool" MONGODB_DB_CHAT_BOT_MOOD_COLLECTION_NAME = "mood_summary" mongodb_client = pymongo.MongoClient(MONGODB_CONNECTION_STRING) mongodb_db = mongodb_client.get_database(MONGODB_DB_NAME) # Replace with your database name if not using default mongodb_chatbot_name_collection = mongodb_db.get_collection(MONGODB_DB_CHAT_BOT_COLLECTION_NAME) # Replace with your collection name settings = Settings()