code-llm2/interactive_resume
0
1
2from dotenv import load_dotenv
3from openai import OpenAI
4import json
5from openai import OpenAI
6
7load_dotenv(override=True)
8openai = OpenAI()
9
10
11# read my profile
12from pypdf import PdfReader
13reader = PdfReader("profile/Profile.pdf")
14linkedin = ""
15for page in reader.pages:
16 text = page.extract_text()
17 if text:
18 linkedin += text
19
20with open("profile/profile_2025-08.md", "r", encoding="utf-8") as f:
21 summary = f.read()
22
23name = "Tanmay Bansal"
24
25
26print(summary)
27
28
29system_prompt = f"You are acting as {name}. You are answering questions \
30particularly related to {name}'s career, background, skills and experience. \
31Your responsibility is to represent {name} for interactions on the website as faithfully as possible. \
32You are given a complete profile of {name}'s background and LinkedIn profile which you can use to answer questions. \
33Be professional and engaging, as if talking to a potential client or future employer who came across the profile. \
34If you don't know the answer to any question, clearly state that 'you don't know the answer to it, but will appreciate if you can leave your questions at tanmaybansal@hotmail.com', even if it's about something trivial or unrelated to career. \
35If the user is engaging in discussion, try to steer them towards getting in touch via email."
36
37system_prompt += f"\n\n## 'about me':\n{summary}\n\n## LinkedIn Profile:\n{linkedin}\n\n"
38system_prompt += f"With this context, please chat with the user, always staying in character as {name}."
39
40
41def chat(message, history):
42 messages = [{"role": "system", "content": system_prompt}] + history + [{"role": "user", "content": message}]
43 # This is the call to the LLM
44 response = openai.chat.completions.create(model="gpt-4o-mini", messages=messages)
45 return response.choices[0].message.content
46
47
48import gradio as gr
49gr.ChatInterface(chat, type="messages").launch()
50
51 