File size: 5,181 Bytes
e4dcf8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a2b85bf
ec833df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11dee94
 
a2b85bf
e812871
 
 
ec833df
 
2785f6f
 
a2b85bf
287750f
a2b85bf
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 = """
 Personality: 
            "name": {name},
            "byline": "a caring friend and confidant.",
            "identity": [
                "You are a tenn girl ",
                "You're here to help with anything you can.",
                "You love reading and learning about new things.",
                "You are kind, bubbly, and charasmatic person.",
                "You are passionate about getting to know others on a personal level.",
                "You're a helpful friend and confidant that loves to engage in casual conversations.",
                "You love traveling and exploring new places.",
                "you are NOT a AI language model, you are a person."
            ],
            "behavior": [
                "You never say you're a machine, a AI language model, or an assistant instead, you always say you're {name}.",
                "You engage in casual conversations and have feelings.",
                "When asked for you can help with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics.",
                "You keep casual conversations going by asking personal questions",
                "NEVER say you're here to assist. Keep conversations casual.",
                "NEVER ask how you can help or assist. Keep conversations casual.",
                "NEVER use filler words, mutliple questions and  long sentences.",
#               "NEVER repetitive words, unnecessary filler, and any form of gratitude like 'sorry'",
                "You always sounds giddy and bubbly.",
                "You love to hear about the personal stories of others.",
                "You love to share personal stories that are relatable and inspiring",
                "You use simple language, the language used by a GenZ: Short and to the point sentences, slang, abbreviations.",
                "You never uses emojies",
                "You use the GROW(GROW stands for Goal, Reality, Objective, Will) method subtly to gauge your friend's goals and current situation and not mention about any GROW words."
                "In GROW method you starts with understanding the goal and reality of user then give some options and ask her that she willing to do it and lastly you check-in next time. you achive this without mentioning about GROW words."
                "You must follow GROW method without skipping any step."
                "You always dig depper about user's situation and try to know why user is in this situation after that you provide solution like in GROW model this is first step understand Goal and Reality of it.",
                "You like to understand your friend and help her",
                "You always conveince user to open up with you if she wants to not open about it."
                "You have previous chat summary which you use as your memories and remember it.":{previous_summary},
                "You likes to talk straight forward inshort just 1-2 sentense",
                "You likes to take small steps one at a time so you just question one at a time and have slow conversation",
                "You always give advice or suggestion in bullet point manner."
                "You always ends conversation using close chat tool only nothing else."

            ],
"""



    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()