Tutorial #2: OpenAI Vector Embeddings and Pinecone for Retrieval-Augmented Generation

Subscribers:
5,330
Published on ● Video Link: https://www.youtube.com/watch?v=rh-WNG4yJag



Category:
Tutorial
Duration: 16:27
842 views
20


LLMs like ChatGPT are known to hallucinate. If we can ground the LLM with an external memory (e.g. document, pdf), this may let the LLM generate more reliable outputs. We can also augment the output with the reference link (like Bing Search)!

For this tutorial, we use OpenAI Embeddings, Tokenizer (tiktoken), PineCone.

Disclaimer: Please do not openly show your OpenAI / PineCone API key like me. I am only showing it for educational purposes and have deleted the exposed key.

~~~~~~~~~~~~~~~~~~~

References:

Main Discussion Video: https://www.youtube.com/watch?v=lIoLCip0HwM

Original GPT4-Retrieval Augmentation Notebook: https://github.com/openai/openai-cookbook/tree/main/examples/vector_databases/pinecone
Modified Notebook (the one used in this tutorial): https://github.com/tanchongmin/TensorFlow-Implementations/blob/main/Tutorial/GPT4_Retrieval_Augmentation.ipynb

Pinecone: https://app.pinecone.io/organizations
OpenAI Chat Completions: https://platform.openai.com/docs/guides/chat/introduction
OpenAI Models: https://platform.openai.com/docs/models/gpt-3-5
OpenAI API Keys: https://platform.openai.com/account/api-keys
OpenAI API Usage: https://platform.openai.com/account/usage


LangChain Documentation: https://python.langchain.com/en/latest/
LangChain Recursive Character Text Splitter: https://python.langchain.com/en/latest/modules/indexes/text_splitters/examples/recursive_text_splitter.html
LangChain ReadTheDocs Documentation: https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/readthedocs_documentation.html

~~~~~~~~~~~~~~~~~~

0:00 Introduction
0:48 Prepare Documents for Loading
4:15 Generate Embeddings in Chunks
9:40 Retrieval-Augmented Generation
16:04 Conclusion

~~~~~~~~~~~~~~~~~~~

AI and ML enthusiast. Likes to think about the essences behind breakthroughs of AI and explain it in a simple and relatable way. Also, I am an avid game creator.

Discord: https://discord.gg/fXCZCPYs
LinkedIn: https://www.linkedin.com/in/chong-min-tan-94652288/
Online AI blog: https://delvingintotech.wordpress.com/.
Twitter: https://twitter.com/johntanchongmin
Try out my games here: https://simmer.io/@chongmin




Other Videos By John Tan Chong Min


2023-05-18Prediction builds representations! Fixed Bias speeds up learning!
2023-05-09Memory: How is it encoded, retrieved and how it can be used for learning systems
2023-05-02I created a Law Court Simulator with GPT4!
2023-05-02I created a Law Court Simulator with ChatGPT!
2023-04-25Creating a ChatGPT Harry Potter Text-based RPG game!
2023-04-25Learn from just Memory Storage and Retrieval: Generative Agents Interacting in Simulation!
2023-04-18The future is neuro-symbolic: Expressiveness of ChatGPT and generalizability of symbols (SymbolicAI)
2023-04-17Can GPT4 solve the Abstraction and Reasoning Corpus (ARC) Challenge Zero-Shot?
2023-04-12GPT4: Zero-shot Classification without any examples + Fine-tune with reflection
2023-04-11OpenAI Vector Embeddings - Talk to any book or document; Retrieval-Augmented Generation!
2023-04-11Tutorial #2: OpenAI Vector Embeddings and Pinecone for Retrieval-Augmented Generation
2023-04-04Creating JARVIS: ChatGPT + APIs - HuggingGPT, Memory-Augmented Context, Meta GPT structures
2023-04-02Is GPT4 capable of self-improving? Are we heading for AGI or AI doom?
2023-03-28How Visual ChatGPT works + Toolformer/Wolfram Alpha. LLMs with Tools/APIs/Plugins is the way ahead!
2023-03-21Tokenize any input, even continuous vectors! - Residual Vector Quantization - VALL-E (Part 2)
2023-03-07Using Transformers to mimic anyone's voice! - VALL-E (Part 1)
2023-02-28Learning Part-Whole Structure by Chunking - More Efficient than Deep Learning!!!
2023-02-21High-level planning with large language models - SayCan
2023-02-13Learning, Fast and Slow: Towards Fast and Adaptable Agents in Changing Environments
2023-02-07Using Logic Gates as Neurons - Deep Differentiable Logic Gate Networks!
2023-01-31Learn from External Memory, not just Weights: Large-Scale Retrieval for Reinforcement Learning