<?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>Forem: Shubrah Gupta</title>
    <description>The latest articles on Forem by Shubrah Gupta (@shubrah_gupta_107).</description>
    <link>https://forem.com/shubrah_gupta_107</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%2F1653074%2F5e209a71-7f0d-491b-8845-a229dfc0f918.png</url>
      <title>Forem: Shubrah Gupta</title>
      <link>https://forem.com/shubrah_gupta_107</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shubrah_gupta_107"/>
    <language>en</language>
    <item>
      <title>Code Companion: Dive Deep into Your Codebase with Your Own Intelligent AI Chatbot!</title>
      <dc:creator>Shubrah Gupta</dc:creator>
      <pubDate>Sun, 10 Nov 2024 16:55:55 +0000</pubDate>
      <link>https://forem.com/shubrah_gupta_107/code-companion-dive-deep-into-your-codebase-with-your-own-intelligent-ai-chatbot-37e</link>
      <guid>https://forem.com/shubrah_gupta_107/code-companion-dive-deep-into-your-codebase-with-your-own-intelligent-ai-chatbot-37e</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/pgai"&gt;Open Source AI Challenge with pgai and Ollama &lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What we Built
&lt;/h2&gt;

&lt;p&gt;We (&lt;a class="mentioned-user" href="https://dev.to/khemraj_bawaskar_f283a984"&gt;@khemraj_bawaskar_f283a984&lt;/a&gt; and I) have developed a dynamic, Streamlit-based application that lets you dive into your codebase like never before! Imagine having a personal ChatGPT that not only understands your code but can answer your questions about it, providing insights and explanations straight from your files. Here’s what our app can do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Codebase Processor:&lt;/strong&gt; Automatically clones your GitHub repository, vectorizes your code, and stores these embeddings in the PostgreSQL Vector Database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intelligent Chatbot&lt;/strong&gt;: Ready to answer all your code queries, it’s your code assistant, right at your fingertips!
Behind the scenes, it harnesses RAG (Retrieval-Augmented Generation) to embed important objects into a vector store, allowing for super-accurate similarity searches to give you the answers you need.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Built with: &lt;code&gt;langchain&lt;/code&gt;, &lt;code&gt;psycopg2&lt;/code&gt;&lt;br&gt;
Languages: Python 🐍&lt;/p&gt;


&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The application url: &lt;a href="https://timescalechallenge-bhqqjnxnnnhvsrlxotbmb5.streamlit.app/" rel="noopener noreferrer"&gt;https://timescalechallenge-bhqqjnxnnnhvsrlxotbmb5.streamlit.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The github repo url for the same: &lt;a href="https://github.com/shubrahgupta/timescale_challenge" rel="noopener noreferrer"&gt;https://github.com/shubrahgupta/timescale_challenge&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first view of the application looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjhkl3lluepwz1jinnj7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjhkl3lluepwz1jinnj7u.png" alt="HomePage" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It has options in the left pane, to toggle between 'Process Codebase' and 'Chatbot', while the default selected option is 'Process Codebase'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe48936xxbwms4a7ztjdh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe48936xxbwms4a7ztjdh.png" alt="Codebase processor in Action" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On selecting Chatbot, we find this screen: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F072ay1ib3xqhec2gi9kf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F072ay1ib3xqhec2gi9kf.png" alt="Chatbot Screen" width="800" height="424"&gt;&lt;/a&gt;&lt;br&gt;
This screen provides a drop-down list to choose from the projects created, and get started on chatting with the assistant.&lt;/p&gt;

&lt;p&gt;On asking queries, the response is delivered, and the screen looks something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r3nzujdphpe4pcu253m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r3nzujdphpe4pcu253m.png" alt="Chatbot in Action" width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Tools Used
&lt;/h2&gt;



