Eden Marco Profile picture
May 19 11 tweets 7 min read Twitter logo Read on Twitter
🧵 Ever wanted to talk with your LLM🤖 on some custom data that it wasn't originally trained on?
@LangChainAI 🦜🔗+ @pinecone 🌲vectorstore will do all the heavy lifting for you. Here's a simplified explanation using a series of 8 illustrations I made.

#GenAI
1/8 Assume you've got documentation of an internal library 📚. When you directly ask the LLM about the library, it can't answer as it wasn't trained on it 🤷‍♂️. No worries! @LangChainAI + @pinecone is here to help 🚀 Image
2/8: We load the entire package documentation into a vectorstore like @pinecone 🌲. This involves transforming the text into vectors, aka 'embeddings'. Now, these vectors hover around, representing our texts 🗂️ Image
3/8: don't worry about this process, it is actually very easy to do- but we will discuss this in future posts 🙂
4/8: We then want to take our query, turn it into a vector (again, an 'embedding') and place it in the vector space in @pinecone 🌐. Let's say the query is "What is LangChain?" 🤔 This is where the magic starts! Image
5/8 We can ask @pinecone to perform a semantic search to find vectors that are close to our query vector.
These vectors are semantically related and hold the info we need for our answer. Think of @pinecone as a magical compass (yes, magic!) pointing us to the answer 🧭 Image
6/8: Now we retrieve these vectors. They contain the context required to answer our query 🕵️‍♂️ and represent the text that we need to base our answer on. Image
7/8 Now we need convert these vectors back into readable text 📝 and send it as context to the LLM with our original query. This augmented prompt helps the LLM provide an accurate answer, even though it wasn't originally trained on our specific library 🏋️‍♀️. Image
8/8 And here's where @LangChainAI 🦜🔗shines - it automates this entire process and does all the heavy lifting for us 💪
With one line of code, you can invoke a RetrievalQA chain that takes care of all those tasks. Image
@LangChainAI has tons of more stuff on it, making our lives so much easier when developing LLM powered applications and IMO is the go to open source framework for developing LLM applications.
python.langchain.com/en/latest/
Here's some code 👇 and the Github repo link -
github.com/emarco177/docu…
Where you can find a reference for what we have discussed.
Inspired by @hwchase17 👑👑 the creator of @LangChainAI

END - OF -THREAD

• • •

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

Keep Current with Eden Marco

Eden Marco 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!

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 on Twitter!

:(