<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmed Abu Qahf</title>
    <description>The latest articles on DEV Community by Ahmed Abu Qahf (@som3aware).</description>
    <link>https://dev.to/som3aware</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F207976%2F2744ba55-d693-4dbe-af71-86b7dd1f4a2f.png</url>
      <title>DEV Community: Ahmed Abu Qahf</title>
      <link>https://dev.to/som3aware</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/som3aware"/>
    <language>en</language>
    <item>
      <title>Streamlining the Hiring Process with OpenAI and LangChain Part 1</title>
      <dc:creator>Ahmed Abu Qahf</dc:creator>
      <pubDate>Thu, 21 Mar 2024 21:07:35 +0000</pubDate>
      <link>https://dev.to/som3aware/streamlining-the-hiring-process-with-openai-and-langchain-part-1-32o8</link>
      <guid>https://dev.to/som3aware/streamlining-the-hiring-process-with-openai-and-langchain-part-1-32o8</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Spotlight Dilemma: Sorting Stars from Stardom&lt;/li&gt;
&lt;li&gt;Navigating Recruitment Challenges: Unveiling Unseen Talent Gems&lt;/li&gt;
&lt;li&gt;Unveiling the Bot: Your Backstage Buddy for Talent Hunting!&lt;/li&gt;
&lt;li&gt;
Process

&lt;ul&gt;
&lt;li&gt;Step 1 - Audition Files&lt;/li&gt;
&lt;li&gt;Step 2 - Spotlight Highlights&lt;/li&gt;
&lt;li&gt;Step 3 - Storing Magic&lt;/li&gt;
&lt;li&gt;Step 4 - Chat Showtime&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Spotlight Dilemma: Sorting Stars from Stardom
&lt;/h2&gt;

&lt;p&gt;
  Imagine you're the director of the most incredible talent show in town, searching for the
  brightest stars to light up the stage. Your job? To find the most dazzling performers who will
  leave the audience in awe. In the past, you'd have a stack of audition tapes to watch, which could
  be overwhelming. But now, with the rise of digital technology, you're flooded with videos from all
  around the world. It's like trying to find a needle in a haystack!
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BTT4GfWs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fneedle-in-the-haystack.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BTT4GfWs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fneedle-in-the-haystack.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="needle in a haystack" width="587" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Navigating Recruitment Challenges: Unveiling Unseen Talent Gems
&lt;/h2&gt;

&lt;p&gt;
  Here's the kicker: sometimes you might accidentally pick a performer just because they remind you
  of someone you know. That means you might miss out on some incredible acts that bring fresh and
  unique flavors to your show. And trust me, you don't want to miss out on the next superstar
  because they dance to a different beat.
&lt;/p&gt;

&lt;p&gt;
  Traditionally, you might have relied on word-of-mouth or the familiar faces you've seen before.
  But think about it, that might mean you're passing up on the chance to discover a hidden gem – a
  performer with a new style that the world has yet to see.
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xQgUP4Ik--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Ffamiliar-face.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xQgUP4Ik--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Ffamiliar-face.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="familiar face" width="750" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
  Ever had that moment when you're singing one song in your head, but your friend is humming a
  completely different tune? Well, imagine you've got a group of judges, each with their own musical
  taste. What one judge loves, another might not be crazy about. It's like trying to pick the best
  ice cream flavor, and everyone has their own favorite.
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sBvV8AY9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fice-cream.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sBvV8AY9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fice-cream.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="three men eating ice cream" width="554" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
  Now, picture this: the whole talent search process taking so long that amazing acts get snatched
  up by other shows. It's like watching a magician disappear in a puff of smoke before you even say
  "ta-da!" And if you're not crystal clear about how you're choosing your acts, they might feel like
  they're solving a puzzle without all the pieces.
&lt;/p&gt;

&lt;p&gt;
  But hey, what if you had a magical assistant who could watch all the auditions, spot the real
  gems, and help you tackle these challenges head-on? This incredible sidekick could make your job
  as a talent show director a breeze, and your stage would be graced with even more extraordinary
  performances!
&lt;/p&gt;

