peter! 🥷 Profile picture
May 11, 2023 10 tweets 3 min read Read on X
Memory in @LangChainAI is a big deal.

It was a lot to go through, but I broke it into bite-size chunks.

• 4 Memory Types Explained
• How to use Memory in a Chain
• How to add Memory to an Agent

Save this ↓ Image
ConversationBufferMemory:

• Memory allows for storing of messages
• Extracts the messages in a variable.

Pro: Basic to understand/pickup Image
ConversationBufferWindowMemory:

• Only uses the last K messages.

Pro: Useful to keep the memory history small Image
ConversationSummaryMemory

• Creates a summary of the conversation over time.

Pro: Useful for condensing information from the conversation over time. Image
VectorStore-Backed Memory

• Stores memories in a VectorDB
• Queries the top-K most relevant docs

Pro:
- Doesn’t explicitly track the order of messages
- AI can remember relevant pieces of information that it was told earlier Image
How to Add Memory to a Chain

1) Setup Prompt and Memory
2) Initialize LLMChain
3) Call the LLMChain Image
How to Add Memory to an Agent

1) Create an LLMChain with memory.
2) Use the LLMChain to create a custom Agent. Image
How to Add Memory to Multi-Input Chain: Image
Last but not least:

It's also possible to combine memory classes in the same chain: Image
That's it!

Will be making a lot more demo projects with memory in the upcoming weeks! 🫡

• • •

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

Keep Current with peter! 🥷

peter! 🥷 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 @pwang_szn

Sep 28, 2023
yo wtf, Microsoft's newly released AutoGen is fk'in dope..

- allows for multiple agents that align to one goal
- human input allowed

🤖 I created 5 agents to help me plan a 30-day iternary in Bangkok

(results below ↓) Image
5 agents:

🥳 Fun Manager - maximizes fun
🎆 Executive Assistant - makes sure work gets done
💪 Gym Trainer - makes sure training gets done
✈️ Planner - Suggests plan
👄 Critic - Double check plan, claims, code from other agents and provide feedback Image
👨‍🍳 Planner at work: Image
Read 5 tweets
Aug 6, 2023
How I Negotiated Multiple 250k+ Software Engineer Offers

No course needed, I'll teach you for free

(Use these lessons to negotiate anything..) Image
A bunch of people DM'd after my previous viral thread

So here it is. A quick guide on how to actually negotiate.

1-3 emails can be the difference between you adding 20-75k to your inital offer

Onwards.
#1 Never Give a Number

You are a Vogue model at a dive-bar. DO NOT GIVE YOUR NUMBER!

Recruiters are going ask for salary expectation, they will anchor their offer around the number you say.

If they insist on a number, just say "competitive for my skill & location"
Read 10 tweets
Jul 29, 2023
🪄 INTRODUCING: NotionWizard (Chat-to-Notion)

(Showcasing power of @OpenAI Functions)

1) Type in Prompt in @streamlit 💬
3) 📖 Get back url to new @NotionHQ page (w/ the help of OpenAI functions)

Demo, Code explained & Github Link↓ Image
👀 Live Demo:
1/ TLDR;

There are two files: main[.]py and api_calls[.]py

1) main[.]py has all the Streamlit chat code.
2) api_calls[.]py has the code to create a Notion page w/ content.

We determine if the user wants to create new notion page, if not, we give a normal GPT response
Read 8 tweets
Jul 22, 2023
How I Made $72,000+ Profit Slinging T-Shirts on the Side

Fun Facts:
- Started in the business in 2017 (my first business!)
- 6000+ uploaded t-shirt designs (I pay $.5 per design)
- <1% of the designs make 80% of the revenue
- $1000-$1500/month (pure profit)

🍿 The entire story: Image
More proof of earnings: Image
Before we start..

- Not selling a passive income course (it's 100x more competitive now..)
- Writing this purely for follower # boost (my ego cares a lot, so help ya boi out @pwang_szn)

So here's how it all started:
Read 15 tweets
Jun 30, 2023
In Jan 2022, I wasted 3 months no-life grinding @LeetCode and ended up with 3 decent offers (all software eng):

- $250k+ from @Uber
- $270k+ from @Affirm
- $260k+ from @gopuff

and then a bunch more 200k+ offers.

5 lessons i learned:
before we start..

no, I don't I have a leetcode course to sell you, i'm cheap af and used YT to interview prep (you can too!)

why am i writing this? my ego is heavily tied to follower # on this bird app, so click that lil' follow button @pwang_szn
tldr; leetcode is basically sudoku in tech interview world

if you're decent at leetcode, you can make 250k+ in tech
Read 11 tweets
Jun 19, 2023
"How I 100% Automated Generating Subtitles for buildfastcourse.com module videos"

1. Setup a @zapier to trigger when new video is added
2. Setup automation in @Dropbox to convert .mp4 to .wav
3. Use @DeepgramAI to generate transcript, convert to .srt format on Django server Image
Goal:

💬 Generate 95%+ accurate transcription for all the videos w/o paying some other service for overpriced human transcription that can cost >$1.5 per minute

Technical choice:
>> 🤖 Using Zapier bcuz I don't want to maintain webhooks on my server
1/ Whenever a new .wav file is added in Dropbox

We trigger an action to call our server's API to start the process of generating the transcript. Image
Read 10 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!

:(