<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rwlankford on Medium]]></title>
        <description><![CDATA[Stories by Rwlankford on Medium]]></description>
        <link>https://medium.com/@rwlankford?source=rss-e1a3e97a9a8e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tlI_lHApVzQhvMJp</url>
            <title>Stories by Rwlankford on Medium</title>
            <link>https://medium.com/@rwlankford?source=rss-e1a3e97a9a8e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 19:23:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rwlankford/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Built a RAG Model that uses Slack as the Querying Interface]]></title>
            <link>https://medium.com/@rwlankford/how-i-built-a-rag-model-that-uses-slack-as-the-querying-interface-1d348f1f2778?source=rss-e1a3e97a9a8e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d348f1f2778</guid>
            <category><![CDATA[llama-3]]></category>
            <category><![CDATA[rag-pipeline]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[rag-model]]></category>
            <dc:creator><![CDATA[Rwlankford]]></dc:creator>
            <pubDate>Wed, 20 Nov 2024 18:58:32 GMT</pubDate>
            <atom:updated>2024-11-22T14:27:02.188Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I ventured into creating a <strong>retrieval-augmented generation (RAG)</strong> pipeline powered by <strong>Llama-3</strong> that extracted text from both PDFs and Videos to build a vector database that Llama-3 could use for question-answering from Slack. Here’s a step-by-step guide on how I built it and what I learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*2WZspcjeqeLLKpFmodgbTA.png" /></figure><h3>The Vision: Making Institutional Knowledge Accessible</h3><p>The goal of this project was to combine related video and pdf content allowing users to utilize the near ubiquitous business interface (Slack) to find actionable insights. By enabling users to ask questions about content generated by the business and get precise answers, I aimed to make institutional knowledge accessible to all. This inspired the creation of a <strong>retrieval-augmented generation (RAG)</strong> pipeline powered by <strong>Llama-3</strong>.</p><h3>Preparing the Foundation</h3><p>Before diving into the development, I started by laying out the project’s objectives and selecting the right tools. The pipeline was designed around three key components:</p><ol><li><strong>Video-to-Text Extraction</strong>: Extracting meaningful text from video media.</li><li><strong>PDF-to-Text Extraction</strong>: Extracting the text contained within PDF files.</li><li><strong>Knowledge Base Construction</strong>: Organizing the extracted text into a queryable vector database.</li><li><strong>AI Query System</strong>: Using Llama-3 to answer questions based on the knowledge base’s content.</li><li><strong>Slack Bot Integration</strong>: Connecting Slack messages made to a Slack Bot into a templated query.</li></ol><h4>Key Tools Used:</h4><ul><li><strong>Python</strong>: The backbone of the project.</li><li><strong>MoviePy</strong>: For extracting audio from video files.</li><li><strong>Whisper</strong>: OpenAI’s transcription tool for converting audio to text.</li><li><strong>HuggingFace Embedding</strong>: Embed the generated text into a form that the LLM can process</li><li><strong>Llama-3</strong>: To power the RAG-based query answering.</li><li><strong>ChromaDB</strong>: An ephemeral database for indexing and retrieval of data.</li><li><strong>Slack Web Client</strong>: Allows for communication between the model and the Slack Interface.</li><li><strong>Flask</strong>: A web application framework for Python</li><li><strong>NGrok</strong>: Exposes the local server so the application can interact with Slack’s WebClient.</li></ul><h3>Step 1: Extracting Video Transcripts</h3><p>To start, I needed to transform video content into a text-based format. This process involved:</p><ul><li><strong>Extracting Audio</strong>: Using <a href="https://zulko.github.io/moviepy/">MoviePy</a> to isolate the audio stream from video files. MoviePy utilizes FFMpeg underneath it so feel free to swap in any audio extractor you wish.</li></ul><pre>def extract_audio_from_video(video_file, output_audio_file):<br>    &quot;&quot;&quot;Extracts audio from video and saves it as an audio file.&quot;&quot;&quot;<br>    try:<br>        video = mp.VideoFileClip(video_file)<br>        video.audio.write_audiofile(output_audio_file)<br>        print(f&quot;Audio extracted from {video_file} and saved as {output_audio_file}.&quot;)<br>    except Exception as e:<br>        print(f&quot;Failed to extract audio from {video_file}: {e}&quot;)</pre><ul><li><strong>Generating Transcripts</strong>: Leveraging OpenAI’s Whisper to convert audio into text. Whisper’s multilingual capabilities ensured a high degree of accuracy. I tried converting with a variety of Whisper models, but for the level of accuracy needed I settled on “Large”.</li></ul><pre>def transcribe_audio_with_whisper(audio_file, model):<br>    &quot;&quot;&quot;Transcribes audio to text using the Whisper model.&quot;&quot;&quot;<br>    try:<br>        result = model.transcribe(audio_file)<br>        print(f&quot;Transcription completed for {audio_file}.&quot;)<br>        return result[&#39;text&#39;]<br>    except Exception as e:<br>        print(f&quot;Failed to transcribe {audio_file}: {e}&quot;)<br>        return &quot;[Transcription Error]&quot;</pre><p>Here is the Python script in it’s entirety. The function <strong>process_videos</strong> calls the functions above to create the .txt files for our next step. I created this Python Script separate as the processing can be time and resource consuming depending on your file sizes.</p><pre>import os<br>import whisper<br>import moviepy.editor as mp<br><br>def extract_audio_from_video(video_file, output_audio_file):<br>    &quot;&quot;&quot;Extracts audio from video and saves it as an audio file.&quot;&quot;&quot;<br>    try:<br>        video = mp.VideoFileClip(video_file)<br>        video.audio.write_audiofile(output_audio_file)<br>        print(f&quot;Audio extracted from {video_file} and saved as {output_audio_file}.&quot;)<br>    except Exception as e:<br>        print(f&quot;Failed to extract audio from {video_file}: {e}&quot;)<br><br>def transcribe_audio_with_whisper(audio_file, model):<br>    &quot;&quot;&quot;Transcribes audio to text using the Whisper model.&quot;&quot;&quot;<br>    try:<br>        result = model.transcribe(audio_file)<br>        print(f&quot;Transcription completed for {audio_file}.&quot;)<br>        return result[&#39;text&#39;]<br>    except Exception as e:<br>        print(f&quot;Failed to transcribe {audio_file}: {e}&quot;)<br>        return &quot;[Transcription Error]&quot;<br><br>def process_videos(video_folder, model):<br>    &quot;&quot;&quot;Processes all videos in a folder, transcribes them, and saves the transcription.&quot;&quot;&quot;<br>    for video_file in os.listdir(video_folder):<br>        if video_file.endswith(&#39;.mp4&#39;):<br>            video_path = os.path.join(video_folder, video_file)<br>            audio_file = video_file.replace(&#39;.mp4&#39;, &#39;.wav&#39;)<br>            audio_path = os.path.join(video_folder, audio_file)<br>            <br>            try:<br>                # Extract audio from video<br>                extract_audio_from_video(video_path, audio_path)<br>                <br>                # Transcribe audio with Whisper<br>                transcription = transcribe_audio_with_whisper(audio_path, model)<br>                <br>                # Save transcription to a text file<br>                transcription_file = video_file.replace(&#39;.mp4&#39;, &#39;.txt&#39;)<br>                transcription_path = os.path.join(video_folder, transcription_file)<br>                with open(transcription_path, &#39;w&#39;) as f:<br>                    f.write(transcription)<br>                <br>                print(f&quot;Transcription saved as {transcription_file}.&quot;)<br>                <br>            except Exception as e:<br>                print(f&quot;Error processing {video_file}: {e}&quot;)<br>            <br>            finally:<br>                # Clean up: Optionally remove the temporary audio file<br>                if os.path.exists(audio_path):<br>                    os.remove(audio_path)<br>                    print(f&quot;Temporary audio file {audio_file} deleted.&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    # Set the path to your video folder<br>    video_folder = &quot;YOUR FILE PATH HERE&quot;  <br>    <br>    try:<br>        # Load the Whisper model<br>        model = whisper.load_model(&quot;large&quot;)  <br>        print(&quot;Whisper model loaded successfully.&quot;)<br>        <br>        # Process all videos in the folder<br>        process_videos(video_folder, model)<br>        <br>    except Exception as e:<br>        print(f&quot;An error occurred: {e}&quot;)</pre><h3>Step 2: Building the Knowledge Base</h3><p>With transcripts ready, the next step was to organize this data into a searchable format. Here, I used embeddings generated by Llama-3 to index the extracted text. The knowledge base was constructed as follows:</p><ol><li><strong>Ensure Llama has Initialized</strong>: I used Ollama to localize Llama 3. This step ensures you did it correctly.</li></ol><pre>#Check to see if Llama has been initialized<br>llm = Ollama(model=&quot;llama3&quot;)<br>response = llm.complete(&quot;What is a RAG Pipeline?&quot;)<br>print(response)</pre><p>2. <strong>Define and Load Files</strong>: This step loads the .txt files from the previous step as well as the PDF documents.</p><pre># Define the path to the folder containing the PDFs<br>pdf_folder_path = &#39;YOUR PDF FILE PATH&#39; <br>txt_folder_path = &#39;YOUR TXT FILE PATH&#39;<br><br># Check if the directorys exist<br>if not os.path.isdir(pdf_folder_path):<br>    raise ValueError(f&quot;Directory {pdf_folder_path} does not exist.&quot;)<br><br>if not os.path.isdir(txt_folder_path):<br>    raise ValueError(f&quot;Directory {txt_folder_path} does not exist.&quot;)<br><br># Gather all PDF and TXT files in the folder<br>pdf_files = list(Path(pdf_folder_path).glob(&#39;*.pdf&#39;))<br>txt_files = list(Path(txt_folder_path).glob(&#39;*.txt&#39;))</pre><p>3. <strong>Parse the TXT files</strong>: Create a custom class to parse the .txt files.</p><pre>class TxtDocument:<br>    def __init__(self, text, doc_id):<br>        self.text = text<br>        self.doc_id = doc_id<br>        self.id_ = doc_id  # Add id_ attribute<br><br>    def get_doc_id(self):<br>        return self.doc_id<br><br>    def hash(self):<br>        return hashlib.md5(self.text.encode(&#39;utf-8&#39;)).hexdigest()<br>    <br>    def get_metadata_str(self, mode=None):<br>        if mode:<br>            return f&quot;Document ID: {self.doc_id}, Mode: {mode}&quot;<br>        return f&quot;Document ID: {self.doc_id}&quot;<br>    <br>    def get_content(self, metadata_mode=None):<br>        if metadata_mode:<br>            return f&quot;Content: {self.text}, Metadata Mode: {metadata_mode}&quot;<br>        return self.text<br>    <br>    def as_related_node_info(self):<br>        return {<br>            &quot;doc_id&quot;: self.doc_id,<br>            &quot;text&quot;: self.text,<br>            &quot;metadata&quot;: self.get_metadata_str()<br>        }</pre><p>3. <strong>Store the content in a List</strong>: Create an empty list to capture the content extracted with a for loop:</p><pre># Initialize an empty list to store PDF content<br>all_content = []<br><br># Loop through each PDF file and extract content<br>for pdfs in pdf_reader.iter_data():<br>    for pdf in pdfs:<br>        pdf.text = pdf.text.upper()<br>        all_content.append(pdf)<br><br># Loop through each TXT file and extract content<br>for txt_file in txt_files:<br>    with open(txt_file, &#39;r&#39;, encoding=&#39;utf-8&#39;) as file:<br>        txt_content = file.read()<br>        txt_doc = TxtDocument(text=txt_content.upper(), doc_id=str(txt_file))<br>        all_content.append(Document(text=txt_doc.get_content(), doc_id=txt_doc.get_doc_id()))</pre><p>3. <strong>Create the Index</strong>: Create an instance of ChromaDB and ensure an existing collection is deleted if it exists</p><pre># Create a unified index<br>chroma_client = chromadb.EphemeralClient()<br><br># Delete the existing collection if it exists<br>if &quot;ollama&quot; in chroma_client.list_collections():<br>    chroma_client.delete_collection(&quot;ollama&quot;)</pre><p>4. <strong>Create the Pipeline</strong>: Build the pipeline for indexing and retrieving the content using a vector database. Steps include:</p><ul><li><strong>Storing the Data</strong>: Using a vector database like <strong>Chroma</strong> for efficient search and retrieval.</li><li><strong>Creating Embeddings</strong>: Generating vector representations for each chunk.</li><li><strong>Chunking the Content</strong>: Breaking large transcripts into smaller, coherent sections</li></ul><p>Here’s a look at the creation process:</p><pre>#Create pipeline for indexing and retrieving documents using vector database<br>chroma_collection = chroma_client.create_collection(&quot;ollama&quot;)<br>vector_store = ChromaVectorStore(chroma_collection=chroma_collection)<br>storage_context = StorageContext.from_defaults(vector_store=vector_store)<br>index = VectorStoreIndex.from_documents(<br>    all_content, <br>    storage_context=storage_context, <br>    embed_model=embed_model, <br>    transformations=[SentenceSplitter(chunk_size=256, chunk_overlap=10)]<br>)</pre><h3>Step 4: Setup Slack</h3><p><strong>Step 1: Create a new Slack app</strong></p><ul><li>Choose an existing Slack workspace or create a new one.</li><li>Go to <a href="https://api.slack.com/apps">https://api.slack.com/apps</a> and sign in with your Slack account.</li><li>Click “Create New App” and then select “From Scratch”</li><li>Provide an app name and select your workspace as the development workspace. Click “Create App”.</li></ul><p><strong>Step 2: Set up your bot</strong></p><ul><li>Under the “Add features and functionality” section, click on “Bots”.</li><li>Click “Add a Bot User” and fill in the display name and default username. Save your changes.</li></ul><p><strong>Step 3: Add permissions to your bot</strong></p><ul><li>In the left sidebar menu, click on “OAuth &amp; Permissions”.</li><li>Scroll down to “Scopes” and add the required bot token scopes. For this example, you’ll need at least app_mentions:read, chat:write, and channels:history.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*JTMiGHr2QefrcFZjdqS82w.png" /></figure><p><strong>Step 4: Install the bot to your workspace</strong></p><ul><li>In the left sidebar menu to go basic information and click on “Install App”.</li><li>Click “Install App to Workspace” and authorize the app.</li></ul><p><strong>Step 5: Retrieve the bot token</strong></p><ul><li>After installation, go back to “OAuth &amp; Permissions” page.</li><li>Copy the “Bot User OAuth Access Token” (it starts with xoxb-). You’ll need it for your Python script.</li></ul><h3>Step 5: Question-Answering with Llama-3</h3><p>The most exciting stage was enabling user queries. This involved:</p><ul><li>Retrieving the most relevant transcript chunk based on the question from Slack.</li><li>Creating a template to prompt the questions into Llama</li><li>Using Llama-3 to generate a response, contextualized by the retrieved chunk.</li></ul><p>I integrated Llama-3 with the vector database, ensuring that answers were both accurate and context-aware.</p><p>Step 1: Create a Prompt Template</p><pre>#Create Prompt Template<br>template = (<br>    &quot;Imagine you are a professor teaching a class on Artifical Intelligence and &quot;<br>    &quot;you answer a student&#39;s questions about what you have gone over in previous lectures.&quot;<br>    &quot;Here is some context from the Aritifical Intelligence class: \n&quot;<br>    &quot;related to the query::\n&quot;<br>    &quot;-----------------------------------------\n&quot;<br>    &quot;{context_str}\n&quot;<br>    &quot;-----------------------------------------\n&quot;<br>    &quot;Considering the above information, &quot;<br>    &quot;please respond to the following inquiry:\n\n&quot;<br>    &quot;Question: {query_str}\n\n&quot;<br>    &quot;Answer succinctly and ensure your response is &quot;<br>    &quot;clear to someone without a deep understaind of Artifical Intelligence.&quot;<br>    &quot;The professor&#39;s name is Richard.&quot;<br>)<br>qa_template = PromptTemplate(template)</pre><p>Step 2: Query the ChromaDB index looking for the top 3 most similar txt files</p><pre>#Create a text-based Question-Answering task the responds with the top 3 most similar documents<br>query_engine = index.as_query_engine(text_qa_template=qa_template, similarity_top_k=3)</pre><h3>Step 6: Python Setup for Slack &amp; Flask</h3><p>This step will allow python to interact with Slack. To do so we will initialize and run Flask which will create a local Flask server with the output running on <a href="http://127.0.0.1:5000/">http://127.0.0.1:5000/</a>. We will utilize this output later in the Ngrok setup.</p><p><strong>Step 1: Setup Slack environment variables in an .env file</strong></p><pre># Load environment variables from .env file<br>load_dotenv(find_dotenv())<br><br># Set Slack API credentials<br>SLACK_BOT_TOKEN = os.environ[&quot;SLACK_BOT_TOKEN&quot;]<br>SLACK_SIGNING_SECRET = os.environ[&quot;SLACK_SIGNING_SECRET&quot;]<br>SLACK_BOT_USER_ID = os.environ[&quot;SLACK_BOT_USER_ID&quot;]</pre><p><strong>Step 2: Initialize the Slack App</strong></p><pre># Initialize the Slack app<br>app = App(token=SLACK_BOT_TOKEN)</pre><p><strong>Step 2: Initialize Flask</strong></p><pre># Initialize the Flask app<br># Flask is a web application framework written in Python<br>flask_app = Flask(__name__)<br>#Pass your Slack Token to Slack WebClient<br>handler = SlackRequestHandler(app)</pre><p><strong>Step 3: Create a Slack Event Listener and Response Mechanism</strong></p><pre>#Create a Slack WebClient for sending messages<br>@app.event(&quot;app_mention&quot;)<br>def handle_mentions(body, say):<br>    &quot;&quot;&quot;<br>    Event listener for mentions in Slack.<br>    When the bot is mentioned, this function processes the text and sends a response.<br><br>    Args:@<br>        body (dict): The event data received from Slack.<br>        say (callable): A function for sending a response to the channel.<br>    &quot;&quot;&quot;<br>    text = body[&quot;event&quot;][&quot;text&quot;]<br><br>    mention = f&quot;&lt;@{SLACK_BOT_USER_ID}&gt;&quot;<br>    text = text.replace(mention, &quot;&quot;).strip()<br><br>#Create an immediate response in slack notifying the user we are working on it<br>    say(&quot;INSERT IMMEDIATE RESPONSE FOR SLACK&quot;)<br>    response = query_engine.query(text)<br>    say(response.response)<br><br><br>@flask_app.route(&quot;/slack/events&quot;, methods=[&quot;POST&quot;])<br>def slack_events():<br>    &quot;&quot;&quot;<br>    Route for handling Slack events.<br>    This function passes the incoming HTTP request to the SlackRequestHandler for processing.<br><br>    Returns:<br>        Response: The result of handling the request.<br>    &quot;&quot;&quot;<br>    return handler.handle(request)</pre><p><strong>Step 4: Run the Flask App</strong></p><pre># Run the Flask app<br>if __name__ == &quot;__main__&quot;:<br>    flask_app.run()</pre><p>Here are the complete code blocks:</p><pre># Load environment variables from .env file<br>load_dotenv(find_dotenv())<br><br># Set Slack API credentials<br>SLACK_BOT_TOKEN = os.environ[&quot;SLACK_BOT_TOKEN&quot;]<br>SLACK_SIGNING_SECRET = os.environ[&quot;SLACK_SIGNING_SECRET&quot;]<br>SLACK_BOT_USER_ID = os.environ[&quot;SLACK_BOT_USER_ID&quot;]<br><br># Initialize the Slack app<br>app = App(token=SLACK_BOT_TOKEN)<br><br># Initialize the Flask app<br># Flask is a web application framework written in Python<br>flask_app = Flask(__name__)<br>handler = SlackRequestHandler(app)</pre><pre>#Create a Slack WebClient for sending messages<br>@app.event(&quot;app_mention&quot;)<br>def handle_mentions(body, say):<br>    &quot;&quot;&quot;<br>    Event listener for mentions in Slack.<br>    When the bot is mentioned, this function processes the text and sends a response.<br><br>    Args:@<br>        body (dict): The event data received from Slack.<br>        say (callable): A function for sending a response to the channel.<br>    &quot;&quot;&quot;<br>    text = body[&quot;event&quot;][&quot;text&quot;]<br><br>    mention = f&quot;&lt;@{SLACK_BOT_USER_ID}&gt;&quot;<br>    text = text.replace(mention, &quot;&quot;).strip()<br><br>    say(&quot;Great question! Let me find the answer for you.&quot;)<br>    response = query_engine.query(text)<br>    say(response.response)<br><br><br>@flask_app.route(&quot;/slack/events&quot;, methods=[&quot;POST&quot;])<br>def slack_events():<br>    &quot;&quot;&quot;<br>    Route for handling Slack events.<br>    This function passes the incoming HTTP request to the SlackRequestHandler for processing.<br><br>    Returns:<br>        Response: The result of handling the request.<br>    &quot;&quot;&quot;<br>    return handler.handle(request)<br><br><br># Run the Flask app<br>if __name__ == &quot;__main__&quot;:<br>    flask_app.run()</pre><h3>Step 7: Server Setup</h3><p>Almost done. Now we expose our local server using <a href="https://ngrok.com/download">Ngrok</a></p><p><strong>Step 1</strong>: <strong>Launch Ngrok:</strong></p><ul><li>In a new terminal (macOS/Linux) or Command Prompt (Windows), start ngrok by running the following command:</li></ul><pre>ngrok http 5000</pre><p><strong>Mac Users Please Note:</strong> Port 5000 of localhost is used by AirPlay Receiver. You may need to use a different port, or turn off the Airplay Receiver from System Preferences -&gt; General -&gt; AirDrop &amp; Handoff</p><p><strong>Step 2: Note the HTTPS URL provided by Ngrok:</strong></p><ul><li>Copy the URL provided by ngrok (e.g., <a href="https://yoursubdomain.ngrok.io/">https://yoursubdomain.ngrok.io</a>). You’ll need it for the next step.</li></ul><p><strong>Step 3: Configure your Slack app with the ngrok URL</strong></p><ul><li>Go back to your Slack app settings at <a href="https://api.slack.com/apps">https://api.slack.com/apps</a>.</li><li>Click on “Event Subscriptions” in the left sidebar menu.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*F16C-SMpvyyLOcz7CwP8VQ.png" /></figure><ul><li>Enable events and enter your ngrok URL <strong>followed by /slack/events</strong> (e.g., <a href="https://yoursubdomain.ngrok.io/slack/events">https://yoursubdomain.ngrok.io/slack/events</a>).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*pOAZB2I5r5UrwKlY4kMllw.png" /></figure><ul><li>Scroll down to “Subscribe to bot events” and click “Add Bot User Event”. Add the app_mention event and save your changes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*j7ejIFPUUnmZ_8rp23IBfw.png" /></figure><h4><strong>Please note that every time you restart ngrok in the terminal, you have to update the URL in Slack — this is just for testing.</strong></h4><p><strong>Step 4: Reinstall your Slack app to Update teh Permissions</strong></p><ul><li>In the left sidebar menu, click on “Install App”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*icFOv-DDSUL7xgf038c1aA.png" /></figure><ul><li>Click “Reinstall App to Workspace” and authorize the app.</li></ul><h3>Step 7: Utilizing within Slack</h3><p>Add your bot to any Slack channel by typing the following in a channel:</p><pre>/invite @bot-name</pre><h3>Lessons Learned</h3><p>Building this pipeline taught me several lessons:</p><ol><li><strong>Iterate Quickly</strong>: Start with a simple MVP before refining each component. This code all runs locally allowing for iterating quickly (but processing slowly)</li><li><strong>Keep it Modular</strong>: Decoupling tasks like transcription, embedding, and querying made debugging easier.</li><li><strong>Focus on Context</strong>: The quality of answers depends heavily on the relevance of retrieved data.</li></ol><h3>Final Thoughts</h3><p>Creating a <strong>retrieval-augmented generation (RAG)</strong> pipeline powered by <strong>Llama-3</strong> was a rewarding journey. While the project is far from perfect, it showcases the immense potential of RAG models in transforming unstructured data into actionable insights.</p><p>If you have any questions please feel free to reach out to me <a href="https://www.linkedin.com/in/rwlankford/">via LinkedIn</a>. Let’s continue pushing the boundaries of what AI can achieve!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d348f1f2778" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>