zuoxiaodong0815 / openai-quickstart

A comprehensive guide to understanding and implementing large language models with hands-on examples using LangChain for GenAI applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAI Quickstart


English | 中文

This project is designed as a one-stop learning resource for anyone interested in large language models and their application in Generative AI(GenAI) scenarios. By providing theoretical foundations, development basics, and hands-on examples, this project offers comprehensive guidance on these cutting-edge topics.

Features

  • Theory and Development Basics of Large Language Models: Deep dive into the inner workings of large language models like BERT and GPT Family, including their architecture, training methods, applications, and more.

  • OpenAI-based Development: tutorial and best practices for OpenAI's Embedding, GPT-3.5, GPT-4, as well as practical development such as Function Calling and ChatGPT Plugin.

  • GenAI Application Development with LangChain: Hands-on examples and tutorials using LangChain to develop GenAI applications, demonstrating the practical application of large language models(AutoGPT, RAG-chatbot, Machine Translation)

  • LLM Tech Stack and Ecosystem: Data privacy and legal compliance, GPU Technology Selection Guide, Hugging Face quick start, ChatGLM usage.

Getting Started

You can start by cloning this repository to your local machine:

git clone https://github.com/DjangoPeng/openai-quickstart.git

Then navigate to the directory and follow the individual module instructions to get started.

Setting Up the Development Environment

Configuring Jupyter Lab for Background Startup

After installing the development environment as mentioned above, it's recommended to start Jupyter Lab as a background service. Here's how to configure it (using the root user as an example):

# Generate a Jupyter Lab configuration file
$ jupyter lab --generate-config
Writing default config to: /root/.jupyter/jupyter_lab_config.py

Open the configuration file and make the following changes:

# Allowing Jupyter Lab to start as a non-root user (no need to modify if starting as root)
c.ServerApp.allow_root = True
c.ServerApp.ip = '*'

Use nohup to start Jupyter Lab in the background:

$ nohup jupyter lab --port=8000 --NotebookApp.token='replace_with_your_password' --notebook-dir=./ &

Jupyter Lab's output log will be saved in the nohup.out file (which is already filtered in the .gitignore file).

Schedule

Lesson Description Course Materials Events
Lesson 1 Fundamentals of Large Models: Evolution of Theory and Technology
- An Initial Exploration of Large Models: Origin and Development
- Warm-up: Decoding Attention Mechanism
- Milestone of Transformation: The Rise of Transformer
- Taking Different Paths: The Choices of GPT and Bert
Suggested Readings:
- Attention Mechanism: Neural Machine Translation by Jointly Learning to Align and Translate
- An Attentive Survey of Attention Models
- Transformer: Attention is All you Need
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
[Homework]
Lesson 2 The GPT Model Family: From Start to Present
- From GPT-1 to GPT-3.5: The Evolution
- ChatGPT: Where It Wins
- GPT-4: A New Beginning
Prompt Learning
- Chain-of-Thought (CoT): The Pioneering Work
- Self-Consistency: Multi-path Reasoning
- Tree-of-Thoughts (ToT): Continuing the Story
Suggested Readings:
- GPT-1: Improving Language Understanding by Generative Pre-training
- GPT-2: Language Models are Unsupervised Multitask Learners
- GPT-3: Language Models are Few-Shot Learners


Additional Readings:
- GPT-4: Architecture, Infrastructure, Training Dataset, Costs, Vision, MoE
- GPTs are GPTs: An Early Look at the Labor Market Impact Potential of Large Language Models
- Sparks of Artificial General Intelligence: Early experiments with GPT-4

[Homework]
Lesson 3 Fundamentals of Large Model Development: OpenAI Embedding
- The Eve of General Artificial Intelligence
- "Three Worlds" and "Turing Test"
- Computer Data Representation
- Representation Learning and Embedding
Embeddings Dev 101
- Course Project: GitHub openai-quickstart
- Getting Started with OpenAI Embeddings
Suggested Readings:
- Representation Learning: A Review and New Perspectives
- Word2Vec: Efficient Estimation of Word Representations in Vector Space
- GloVe: Global Vectors for Word Representation