&lt;p&gt;
  That's where __LLMs__ – our modern-day magic helpers – come in for HR recruiters. They can help
  unearth the top talents, conquer these hurdles, and let recruiters focus on the most exciting
  parts of their gig. It's like having a team of assistants who always know the perfect act to steal
  the show.
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xugG-O5a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fmagic.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xugG-O5a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fmagic.webp%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="i am not seeing it's magic but it's meme" width="461" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Unveiling the Bot: Your Backstage Buddy for Talent Hunting!
&lt;/h2&gt;

&lt;p&gt;
  Introducing the Talent Scouter Bot – your trusty assistant, powered by super-smart technology.
  It's like having a backstage helper who can chat about all those audition tapes, just like friends
  discussing their favorite acts.
&lt;/p&gt;

&lt;p&gt;
  You share the job description and what you're looking for in a superstar performer, and the Bot
  jumps into action. It chats with you like a friendly colleague, asking questions, and even
  provides a scorecard for each act's relevance to the role.
&lt;/p&gt;

&lt;p&gt;
  But here's where the magic happens. The Bot isn't just about numbers. It actually understands the
  resumes, just like you would read a story. It figures out who danced their way through college,
  who's a master at magic tricks, and who's a stand-up comedy sensation.
&lt;/p&gt;

&lt;p&gt;Now, let's dive into how this genius works:&lt;/p&gt;

&lt;p&gt;
  This is the resume we're going to use throughout this guide: 
[Resume](https://upload.wikimedia.org/wikipedia/commons/c/cc/Resume.pdf)
&lt;/p&gt;

&lt;h2&gt;
  
  
  Process
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1 - Audition Files
&lt;/h3&gt;

&lt;p&gt;
Imagine your Bot grabbing the audition tapes (resumes) and giving them a good watch (reading). It's like flipping through pages, but way faster. We're using special tools from __LangChain__, `PyMuPDFLoader`, to make this happen.

`PyMuPDFLoader` will load the contents of every page in the resume and store them in a `Document` object. We can access the content of each page using the `page_content` attribute.

&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.document_loaders&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PyMuPDFLoader&lt;/span&gt;

&lt;span class="n"&gt;resume_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./resumes/john-doe.pdf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;loader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PyMuPDFLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;resume_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;resume_content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resume_content&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;page_content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QxBl1VPC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Floading-content.gif%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QxBl1VPC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Floading-content.gif%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="loading resume's content" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2 - Spotlight Highlights
&lt;/h3&gt;

&lt;p&gt;
The Bot is a pro at finding the golden nuggets. It picks out the coolest parts of each act and creates a quick summary. Think of it like the highlights reel of a sports game – only for resumes. To make this happen, we’re going to use summarize chains and chat models modules from LangChain as well, specifically `load_summarize_chain` and `ChatOpenAI`.

`load_summarize_chain` would take the resume's content and make a concise summary for it based on the prompt we pass to it, `SUMMARY_PROMPT`, here.

&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/bin/python
# -*- coding: utf-8 -*-
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.chains.summarize&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_summarize_chain&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.chat_models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ChatOpenAI&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.prompts&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PromptTemplate&lt;/span&gt;

&lt;span class="c1"&gt;# Summarization Prompt
&lt;/span&gt;
&lt;span class="n"&gt;single_resume_tempate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
You are an expert at extracting information from a resume.
Use the given resumes text to write a concise summary.
The summary must include the following sections:
1. Name
2. Contact Information
3. Professional Summary or Objective
4. Work Experience
5. Internships
6. Education
7. Skills
8. Achievements and Accomplishments
9. Relevant Projects
10. Certifications
11. Volunteer Work and Extracurricular Activities
12. Publications and Presentations
13. Personal Interests
14. Extra Useful Information such as years of experience,
working environment (On-site,remote or hybrid), will to
relocate for a job (yes or no), military status (exempted,
completed, required)...etc.
{text}
Your final answer must not exceed 1000 words. &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;span class="n"&gt;SUMMARY_PROMPT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PromptTemplate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;template&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;single_resume_tempate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                &lt;span class="n"&gt;input_variables&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;# Chat Model
&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;gpt-4&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Summarize Chain
&lt;/span&gt;&lt;span class="n"&gt;single_summary_chain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load_summarize_chain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;chain_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;stuff&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;SUMMARY_PROMPT&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Print Summary
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="n"&gt;single_summary_chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resume_content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SLKlqmqb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fsummarize-resume.gif%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SLKlqmqb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fsummarize-resume.gif%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="summarizing resume's content" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3 - Storing Magic
&lt;/h3&gt;

&lt;p&gt;
Just like you have a drawer for your favorite things, the Bot has a digital space to keep those resume summaries. This makes it easy to find and chat about each act later on. It's like organizing your superhero cards. In order to do this, we’re going to utilize embeddings and vector stores from LangChain, especially `OpenAIEmbeddings` and `Chroma`.

`Chroma` is our vector store. It would use the `OpenAIEmbeddings` to embed the resume's content and store them for retrieval. Think of `Chroma` as a database that stores data about our resume.

&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.embeddings&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAIEmbeddings&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.docstore.document&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Document&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.vectorstores&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&gt;

&lt;span class="n"&gt;resume_summary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;single_summary_chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;summary_documents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page_content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resume_summary&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                     &lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;resume_path&lt;/span&gt;&lt;span class="p"&gt;})]&lt;/span&gt;
&lt;span class="n"&gt;embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;vectorstore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;summary_documents&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4 - Chat Showtime
&lt;/h3&gt;

