Shubham Saboo Profile picture
May 4, 2024 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_

Sep 14
China's Alibaba just dropped a Python framework for building multi-agent apps.

AgentScope lets you build AI agents visually with MCP tools, memory, rag, and reasoning capabilities.

Works with any LLM and supports real-time steering.

100% Opensource. Image
100+ free step-by-step tutorials with code covering:

🚀 AI Agents
📀 RAG Systems
🗣️ Voice AI Agents
🌐 MCP AI Agents
🤝 Multi-agent Teams
🎮 Autonomous Game Playing Agents

P.S: Don't forget to subscribe for FREE to access future tutorials.

theunwindai.com
Read 4 tweets
Sep 12
JSON prompting for LLMs, explained with examples:
What is JSON prompting?

JSON prompting is a way of asking an LLM using a clear, structured format (with keys and values) and expecting the response in the same structured style.

Text prompts → inconsistent, messy outputs
JSON prompt → consistent, parseable data Image
The Problem With Text Prompts

Natural language is strong, but in AI it’s loose.

“Summarize this email” or “give key takeaways” leaves room for guesswork.

You wouldn’t tell a junior: “Make it better. Do what feels right.”

Yet we do that with AI all the time. Image
Read 12 tweets
Sep 7
Let's build a local RAG Agent using Google's EmbeddingGemma and Ollama running locally on your machine.

100% Opensource and works without internet.
You can follow along this tutorials with step-by-step code instructions on @unwind_ai_

theunwindai.com/p/build-a-loca…
1. Install the necessary Python Libraries

Run the following command from your terminal.

Then pull the required Ollama models:
• ollama pull embeddinggemma:latest
• ollama pull llama3.2:latest Image
Read 11 tweets
Sep 4
Stop building AI agents that ignore your instructions.

This Python framework guarantees LLM Agents follow your rules in production. Every single time.

100% Opensource. Image
Traditional approach: Write 47-rule system prompts and pray the LLM follows them.

Parlant (@EmcieCo) approach: Define clear guidelines that are contextually matched and enforced.

No more "roll of the dice" conversations. Image
Parlant Version 3 just dropped:

• Guidelines: Rules you set are enforced every single time
• Journeys: Conversations adapt when users go off-script
• Playground: Watch, test, and debug in full context
• Widget: Production-ready chat UI you can drop anywhere
Read 4 tweets
Aug 30
RAG everything locally!

Index millions of documents on your laptop using 97% less storage than traditional vector databases.

Also work as a drop-in semantic search search MCP for claude Code.

100% Opensource and free with Ollama. Image
100+ free step-by-step tutorials with code covering:

🚀 AI Agents
📀 RAG Systems
🗣️ Voice AI Agents
🌐 MCP AI Agents
🤝 Multi-agent Teams
🎮 Autonomous Game Playing Agents

P.S: Don't forget to subscribe for FREE to access future tutorials.

theunwindai.com
Stay tuned for more such interesting posts → @Saboo_Shubham_

I have created 100+ AI Agents and RAG tutorials, 100% free and opensource.

P.S: Don't forget to star the repo to show your support 🌟

github.com/Shubhamsaboo/a…
Read 4 tweets
Aug 25
Learn to build AI Coding Agents from scratch.

Similar to Claude code, Cursor, Windsurf, Amp, Cline and OpenCode.

100% free workshop. Image
100+ free AI Agents and RAG tutorials with code covering:

🚀 AI Agents
📀 RAG Systems
🗣️ Voice AI Agents
🌐 MCP AI Agents
🤝 Multi-agent Teams
🎮 Autonomous Game Playing Agents

P.S: Don't forget to subscribe for FREE to access future tutorials.

theunwindai.com
Read 4 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!

:(