Additional Readings:

- Improving Distributional Similarity with Lessons Learned from Word Embeddings
- Evaluation methods for unsupervised word embeddings
[Homework]
Code:
[embedding]
Lesson 4 OpenAI Large Model Development and Application Practice
- OpenAI Large Model Development Guide
- Overview of OpenAI Language Models
- OpenAI GPT-4, GPT-3.5, GPT-3, Moderation
- OpenAI Token Billing and Calculation
OpenAI API Introduction and Practice
- OpenAI Models API
- OpenAI Completions API
- OpenAI Chat Completions API
- Completions vs Chat Completions
OpenAI Large Model Application Practice
- Initial Exploration of Text Completion
- Initial Exploration of Chatbots
Suggested Readings:

- OpenAI Models
- OpenAI Completions API
- OpenAI Chat Completions API
Code:
[models]
[tiktoken]
Lesson 5 Best Practices for Applying Large AI Models
- How to Improve the Efficiency and Quality of GPT Model Use
- Best Practices for Applying Large AI Models
- Text Creation and Generation
- Article Abstract and Summary
- Novel Generation and Content Supervision
- Executing Complex Tasks Step by Step
- Evaluating the Quality of Model Output
- Constructing Training Annotation Data
- Code Debugging Assistant
- New Features: Function Calling Introduction and Practical Application
Suggested Readings
- GPT Best Practices
- Function Calling
Code:
Function Calling
Lesson 6 Practical: OpenAI-Translator
- Market demand analysis for OpenAI-Translator
- Product definition and feature planning for OpenAI-Translator
- Technical solutions and architecture design for OpenAI-Translator
- OpenAI module design
- OpenAI-Translator practical application
Code:
pdfplumber
Lesson 7 ChatGPT Plugin Development Guide
- Introduction to ChatGPT Plugin
- Sample project: Todo management plugin
- Deployment and testing of practical examples
- ChatGPT developer mode
- Practical: Weather Forecast plugin development
- Weather Forecast Plugin design and definition
- Weather Forecast function service
- Integration with third-party weather query platform
- Practical Weather Forecast Plugin
Code:
[todo list]
[weather forecast]
Lesson 8 LLM Application Development Framework LangChain (Part 1)
- LangChain 101
- What is LangChain
- Why LangChain is Needed
- Typical Use Cases of LangChain
- Basic Concepts and Modular Design of LangChain
- Introduction and Practice of LangChain Core Modules
- Standardized Large-Scale Model Abstraction: Mode I/O
- Template Input: Prompts
- Language Model: Models
- Standardized Output: Output Parsers
Code:
[model io]
Lesson 9 LLM Application Development Framework LangChain (Part 2)
- Best Practices for LLM Chains
- Getting Started with Your First Chain: LLM Chain
- Sequential Chain: A Chained Call with Sequential Arrangement
- Transform Chain: A Chain for Processing Long Texts
- Router Chain: A Chain for Implementing Conditional Judgments
- Memory: Endowing Applications with Memory Capabilities
- The Relationship between Memory System and Chain
- BaseMemory and BaseChatMessageMemory: Memory Base Classes
- Memory System for Service Chatting
- ConversationBufferMemory
- ConversationBufferWindowMemory
- ConversationSummaryBufferMemory
Code:
[chains]
[memory]
Lesson 10 LLM Application Development Framework LangChain (Part 3)
- Native data processing flow of the framework: Data Connection
- Document Loaders
- Document Transformers
- Text Embedding Models
- Vector Stores
- Retrievers
- Agent Systems for Building Complex Applications: Agents
- Theoretical Foundation of Agents: ReAct
- LLM Reasoning Capabilities: CoT, ToT
- LLM Operation Capabilities: WebGPT, SayCan
- LangChain Agents Module Design and Principle Analysis
- Module: Agent, Tools, Toolkits
- Runtime: AgentExecutor, PlanAndExecute, AutoGPT
- Getting Started with Your First Agent: Google Search + LLM
- Practice with ReAct: SerpAPI + LLM-MATH
Code:
[data connection]
[agents]
Lesson 11 Practical: LangChain version OpenAI-Translator v2.0
- In-depth understanding of Chat Model and Chat Prompt Template
- Review: LangChain Chat Model usage and process
- Design translation prompt templates using Chat Prompt Template
- Implement bilingual translation using Chat Model
- Simplify Chat Prompt construction using LLMChain
- Optimize OpenAI-Translator architecture design based on LangChain
- Hand over large model management to LangChain framework
- Focus on application-specific Prompt design
- Implement translation interface using TranslationChain
- More concise and unified configuration management
- Development of OpenAI-Translator v2.0 feature
- Design and implementation of graphical interface based on Gradio
- Design and implementation of Web Server based on Flask
Code:
[openai-translator]
Lesson 12 Practical: LangChain version Auto-GPT
- Auto-GPT project positioning and value interpretation
- Introduction to Auto-GPT open source project
- Auto-GPT positioning: an independent GPT-4 experiment
- Auto-GPT value: an attempt at AGI based on Agent
- LangChain version Auto-GPT technical solution and architecture design
- In-depth understanding of LangChain Agents
- LangChain Experimental module
- Auto-GPT autonomous agent design
- Auto-GPT Prompt design
- Auto-GPT Memory design
- In-depth understanding of LangChain VectorStore
- Auto-GPT OutputParser design
- Practical LangChain version Auto-GPT
Code:
[autogpt]
Lesson 13 Sales-Consultant business process and value analysis
- Technical solution and architecture design of Sales-Consultant
- Use GPT-4 to generate sales pitches
- Store sales Q&A pitches in FAISS vector database
- Retrieve sales pitches data using RetrievalQA
- Implement chatbot graphical interface using Gradio
- Practical LangChain version Sales-Consultant
Code:
[sales_chatbot]
Lesson 14 Era of large models: Open source and data protocols
- What is open source?
- Widely used open source and data protocols
- Is Llama pseudo-open source?
- Open source protocol of ChatGLM2-6B
Interpretability of large language models
- Enhancing transparency in model decision-making
- Related research of Stanford Alpaca
Regulatory compliance of large language model applications
- Mainland China: Registration of generative AI services
- International: Data privacy and protection (taking GDPR as an example)
- Key points of corporate compliance
Lesson 15 Github in the era of large models: Hugging Face
- What is Hugging Face?
- Hugging Face Transformers library
- Hugging Face open community: Models, Datasets, Spaces, Docs
- Comparative analysis of large models
- Open LLM Leaderboard (Large Model Ladder)
Graphics card selection guide
- GPU vs Graphics card
- GPU Core vs AMD CU
- CUDA Core vs Tensor Core
- Evolution of Nvidia architectures
- Graphics card performance ladder
Lesson 16 Tsinghua GLM large model family
- Strongest base model GLM-130B
- Enhanced dialogue capability ChatGLM
- Open source chat model ChatGLM2-6B
- Internet search capability WebGLM
- Initial exploration of multimodal VisualGLM-6B
- Code generation model CodeGeex2
Application development of ChatGLM2-6B large model
- Private deployment of ChatGLM2-6B
- HF Transformers Tokenizer
- HF Transformers Model
- Synchronize the model to Hugging Face
- Empower ChatGLM2-6B graphical interface using Gradio
- Fine-tuning of ChatGLM2-6B model
- Practical assignment: Implement graphical interface of openai-translator based on ChatGLM2-6B

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have any suggestions or feature requests, please open an issue first to discuss what you would like to change.

Github

License

This project is licensed under the terms of the Apache-2.0 License . See the LICENSE file for details.

Contact

Django Peng - pjt73651@email.com

Project Link: https://github.com/DjangoPeng/openai-quickstart

About

A comprehensive guide to understanding and implementing large language models with hands-on examples using LangChain for GenAI applications.

License:Apache License 2.0


Languages

Language:Jupyter Notebook 97.9%Language:Python 2.1%