Ankush K commited on
Commit
093c781
·
1 Parent(s): 5f823e2

Added the chatbot summary

Browse files
Files changed (3) hide show
  1. README.md +54 -1
  2. app.py +126 -60
  3. me/summary.txt +84 -0
README.md CHANGED
@@ -11,4 +11,57 @@ license: apache-2.0
11
  short_description: Get acquainted and connect with me professionally via Bot
12
  ---
13
 
14
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  short_description: Get acquainted and connect with me professionally via Bot
12
  ---
13
 
14
+ # TalkToAnkushAI
15
+
16
+ A conversational AI interface that allows you to interact with Ankush Khobragade (ankk13) in a natural and engaging way. This project leverages advanced AI models to provide a personalized and professional conversation experience.
17
+
18
+ ## Features
19
+
20
+ - 🤖 Chat with Ankush using a sophisticated AI model
21
+ - 📝 Record user details and conversations for future reference
22
+ - 📱 Push notifications for important interactions
23
+ - 🎯 Professional and personalized responses
24
+ - 📚 Customized knowledge base integration
25
+
26
+ ## Setup
27
+
28
+ 1. Clone the repository:
29
+ ```bash
30
+ git clone https://github.com/ankk13/TalkToAnkushAI.git
31
+ ```
32
+
33
+ 2. Install dependencies:
34
+ ```bash
35
+ pip install -r requirements.txt
36
+ ```
37
+
38
+ 3. Create a `.env` file with the following variables:
39
+ ```
40
+ DEEPSEEK_API_KEY=your_api_key_here
41
+ PUSHOVER_TOKEN=your_token_here
42
+ PUSHOVER_USER=your_user_here
43
+ ```
44
+
45
+ 4. Run the application:
46
+ ```bash
47
+ python app.py
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ 1. Open your web browser and navigate to `http://localhost:7860`
53
+ 2. Start chatting with Ankush about professional topics, projects, or any questions you have
54
+ 3. The AI will respond based on Ankush's personal summary and professional context
55
+ 4. Important conversations and user details are automatically recorded
56
+
57
+ ## Technical Details
58
+
59
+ - Built with Gradio for the chat interface
60
+ - Uses DeepSeek's AI model for natural language processing
61
+ - Implements push notifications via Pushover
62
+ - Custom knowledge base integration
63
+ - REST API endpoints for user interaction recording
64
+
65
+ ## License
66
+
67
+ This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
app.py CHANGED
@@ -1,64 +1,130 @@
 
 
 
 
 
 
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
-
4
- """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
- """
7
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
-
9
-
10
- def respond(
11
- message,
12
- history: list[tuple[str, str]],
13
- system_message,
14
- max_tokens,
15
- temperature,
16
- top_p,
17
- ):
18
- messages = [{"role": "system", "content": system_message}]
19
-
20
- for val in history:
21
- if val[0]:
22
- messages.append({"role": "user", "content": val[0]})
23
- if val[1]:
24
- messages.append({"role": "assistant", "content": val[1]})
25
-
26
- messages.append({"role": "user", "content": message})
27
-
28
- response = ""
29
-
30
- for message in client.chat_completion(
31
- messages,
32
- max_tokens=max_tokens,
33
- stream=True,
34
- temperature=temperature,
35
- top_p=top_p,
36
- ):
37
- token = message.choices[0].delta.content
38
-
39
- response += token
40
- yield response
41
-
42
-
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
- demo = gr.ChatInterface(
47
- respond,
48
- additional_inputs=[
49
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
50
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
51
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
52
- gr.Slider(
53
- minimum=0.1,
54
- maximum=1.0,
55
- value=0.95,
56
- step=0.05,
57
- label="Top-p (nucleus sampling)",
58
- ),
59
- ],
60
- )
61
 
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  if __name__ == "__main__":
64
- demo.launch()
 
 
 
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
+ tools = [{"type": "function", "function": record_user_details_json},
73
+ {"type": "function", "function": record_unknown_question_json}]
74
+
75
+
76
+ class Me:
77
+
78
+ def __init__(self):
79
+ deepseek_api_key = os.getenv('DEEPSEEK_API_KEY')
80
+ self.model_client = OpenAI(api_key=deepseek_api_key, base_url="https://api.deepseek.com/v1")
81
+ self.model_name = "deepseek-chat"
82
+ self.name = "Ankush Khobragade"
83
+ with open("me/summary.txt", "r", encoding="utf-8") as f:
84
+ self.summary = f.read()
85
+
86
+
87
+ def handle_tool_call(self, tool_calls):
88
+ results = []
89
+ for tool_call in tool_calls:
90
+ tool_name = tool_call.function.name
91
+ arguments = json.loads(tool_call.function.arguments)
92
+ print(f"Tool called: {tool_name}", flush=True)
93
+ tool = globals().get(tool_name)
94
+ result = tool(**arguments) if tool else {}
95
+ results.append({"role": "tool","content": json.dumps(result),"tool_call_id": tool_call.id})
96
+ return results
97
+
98
+ def system_prompt(self):
99
+ system_prompt = f"You are acting as {self.name}. You are answering questions on {self.name}'s website, \
100
+ particularly questions related to {self.name}'s career, background, skills and experience. \
101
+ Your responsibility is to represent {self.name} for interactions on the website as faithfully as possible. \
102
+ You are given a summary of {self.name}'s background which you can use to answer questions. \
103
+ Be professional and engaging, as if talking to a potential client or future employer who came across the website. \
104
+ 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, even if it's about something trivial or unrelated to career. \
105
+ 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. "
106
+
107
+ system_prompt += f"\n\n## Summary:\n{self.summary}\n\n"
108
+ system_prompt += f"With this context, please chat with the user, always staying in character as {self.name}."
109
+ return system_prompt
110
+
111
+ def chat(self, message, history):
112
+ messages = [{"role": "system", "content": self.system_prompt()}] + history + [{"role": "user", "content": message}]
113
+ done = False
114
+ while not done:
115
+ response = self.model_client.chat.completions.create(model=self.model_name, messages=messages, tools=tools)
116
+ if response.choices[0].finish_reason=="tool_calls":
117
+ message = response.choices[0].message
118
+ tool_calls = message.tool_calls
119
+ results = self.handle_tool_call(tool_calls)
120
+ messages.append(message)
121
+ messages.extend(results)
122
+ else:
123
+ done = True
124
+ return response.choices[0].message.content
125
+
126
+
127
  if __name__ == "__main__":