&lt;p&gt;We have made use of: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;pgvector&lt;/strong&gt;: We tapped into the open-source power of pgvector through the &lt;code&gt;langchain_postgres&lt;/code&gt; library to store vectorized documents and handle similarity searches.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langchain_postgres.vectorstores import PGVector
vectorstore = PGVector(
        embeddings=embeddings,
        collection_name=collection_name,
        connection=connection,
        use_jsonb=True,
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;pgai&lt;/strong&gt;: Our custom integration of Timescale's pgai with the LangChain's &lt;code&gt;PGVector&lt;/code&gt; Class gave us a streamlined approach for creating embeddings! Using pgAI, we crafted a custom &lt;code&gt;PgAIEmbeddings&lt;/code&gt; class to harness the OpenAI model via pgAI.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from langchain_postgres.vectorstores import PGVector
vectorstore = PGVector(
       embeddings=**PgAIEmbeddings**(connection_string=connection),
        collection_name=collection_name,
        connection=connection,
        use_jsonb=True,
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here’s a sneak peek at how we handled embeddings in our PgAIEmbeddings class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def embed_documents(self, texts: List[str]) -&amp;gt; List[List[float]]:
    """Embed a list of documents using pgAI's OpenAI embedding function"""
    embeddings = []
    with psycopg2.connect(self.connection_string) as conn:
        with conn.cursor() as cur:
            for text in texts:
                cur.execute(
                    "SELECT ai.openai_embed('text-embedding-ada-002', %s) as embedding",
                    (text,)
                )
                result = cur.fetchone()
                # Parse the embedding string into a list of floats
                embedding = self._parse_embedding(result[0])
                embeddings.append(embedding)
    return embeddings
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open AI&lt;/strong&gt;: Acting as both the embedding creator and the brains behind the answers, OpenAI’s LLM brings this platform to life!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This platform is a complete game-changer for code exploration, making it fun, intuitive, and unbelievably insightful. Just imagine using it to create code summaries, suggest improvements, JIRA user story and test cases creation, modernize legacy code or even aid in debugging—possibilities are endless! With pgvector and pgai as our foundation, our app is set up for endless growth and flexibility.&lt;/p&gt;

&lt;p&gt;Prize Categories:&lt;br&gt;
We're in the running for the main prize category! This challenge asked us to build an AI application using open-source tools with PostgreSQL as a vector database, alongside at least two of the following: pgvector, pgvectorscale, pgai, and pgai Vectorizer. We did that—and more!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>pgaichallenge</category>
      <category>database</category>
      <category>ai</category>
    </item>
    <item>
      <title>Magical Stories for All: Journey into Fantasy with Our StoryTeller Bot!</title>
      <dc:creator>Shubrah Gupta</dc:creator>
      <pubDate>Sun, 23 Jun 2024 19:11:43 +0000</pubDate>
      <link>https://forem.com/shubrah_gupta_107/get-enchanted-by-the-good-old-storyteller-5g6h</link>
      <guid>https://forem.com/shubrah_gupta_107/get-enchanted-by-the-good-old-storyteller-5g6h</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/twilio"&gt;Twilio Challenge v24.06.12&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Ever wanted to go back to your childhood, when grandma told you stories about animals and birds, adding her own little twists while you sat in wonder about what would happen next? Ever felt bored and wished someone would read you magical stories that could transport you to another realm? Well, we've got just the thing for you!&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;p&gt;We(&lt;a class="mentioned-user" href="https://dev.to/khemraj_bawaskar_f283a984"&gt;@khemraj_bawaskar_f283a984&lt;/a&gt; and I) have created a storyteller bot for WhatsApp that reads stories to you over a call. Simply provide the genre and maturity level, and our bot will deliver an engaging storytelling experience tailored to your preferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/s7uwEDdPI9k"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Twilio and AI
&lt;/h2&gt;

&lt;p&gt;We have leveraged the WhatsApp Sandbox feature of Twilio to create a storyteller bot that uses a webhook link for a Flask server. By integrating Azure OpenAI LLM for advanced AI capabilities and Twilio's voice call feature, our bot can call users and tell them a story in their desired genre.&lt;/p&gt;

&lt;p&gt;We have a command '/story' to generate the response from the bot.&lt;/p&gt;

&lt;p&gt;To get into the sandbox, follow this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03wqadkztp1ax9jh7hgy.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03wqadkztp1ax9jh7hgy.jpeg" alt="Whatsapp Sandbox" width="800" height="179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This link can help you get started with the Twilio Whatsapp sandbox: &lt;a href="https://www.twilio.com/docs/whatsapp/sandbox"&gt;https://www.twilio.com/docs/whatsapp/sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the sandbox starts, the user can get started with '/start' command, which throws the following message: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Hello there! I'm your Storyteller Bot, here to whisk you away on incredible adventures. Whether you seek epic fantasies, heartwarming tales, or thrilling mysteries, I have a story for every mood and moment.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Please use '/story' tag followed with the genre and age group for which you want to hear the story.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Following template can be used:&lt;/em&gt;&lt;br&gt;
&lt;em&gt;'/story tell me a romantic story for age group of 24-26 years&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The user can accordingly use the commands and get responses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/story:&lt;/strong&gt; Generates a story using Azure OpenAI from the genre and the maturity level provided by the user, and calls the user to read them a beautiful story.&lt;/p&gt;

&lt;p&gt;Checkout our Github repo: &lt;a&gt;StoryTellerBot repository&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Prize Categories
&lt;/h2&gt;

&lt;p&gt;Our team believes that our submission of the fitness bot qualifies for two of the categories: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Twilio Times Two:&lt;/strong&gt; We have utilized two APIs provided by Twilio: the voice calling API and the WhatsApp Sandbox messaging API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Entertaining Endeavors:&lt;/strong&gt; This project offers a wonderfully entertaining experience that can calm, soothe, or entertain users with their requested stories. Children often enjoy listening to stories while eating or sleeping, making this a great tool for them, akin to having their grandparents read to them. It is also beneficial for grown-ups who desire stories that are intense, thrilling, or chilling.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devchallenge</category>
      <category>twiliochallenge</category>
      <category>ai</category>
      <category>twilio</category>
    </item>
    <item>
      <title>Your personal fitness trainer at your service!</title>
      <dc:creator>Shubrah Gupta</dc:creator>
      <pubDate>Sun, 23 Jun 2024 19:11:41 +0000</pubDate>
      <link>https://forem.com/shubrah_gupta_107/your-personal-fitness-trainer-at-your-service-4144</link>
      <guid>https://forem.com/shubrah_gupta_107/your-personal-fitness-trainer-at-your-service-4144</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/twilio"&gt;Twilio Challenge v24.06.12&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I used to be hesitant about fitness, worrying about how much effort it would take and what might happen if I did an exercise wrong. I thought it would be too much work, but then I just went for it. Guess what? It's awesome! Fitness is the best way to prolong your life, live to your maximum potential, and keep yourself free from illness. And we've created just the thing you need to get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;p&gt;We(&lt;a class="mentioned-user" href="https://dev.to/khemraj_bawaskar_f283a984"&gt;@khemraj_bawaskar_f283a984&lt;/a&gt; and I) have developed a fitness bot on Whatsapp designed to support and enhance your fitness journey. Our fitness bot offers motivational fitness quotes, assists in planning your workouts and diet, and schedules reminders to ensure you stay hydrated and eat your meals on time. You can also ask the bot any fitness-related queries, and it will provide the best possible answers and advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/BWltYXFmZmo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Twilio and AI
&lt;/h2&gt;

&lt;p&gt;We have leveraged the WhatsApp Sandbox feature of Twilio to create a bot that utilizes a webhook link for a Flask server. By integrating Azure OpenAI LLM for advanced AI capabilities and Twilio's voice call feature, our bot can call users to remind them about their scheduled reminders.&lt;/p&gt;

&lt;p&gt;We have certain commands such as '/tip' or '/dietplan' or '/workoutplan' or '/reminder' or '/query' to generate the response from the bot.&lt;/p&gt;

&lt;p&gt;To get into the sandbox, follow this:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixfs1fkutjlpyz0ujo69.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixfs1fkutjlpyz0ujo69.png" alt="Whatsapp Sandbox" width="800" height="159"&gt;&lt;/a&gt;&lt;br&gt;
This link can help you get started with the Twilio Whatsapp sandbox: &lt;a href="https://www.twilio.com/docs/whatsapp/sandbox"&gt;https://www.twilio.com/docs/whatsapp/sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the sandbox starts, the user can get started with '/start' command, which throws the following message: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Hi, start your wellness journey now. please use '/tip' or '/dietplan' or '/workoutplan' or '/reminder' or '/query' tag along with the information needed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;These templates can be used:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;'/dietplan weight: 50Kg, height: 5 feet, purpose: muscle-enhancement, non-veg food'&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;'/workoutplan weight: 50Kg, height: 5 feet, purpose: leg-muscles-enhancement, exercise mode: mid'&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;'/query I am unable to feel my back-muscle while doing lat-pull downs. What should I do to improve?'&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;'/reminder Please set an call reminder for lunch at 2 PM on 25/06/2024'&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;'/tip'&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The user can accordingly use the commands and get responses.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;/tip:&lt;/strong&gt; Provides motivational fitness/workout quotes to keep you inspired.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/reminder:&lt;/strong&gt; Helps to schedule a reminder with a time and description, and a voice call comes at the scheduled time to remind the user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/query:&lt;/strong&gt; The bot answers the query with the best possible suggestions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/workoutplan:&lt;/strong&gt; The bot creates a workout plan for the user for a day according to the given weight, height, purpose of the workout, and intensity of the exercise mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/dietplan:&lt;/strong&gt; The bot creates a diet plan for the user for a day according to the given weight, height, purpose of the diet(for bulking/cutting/normal muscle growth), and preference of the food(veg/non-veg).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Checkout our Github repo: &lt;a href="https://github.com/shubrahgupta/fitness-bot"&gt;FitnessBot repository&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Prize Categories
&lt;/h2&gt;

&lt;p&gt;Our team believes that our submission of the fitness bot qualifies for two of the categories: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Twilio Times Two:&lt;/strong&gt; We have utilized two APIs provided by Twilio: the voice calling API and the WhatsApp Sandbox messaging API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Impactful Innovators:&lt;/strong&gt; We believe this project can drive a positive impact on society by promoting fitness. Beginners can overcome their nervousness by asking the bot relevant questions, helping them become more fit and start their fitness journey with confidence.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devchallenge</category>
      <category>twiliochallenge</category>
      <category>ai</category>
      <category>twilio</category>
    </item>
  </channel>
</rss>
