Avi Chawla Profile picture
Jan 25 7 tweets 2 min read Read on X
Let's build a mini-ChatGPT that's powered by DeepSeek-R1 (100% local):
Here's a mini-ChatGPT app that runs locally on your computer. You can chat with it just like you would chat with ChatGPT.

We use:
- @DeepSeek_AI R1 as the LLM
- @Ollama to locally serve R1
- @chainlit_io for the UI

Let's build it!
We begin with the import statements and define the start_chat method.

It is invoked as soon as a new chat session starts. Image
Next, we define another method which will be invoked to generate a response from the LLM:

• The user inputs a prompt.
• We add it to the interaction history.
• We generate a response from the LLM.
• We store the LLM response in the interaction history. Image
Finally, we define the main method and run the app as follows: Image
Done!

This launches our 100% locally running mini-ChatGPT that is powered by DeepSeek-R1.
That's a wrap!

If you enjoyed this tutorial:

Find me → @_avichawla

Every day, I share tutorials and insights on DS, ML, LLMs, and RAGs.

• • •

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

Keep Current with Avi Chawla

Avi Chawla 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 @_avichawla

Jan 26
95% of Jupyter Notebook users don't know these 5 AWESOME tricks:
1) Retrieve a cell’s output in Jupyter

If you often forget to assign the results of a Jupyter cell to a variable, you can use the `Out` dictionary to retrieve the output: Image
2) Enrich the default preview of a DataFrame

Printing a DataFrame hardly tells anything about what’s inside this data.

Jupyter-DataTables enriches it with:
- sorting
- filtering
- exporting
- pagination
- column data type
- column distribution Image
Read 7 tweets
Jan 23
5 most popular Agentic AI design patterns, clearly explained (with visuals):
Agentic behaviors allow LLMs to refine their output by incorporating self-evaluation, planning, and collaboration!

The following visual depicts the 5 most popular design patterns employed in building AI agents.

Let's understand them below!
1) Reflection pattern:

The AI reviews its own work to spot mistakes and iterate until it produces the final response.
Read 8 tweets
Jan 22
What is DeepSeek-R1 and how to use it, clearly explained:
For starters, DeepSeek AI released some open-weight reasoning models (like o1).

What's crazy is that it achieves a similar performance as OpenAI o1 but at much lower costs (~95% cheaper).

For instance, per 1M tokens:
• OpenAI o1: $60.00
• DeepSeek R1: $2.19 (95% cheaper). Image
Here's how to access it:

- Run it locally using Ollama (shown in the image).
- Use the chat interface chat [.] deepseek [.] com (select "DeepThink").
- DeepSeek API. Image
Read 9 tweets
Jan 21
5 chunking strategies for RAG, clearly explained (with visuals):
Additional document(s) can be pretty large.

Thus chunking involves dividing large documents into smaller/manageable pieces.

This ensures the text fits the input size of the embedding model, and it also improves the retrieval quality. Image
Here are five chunking strategies for RAG:

Let’s understand them below.
Read 10 tweets
Jan 19
Let's build a multi-agent internet research assistant with OpenAI Swarm & Llama 3.2 (100% local):
Before we begin, here's what we're building!

The app takes a user query, searches the web for it, and turns it into a well-crafted article.

Tool stack:
- @ollama for running LLMs locally.
- @OpenAI Swarm for multi-agent orchestration.
- @Streamlit for the UI.
The architecture diagram below illustrates the key components (agents/tools) & how they interact with each other!

Let's implement it now!
Read 9 tweets
Jan 17
Traditional RAG vs. Agentic RAG, clearly explained (with visuals):
Traditional RAG has many issues:

- It retrieves once and generates once. If the context isn't enough, it cannot dynamically search for more info.

- It cannot reason through complex queries.

- The system can't modify its strategy based on the problem.
Agentic RAG attempts to solve this.

The following visual depicts how it differs from traditional RAG.

The core idea is to introduce agentic behaviors at each stage of RAG.
Read 7 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!

:(