diff --git a/README.md b/README.md index 8ec921b..e160b03 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ +**This project is live at:** https://genai-cold-email-generator-aicraftalchemy.streamlit.app/ + +I have modified the code for the dynamic input from the user and deployed in streamlit community so that everyone can use the application. +![img.png](imgs/img1.png) + + + +# The above is the output I have modified + +This Project is forked from: https://github.com/codebasics/project-genai-cold-email-generator + +Credits: https://github.com/codebasics + # 📧 Cold Mail Generator Cold email generator for services company using groq, langchain and streamlit. It allows users to input the URL of a company's careers page. The tool then extracts job listings from that page and generates personalized cold emails. These emails include relevant portfolio links sourced from a vector database, based on the specific job descriptions. diff --git a/app/.env b/app/.env index 5d0786d..b43e035 100644 --- a/app/.env +++ b/app/.env @@ -1 +1 @@ -GROQ_API_KEY= \ No newline at end of file +GROQ_API_KEY= diff --git a/app/app.py b/app/app.py new file mode 100644 index 0000000..e112a28 --- /dev/null +++ b/app/app.py @@ -0,0 +1,261 @@ +import os +import streamlit as st +from dotenv import load_dotenv +from langchain_community.document_loaders import WebBaseLoader +from langchain_groq import ChatGroq +from langchain_core.prompts import PromptTemplate +from langchain_core.output_parsers import JsonOutputParser +from langchain_core.exceptions import OutputParserException +import re + + +# Load environment variables +load_dotenv() + + +def clean_text(text): + # Remove HTML tags + text = re.sub(r'<[^>]*?>', '', text) + # Remove URLs + text = re.sub(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', '', text) + # Remove special characters + text = re.sub(r'[^a-zA-Z0-9 ]', '', text) + # Replace multiple spaces with a single space + text = re.sub(r'\\s{2,}', ' ', text) + # Trim leading and trailing whitespace + text = text.strip() + # Remove extra whitespace + text = ' '.join(text.split()) + return text + + +# Chain class handling the LLM processing +class Chain: + def __init__(self): + self.llm = ChatGroq(temperature=0, groq_api_key=os.getenv("GROQ_API_KEY"), model_name="llama-3.1-70b-versatile") + + + def extract_jobs(self, cleaned_text): + prompt_extract = PromptTemplate.from_template( + """ + ### SCRAPED TEXT FROM WEBSITE: + {page_data} + ### INSTRUCTION: + The scraped text is from the career's page of a website. + Your job is to extract the job postings and return them in JSON format containing the following keys: `role`, `experience`, `skills` and `description`. + Only return the valid JSON. + ### VALID JSON (NO PREAMBLE): + """ + ) + chain_extract = prompt_extract | self.llm + res = chain_extract.invoke(input={"page_data": cleaned_text}) + try: + json_parser = JsonOutputParser() + res = json_parser.parse(res.content) + except OutputParserException: + raise OutputParserException("Context too big. Unable to parse jobs.") + return res if isinstance(res, list) else [res] + + + def write_mail(self, job, links, user_name, user_about): + prompt_email = PromptTemplate.from_template( + """ + ### JOB DESCRIPTION: + {job_description} + + ### INSTRUCTION: + You are {user_name}. {user_about} + Your job is to write a cold email to the client regarding the job mentioned above, describing how you can contribute to fulfilling their needs. + Also, add the most relevant ones from the following links to showcase portfolio: {link_list} + Do not provide a preamble. + ### EMAIL (NO PREAMBLE): + + + """ + ) + chain_email = prompt_email | self.llm + res = chain_email.invoke({"job_description": str(job), "link_list": links, "user_name": user_name, "user_about": user_about}) + return res.content + + +# Portfolio class using temporary in-memory storage +class Portfolio: + def __init__(self): + # Initialize a dictionary to store skills and portfolio links temporarily + if 'portfolio' not in st.session_state: + st.session_state['portfolio'] = [] + + + def add_to_portfolio(self, skills, links): + """Add the user's skills and portfolio links to temporary storage.""" + if skills and links: + st.session_state['portfolio'].append({"skills": skills, "links": links}) + + + def query_links(self, required_skills): + """Query the temporary storage for relevant links based on provided skills.""" + if not required_skills: + return [] + + + # Find relevant portfolio entries based on skills + matched_links = [] + for entry in st.session_state['portfolio']: + portfolio_skills = entry['skills'] + if any(skill in portfolio_skills for skill in required_skills): + matched_links.append(entry['links']) + + + return matched_links[:2] # Return up to 2 matched links + + +# Function to create the Streamlit app interface +def create_streamlit_app(llm, portfolio, clean_text): + st.set_page_config(page_title="Cold Email Generator", page_icon="", layout="wide") + + + st.markdown(""" + + """, unsafe_allow_html=True) + + + st.markdown("
Cold Email Generator
", unsafe_allow_html=True) + st.markdown("
Effortlessly craft professional cold emails for job applications based on job postings.
", unsafe_allow_html=True) + + + st.markdown("
", unsafe_allow_html=True) + + + user_name = st.text_input("Enter your name:", value=" ") + user_about = st.text_area( + "Enter a brief description about yourself:", + value=" " + ) + + + url_input = st.text_input("Enter a Job Post URL:", value=" ") + + + st.subheader("Enter Your Skills and Portfolio Links") + skills_input = st.text_area("Enter your skills (comma separated):", value="") + links_input = st.text_area("Enter your portfolio links (comma separated):", value="") + + + submit_button = st.button("Submit", key='submit_button', help="Click to generate the cold email") + + + if submit_button: + try: + skills_list = [skill.strip() for skill in skills_input.split(",")] + links_list = [link.strip() for link in links_input.split(",")] + + + portfolio.add_to_portfolio(skills_list, links_list) + + + loader = WebBaseLoader([url_input]) + data = clean_text(loader.load().pop().page_content) + jobs = llm.extract_jobs(data) + + + for job in jobs: + job_skills = job.get('skills', []) + links = portfolio.query_links(job_skills) + email = llm.write_mail(job, links, user_name, user_about) + st.markdown(f"
{email}
", unsafe_allow_html=True) + + + except Exception as e: + st.error(f"An Error Occurred: {e}") + + + st.markdown("
", unsafe_allow_html=True) + + + st.markdown("", unsafe_allow_html=True) + + +# Main function to run the app +if __name__ == "__main__": + chain = Chain() + portfolio = Portfolio() + + + create_streamlit_app(chain, portfolio, clean_text) diff --git a/app/chains.py b/app/chains.py deleted file mode 100644 index db118fe..0000000 --- a/app/chains.py +++ /dev/null @@ -1,60 +0,0 @@ -import os -from langchain_groq import ChatGroq -from langchain_core.prompts import PromptTemplate -from langchain_core.output_parsers import JsonOutputParser -from langchain_core.exceptions import OutputParserException -from dotenv import load_dotenv - -load_dotenv() - -class Chain: - def __init__(self): - self.llm = ChatGroq(temperature=0, groq_api_key=os.getenv("GROQ_API_KEY"), model_name="llama-3.1-70b-versatile") - - def extract_jobs(self, cleaned_text): - prompt_extract = PromptTemplate.from_template( - """ - ### SCRAPED TEXT FROM WEBSITE: - {page_data} - ### INSTRUCTION: - The scraped text is from the career's page of a website. - Your job is to extract the job postings and return them in JSON format containing the following keys: `role`, `experience`, `skills` and `description`. - Only return the valid JSON. - ### VALID JSON (NO PREAMBLE): - """ - ) - chain_extract = prompt_extract | self.llm - res = chain_extract.invoke(input={"page_data": cleaned_text}) - try: - json_parser = JsonOutputParser() - res = json_parser.parse(res.content) - except OutputParserException: - raise OutputParserException("Context too big. Unable to parse jobs.") - return res if isinstance(res, list) else [res] - - def write_mail(self, job, links): - prompt_email = PromptTemplate.from_template( - """ - ### JOB DESCRIPTION: - {job_description} - - ### INSTRUCTION: - You are Mohan, a business development executive at AtliQ. AtliQ is an AI & Software Consulting company dedicated to facilitating - the seamless integration of business processes through automated tools. - Over our experience, we have empowered numerous enterprises with tailored solutions, fostering scalability, - process optimization, cost reduction, and heightened overall efficiency. - Your job is to write a cold email to the client regarding the job mentioned above describing the capability of AtliQ - in fulfilling their needs. - Also add the most relevant ones from the following links to showcase Atliq's portfolio: {link_list} - Remember you are Mohan, BDE at AtliQ. - Do not provide a preamble. - ### EMAIL (NO PREAMBLE): - - """ - ) - chain_email = prompt_email | self.llm - res = chain_email.invoke({"job_description": str(job), "link_list": links}) - return res.content - -if __name__ == "__main__": - print(os.getenv("GROQ_API_KEY")) \ No newline at end of file diff --git a/app/main.py b/app/main.py deleted file mode 100644 index da04324..0000000 --- a/app/main.py +++ /dev/null @@ -1,35 +0,0 @@ -import streamlit as st -from langchain_community.document_loaders import WebBaseLoader - -from chains import Chain -from portfolio import Portfolio -from utils import clean_text - - -def create_streamlit_app(llm, portfolio, clean_text): - st.title("📧 Cold Mail Generator") - url_input = st.text_input("Enter a URL:", value="https://jobs.nike.com/job/R-33460") - submit_button = st.button("Submit") - - if submit_button: - try: - loader = WebBaseLoader([url_input]) - data = clean_text(loader.load().pop().page_content) - portfolio.load_portfolio() - jobs = llm.extract_jobs(data) - for job in jobs: - skills = job.get('skills', []) - links = portfolio.query_links(skills) - email = llm.write_mail(job, links) - st.code(email, language='markdown') - except Exception as e: - st.error(f"An Error Occurred: {e}") - - -if __name__ == "__main__": - chain = Chain() - portfolio = Portfolio() - st.set_page_config(layout="wide", page_title="Cold Email Generator", page_icon="📧") - create_streamlit_app(chain, portfolio, clean_text) - - diff --git a/app/portfolio.py b/app/portfolio.py deleted file mode 100644 index c588a1b..0000000 --- a/app/portfolio.py +++ /dev/null @@ -1,21 +0,0 @@ -import pandas as pd -import chromadb -import uuid - - -class Portfolio: - def __init__(self, file_path="app/resource/my_portfolio.csv"): - self.file_path = file_path - self.data = pd.read_csv(file_path) - self.chroma_client = chromadb.PersistentClient('vectorstore') - self.collection = self.chroma_client.get_or_create_collection(name="portfolio") - - def load_portfolio(self): - if not self.collection.count(): - for _, row in self.data.iterrows(): - self.collection.add(documents=row["Techstack"], - metadatas={"links": row["Links"]}, - ids=[str(uuid.uuid4())]) - - def query_links(self, skills): - return self.collection.query(query_texts=skills, n_results=2).get('metadatas', []) diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 0000000..661f7f0 --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,7 @@ +streamlit==1.35.0 +python-dotenv==1.0.0 +langchain-community==0.2.12 +langchain-groq==0.1.9 +langchain-core==0.2.37 +Gunicorn +beautifulsoup4==4.12.2 \ No newline at end of file diff --git a/app/resource/my_portfolio.csv b/app/resource/my_portfolio.csv deleted file mode 100644 index d468704..0000000 --- a/app/resource/my_portfolio.csv +++ /dev/null @@ -1,21 +0,0 @@ -"Techstack","Links" -"React, Node.js, MongoDB","https://example.com/react-portfolio" -"Angular,.NET, SQL Server","https://example.com/angular-portfolio" -"Vue.js, Ruby on Rails, PostgreSQL","https://example.com/vue-portfolio" -"Python, Django, MySQL","https://example.com/python-portfolio" -"Java, Spring Boot, Oracle","https://example.com/java-portfolio" -"Flutter, Firebase, GraphQL","https://example.com/flutter-portfolio" -"WordPress, PHP, MySQL","https://example.com/wordpress-portfolio" -"Magento, PHP, MySQL","https://example.com/magento-portfolio" -"React Native, Node.js, MongoDB","https://example.com/react-native-portfolio" -"iOS, Swift, Core Data","https://example.com/ios-portfolio" -"Android, Java, Room Persistence","https://example.com/android-portfolio" -"Kotlin, Android, Firebase","https://example.com/kotlin-android-portfolio" -"Android TV, Kotlin, Android NDK","https://example.com/android-tv-portfolio" -"iOS, Swift, ARKit","https://example.com/ios-ar-portfolio" -"Cross-platform, Xamarin, Azure","https://example.com/xamarin-portfolio" -"Backend, Kotlin, Spring Boot","https://example.com/kotlin-backend-portfolio" -"Frontend, TypeScript, Angular","https://example.com/typescript-frontend-portfolio" -"Full-stack, JavaScript, Express.js","https://example.com/full-stack-js-portfolio" -"Machine Learning, Python, TensorFlow","https://example.com/ml-python-portfolio" -"DevOps, Jenkins, Docker","https://example.com/devops-portfolio" \ No newline at end of file diff --git a/app/utils.py b/app/utils.py deleted file mode 100644 index cf8aecf..0000000 --- a/app/utils.py +++ /dev/null @@ -1,16 +0,0 @@ -import re - -def clean_text(text): - # Remove HTML tags - text = re.sub(r'<[^>]*?>', '', text) - # Remove URLs - text = re.sub(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', '', text) - # Remove special characters - text = re.sub(r'[^a-zA-Z0-9 ]', '', text) - # Replace multiple spaces with a single space - text = re.sub(r'\s{2,}', ' ', text) - # Trim leading and trailing whitespace - text = text.strip() - # Remove extra whitespace - text = ' '.join(text.split()) - return text \ No newline at end of file diff --git a/email_generator.ipynb b/email_generator.ipynb deleted file mode 100644 index b4ee620..0000000 --- a/email_generator.ipynb +++ /dev/null @@ -1,549 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "0eccd20e", - "metadata": {}, - "outputs": [], - "source": [ - "from langchain_groq import ChatGroq" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "c16ff50e", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "... Neil Armstrong!\n", - "\n", - "On July 20, 1969, Neil Armstrong became the first person to set foot on the Moon as part of the Apollo 11 mission. He famously declared, \"That's one small step for man, one giant leap for mankind,\" as he stepped onto the lunar surface.\n", - "\n", - "Would you like to know more about the Apollo 11 mission or Neil Armstrong's incredible achievement?\n" - ] - } - ], - "source": [ - "llm = ChatGroq(\n", - " temperature=0, \n", - " groq_api_key='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', \n", - " model_name=\"llama-3.1-70b-versatile\"\n", - ")\n", - "response = llm.invoke(\"The first person to land on moon was ...\")\n", - "print(response.content)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "90d33612", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "USER_AGENT environment variable not set, consider setting it to identify your requests.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Apply for Software Engineer II, AI/ML Platforms\n", - "\n", - "Search JobsSkip navigationSearch JobsNIKE, INC. JOBSContract JobsJoin The Talent CommunityLife @ NikeOverviewBenefitsBrandsOverviewJordanConverseTeamsOverviewAdministrative SupportAdvanced InnovationAir Manufacturing InnovationAviationCommunicationsCustomer ServiceDesignDigitalFacilitiesFinance & AccountingGovernment & Public AffairsHuman ResourcesInsights & AnalyticsLegalManufacturing & EngineeringMarketingMerchandisingPlanningPrivacyProcurementProduct Creation, Development & ManagementRetail CorporateRetail StoresSalesSocial & Community ImpactSports MarketingStrategic PlanningSupply Chain, Distribution & LogisticsSustainabilityTechnologyLocationsOverviewNike WHQNike New York HQEHQ: Hilversum, The NetherlandsELC: Laakdal, BelgiumGreater China HQDiversity, Equity & InclusionOverviewMilitary InclusionDisability InclusionIndigenous InclusionInternshipsTechnologySoftware Engineer II, AI/ML PlatformsBeaverton, OregonBecome a Part of the NIKE, Inc. TeamNIKE, Inc. does more than outfit the world’s best athletes. It is a place to explore potential, obliterate boundaries and push out the edges of what can be. The company looks for people who can grow, think, dream and create. Its culture thrives by embracing diversity and rewarding imagination. The brand seeks achievers, leaders and visionaries. At NIKE, Inc. it’s about each person bringing skills and passion to a challenging and constantly evolving game.NIKE is a technology company. From our flagship website and five-star mobile apps to developing products, managing big data and providing leading edge engineering and systems support, our teams at NIKE Global Technology exist to revolutionize the future at the confluence of tech and sport. We invest and develop advances in technology and employ the most creative people in the world, and then give them the support to constantly innovate, iterate and serve consumers more directly and personally.  Our teams are innovative, diverse, multidisciplinary and collaborative, taking technology into the future and bringing the world with it.WHO WE ARE LOOKING FORWe are looking for a Software Engineer II to design and implement core components of our data science services and platform and scale it to serve Nike globally. The focus of this engineer will be at the intersection of computer systems and machine learning. You will also work collaboratively with the data science and analytics teams to ship scalable, performant and reliable solutions.WHAT YOU WILL WORK ONAs a Software Engineer in AI/ML Platforms, you will be part of a fast-paced engineering team developing services and platform that drive AI/ML at Nike. AI/ML is used in Nike to accelerate its digital transformation and real-time data-based decision-making capabilities. The focus is to leverage AI/ML technology to improve the user experience by using personalization, recommendation, smart search, digital demand sensing and scheduling techniques. These enhancements will be used to power consumer experiences on nike.com, Nike App, Nike SNKRS App as well as product innovation, supply chain, and logistics.This Software Engineer will develop and/or implement services and paved-path solutions to enable data scientists and ML engineers at Nike. These services will enable and accelerate model training, model serving and model management. Additionally, they will evaluate new AI/ML platform services and capabilities for possible long-term approaches, and work with the user community to anticipate services and platform needs required to support algorithm development, model training, model management, data engineering and model serving. Lastly, they will advance and improve development practices with the engineering team through participation in architecture, technical design and code reviewsWHO YOU WILL WORK WITHYou'll be working with Data Scientists, ML Engineers and Product teams to identify and deliver platform capabilities to accelerate and streamline the delivery and maintenance of ML use cases. Additionally, you’ll work with teams integrating ML capabilities into Nike experiences and business applications. This position reports to the Director of AI/ML Tech Platforms.WHAT YOU BRINGBachelor's degree in Computer Science, Engineering, Information Systems, or similar field or relevant professional experience, education, and training.Strong Computer Science fundamentals2+ years professional software development experienceProgramming experience with at least one modern language such as Java, Python, GolangExperience with Infrastructure as Code / DevOps practices and technologies like TerraformExperience with Cloud services (e.g. AWS Cloud EC2, S3, DynamoDB, Azure Cloud, etc.)Experience developing and using microservicesExcellent written and oral communication skills on both technical and non-technical topicsNIKE, Inc. is a growth company that looks for team members to grow with it. Nike offers a generous total rewards package, casual work environment, a diverse and inclusive culture, and an electric atmosphere for professional development. No matter the location, or the role, every Nike employee shares one galvanizing mission: To bring inspiration and innovation to every athlete* in the world.NIKE, Inc. is committed to employing a diverse workforce. Qualified applicants will receive consideration without regard to race, color, religion, sex, national origin, age, sexual orientation, gender identity, gender expression, veteran status, or disability.How We HireAt NIKE, Inc. we promise to provide a premium, inclusive, compelling and authentic candidate experience. Delivering on this promise means we allow you to be at your best — and to do that, you need to understand how the hiring process works. Transparency is key.\r\n", - "\r\n", - "* This overview explains our hiring process for corporate roles. Note there may be different hiring steps involved for non-corporate roles.Start nowBenefitsWhether it’s transportation or financial health, we continually invest in our employees to help them achieve greatness — inside and outside of work. All who work here should be able to realize their full potential.Employee Assistance ProgramEmployee Stock Purchase Plan (ESPP)HolidaysMedical PlanPaid Time Off (PTO)Product DiscountsSabbaticalsLearn moreGIFT CARDSPROMOTIONSFIND A STORESIGN UP FOR EMAILBECOME A MEMBERNIKE JOURNALSEND US FEEDBACKGET HELPGET HELPOrder StatusShipping and DeliveryReturnsPayment OptionsGift Cards BalanceContact UsABOUT NIKEABOUT NIKENewsCareersInvestorsPurposeSustainabilityUnited States© 2024 Nike, Inc. All Rights ReservedGuidesNike AdaptNike Air MaxNike FlyleatherNike ReactSpace HippieNike AirNike FlyEaseNike Free Nike VaporflyNike Air Force 1 Nike FlyknitNike JoyrideNike ZoomXTerms of SaleTerms of UseNike Privacy PolicyYour Privacy ChoicesCA Supply Chain Act\n" - ] - } - ], - "source": [ - "from langchain_community.document_loaders import WebBaseLoader\n", - "\n", - "loader = WebBaseLoader(\"https://jobs.nike.com/job/R-33460\")\n", - "page_data = loader.load().pop().page_content\n", - "print(page_data)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "85c89a57", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "str" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain_core.prompts import PromptTemplate\n", - "\n", - "prompt_extract = PromptTemplate.from_template(\n", - " \"\"\"\n", - " ### SCRAPED TEXT FROM WEBSITE:\n", - " {page_data}\n", - " ### INSTRUCTION:\n", - " The scraped text is from the career's page of a website.\n", - " Your job is to extract the job postings and return them in JSON format containing the \n", - " following keys: `role`, `experience`, `skills` and `description`.\n", - " Only return the valid JSON.\n", - " ### VALID JSON (NO PREAMBLE): \n", - " \"\"\"\n", - ")\n", - "\n", - "chain_extract = prompt_extract | llm \n", - "res = chain_extract.invoke(input={'page_data':page_data})\n", - "type(res.content)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "5415fd54", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'role': 'Software Engineer II, AI/ML Platforms',\n", - " 'experience': '2+ years professional software development experience',\n", - " 'skills': ['Strong Computer Science fundamentals',\n", - " 'Programming experience with at least one modern language such as Java, Python, Golang',\n", - " 'Experience with Infrastructure as Code / DevOps practices and technologies like Terraform',\n", - " 'Experience with Cloud services (e.g. AWS Cloud EC2, S3, DynamoDB, Azure Cloud, etc.)',\n", - " 'Experience developing and using microservices'],\n", - " 'description': 'We are looking for a Software Engineer II to design and implement core components of our data science services and platform and scale it to serve Nike globally. The focus of this engineer will be at the intersection of computer systems and machine learning. You will also work collaboratively with the data science and analytics teams to ship scalable, performant and reliable solutions.'}" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from langchain_core.output_parsers import JsonOutputParser\n", - "\n", - "json_parser = JsonOutputParser()\n", - "json_res = json_parser.parse(res.content)\n", - "json_res" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "39961ed6", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "dict" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "type(json_res)" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "1e8a0f74", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TechstackLinks
0React, Node.js, MongoDBhttps://example.com/react-portfolio
1Angular,.NET, SQL Serverhttps://example.com/angular-portfolio
2Vue.js, Ruby on Rails, PostgreSQLhttps://example.com/vue-portfolio
3Python, Django, MySQLhttps://example.com/python-portfolio
4Java, Spring Boot, Oraclehttps://example.com/java-portfolio
5Flutter, Firebase, GraphQLhttps://example.com/flutter-portfolio
6WordPress, PHP, MySQLhttps://example.com/wordpress-portfolio
7Magento, PHP, MySQLhttps://example.com/magento-portfolio
8React Native, Node.js, MongoDBhttps://example.com/react-native-portfolio
9iOS, Swift, Core Datahttps://example.com/ios-portfolio
10Android, Java, Room Persistencehttps://example.com/android-portfolio
11Kotlin, Android, Firebasehttps://example.com/kotlin-android-portfolio
12Android TV, Kotlin, Android NDKhttps://example.com/android-tv-portfolio
13iOS, Swift, ARKithttps://example.com/ios-ar-portfolio
14Cross-platform, Xamarin, Azurehttps://example.com/xamarin-portfolio
15Backend, Kotlin, Spring Boothttps://example.com/kotlin-backend-portfolio
16Frontend, TypeScript, Angularhttps://example.com/typescript-frontend-portfolio
17Full-stack, JavaScript, Express.jshttps://example.com/full-stack-js-portfolio
18Machine Learning, Python, TensorFlowhttps://example.com/ml-python-portfolio
19DevOps, Jenkins, Dockerhttps://example.com/devops-portfolio
\n", - "
" - ], - "text/plain": [ - " Techstack \\\n", - "0 React, Node.js, MongoDB \n", - "1 Angular,.NET, SQL Server \n", - "2 Vue.js, Ruby on Rails, PostgreSQL \n", - "3 Python, Django, MySQL \n", - "4 Java, Spring Boot, Oracle \n", - "5 Flutter, Firebase, GraphQL \n", - "6 WordPress, PHP, MySQL \n", - "7 Magento, PHP, MySQL \n", - "8 React Native, Node.js, MongoDB \n", - "9 iOS, Swift, Core Data \n", - "10 Android, Java, Room Persistence \n", - "11 Kotlin, Android, Firebase \n", - "12 Android TV, Kotlin, Android NDK \n", - "13 iOS, Swift, ARKit \n", - "14 Cross-platform, Xamarin, Azure \n", - "15 Backend, Kotlin, Spring Boot \n", - "16 Frontend, TypeScript, Angular \n", - "17 Full-stack, JavaScript, Express.js \n", - "18 Machine Learning, Python, TensorFlow \n", - "19 DevOps, Jenkins, Docker \n", - "\n", - " Links \n", - "0 https://example.com/react-portfolio \n", - "1 https://example.com/angular-portfolio \n", - "2 https://example.com/vue-portfolio \n", - "3 https://example.com/python-portfolio \n", - "4 https://example.com/java-portfolio \n", - "5 https://example.com/flutter-portfolio \n", - "6 https://example.com/wordpress-portfolio \n", - "7 https://example.com/magento-portfolio \n", - "8 https://example.com/react-native-portfolio \n", - "9 https://example.com/ios-portfolio \n", - "10 https://example.com/android-portfolio \n", - "11 https://example.com/kotlin-android-portfolio \n", - "12 https://example.com/android-tv-portfolio \n", - "13 https://example.com/ios-ar-portfolio \n", - "14 https://example.com/xamarin-portfolio \n", - "15 https://example.com/kotlin-backend-portfolio \n", - "16 https://example.com/typescript-frontend-portfolio \n", - "17 https://example.com/full-stack-js-portfolio \n", - "18 https://example.com/ml-python-portfolio \n", - "19 https://example.com/devops-portfolio " - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import pandas as pd\n", - "\n", - "df = pd.read_csv(\"my_portfolio.csv\")\n", - "df" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "f7e888d4", - "metadata": {}, - "outputs": [], - "source": [ - "import uuid\n", - "import chromadb\n", - "\n", - "client = chromadb.PersistentClient('vectorstore')\n", - "collection = client.get_or_create_collection(name=\"portfolio\")\n", - "\n", - "if not collection.count():\n", - " for _, row in df.iterrows():\n", - " collection.add(documents=row[\"Techstack\"],\n", - " metadatas={\"links\": row[\"Links\"]},\n", - " ids=[str(uuid.uuid4())])" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "39ad2fa2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[[{'links': 'https://example.com/ml-python-portfolio'},\n", - " {'links': 'https://example.com/magento-portfolio'}],\n", - " [{'links': 'https://example.com/ml-python-portfolio'},\n", - " {'links': 'https://example.com/python-portfolio'}],\n", - " [{'links': 'https://example.com/devops-portfolio'},\n", - " {'links': 'https://example.com/xamarin-portfolio'}],\n", - " [{'links': 'https://example.com/xamarin-portfolio'},\n", - " {'links': 'https://example.com/wordpress-portfolio'}],\n", - " [{'links': 'https://example.com/magento-portfolio'},\n", - " {'links': 'https://example.com/wordpress-portfolio'}]]" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "links = collection.query(query_texts=job['skills'], n_results=2).get('metadatas', [])\n", - "links" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "8bd36844", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'role': 'Software Engineer II, AI/ML Platforms',\n", - " 'experience': '2+ years professional software development experience',\n", - " 'skills': ['Strong Computer Science fundamentals',\n", - " 'Programming experience with at least one modern language such as Java, Python, Golang',\n", - " 'Experience with Infrastructure as Code / DevOps practices and technologies like Terraform',\n", - " 'Experience with Cloud services (e.g. AWS Cloud EC2, S3, DynamoDB, Azure Cloud, etc.)',\n", - " 'Experience developing and using microservices'],\n", - " 'description': 'We are looking for a Software Engineer II to design and implement core components of our data science services and platform and scale it to serve Nike globally. The focus of this engineer will be at the intersection of computer systems and machine learning. You will also work collaboratively with the data science and analytics teams to ship scalable, performant and reliable solutions.'}" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "job" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "1ccfd720", - "metadata": { - "scrolled": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "['Strong Computer Science fundamentals',\n", - " 'Programming experience with at least one modern language such as Java, Python, Golang',\n", - " 'Experience with Infrastructure as Code / DevOps practices and technologies like Terraform',\n", - " 'Experience with Cloud services (e.g. AWS Cloud EC2, S3, DynamoDB, Azure Cloud, etc.)',\n", - " 'Experience developing and using microservices']" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "job = json_res\n", - "job['skills']" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "64a97dd2", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Subject: Expert AI/ML Solutions for Nike's Data Science Services and Platform\n", - "\n", - "Dear Hiring Manager,\n", - "\n", - "I came across the job description for a Software Engineer II, AI/ML Platforms at Nike, and I'm excited to introduce AtliQ, a leading AI & Software Consulting company that can help you design and implement core components of your data science services and platform.\n", - "\n", - "With our expertise in AI, ML, and software development, we can help you scale your platform to serve Nike globally. Our team of experts has a strong foundation in computer science and experience with modern programming languages such as Java, Python, and Golang. We're well-versed in Infrastructure as Code / DevOps practices and technologies like Terraform, and have hands-on experience with Cloud services like AWS and Azure.\n", - "\n", - "Our portfolio showcases our capabilities in developing and deploying scalable, performant, and reliable solutions. I'd like to highlight a few relevant examples:\n", - "\n", - "* Our Machine Learning with Python portfolio (https://example.com/ml-python-portfolio) demonstrates our expertise in building predictive models and deploying them on cloud platforms.\n", - "* Our DevOps portfolio (https://example.com/devops-portfolio) showcases our ability to automate infrastructure provisioning and deployment using Terraform and other tools.\n", - "\n", - "At AtliQ, we've empowered numerous enterprises with tailored solutions, fostering scalability, process optimization, cost reduction, and heightened overall efficiency. We're confident that our expertise can help Nike achieve its goals in the AI/ML space.\n", - "\n", - "I'd love to schedule a call to discuss how AtliQ can support Nike's data science services and platform. Please let me know if you're available for a quick call this week.\n", - "\n", - "Best regards,\n", - "\n", - "Mohan\n", - "Business Development Executive\n", - "AtliQ\n" - ] - } - ], - "source": [ - "prompt_email = PromptTemplate.from_template(\n", - " \"\"\"\n", - " ### JOB DESCRIPTION:\n", - " {job_description}\n", - " \n", - " ### INSTRUCTION:\n", - " You are Mohan, a business development executive at AtliQ. AtliQ is an AI & Software Consulting company dedicated to facilitating\n", - " the seamless integration of business processes through automated tools. \n", - " Over our experience, we have empowered numerous enterprises with tailored solutions, fostering scalability, \n", - " process optimization, cost reduction, and heightened overall efficiency. \n", - " Your job is to write a cold email to the client regarding the job mentioned above describing the capability of AtliQ \n", - " in fulfilling their needs.\n", - " Also add the most relevant ones from the following links to showcase Atliq's portfolio: {link_list}\n", - " Remember you are Mohan, BDE at AtliQ. \n", - " Do not provide a preamble.\n", - " ### EMAIL (NO PREAMBLE):\n", - " \n", - " \"\"\"\n", - " )\n", - "\n", - "chain_email = prompt_email | llm\n", - "res = chain_email.invoke({\"job_description\": str(job), \"link_list\": links})\n", - "print(res.content)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.11" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/imgs/img1.png b/imgs/img1.png new file mode 100644 index 0000000..4f4ff8b Binary files /dev/null and b/imgs/img1.png differ diff --git a/my_portfolio.csv b/my_portfolio.csv deleted file mode 100644 index d468704..0000000 --- a/my_portfolio.csv +++ /dev/null @@ -1,21 +0,0 @@ -"Techstack","Links" -"React, Node.js, MongoDB","https://example.com/react-portfolio" -"Angular,.NET, SQL Server","https://example.com/angular-portfolio" -"Vue.js, Ruby on Rails, PostgreSQL","https://example.com/vue-portfolio" -"Python, Django, MySQL","https://example.com/python-portfolio" -"Java, Spring Boot, Oracle","https://example.com/java-portfolio" -"Flutter, Firebase, GraphQL","https://example.com/flutter-portfolio" -"WordPress, PHP, MySQL","https://example.com/wordpress-portfolio" -"Magento, PHP, MySQL","https://example.com/magento-portfolio" -"React Native, Node.js, MongoDB","https://example.com/react-native-portfolio" -"iOS, Swift, Core Data","https://example.com/ios-portfolio" -"Android, Java, Room Persistence","https://example.com/android-portfolio" -"Kotlin, Android, Firebase","https://example.com/kotlin-android-portfolio" -"Android TV, Kotlin, Android NDK","https://example.com/android-tv-portfolio" -"iOS, Swift, ARKit","https://example.com/ios-ar-portfolio" -"Cross-platform, Xamarin, Azure","https://example.com/xamarin-portfolio" -"Backend, Kotlin, Spring Boot","https://example.com/kotlin-backend-portfolio" -"Frontend, TypeScript, Angular","https://example.com/typescript-frontend-portfolio" -"Full-stack, JavaScript, Express.js","https://example.com/full-stack-js-portfolio" -"Machine Learning, Python, TensorFlow","https://example.com/ml-python-portfolio" -"DevOps, Jenkins, Docker","https://example.com/devops-portfolio" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index be82b75..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -langchain==0.2.14 -langchain-community==0.2.12 -langchain-groq===0.1.9 -unstructured==0.14.6 -selenium==4.21.0 -chromadb==0.5.0 -streamlit==1.35.0 -pandas==2.0.2 -python-dotenv==1.0.0 \ No newline at end of file diff --git a/tutorial_chromadb.ipynb b/tutorial_chromadb.ipynb deleted file mode 100644 index 778c43b..0000000 --- a/tutorial_chromadb.ipynb +++ /dev/null @@ -1,223 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "e7156610", - "metadata": {}, - "outputs": [], - "source": [ - "import chromadb\n", - "\n", - "client = chromadb.Client()\n", - "collection = client.create_collection(name=\"my_collection\")" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "6f35da91", - "metadata": {}, - "outputs": [], - "source": [ - "collection.add(\n", - " documents=[\n", - " \"This document is about New York\",\n", - " \"This document is about Delhi\"\n", - " ],\n", - " ids = ['id1', 'id2']\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "023d55f8", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ids': ['id1', 'id2'],\n", - " 'embeddings': None,\n", - " 'metadatas': [None, None],\n", - " 'documents': ['This document is about New York',\n", - " 'This document is about Delhi'],\n", - " 'uris': None,\n", - " 'data': None}" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "all_docs = collection.get()\n", - "all_docs" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "669928f2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ids': ['id1'],\n", - " 'embeddings': None,\n", - " 'metadatas': [None],\n", - " 'documents': ['This document is about New York'],\n", - " 'uris': None,\n", - " 'data': None}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "documents = collection.get(ids=[\"id1\"])\n", - "documents" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "01f89e5b", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ids': [['id1', 'id2']],\n", - " 'distances': [[1.6312181949615479, 1.867558479309082]],\n", - " 'metadatas': [[None, None]],\n", - " 'embeddings': None,\n", - " 'documents': [['This document is about New York',\n", - " 'This document is about Delhi']],\n", - " 'uris': None,\n", - " 'data': None}" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "results = collection.query(\n", - " query_texts=['Query is about big apple'],\n", - " n_results=2\n", - ")\n", - "results" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "4492fd01", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ids': [],\n", - " 'embeddings': None,\n", - " 'metadatas': [],\n", - " 'documents': [],\n", - " 'uris': None,\n", - " 'data': None}" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "collection.delete(ids=all_docs['ids'])\n", - "collection.get()" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "197e4bad", - "metadata": {}, - "outputs": [], - "source": [ - "collection.add(\n", - " documents=[\n", - " \"This document is about New York\",\n", - " \"This document is about Delhi\"\n", - " ],\n", - " ids=[\"id3\", \"id4\"],\n", - " metadatas=[\n", - " {\"url\": \"https://en.wikipedia.org/wiki/New_York_City\"},\n", - " {\"url\": \"https://en.wikipedia.org/wiki/New_Delhi\"}\n", - " ]\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "d25c8d29", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'ids': [['id4', 'id3']],\n", - " 'distances': [[1.5588479042053223, 1.8114912509918213]],\n", - " 'metadatas': [[{'url': 'https://en.wikipedia.org/wiki/New_Delhi'},\n", - " {'url': 'https://en.wikipedia.org/wiki/New_York_City'}]],\n", - " 'embeddings': None,\n", - " 'documents': [['This document is about Delhi',\n", - " 'This document is about New York']],\n", - " 'uris': None,\n", - " 'data': None}" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "results = collection.query(\n", - " query_texts=[\"Query is about Chhole Bhature\"],\n", - " n_results=2\n", - ")\n", - "results" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.11" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/tutorial_groq.ipynb b/tutorial_groq.ipynb deleted file mode 100644 index e22945d..0000000 --- a/tutorial_groq.ipynb +++ /dev/null @@ -1,56 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "0f76f97c", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "... Neil Armstrong!\n", - "\n", - "On July 20, 1969, Neil Armstrong became the first person to set foot on the Moon as part of the Apollo 11 mission. He famously declared, \"That's one small step for man, one giant leap for mankind\" as he stepped off the lunar module Eagle onto the Moon's surface.\n", - "\n", - "Would you like to know more about the Apollo 11 mission or Neil Armstrong's life?\n" - ] - } - ], - "source": [ - "from langchain_groq import ChatGroq\n", - "\n", - "llm = ChatGroq(\n", - " temperature=0, \n", - " groq_api_key='', \n", - " model_name=\"llama-3.1-70b-versatile\"\n", - ")\n", - "\n", - "response = llm.invoke(\"The first person to land on moon was ...\")\n", - "print(response.content)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.11" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}