&lt;p&gt;
This is where the magic comes alive. The Bot turns into a lively conversation, ready to discuss the acts. You throw questions like confetti, and the Bot pulls out the perfect answers from its magic hat. In order to make this happen, we are going to use the chains module from LangChain, specifically `ConversationalRetrievalChain`. 

`ConversationalRetrievalChain` allows us to have a conversation with LLM about our resumes. The `ConversationBufferMemory` powers our `ConversationalRetrievalChain` with memory, like human memory, so we can ask questions using pronouns like he, she, they...etc. instead of using the names every single time.

&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.memory&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ConversationBufferMemory&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.chains&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ConversationalRetrievalChain&lt;/span&gt;

&lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ConversationBufferMemory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;memory_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;chat_history&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;return_messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ConversationalRetrievalChain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_llm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chain_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;stuff&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;retriever&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;vectorstore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_retriever&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Who is the resume about?&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;question&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;answer&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# The resume is about John Doe
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wnw-HrWC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fconversational-chain.gif%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wnw-HrWC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://som3aware.vercel.app/_next/image%3Furl%3D%252Fposts%252Fconversational-chain.gif%26w%3D1200%26q%3D75%26dpl%3Ddpl_8pmxkxnScmx1iYjN8T3VHfaUeAy2" alt="conversation about resume video" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
  With a wave of LangChain's wizardry, we've created a Bot that can chat about talents, just like
  you'd talk about your favorite show. 🎤🎭 And guess what? You don't need to be a tech wizard to
  use it – it's all designed to make your talent-hunting adventure easy and fun.
&lt;/p&gt;

&lt;p&gt;
  So, next time you're searching for the brightest star in your talent galaxy, let the Talent
  Scouter Bot be your guide. It's like having a chatty sidekick who's always ready to help you find
  the next big sensation! 🎉🎵🤖
&lt;/p&gt;

&lt;p&gt;See part 2 to know more about Langchain, LLMs and more.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>openai</category>
      <category>python</category>
      <category>langchain</category>
    </item>
    <item>
      <title>How Does The Internet Work? Part 3: Traceroute</title>
      <dc:creator>Ahmed Abu Qahf</dc:creator>
      <pubDate>Mon, 09 Sep 2019 17:40:01 +0000</pubDate>
      <link>https://dev.to/som3aware/how-does-the-internet-work-part-3-traceroute-2b7l</link>
      <guid>https://dev.to/som3aware/how-does-the-internet-work-part-3-traceroute-2b7l</guid>
      <description>&lt;p&gt;Ever noticed how fast a single web page loads? How is it possible for a web page whose web-servers might be miles and miles away from your machine loads almost instantaneously? It makes you think: are our machines directly connected to our favorite website's servers? The answer is no, they are not.&lt;/p&gt;

