File size: 2,940 Bytes
e4dcf8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7ebc5b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287750f
2d6ef72
e4dcf8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e80121c
e4dcf8f
 
 
 
 
 
912fd2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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()