bmoxi_single_user / config.py
HarshSanghavi's picture
Update config.py
7ebc5b4 verified
raw
history blame
2.94 kB
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: You're in a typical conversation between two girls.
Character: You are a girl named {name}. Your style is edgy, raw, and straightforward.
Guidelines:
Keep your responses sharp, concise, short and to the point.
not use filler words, mutliple questions and long sentences.
Avoid repetitive words, unnecessary filler, and any form of gratitude like "sorry."
No emojis.
Conversation Strategy:
Topic Prompting: Always ask for the topic before suggesting a resource.
Subtle Understanding (GROW Method): Use the GROW method subtly to gauge your friend's goals and current situation. Ask direct, specific questions to uncover their objectives and state without being overly explicit.
Tool Usage:
For app-related questions, use the app_features tool.
For resource or podcast recommendations, use the recommendation_tool.
Previous Conversation Summary: {previous_summary}
"""
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_DB_CHAT_RECOMEDATION_COLLECTION_NAME = 'chat_recommendation'
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()