&lt;p&gt;When you are on the internet, requests sent from your machine don't reach the destination computer in a single jump or a &lt;strong&gt;hop&lt;/strong&gt;. However, it follows a unique route through strategically and physically interconnected computer networks around the world called &lt;strong&gt;The Internet Backbone&lt;/strong&gt; in order to help you receive and transmit requests and information.&lt;/p&gt;

&lt;p&gt;If you navigate to &lt;a href="https://www.submarinecablemap.com"&gt;Submarine Cable Map&lt;/a&gt;, you'll be able to view the locations of these networks, and how they are interconnected.&lt;/p&gt;

&lt;p&gt;Another way to look at it is the &lt;a href="https://en.wikipedia.org/wiki/Opte_Project"&gt;Opte Project's&lt;/a&gt; visual representation of the internet. One of its visualizations is the following image which portrays a portion of the internet in 2005 in which each line is connected between nodes that represent two different IP addresses. How awesome is that 😮.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tKAcsd4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Internet_map_1024.jpg/800px-Internet_map_1024.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tKAcsd4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Internet_map_1024.jpg/800px-Internet_map_1024.jpg" alt="Alt text of image" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes you may wanna know what that route is, and that's where &lt;strong&gt;traceroute&lt;/strong&gt; steps in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Traceroute&lt;/strong&gt; is a procedure that enables you to precisely figure out how data transmission travels from one machine to another. Basically, it compiles a list of the computers on the network that are involved with an internet activity and identifies each computer or a server on that list and the time data took to get from one machine to another. If any interruption happens in the transfer of data, the traceroute shows you where the problem occurred along the chain.&lt;/p&gt;

&lt;p&gt;In order to perform a traceroute, open up your terminal and write down the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* traceroute HOSTNAME           if you're a Mac or Linux user.
* tracert HOSTNAME              if you're a Windows user.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For example, Let's try and traceroute Google.com&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SLnEcg51--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/34rye52vcxd39gpm06zy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SLnEcg51--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/34rye52vcxd39gpm06zy.PNG" alt="Alt Text" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We got that google's IP address is 172.217.17.174, so were we to enter that IP address in the browser's address bar and hit go, we should redirected to Google.com web page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YjNPmLo6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/29cxgfkv8cdyayp06yp1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YjNPmLo6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/29cxgfkv8cdyayp06yp1.gif" alt="Alt Text" width="640" height="346"&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Traceroute&lt;/strong&gt; is always a practical way if you're finding difficulty accessing a particular website. It helps in finding out where the problem is occurring in the network.&lt;/p&gt;

&lt;p&gt;The icon used in the cover image is licensed under &lt;a href="https://icons8.com/"&gt;icons8&lt;/a&gt; Free License.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How Does The Internet Work? Part 2: Breaking a Website</title>
      <dc:creator>Ahmed Abu Qahf</dc:creator>
      <pubDate>Fri, 06 Sep 2019 18:56:30 +0000</pubDate>
      <link>https://dev.to/som3aware/how-does-the-internet-work-part-2-breaking-a-website-5e59</link>
      <guid>https://dev.to/som3aware/how-does-the-internet-work-part-2-breaking-a-website-5e59</guid>
      <description>&lt;p&gt;This part's title might be a little bit deceiving; as you might think of it as hacking the website, and shutting it down. Sorry to disappoint you, but this is not what the title amplifies. The first &lt;a href="https://dev.to/ahmedsomaa/how-does-the-internet-works-part-1-behind-the-scenes-4d6m"&gt;part&lt;/a&gt; of this series finished at the website's web server replies back to your browser with the necessary &lt;strong&gt;HTML, CSS &amp;amp; JS&lt;/strong&gt; files so that the browser can render the website. What the title indicates is to break down the website to its components (HMTL, CSS &amp;amp; JS), and have some fun playing with them. In order to do so, we need to open a browser (firefox...E.g.), navigate to google.com or any other website and turn on the developer's tools.&lt;/p&gt;

