
Explore LangChain concepts like lms prompts, chains, memory retrieval, and augmented generation using open source llm models and HuggingFace transformers.
LangChain is an open source framework for building apps with large language models, offering Python and JavaScript libraries as a central hub for LLMs, external data sources, and workflows.
Set up a Pipenv environment and install the required libraries. Load Mistral A-7b from Hugging Face as an 8-bit quantized CPU model and stream text in the terminal.
Explore how prompts guide language models using prompt templates for dynamic customization with variables and placeholders. Learn how to construct a chain to apply these prompts in practice.
Learn to add memory to a chatbot by using LangChain's conversation buffer memory with a chat history key, load memory variables via runnable lambda, and save context after each exchange.
Understand retrieval augmented generation, an framework grounding large language models with external data. Follow the workflow: load, split, embed, store in a LangChain vector store, and retrieve with similarity search.
Use mini lm6 v2 open source embeddings from Hugging Face to map text into a 384-dimensional vector, then store and retrieve them with Chroma DB via LangChain embeddings.
Initialize db Init.py to load sample.txt with Lang change document loaders, split into 400-chunk pieces with 100 overlap, create embeddings with all mintum l6 v2 and persist data with chroma.
Build a retrieval augmented generation pipeline in code using lang chain components like llama cpp, hugging face embeddings, and chroma vector store to answer from context.
Explore how agents use a language model as a reasoning engine to decide actions and their order, customize with tools and toolkits, and communicate decisions via xml based chains.
Create a Kaggle notebook, install transformers and related libraries, load the Mistral 7b Instruct model with auto tokenizer and auto model, and stream output via a Hugging Face pipeline.
Explore building an XML agent with LangChain by wiring a word count tool, pulling prompts from LangChain hub, and executing the agent with a configured executor.
Explore how the ReAct agent uses react prompting to couple reasoning and action in a long chain framework, with the language model guiding steps and order.
Build a mini chatbot using a react frontend template with buttons and text areas, sending post requests to chat endpoint; use FastAPI and LangChain to generate and stream output back.
Set up GitHub Codespaces with react template on virtual machine, verify 16gb ram, clone repo into chat, rename folders frontend and backend, install dependencies, and run app on port 5173.
Open a terminal, navigate to chat and back end, install LangChain, llama cpp, Python, and faster pi, create a models directory, and download gemma seven with wget.
Configure a back-end script to generate text with gemma 7b using llama cpp via langchain community lms. Set the model path and max tokens to 50, then invoke and print.
Create a fast api app with cors middleware for localhost 5173 and credentials, install an auto formatter, and build a chat prompt template with a language model, stopping at Q.
Create a faster API chat endpoint with app.post, converting requests to JSON, and streaming LLM output via a generator and server-sent events using FastAPI streaming response.
Configure allow origins to asterisk to make the url accessible, run uvicorn with reload, publish port 8000, and update the frontend to use the copied url with /chat.
In this course I will teach you how to use langchain to build LLM powered Applications and I will be using Open source models from hugging face
What is LangChain?
LangChain serves as a framework aimed at streamlining the development of applications utilizing Large language models. Functioning as a language model integration framework, LangChain's applications align closely with those of language models, spanning document analysis, summarization, chatbots, and code analysis.
What is an LLM?
A Large Language Model (LLM) is a type of artificial intelligence model that is trained on a vast amount of text data. It’s designed to generate human-like text based on the input it receives.
In this course, I will be using LLMs such as Llama 2 7B and Mistral 7B.
What is LCEL?
LangChain Expression Language (LCEL) emerges as a declarative method within the LangChain framework, enabling effortless composition of chains. From its inception, LCEL prioritizes seamless transition from prototypes to production, accommodating a spectrum of complexities, from straightforward "prompt + LLM" sequences to intricate chains comprising hundreds of steps. Noteworthy features encompass streaming support for optimal time-to-first-token, asynchronous capabilities for versatile API usage, and optimized parallel execution for reduced latency. LCEL further offers configurations for retries, fallbacks, and access to intermediate results, enhancing reliability and debugging.
In this course you learn
- Langchain Basics
- Langchain Expression Language
- Chains
- Memory
- Agents and Tools
- RAG etc
Disclaimer:
In this course I won't be using Open Ai API instead I would be using Open source models from hugging face and i will be using windows, kaggle