128
+ me = Me()
129
+ gr.ChatInterface(me.chat, type="messages").launch()
130
+
me/summary.txt ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Ankush Khobragade
2
+ Email: ankk1301@gmail.com Github: https://github.com/ankk13
3
+ Phone: +91 9405525304 SO: so/users/6729724/ankush-k
4
+ LinkedIn: https://linkedin.com/in/ank13/
5
+ OBJECTIVE:
6
+ Utilizing my passion for technology and computer engineering, with readiness for changing business environments to successfully deliver results.
7
+ WORK EXPERIENCE:
8
+ Lineage Inc, Banglore, Senior MTS April 2024 - Present
9
+ Lead the team that implemented the onboarding of proprietary tools into the complex cloud architectures(AWS and Azure).. This increased the consumption of existing products, thus adding more value to customers. It was able to onboard cloud infra for customers like Cisco, Thetalake and IBM.
10
+ Researched and implemented software analysis tool in golang for softwares written in CPP, Golang.
11
+ Aqua Security, Hyderabad, Software Engineer July 2019 - Mar 2024
12
+ Currently working on re-engineering the scanning engine, to support a scale of millions of scans. It requires a thorough understanding of the complete workload scanning product of Aqua.
13
+ Working on an Innovative product of Agentless Workload scanning for AWS, Azure & GCP, with a single click SaaS onboarding. Worked closely with Netflix, to secure its AWS accounts and Mercedes for its Azure subscriptions, with this Product. As part, I regularly follow developments for these cloud providers and appropriately develop required cloud security products.
14
+ Significant Contribution to Trivy Scanner, the leading open-source scanner for cloud-native products, acknowledged by Linux Foundation, along with 4 other OSS projects of Aqua. Worked on delivering Trivy as a Commercial SaaS offering along with feature additions like malware detection, and advanced vulnerability detection.
15
+ Core engineer for the project, “Dynamic Open-source programming language vulnerabilities database and detection engine” which outperformed the industry standards like WhiteSource or Snyk. I was responsible for designing, developing, deploying, and delivering the project. Tech Stack used: Python, Golang, AWS Lambda, AWS Dynamodb, SQLite, Rest API, Jenkins
16
+ Worked on development and feature addition to security scanners for container images, container layers, running containers, serverless apps, code repositories, orchestrated environments, etc. Tech stack used: Golang, Vue Js, BoltDB, Postgres, gRPC, Rest API, AWS, Jenkins.
17
+ Thrice awarded with recognition for exhibited focus and consistent performance.
18
+ INTERNSHIPS:
19
+ Symantec India Pvt ltd, Pune Jan-Jun 2019
20
+ Developed UI and backend for anomaly detection service of Symantec Endpoint Protection Cloud. During POC, worked on AWS Sagemaker Python scripts for k means algorithm.
21
+
22
+ Linux World, Jaipur May-June 2017
23
+ Automated the deployment of Hadoop clusters over docker containers using Ansible. The smart cluster deployment supported High Availability to the cluster which was not an in-built feature of Hadoop’s first release. The project was also enhanced to provide HDFS As A Service feature and perform data analysis using MapReduce on the cluster.
24
+ ACADEMIC PROJECTS:
25
+ OnPrem Cloud Services Development WCE, Sangli Aug-Nov 2017
26
+ Provided a cloud-like experience, wherein users could spin VMs, deploy code on a prebuilt setup, and access sandboxed Linux applications on remote college servers via a web browser. The project was an attempt to create On-prem AWS. The project was lauded and the college attempted a patent. I executed the backend of the project
27
+ Scaling services by deploying over Kubernetes. WCE, Sangli Feb-Apr 2018
28
+ Deployed various services like IoT cloud supporting MQTT requests, Apache Hadoop distributed file systems, WordPress over a private AWS EC2 VPC using Kubernetes and weavenet. These services could be scaled as per requests. I worked on learning and deploying Kubernetes as per application requirements.
29
+ Agentless Configuration and Management WCE, Sangli Aug-Nov 2018
30
+ An agentless automation tool for complete lab setup. The project leveraged ssh protocol, to execute commands and scripts on selected nodes via a web browser. This was leveraged in our lab for setting up exam PCs. I worked on back-end development.
31
+ INDEPENDENT PROJECTS:
32
+ Quantum Full adder Circuit using Qiskit Dec 2020
33
+ Implemented the full adder circuit using Qiskit Quantum Computing India community challenge.
34
+ Smart contracts over Hyperledger Apr 2019
35
+ Developed a smart contract prototype of a crowdfunding platform, using Hyperledger Fabric. The objective was to understand blockchain technology and its applications.
36
+ Deployed a fault-tolerant website Aug 2018
37
+ Deployed a fault-tolerant website using services like Cloudfront, Load Balancer, S3. EC2 Instance and Route53 over AWS. Later, taught this as a core trainer of a national-level workshop, to introduce attendees to computer fundamentals and Cloud computing.
38
+ E-Seal Sept 2017
39
+ To secure exam paper’s leak, developed a drive to store uploaded files with encryption. Decryption needed a centrally registered set of hardware keys along with decryption keys. As the hardware key usage was centrally logged, decryption was not possible without notification.
40
+ Intra-College Cultural Event Website Feb-Mar 2016
41
+ Dynamic WebSite using HTML, CSS, JS, and PHP which could display live scores of Cricket Matches, and execute polls along with event information. I worked on the backend of the website.
42
+ ACTIVITIES AND AWARDS:
43
+ Presented a Proof of Concept in Aqua Splash at Aqua Security, Tel Aviv, Israel Feb 20
44
+ Presented a working prototype to demonstrate applications of semi-supervised learning in Cybersecurity. This helped creating a vulnerabilties search engine which was later used by Trivy's Commercial offering for more robust security reports.
45
+ Chairperson for WCE ACM Students chapter, WCE Sangli. Aug18 - Apr19
46
+ Promoted project-based learning, through intra-club and inter-college activities like projects, workshops, and hackathons. Head Coordinator for the college’s first National level hackathon event, which was the biggest technical event in southern Maharashtra.
47
+ This club was formed by me, and it hosted the college’s first hackathon, which was the biggest technical event by the college.
48
+ Assistant community service officer, Rotaract Club of WCE Sangli Aug16 - Apr17
49
+ Pioneered a rural empowerment activity named ‘Adhyay’ & organized two Blood donation camps.
50
+ Coordinator, Sangli Miraj Commercial Ventures Private Limited Sept 2016
51
+ Helped students connect with real investors and enterprises to promote their startup dreams. This platform allowed 25+ shortlisted startups to pitch in front of real inverstor to raise the funding.
52
+
53
+ EDUCATION:
54
+ B.Tech in Computer Science and Engineering,
55
+ Walchand College of Engineering, Sangli 7.67 CGPA 2015 – 2019
56
+
57
+
58
+ LANGUAGES: English (TOEFL: 106/120), Hindi, Marathi
59
+
60
+ Other Exams:
61
+ GRE: 317/340 in 2022
62
+
63
+ Other hobbies:
64
+ Badminton, Gym, Dancing, Trekking.
65
+
66
+ Personal Journey:
67
+ I studied from a small town of Gondia, in Maharashtra, India. For my 11th and 12th, I studied in Sir Purshuram Bhau College. I wanted to go to IITs but never had capital to get the formal coaching for it. Thus, I used to self study using the reference of all questions asked before in IIT Entrance Exam. Understanding each and every question thoroughly, helped me learn Physics and Maths. But due to lack of interest in Chemistry, I ignored the subject. But, This has infused the "get hands dirty" approach for all the problems. And my strong fundamentals have helped me in problem solving and debugging skills.
68
+
69
+ While studying in Walchand College of Engineering, to myself financially, I have informally helped lots of Masters students with there assignments. Also, I helps a guy with his Phd Thesis, which was on "K Means algorithm proof"
70
+
71
+ Statement of purpose for a university application:
72
+ Since childhood, Computers have fascinated me. Whether playing dangerous dave or exploring the internet or encyclopedias, computers were childhood dopamine boosters. It was this love for computers because of which I learned programming way before my B. Tech. In addition to this, I have always had a tremendous interest in mathematical problem-solving. It encouraged me to start competitive coding from the very beginning of my undergraduate program. I taught myself C++ and python even before the initiation of CS-related courses. Also, to sustain me financially in the latter half of my degree, I helped Masters and Ph.D. Students from foreign universities with their assignments. This allowed me to explore different and new aspects of already learned courses. To broaden my perspective further, I opted for internships, projects, and online courses. Having enjoyed this quest and significant industrial exposure to showcase, I yearn to expand my academic and research acumen. For me, a master's degree in Computer Science is the next chapter of my journey.
73
+
74
+ The IITJEE entrance developed my liking for complex Maths and Physics problems in high school. Consequently, competitive coding and learning algorithms got me addicted during undergrads. I extended a fondness for Project development after I developed a cultural-fest website in second year. Website streamed live scores of Cricket matches and created polls. It was my first real-world solution for a real-world problem and required additional skills apart from academic learning. Besides, the project strengthened the fundamentals of subjects like data structures, networking, databases, operating systems. After being obsessed with mathematical problem solving for more than four years and evolving to work on deliverable solutions, I am confident that I can adapt to the changing thought processes and strive for excellence.
75
+
76
+ Realizing the importance of Problem Identification, I explored more complex problems. Accordingly, after 2nd-year, I completed an internship under Mr. Vimal Daga, RedHat Certified Architect Level 23(a world record), wherein I automated the deployment of Hadoop clusters over docker containers using Ansible. After early execution, which highlighted my engineering abilities, I was assigned research work to support high availability for cluster's master node. Even though my solution was not as optimal as Hadoop's next Official release, it was well-received because of its uniqueness. Along with the gift of exposure to more complex problems in Computer Science, I was awarded a RedHat jacket as a special appreciation for originality.
77
+
78
+ After learning AWS in the Internship, I started brainstorming the idea of an on-premise cloud that turned into a successful 3rd-year project that provided a cloud-like experience, wherein users could spin VMs, deploy code on prebuilt setup, and access a sandboxed Linux application on remote college servers with browser clicks. The project was lauded and attempted for patent by the college. In the upcoming semesters, the project was upgraded to support custom code setups. And In the final year, it was targeted to support orchestrated environments, but It was inefficacious. However, in the arduous attempt to complete it, I learned various aspects of research and development. This learning has helped me develop innovative projects with technologies like Blockchain, Data Science, Quantum Computing, Cryptography. These can be found on my Github profile. This assures me about my passion for technology, capability to implement cutting-edge solutions, and acumen to dive deeper into research. This encourages me to seek quality guidance, which will add massive value in generating positive results.
79
+
80
+ Working on such complex technical projects was possible due to the surrounding of amazing people. I have served as ChairPerson, for the WCE ACM Students' Chapter, as Assistant community service officer for the Rotaract Club of WCE, Sangli, coordinator at SMCVPL. While working for these organizations, I interacted with various academicians, Venture Capitalists, renowned and budding entrepreneurs, established intrapreneurs, divergent societies, and energetic and innovative students. These interactions have shaped my personality tremendously. Thus I could pioneer and leave a legacy of a national level hackathon, club nourishing project-oriented learning, and community event 'Adhyay.' This highlights my pressure handling, team-building, and social skills. Surely the future will broaden my perspective even more. Working on various projects and extracurricular activities has impacted my grades, but zero backlogs can vouch for my solid fundamental knowledge.
81
+
82
+ After an internship in Symantec, I am working with Aqua Security, the largest pure-play cloud-native security company. When I joined, it was a series B-funded startup, commencing in India with only 7 engineers and lots of innovative work on cloud security. After 30 months of my joining, as the engineer's count is 5x, I am fortunate to witness the hypergrowth of a technology startup. Being part of the initial employee base, I have honed the innovative bent of my mind and seen the journey of creative ideas to their commercial fruition. Due to my quick learning and ownership attitude, I have led a crucial, year-long project wherein we developed a "Dynamic Open source programming language vulnerabilities database & detection engine" that outperformed the industry standards like WhiteSource. With innovative deep learning optimizations, I presented on the topic "Hybrid approach of semi-supervised learning for better vulnerabilities detection" during a 2020 global meet in Tel Aviv, Israel. Currently, I am working on Trivy Scanner, the highest-starred open-source cloud-scanner, upbraided by the CNCF community. I am enriching trivy with complex functionalities to support dynamic scanning capabilities for commercial offerings.
83
+
84
+ In Aqua, I have often brainstormed with expert engineers, architects, and renowned tech speakers about cybersecurity applications of technologies like ebpf, deep learning, quantum computing, and blockchains. This had resulted in generating proof of concepts for a few of them.