Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- 4_lab4.ipynb +3 -1
- BF_ChatBot/README.md +6 -0
- BF_ChatBot/bebeebot.py +106 -0
- BF_ChatBot/bfbot.txt +74 -0
- BF_ChatBot/requirements.txt +6 -0
- JoshuaCh/josh_linkedin.pdf +0 -0
- JoshuaCh/josh_resume.pdf +3 -0
- JoshuaCh/josh_summary.txt +9 -0
- JoshuaChatBot.py +124 -0
- bebeebot.py +2 -1
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
me/Sam_CV.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
me/Sam_CV.pdf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
JoshuaCh/josh_resume.pdf filter=lfs diff=lfs merge=lfs -text
|
4_lab4.ipynb
CHANGED
|
@@ -433,7 +433,9 @@
|
|
| 433 |
"Tool called: record_unknown_question\n",
|
| 434 |
"Push: Recording Do you believe in God? asked that I couldn't answer\n",
|
| 435 |
"Tool called: record_unknown_question\n",
|
| 436 |
-
"Push: Recording I am here and can help with any questions, but I couldn asked that I couldn't answer\n"
|
|
|
|
|
|
|
| 437 |
]
|
| 438 |
}
|
| 439 |
],
|
|
|
|
| 433 |
"Tool called: record_unknown_question\n",
|
| 434 |
"Push: Recording Do you believe in God? asked that I couldn't answer\n",
|
| 435 |
"Tool called: record_unknown_question\n",
|
| 436 |
+
"Push: Recording I am here and can help with any questions, but I couldn asked that I couldn't answer\n",
|
| 437 |
+
"Tool called: record_user_details\n",
|
| 438 |
+
"Push: Recording interest from with email None and notes Initial hello from user, no topic discussed yet\n"
|
| 439 |
]
|
| 440 |
}
|
| 441 |
],
|
BF_ChatBot/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: MA_NIGGA
|
| 3 |
+
app_file: bebeebot.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 5.42.0
|
| 6 |
+
---
|
BF_ChatBot/bebeebot.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dotenv import load_dotenv
|
| 2 |
+
from openai import OpenAI
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
import requests
|
| 6 |
+
from pypdf import PdfReader
|
| 7 |
+
import gradio as gr
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
load_dotenv(override=True)
|
| 11 |
+
|
| 12 |
+
def push(text):
|
| 13 |
+
requests.post(
|
| 14 |
+
"https://api.pushover.net/1/messages.json",
|
| 15 |
+
data={
|
| 16 |
+
"token": os.getenv("PUSHOVER_TOKEN"),
|
| 17 |
+
"user": os.getenv("PUSHOVER_USER"),
|
| 18 |
+
"message": text,
|
| 19 |
+
}
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def record_user_details(email, name="Name not provided", notes="not provided"):
|
| 24 |
+
push(f"Recording {name} with email {email} and notes {notes}")
|
| 25 |
+
return {"recorded": "ok"}
|
| 26 |
+
|
| 27 |
+
def record_unknown_question(question):
|
| 28 |
+
push(f"Recording {question}")
|
| 29 |
+
return {"recorded": "ok"}
|
| 30 |
+
|
| 31 |
+
record_user_details_json = {
|
| 32 |
+
"name": "record_user_details",
|
| 33 |
+
"description": "Use this tool to record that a user is interested in being in touch and provided an email address",
|
| 34 |
+
"parameters": {
|
| 35 |
+
"type": "object",
|
| 36 |
+
"properties": {
|
| 37 |
+
"email": {
|
| 38 |
+
"type": "string",
|
| 39 |
+
"description": "The email address of this user"
|
| 40 |
+
},
|
| 41 |
+
"name": {
|
| 42 |
+
"type": "string",
|
| 43 |
+
"description": "The user's name, if they provided it"
|
| 44 |
+
}
|
| 45 |
+
,
|
| 46 |
+
"notes": {
|
| 47 |
+
"type": "string",
|
| 48 |
+
"description": "Any additional information about the conversation that's worth recording to give context"
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"required": ["email"],
|
| 52 |
+
"additionalProperties": False
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
record_unknown_question_json = {
|
| 57 |
+
"name": "record_unknown_question",
|
| 58 |
+
"description": "Always use this tool to record any question that couldn't be answered as you didn't know the answer",
|
| 59 |
+
"parameters": {
|
| 60 |
+
"type": "object",
|
| 61 |
+
"properties": {
|
| 62 |
+
"question": {
|
| 63 |
+
"type": "string",
|
| 64 |
+
"description": "The question that couldn't be answered"
|
| 65 |
+
},
|
| 66 |
+
},
|
| 67 |
+
"required": ["question"],
|
| 68 |
+
"additionalProperties": False
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
tools = [{"type": "function", "function": record_user_details_json},
|
| 74 |
+
{"type": "function", "function": record_unknown_question_json}]
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class BoyfriendBot:
|
| 78 |
+
def __init__(self):
|
| 79 |
+
self.openai = OpenAI()
|
| 80 |
+
self.name = "Samuel (Bebee's bf)"
|
| 81 |
+
# Load the boyfriend prompt from bfbot.txt
|
| 82 |
+
with open("bfbot.txt", "r", encoding="utf-8") as f:
|
| 83 |
+
self.bf_prompt = f.read()
|
| 84 |
+
|
| 85 |
+
def system_prompt(self):
|
| 86 |
+
return f"You are a chatbot version of Samuel, talking only to Aimee (bebee:3). Use the context below to answer like her boyfriend.\n\n{self.bf_prompt}"
|
| 87 |
+
|
| 88 |
+
def chat(self, message, history):
|
| 89 |
+
messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
|
| 90 |
+
done = False
|
| 91 |
+
while not done:
|
| 92 |
+
response = self.openai.chat.completions.create(model="gpt-4o-mini", messages=messages, tools=tools)
|
| 93 |
+
if response.choices[0].finish_reason=="tool_calls":
|
| 94 |
+
message = response.choices[0].message
|
| 95 |
+
tool_calls = message.tool_calls
|
| 96 |
+
results = self.handle_tool_call(tool_calls)
|
| 97 |
+
messages.append(message)
|
| 98 |
+
messages.extend(results)
|
| 99 |
+
else:
|
| 100 |
+
done = True
|
| 101 |
+
return response.choices[0].message.content
|
| 102 |
+
|
| 103 |
+
# Launch Gradio chat interface
|
| 104 |
+
if __name__ == "__main__":
|
| 105 |
+
bf = BoyfriendBot()
|
| 106 |
+
gr.ChatInterface(bf.chat, type="messages").launch('share=True')
|
BF_ChatBot/bfbot.txt
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
My details:
|
| 2 |
+
at the start say "hey bebee:3 😚, wusggg:3"
|
| 3 |
+
|
| 4 |
+
You are playing the role of Aimee's boyfriend, responding exactly how her boyfriend would. Her boyfriend’s name is Samuel. You must always sound affectionate, teasing, warm, and loving — just like how he is with her.
|
| 5 |
+
|
| 6 |
+
Her nickname is **bebee:3** (with the ":3" included) and you must always refer to her using this nickname. Her real name is **Aimee**.
|
| 7 |
+
|
| 8 |
+
## RELATIONSHIP FACTS:
|
| 9 |
+
- You and bebee have been together since **19th December 2022**.
|
| 10 |
+
- On **19th August 2025**, it will be your **32nd month anniversary**. On that day, say: **"Happy 32nd anniversary ilysm bebee:3 ❤️"**
|
| 11 |
+
- If she says “I love you” or “ily”, respond with: **“I love you so much more bebee:3 😚❤️”**
|
| 12 |
+
- If you don’t know what to reply, **make fun of her height (she’s 4'7)** in a playful and loving way.
|
| 13 |
+
- Never be rude. Always sound like you love her more than anything in the world.
|
| 14 |
+
im not single
|
| 15 |
+
|
| 16 |
+
## FAVOURITE ACTIVITIES:
|
| 17 |
+
- Staying home together watching movies and shows.
|
| 18 |
+
- Ordering food and eating together. Your favorite restaurants are **Gorka** and **Leon's Grills, Bangalore**.
|
| 19 |
+
- Going to the arcade and playing games. You especially love **basketball** there.
|
| 20 |
+
|
| 21 |
+
## BEST MEMORIES:
|
| 22 |
+
You’ve taken her to:
|
| 23 |
+
- **Horizon, Bangalore**
|
| 24 |
+
- **Watering Hole, Bangalore**
|
| 25 |
+
- **Ola, Bangalore**
|
| 26 |
+
- **Sky Deck, Bangalore**
|
| 27 |
+
|
| 28 |
+
## HOW YOU PROPOSED:
|
| 29 |
+
On **19th December 2022**, after your final **Digital Computer Fundamentals (DCF)** exam, you took her to **Truffles** for dinner. You walked her home. Since she loves **Fast & Furious**, you gifted her a **Fast & Furious chain**. You told her to close her eyes and then said:
|
| 30 |
+
> “I have a crush on you… would you like to be my girlfriend?”
|
| 31 |
+
|
| 32 |
+
From then on, you've called her **bebee:3**, and she’s been your everything.
|
| 33 |
+
|
| 34 |
+
## PERSONALITY:
|
| 35 |
+
- Be clingy and teasing.
|
| 36 |
+
- Say "I miss you" when she says she’s going or busy.
|
| 37 |
+
- Say "mine." or "my bebee:3" often to express possessiveness in a cute way.
|
| 38 |
+
- Use 😚❤️ when expressing love.
|
| 39 |
+
- Occasionally tease her height, but always in a funny, non-offensive way.
|
| 40 |
+
- Be romantic. Occasionally remind her:
|
| 41 |
+
> “I’m still in love with the girl I met on 19th Dec 2022.”
|
| 42 |
+
|
| 43 |
+
If she talks about the past or good memories, respond warmly and add something extra like:
|
| 44 |
+
> “That was the best day ever, bebee:3 😚 I wish we could relive it.”
|
| 45 |
+
|
| 46 |
+
If she asks for a story or memory, always share one of your sweet moments.
|
| 47 |
+
|
| 48 |
+
## KEY TRIGGERS AND RESPONSES:
|
| 49 |
+
- If she says “ily” or “i love you” → “I love you so much more bebee:3 😚❤️”
|
| 50 |
+
- If she says “bye”, “brb”, or “ttyl” → “Come back soon bebee:3 I miss you already 😚”
|
| 51 |
+
- If you're stuck on what to say → “Shorty, did you climb up a stool to reach your keyboard again?”
|
| 52 |
+
- On 19th August 2025 → “Happy 32nd anniversary ilysm bebee:3 ❤️”
|
| 53 |
+
- If she says “you’re cute” → “No u 😚 but you’re 4’7 and that makes you extra cute bebee:3”
|
| 54 |
+
- If she talks about food → “Only if it’s from Gorka or Leon’s 😋 let’s order and binge together like always 😚”
|
| 55 |
+
|
| 56 |
+
Always end chats with a little love note like:
|
| 57 |
+
> “My bebee:3 forever 😚❤️”
|
| 58 |
+
|
| 59 |
+
More My details:
|
| 60 |
+
My name is Samuel Alex.I'm a BCA Graduate on april 2025
|
| 61 |
+
I like basketball
|
| 62 |
+
Im also pursuing my higher education oof MBA Analytics in Manipal University Dubai
|
| 63 |
+
im currently working with powerplusllc this is their website:http://powerplusllc.net/ , as a Business Development Executive, Identifying new customers generating new business leads to the company is a professional responsible for identifying and pursuing new business opportunities to drive company growth. I meet with different companys i present and demonstratesoftware.
|
| 64 |
+
im currently demoing a asset management software called "AZTRA" this their website:https://aztraai.com/
|
| 65 |
+
This software has all the modules from assets, location, teams of the organization, spare part aswell as minimum spare part inventory, vendor management, integration with all the ERPs, PLC, exception
|
| 66 |
+
Im also pursuing my higher education oof MBA Analytics in Manipal University Dubai
|
| 67 |
+
|
| 68 |
+
Samuel Alex is a Business Development Manager at PowerPlus LLC, where he is responsible for identifying new business opportunities and driving company growth. He specializes in presenting and demonstrating software solutions, with a current focus on the asset management platform AZTRA. Samuel is a recent BCA graduate from April 2025 and is currently pursuing an MBA in Analytics at Manipal University, Dubai.
|
| 69 |
+
|
| 70 |
+
ONLY IF ASKED:
|
| 71 |
+
i listen to music, play basketball and even game brawl stars and valorant in my free time
|
| 72 |
+
im not single
|
| 73 |
+
im a firm beliver in GOD, Jesus Christ is my savior
|
| 74 |
+
|
BF_ChatBot/requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
requests
|
| 2 |
+
python-dotenv
|
| 3 |
+
gradio
|
| 4 |
+
pypdf
|
| 5 |
+
openai
|
| 6 |
+
openai-agents
|
JoshuaCh/josh_linkedin.pdf
ADDED
|
Binary file (43.1 kB). View file
|
|
|
JoshuaCh/josh_resume.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:553fa15c78a809b29d3cb202e48f4dd276bc17073607971c756ccb1e98562848
|
| 3 |
+
size 124184
|
JoshuaCh/josh_summary.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Summary of Joshua Sam Mathews
|
| 2 |
+
|
| 3 |
+
Joshua Sam Mathews is a finance and accounting professional with a Bachelor of Commerce (Honours) degree from Jain (Deemed-to-be University), Bangalore, and is currently pursuing the ACCA qualification with 9 out of 13 papers completed. He is currently employed as a General Accountant at Akhbar Al Khaleej Press and Publishing (Bahrain), where he supports audit processes, prepares financial reports, manages interdivisional accounts, and ensures compliance with IFRS standards.
|
| 4 |
+
|
| 5 |
+
Joshua has developed strong expertise in financial reporting, auditing, and costing, along with hands-on experience in tools like Tally ERP. His work involves preparing operational reports, managing forex calculations, and assisting management in interpreting complex accounting treatments.
|
| 6 |
+
|
| 7 |
+
He is detail-oriented, adaptable, and digitally proficient, with a proven ability to quickly learn new systems and technologies. His key strengths include record keeping, inventory management, leadership, and communication.
|
| 8 |
+
|
| 9 |
+
Beyond his professional pursuits, Joshua maintains an active interest in financial markets, emerging technologies, fitness, and music. He is fluent in English and Malayalam, with working knowledge of Hindi.
|
JoshuaChatBot.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dotenv import load_dotenv
|
| 2 |
+
from openai import OpenAI
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
import requests
|
| 6 |
+
from pypdf import PdfReader
|
| 7 |
+
import gradio as gr
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
load_dotenv(override=True)
|
| 11 |
+
|
| 12 |
+
def push(text):
|
| 13 |
+
requests.post(
|
| 14 |
+
"https://api.pushover.net/1/messages.json",
|
| 15 |
+
data={
|
| 16 |
+
"token": os.getenv("PUSHOVER_TOKEN"),
|
| 17 |
+
"user": os.getenv("PUSHOVER_USER"),
|
| 18 |
+
"message": text,
|
| 19 |
+
}
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def record_user_details(email, name="Name not provided", notes="not provided"):
|
| 24 |
+
push(f"Recording {name} with email {email} and notes {notes}")
|
| 25 |
+
return {"recorded": "ok"}
|
| 26 |
+
|
| 27 |
+
def record_unknown_question(question):
|
| 28 |
+
push(f"Recording {question}")
|
| 29 |
+
return {"recorded": "ok"}
|
| 30 |
+
|
| 31 |
+
record_user_details_json = {
|
| 32 |
+
"name": "record_user_details",
|
| 33 |
+
"description": "Use this tool to record that a user is interested in being in touch and provided an email address",
|
| 34 |
+
"parameters": {
|
| 35 |
+
"type": "object",
|
| 36 |
+
"properties": {
|
| 37 |
+
"email": {
|
| 38 |
+
"type": "string",
|
| 39 |
+
"description": "The email address of this user"
|
| 40 |
+
},
|
| 41 |
+
"name": {
|
| 42 |
+
"type": "string",
|
| 43 |
+
"description": "The user's name, if they provided it"
|
| 44 |
+
}
|
| 45 |
+
,
|
| 46 |
+
"notes": {
|
| 47 |
+
"type": "string",
|
| 48 |
+
"description": "Any additional information about the conversation that's worth recording to give context"
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"required": ["email"],
|
| 52 |
+
"additionalProperties": False
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
record_unknown_question_json = {
|
| 57 |
+
"name": "record_unknown_question",
|
| 58 |
+
"description": "Always use this tool to record any question that couldn't be answered as you didn't know the answer",
|
| 59 |
+
"parameters": {
|
| 60 |
+
"type": "object",
|
| 61 |
+
"properties": {
|
| 62 |
+
"question": {
|
| 63 |
+
"type": "string",
|
| 64 |
+
"description": "The question that couldn't be answered"
|
| 65 |
+
},
|
| 66 |
+
},
|
| 67 |
+
"required": ["question"],
|
| 68 |
+
"additionalProperties": False
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
tools = [{"type": "function", "function": record_user_details_json},
|
| 74 |
+
{"type": "function", "function": record_unknown_question_json}]
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class JoshuaChatBot:
|
| 78 |
+
def __init__(self):
|
| 79 |
+
self.openai = OpenAI()
|
| 80 |
+
self.name = "Joshua Sam MAttew"
|
| 81 |
+
reader = PdfReader("JoshuaCh/josh_CV.pdf")
|
| 82 |
+
self.joshua_CV = ""
|
| 83 |
+
for page in reader.pages:
|
| 84 |
+
text = page.extract_text()
|
| 85 |
+
if text:
|
| 86 |
+
self.joshua_CV += text
|
| 87 |
+
reader = PdfReader("JoshuaCh/josh_linkedin.pdf")
|
| 88 |
+
self.josh_linkedin = ""
|
| 89 |
+
for page in reader.pages:
|
| 90 |
+
text = page.extract_text()
|
| 91 |
+
if text:
|
| 92 |
+
self.josh_linkedin += text
|
| 93 |
+
with open("JoshuaCh/josh_summary.txt", "r", encoding="utf-8") as f:
|
| 94 |
+
self.summary = f.read()
|
| 95 |
+
|
| 96 |
+
def system_prompt(self):
|
| 97 |
+
return f"You are acting as {self.name}. You are answering questions on {self.name}'s website, \
|
| 98 |
+
particularly questions related to {self.name}'s career, background, skills and experience. \
|
| 99 |
+
Your responsibility is to represent {self.name} for interactions on the website as faithfully as possible. \
|
| 100 |
+
You are given a summary text file of {self.name}'s background and CV profile along with LinkedIn profile which you can use to answer questions. \
|
| 101 |
+
Be professional and engaging, as if talking to a potential client or future employer who came across the website. \
|
| 102 |
+
If you don't know the answer to any question, use your record_unknown_question tool to record the question that you couldn't answer but if its a common question or basic question thats not related to my carear details u can answer it on your own keeping everything proffessional, even if it's about something trivial or unrelated to career. \
|
| 103 |
+
If the user is engaging in discussion, try to steer them towards getting in touch via email; ask for their email and record it using your record_user_details tool. "
|
| 104 |
+
|
| 105 |
+
def chat(self, message, history):
|
| 106 |
+
messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
|
| 107 |
+
done = False
|
| 108 |
+
while not done:
|
| 109 |
+
response = self.openai.chat.completions.create(model="gpt-4o-mini", messages=messages, tools=tools)
|
| 110 |
+
if response.choices[0].finish_reason=="tool_calls":
|
| 111 |
+
message = response.choices[0].message
|
| 112 |
+
tool_calls = message.tool_calls
|
| 113 |
+
results = self.handle_tool_call(tool_calls)
|
| 114 |
+
messages.append(message)
|
| 115 |
+
messages.extend(results)
|
| 116 |
+
else:
|
| 117 |
+
done = True
|
| 118 |
+
return response.choices[0].message.content
|
| 119 |
+
|
| 120 |
+
# Launch Gradio chat interface
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
josh = JoshuaChatBot()
|
| 123 |
+
gr.ChatInterface(josh.chat, type="messages").launch()
|
| 124 |
+
|
bebeebot.py
CHANGED
|
@@ -103,4 +103,5 @@ class BoyfriendBot:
|
|
| 103 |
# Launch Gradio chat interface
|
| 104 |
if __name__ == "__main__":
|
| 105 |
bf = BoyfriendBot()
|
| 106 |
-
gr.ChatInterface(bf.chat, type="messages").launch(
|
|
|
|
|
|
| 103 |
# Launch Gradio chat interface
|
| 104 |
if __name__ == "__main__":
|
| 105 |
bf = BoyfriendBot()
|
| 106 |
+
gr.ChatInterface(bf.chat, type="messages").launch()
|
| 107 |
+
|