&lt;p&gt;First things first. I'll start by giving a simple explanation to each component.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;a href="https://www.w3schools.com/html/html_intro.asp" rel="noopener noreferrer"&gt;HTML&lt;/a&gt;
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* stands for hyper text markup language.
* responsible for the structure of a web page.
* consists of elements represented in it by tags.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;a href="https://www.w3schools.com/css/" rel="noopener noreferrer"&gt;CSS&lt;/a&gt;
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* stands for cascading style sheet.
* from the name, it describes the style of a HTML page and 
  how HTML elements should be displayed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;a href="https://www.w3schools.com/js/" rel="noopener noreferrer"&gt;JavaScript&lt;/a&gt;
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* the programming language of HTML and the web.
* used in writing the elements' handlers to interact with the backend.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's get to the fun part.&lt;/p&gt;

&lt;p&gt;In order to turn on the developer's tools, you need to click on the settings menu icon which usually looks like three vertical lines or dots, then choose &lt;strong&gt;Web Developer&lt;/strong&gt; (Firefox), and check the &lt;strong&gt;toggle tools&lt;/strong&gt; tab, you should be getting a result like this.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F4wjazpctzjkl806uo871.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F4wjazpctzjkl806uo871.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the image, you can see that Google's home page HTML is located on the left of the image and right next to it is the CSS. Now we're going to play with the HTML code, and try to do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change Google Search Button To Your Name Search&lt;/li&gt;
&lt;li&gt;Delete I am Feeling Lucky Button&lt;/li&gt;
&lt;li&gt;Delete the whole html code&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Let's start with the first one:
&lt;/h4&gt;

&lt;p&gt;In order to do so, we need to activate &lt;strong&gt;pick an element from the page&lt;/strong&gt; button, located next to the inspector tab to the left, by either clicking on it or by clicking &lt;strong&gt;Ctrl+Shift+C&lt;/strong&gt; from the keyboard. Then, we pick the element we want to edit so we're going to pick &lt;strong&gt;Google Search&lt;/strong&gt; for this one. The tools immediately highlights the html code for this button to you. What we're going to do is to change the &lt;strong&gt;value attribute&lt;/strong&gt; to Your Name instead of Google, press ENTER, and voila you have your own search button 😃 .&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F9dnn9jqtf2gipdomkpyo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F9dnn9jqtf2gipdomkpyo.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  The second one:
&lt;/h4&gt;

&lt;p&gt;we'll follow the same steps as in one, but instead of changing the attribute value, we're going to delete the following line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input class="RNmpXc" value="I'm Feeling Lucky" 
aria-label="I'm Feeling Lucky" name="btnI" type="submit" jsaction="sf.lck" 
data-ved="0ahUKEwi1opyl4bzkAhUI0uAKHd4BBqAQ19QECAo"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F20vu0k1ziyz5l52byp7p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F20vu0k1ziyz5l52byp7p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
As the image shows, we successfully deleted the button. Can we do the same to the whole page, though?&lt;/p&gt;

&lt;h4&gt;
  
  
  The third one:
&lt;/h4&gt;

