Notes on the short course from DeepLearning.AI
- LangChain (LC) provides abstraction for interacting with LLM APIs, i.e. prompt templates and output parsers
- LLMs are stateless, but when building a chat interface, we can supply the entire conversation as context
- Embeddings create numerical representation for pieces of text covering their content/meaning - text with similar content will have similar vectors
- Vector databases contain embedding vectors and the corresponding chunk of text (which are usually smaller than the original document/text)
- Querying a vector database means creating an embedding for the search query and retrieving n most-similar chunks of text
- Chain-of-Thought Reasoning (ReAct)
- Check out prompts for common operations
- Chains and memory (especially ConversationSummaryBufferMemory) lend themselves to building chat interfaces
- Use chains to use (multiple) output from one prompt as input to another prompt
- Memory can also be stored and retrieved in/from external databases, i.e. vector databases
- LangChain also supports developing Q&A applications over documents
- Use QAGenerationChain to generate question/answer pairs automatically (using LLM)
- Use QAEvalChain to evaluate question/answer pairs automatically (using LLM)
- Use
langchain.debug = True
to get debugging information - Agents use LLMs as a reasoning engine and can use tools, i.e. a calculator or searching information on Wikipedia, to complete tasks
- You can define your own tools by writing a Python function and decorating it with
@tool