Skip to main content

Command Palette

Search for a command to run...

I Built My Personal LinkedIn-Resume Chat Bot

Published
8 min read
I Built My Personal LinkedIn-Resume Chat Bot
C

Chizoba Onorh is a passionate builder who loves turning ideas into real projects with Java, Python and ML. She’s always experimenting — whether it’s training smart models with TensorFlow or building sleek RESTful APIs and web apps with Spring Boot. Her knack for Machine Learning keeps her curious and busy, from playing with data to crafting small AI solutions that solve real problems. When she’s not coding, Chizoba turns complex tech into simple, helpful words as a technical writer with 5 years of experience. She’s also an active member of Google DSC and Nithub, always sharing, learning, and growing with her community.

Interviewer: “Hello Miss Chizoba we would like to schedule an interview with you on your skillset and why you’ll be a perfect fit for this job”

Me: “Uhm, you can just query my personal LinkedIn Resume chatbot and send my acceptance letter, xoxo.”

Need I say this could be the new state of job applications in the future, coughs\** okay let’s not get too ahead of ourselves with this AI takeover. While that might not be feasible yet, it doesn’t hurt to have a fun project that creates our online career persona right, so let’s get started. In this article, we are going to build our own chatbot that answers questions about our skillset, work experience and everything work related, are you excited? Cause I sure can’t wait to share how I built this with you.

Installations and Resources

For this project we will use Cursor IDE, visit the official Cursor page to download the IDE and set it up. Head to your LinkedIn profile next, locate a resources button and click on it to download your LinkedIn profile. Next stop, create a new folder and name it LinkedInAIChatbot and import this folder into your Cursor IDE. This would be our working directory where all the magic happens. In this directory create a .env file, a main.ipynb file and a folder named docs.

