Shubham Saboo Profile picture
May 4 11 tweets 4 min read Read on X
Build a LLM app with RAG to chat with any AI newsletter on Substack in just 30 lines of Python Code (step-by-step instructions):
1. Import necessary libraries

• Streamlit for building the web app
• Embedchain for the RAG functionality
• tempfile for creating temporary files and directories Image
2. Configure the Embedchain App

For this application we will use GPT-4 Turbo, you can choose from cohere, anthropic or any other LLM of your choice.

Select the vector database as the opensource chroma db (you are free to choose any other vector database of your choice) Image
3. Set up the Streamlit App

Streamlit lets you create user interface with just python code, for this app we will:

• Add a title to the app using 'st.title()'
• Create a text input box for the user to enter their OpenAI API key using 'st.text_input()' Image
4. Initialize the Embedchain App

• If the OpenAI API key is provided, create a temporary directory for the vector database using 'tempfile.mkdtemp()'
• Initialize the Embedchain app using the 'embedchain_bot' function Image
5. Get the Substack Newsletter URL from the user and add it to the knowledge base

• Use 'st.text_input()' to get the substack URL from the user
• Given the video URL, add it to the embedchain application Image
6. Ask question about the AI newsletter and display the answer

• Create a text input for the user to enter their question using 'st.text_input()'
• If a question is asked, get the answer from the Embedchain app and display it using 'st.write()' Image
Full RAG Application Code to Chat with Substack Newsletter👇 Image
Working Application demo using Streamlit

Paste the above code in vscode and run the following command: 'streamlit run chat_substack.py' Image
If you’re interested in:
- ML/NLP
- LLMs
- RAG

Connect with me → @Saboo_Shubham_
My Newsletter →

Everyday, I share tip & tutorials on above topics on X and my newsletter. unwindai.substack.com
Image
Find all the awesome LLM Apps demo with RAG in the following Github Repo.

P.S: Don't forget to star the repo to show your support 🌟
github.com/Shubhamsaboo/a…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Shubham Saboo

Shubham Saboo Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Saboo_Shubham_

May 2
Build a RAG app with Llama-3 running locally on your computer
(100% free and without internet):
1. Install the necessary Python Libraries

Run the following command from your terminal. Image
2. Import necessary libraries

• Streamlit for building the web app
• LangChain for the RAG functionality
• Ollama for running local LLM like Llama-3 Image
Read 13 tweets
May 1
Build a LLM app with RAG to chat with your Gmail Inbox in just 30 lines of Python Code (step-by-step instructions):
1. Install the necessary Python Libraries

Run the following command from your terminal. Image
2. Create a project in Google Cloud

• Head to Google Cloud Console .
• Click on 'Create Project', give it a name, and proceed. console.cloud.google.com
Image
Read 16 tweets
Apr 29
Build a LLM app with RAG to chat with YouTube videos in just 30 lines of Python Code (step-by-step instructions):
1. Import necessary libraries

• Streamlit for building the web app
• Embedchain for the RAG functionality
• tempfile for creating temporary files and directories Image
2. Configure the Embedchain App

For this application we will use GPT-4 Turbo, you can choose from cohere, anthropic or any other LLM of your choice.

Select the vector database as the opensource chroma db (you are free to choose any other vector database of your choice) Image
Read 10 tweets
Apr 28
Build a LLM app with RAG to chat with PDF in just 30 lines of Python Code
(step-by-step instructions):
1. Import necessary libraries

• Streamlit for building the web app
• Embedchain for the RAG functionality
• tempfile for creating temporary files and directories Image
2. Configure the Embedchain App

Select the LLM and embedding provider as OpenAI, you can choose from cohere, anthropic or any other of your choice.

Select the vector database as the opensource chroma db (you are free to choose any other vector database of your choice). Image
Read 10 tweets
Apr 26
Build LLM app with RAG in a few lines of Python Code (step-by-step instructions):
1. Install Embedchain

Embedchain is an opensource AI framework for creating LLM apps with RAG. It effectively segments data into manageable chunks, generates relevant embeddings, and stores them in a vector database for optimized retrieval. Image
2. Get your OpenAI API key from platform.openai.com/api-keys
Read 6 tweets
Apr 20
3 ways to run Llama-3 locally (100% free and without internet):
1. GPT4All

An open-source project that provides tools and software to run powerful LLMs on your computer, without needing access to expensive GPU hardware or cloud services.
2. LM Studio

It is a tool that allows you to run Llama-3 and other opensource LLMs offline on your local PC.

You can download the LM Studio application, install it, and then use it to download and run any opensource LLM completely offline.
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(