&lt;p&gt;we'll do the same steps in two, but this time, we're going to delete the whole &lt;strong&gt;body tag&lt;/strong&gt; code and see what happens.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8kurq3th9qv3oidvc2g6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8kurq3th9qv3oidvc2g6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
As we can see from the image, the page is totally white; no google logo image, no buttons, no tabs, nothing at all. This is mainly because the code inside the &lt;strong&gt;body tag&lt;/strong&gt; is the structure of the page. So, does this means you deleted google forever, and you might go to jail for this?! 😟. Absolutely not! What you just did is only deleting the copy of HTML code your browser got from Google's web servers for the request you sent earlier. If you enter google.com again in the browser's address bar and hit go, the process we talked about in &lt;a href="https://dev.to/ahmedsomaa/how-does-the-internet-works-part-1-behind-the-scenes-4d6m"&gt;part 1&lt;/a&gt; happens again, and you get another copy of the HTML code from Google's web servers so that your browser renders it and the full page shows up again like nothing happened.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fmoojg92cymloef9ytikq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fmoojg92cymloef9ytikq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's what I did after I played a bit, I changed it to totally Somaa's Search Engine 😂&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fxkw21iuwxefgpktd867h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fxkw21iuwxefgpktd867h.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cover Image Icon License: &lt;a href="https://icons8.com/" rel="noopener noreferrer"&gt;icons8&lt;/a&gt; Free License.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How Does The Internet Work? Part 1: Browsing a Website</title>
      <dc:creator>Ahmed Abu Qahf</dc:creator>
      <pubDate>Fri, 09 Aug 2019 23:49:08 +0000</pubDate>
      <link>https://dev.to/som3aware/how-does-the-internet-works-part-1-behind-the-scenes-4d6m</link>
      <guid>https://dev.to/som3aware/how-does-the-internet-works-part-1-behind-the-scenes-4d6m</guid>
      <description>&lt;p&gt;Who doesn't use the internet at least once during the day? Almost everyone, right? You start by opening up your browser (Firefox, chrome, safari...etc.), write down your favourite website's &lt;strong&gt;URL&lt;/strong&gt; (DEV, Google...etc.)  in the browser's address bar, you hit go and BOOM the website shows up, but have you ever considered how does this happen? what happens behind the scenes so once you gave the browser the website address, it shows up?&lt;/p&gt;

&lt;p&gt;Understanding how the Internet works is very important. Lots of people usually skims through the surface of the concepts behind the working mechanism of the internet without fully understanding how everything works together. Without these foundations, it becomes very difficult to think about performance, optimizing sites and so on. Therefore, I decided to share with you what I know about that, and I decided to post it as a series so that the post won't take you too much time reading it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 1:                 Browsing a Website
&lt;/h3&gt;

&lt;h4&gt;
  
  
  (A) Finding out The Domain's IP Address
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flh66syyh8zu9d9fathnm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flh66syyh8zu9d9fathnm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
When you enter a website URL (Google.com ...E.g.) in your browser URL bar and hit the go button, the browser first needs to know the &lt;strong&gt;IP address&lt;/strong&gt; of this domain you want to visit in order to navigate to it. Therefore, the browser checks its cache which keeps &lt;strong&gt;DNS&lt;/strong&gt; records for (2-30 minutes). If it is not there, the browser sends a request to your internet router asking it &lt;em&gt;"Who is this Google.com fellow?"&lt;/em&gt; Your router does the same by checking its own cache for &lt;strong&gt;DNS&lt;/strong&gt; records. If it is not there either, it sends the same request to your &lt;strong&gt;ISP&lt;/strong&gt; asking the same question &lt;em&gt;"Do you know this google.com?"&lt;/em&gt; Your &lt;strong&gt;ISP&lt;/strong&gt;  sends the same request one more time to its &lt;strong&gt;DNS&lt;/strong&gt; cache. The &lt;strong&gt;DNS&lt;/strong&gt; replies back to the ISP: &lt;em&gt;"I don't know who google.com is but I have its address, here it is 127.217.7.23"&lt;/em&gt;. The &lt;strong&gt;ISP&lt;/strong&gt; returns the &lt;strong&gt;IP Address&lt;/strong&gt; back to the router which in turn sends it back to your browser. &lt;/p&gt;

&lt;h4&gt;
  
  
  (B) Navigating to the Website
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhtfpa6huhiyb5vv4kurl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhtfpa6huhiyb5vv4kurl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Once the browser receives the &lt;strong&gt;IP Address&lt;/strong&gt;, it sends a &lt;strong&gt;HTTP request&lt;/strong&gt; to that address asking for establishing a connection between the browser and the website's web servers. The Web servers handle the request, and reply back to the browser by sending the website's &lt;strong&gt;HTML, CSS and JavaScript&lt;/strong&gt; which the browser renders so that you can view the website's page as it should be.&lt;/p&gt;

&lt;p&gt;Cover Image Icon License: &lt;a href="https://icons8.com/" rel="noopener noreferrer"&gt;icons8&lt;/a&gt; Free License.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