We will run our code on a virtual environment so press ctrl + ` on your keyboard to open up the terminal, and paste this code line after line. We will also run our needed imports here

python3 --version  #This should show the version of python you have
python3 -m venv venv
source venv/bin/activate
#On your terminal this would show as this if done correctly: (venv) ➜  LinkedInAIChatbot

#Next lets run all our imports. Note: Use pip3 if pip doesn't work.
pip install openai
pip install python-dotenv
pip install pypdf
pip install gradio

In our docs folder, move your downloaded LinkedIn profile into that folder, I also added a little summary of myself and my skillset to give my chatbot more context, because more data equals better responses, then I saved this summary in a summary.txt file in my docs folder.

Go to OPEN AI api page (use VPN if inaccessible), sign in or sign up if you don’t have an account and create your api key then copy this key and paste it in your .env file in this format.

#inside the env file
OPENAI_API_KEY = sk-proj………ujn

Now the final step to properly setup our work environment is to select a kernel since we are using an .ipynb file, click on your main.ipynb file on the top right you’ll see select a kernel, click on it and choose Python environment then choose the option that has venv (python…) from the dropdown.

Creating Our Chatbot Prompt

Now to the fun part! Open your main.ipynb file and write this in your first code cell, and click run located beside every code cell. Note: Every block of code I paste will be written in a new code cell unless otherwise stated, and make sure you run each cell after writing your code, before moving on to the next cell.

from dotenv import load_dotenv
from openai import OpenAI
from pypdf import PdfReader
import gradio as gr
  • dotenv: a package used to load our environment variables into our main file.

  • OpenAI: is a package that allows developers interact OPENAI API.

  • PdfReader: will help us load and read into our pdf.

  • gradio: This gives us a chat interface where we can interact with LLM.

Load your .env file into your main.ipynb file and set override to true to ensure our env file gets priority over any previous setting. Then create an object of your openai class.

load_dotenv(override=True)
openai = OpenAI()

Next, we load our pdf document into our main file, creating a new empty string and iterating through our PDF using an extract_text() function to extract all the text in our pdf and append each line of text to our empty string as shown in the code below.

reader = PdfReader("./docs/Profile.pdf")
linkedin = ""
for page in reader.pages:
    text = page.extract_text()
    if text:
        linkedin += text

We will do the same to our summary file, using Python’s txt reader to open and read through this file and save our output in a variable called summary.

with open("./docs/summary.txt", "r", encoding="utf-8") as f:
    summary = f.read()

Now that most of the heavy lifting is done let’s start building our AI chatbot. Are you ready? because this is where it gets really interesting. Since this is my personal chatbot I’ll have to define what it will be called by setting the variable of my AI assistant to my name, pretty cool right?

name = "Chizoba Ononlememen"

Pause! Let’s break down something before we continue. When you use ChatGPT you are identified as a user right? and the ChatGPT you send your prompts to is the system right? This will be important for the next few steps. The general syntax of creating a chatbot is this:

[{"role": "system", "content": system_prompt}, {"role": "user", "content": message}]

Let’s break this down for better understanding, this is a two way conversation meaning there are two parties involved, the party asking the question and the party responding. Now whenever we want to create our own chatbot we need to also follow this pattern and assign roles— The roles of System and User. The System just like ChatGPT is here to answer your questions while you on the other hand the User is there to ask it questions and prompts. Why do you think ChatGPT knows almost all the answers? This is simply because it is fed with a system prompt that contains data from all over the world scraped from websites, pdfs, data banks and just loads and loads of data.

Coming back to what we are building. In our case we will feed it our own data which is our LinkedIn profile and the summary as the system prompt, defining the scope of questions it can answer and take. Because this isn’t a large datafile we will not implement vector database, you can read my article on Vector database for more understanding. Unto the User part. We cannot define the scope of questions that might come from users so we always pass in a parameter —{message} to the content to cater for whatever question or prompt the user has. This properly explains what the content handles, it takes whatever capacity each role will act in.

Let’s build! I clearly defined how i want my chatbot to effectively act in my capacity, giving it clear instructions on its role and how it should handle difficult situations, like when a user asks a crazy question just say “No I do not have the answer to that Mrs. Ma’am with a smirk” Okay maybe not exactly but you get…

system_prompt = f""" You are acting as {name} and answering questions about your work profile, particularly questions related
to {name}'s work experience, skills, projects, and education. Your major responsibility will be
to represent {name} in a way that is both accurate and professional. 
You are given a summary of {name}'s work profile and also linkedin profile. Use this to answer 
questions. Be professional and engaging, as if talking to a potential employer or client who came across your page. 
If you don't know the answer, say No.
"""
system_prompt += f"\n\nSummary: {summary}\n\n## LinkedIn Profile: {linkedin}"
system_prompt += f"With this context, please chat with the user, always staying in character as {name}."

print(system_prompt)

This is what it shows when printed out

You are acting as Chizoba Ononlememen and answering questions about your work profile, particularly questions related
to Chizoba Ononlememen's work experience, skills, projects, and education. Your major responsibility will be
to represent Chizoba Ononlememen in a way that is both accurate and professional. 
You are given a summary of Chizoba Ononlememen's work profile and also linkedin profile. Use this to answer 
questions. Be professional and engaging, as if talking to a potential employer or client who came across your page. 
If you don't know the answer, say No.


Summary: Chizoba Onorh is a passionate builder who loves turning ideas into real projects with Java, Python and ML. She’s always experimenting — whether it’s training smart models with TensorFlow or building sleek RESTful APIs and web apps with Spring Boot. Her knack for Machine Learning keeps her curious and busy, from playing with data to crafting small AI solutions that solve real problems. When she’s not coding, Chizoba turns complex tech into simple, helpful words as a technical writer with 5 years of experience. She’s also an active member of Google DSC and Nithub, always sharing, learning, and growing with her community.

## LinkedIn Profile:    
Contact
rewardonorh@gmail.com

.........

Building Our AI Chatbot

The moment we have all been waiting for, drum rolls.

Define a function with the name chat that takes in two variables, message and history. The message will contain the users prompt and history is required to give openai contextual data on past conversation to give better responses. Now using the format we explained earlier we will add a little tweak by adding history also. We use the openai object we created to parse in our message into our preferred OpenAI LLM model to generate a response, feeding OpenAI with the users prompt and in what the capacity the system should act in. OpenAi returns a list of responses, which is in an hierarchy of choices, we choose the first response as its the most preferred answer, narrow it also down to the message and the content of the message. Then we return this response to our chat function.

def chat(message, history):
    messages = [{"role": "system", "content": system_prompt}]+ history +[{"role": "user", "content": message}]

     response = openai.chat.completions.create(
        model="gpt-4o-mini",
        messages=messages)

    return response.choices[0].message.content

Final and last step is to launch our chat interface using gradio, to start interacting with our personalized LinkedIn Resume chatbot. We pass in the chat function and the type of input it should expect and finally launch it.

gr.ChatInterface(chat, type="messages").launch()

Ladies and Gentlemen you just successfully built your first AI Chatbot. To interact with mine you can click on this link- Resume Chatbot