Skip to content

Commit d037e22

Browse files
committed
Update README
1 parent ca140e1 commit d037e22

File tree

3 files changed

+131
-50
lines changed

3 files changed

+131
-50
lines changed

.github/workflows/trans.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

READM.zh-TW.md

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
# docGPT
22

3-
(English)[README.md] | (中文版)[README.zh-TW.md]
4-
3+
[English](./README.md) | [中文版](./README.zh-TW.md)
54

65
- 目錄
76
- [Introduction](#introduction)
87
- [What's LangChain?](#whats-langchain)
9-
- [Questions that ChatGPT cannot answer are handed over to LangChain for implementation!](#questions-that-chatgpt-cannot-answer-are-handed-over-to-langchain-for-implementation)
108
- [How to Use docGPT?](#how-to-use-docgpt)
11-
- [Why Use docGPT?](#why-use-docgpt)
129
- [How to develope a docGPT with streamlit?](#how-to-develope-a-docgpt-with-streamlit)
1310

11+
12+
* 主要開發軟體與套件:
13+
* `Python 3.8.6`
14+
* `Langchain 0.0.218`
15+
* `Streamlit 1.22.0`
16+
17+
* 使用該工具至少須具備 `openai_api_key`,有關如何取得 key 可以前往[連結](https://platform.openai.com/)
18+
1419
---
1520

21+
1622
### Introduction
1723

1824
* 使用 langchain、streamlit 輕鬆搭建出一個 AI 模型
@@ -32,19 +38,11 @@
3238
2. 允許與 LLM 模型進行交互
3339
* `streamlit`: streamlit 使 python 可以**快速、免費**的部署屬於你的應用程序
3440

35-
* 主要開發軟體與套件:
36-
* `Python 3.8.6`
37-
* `Langchain 0.0.218`
38-
* `Streamlit 1.22.0`
39-
40-
* 使用該工具至少須具備 `openai_api_key`,有關如何取得 key 可以前往[連結](https://platform.openai.com/)
41-
41+
---
4242

4343
### What's LangChain?
4444

45-
* 有關 langchain 的介紹,建議查看官方文件、[Github源專案](https://github.com/hwchase17/langchain)
46-
47-
#### Questions that ChatGPT cannot answer are handed over to LangChain for implementation!
45+
有關 langchain 的介紹,建議查看官方文件、[Github源專案](https://github.com/hwchase17/langchain)
4846

4947
**ChatGPT 無法回答的問題,交給 Langchain 實現!**
5048

@@ -71,6 +69,8 @@
7169
7270
透過 langchain,我們可以創建屬於自己的 chatgpt 模型,它可以是通用型的模型,也可以是**企業化、商業化**的!
7371

72+
---
73+
7474
### How to Use docGPT?
7575

7676
* 前往[應用程序](https://docgpt-app.streamlit.app/)
@@ -84,16 +84,7 @@
8484

8585
![RGB_cleanup](https://github.com/Lin-jun-xiang/docGPT-streamlit/blob/main/img/docGPT.gif?raw=true)
8686

87-
88-
### Why Use docGPT?
89-
90-
* 本專案開發的 `docGPT` 具有以下功能:
91-
* 上傳 PDF
92-
* 與GPT進行來回答覆,快速學習PDF內容
93-
* 進行文檔總結
94-
* 附加 **"math-llm"**,提供您進行**數學計算**相關問答 (chatgpt無法回答的問題)
95-
* 附加 **"google-search"**,提供您進行**google搜尋** (chatgpt無法回答的問題)
96-
87+
---
9788

9889
### How to develope a docGPT with streamlit?
9990

@@ -104,12 +95,14 @@
10495
方法有如下兩種:
10596

10697
* 於本地開發方式
107-
1. `pip install -r requirements.txt`: 下載開發需求套件
108-
2. `streamlit run ./app.py`: 於專案根目錄啟動服務
109-
3. 開始體驗!
98+
* `pip install -r requirements.txt`: 下載開發需求套件
99+
* `streamlit run ./app.py`: 於專案根目錄啟動服務
100+
* 開始體驗!
110101

111102
* 使用 Streamlit Community Cloud 免費部屬、管理和共享應用程序
112-
1. 將您的應用程序放在公共 GitHub 存儲庫中(並確保它有一個 `requirements.txt`!)
113-
2. 登錄[share.streamlit.io](https://share.streamlit.io/)
114-
3. 單擊“部署應用程序”,然後粘貼您的 GitHub URL
115-
4. 完成部屬[應用程序](https://docgpt-app.streamlit.app//)
103+
* 將您的應用程序放在公共 GitHub 存儲庫中(並確保它有一個 `requirements.txt`!)
104+
* 登錄[share.streamlit.io](https://share.streamlit.io/)
105+
* 單擊“部署應用程序”,然後粘貼您的 GitHub URL
106+
* 完成部屬[應用程序](https://docgpt-app.streamlit.app//)
107+
108+
<a href="#top">Back to top</a>

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# docGPT
2+
3+
[English](./README.md) | [中文版](./README.zh-TW.md)
4+
5+
- Table of Contents
6+
- [Introduction](#introduction)
7+
- [What's LangChain?](#whats-langchain)
8+
- [How to Use docGPT?](#how-to-use-docgpt)
9+
- [How to Develop a docGPT with Streamlit?](#how-to-develop-a-docgpt-with-streamlit)
10+
11+
12+
* Main Development Software and Packages:
13+
* `Python 3.8.6`
14+
* `Langchain 0.0.218`
15+
* `Streamlit 1.22.0`
16+
17+
* Using this tool requires at least the `openai_api_key`. You can visit the [link](https://platform.openai.com/) to learn how to obtain the key.
18+
19+
20+
---
21+
22+
23+
### Introduction
24+
25+
* Easily build an AI model using Langchain and Streamlit.
26+
27+
* This project consists of three main components:
28+
* [`DataConnection`](../model/data_connection.py): Allows LLM to communicate with external data, i.e., read PDF files and perform text segmentation for large PDFs to avoid exceeding OPENAI's 4000-token limit.
29+
* [`docGPT`](../docGPT/): This component enables the model to understand the content of PDFs. It includes embedding PDF text and building a retrievalQA model using Langchain. For more details, please refer to the [documentation](https://python.langchain.com/docs/modules/chains/popular/vector_db_qa).
30+
* [`agent`](../agent/agent.py): Responsible for managing the tools used by the model and automatically determining which tool to use based on the user's question. The tools include:
31+
* `SerpAI`: Used for "**current questions**" by performing a **Google search**.
32+
* `llm_math_chain`: Used for "**mathematical calculations**" by performing mathematical computations.
33+
* `docGPT`: Used for answering questions about the content of PDF documents. (This tool is built using retrievalQA)
34+
35+
36+
* `docGPT` is developed based on **Langchain** and **Streamlit**.
37+
* `Langchain`: LangChain is a framework for **developing applications supported by language models**. It supports the following applications:
38+
1. Connecting LLM models with external data sources.
39+
2. Allowing interaction with LLM models.
40+
* `Streamlit`: Streamlit enables fast and free deployment of Python applications.
41+
42+
43+
---
44+
45+
### What's LangChain?
46+
47+
For an introduction to LangChain, it is recommended to refer to the official documentation or the GitHub [repository](https://github.com/hwchase17/langchain).
48+
49+
**Questions that ChatGPT cannot answer can be handled by Langchain!**
50+
51+
Here, the author briefly introduces the differences between Langchain and ChatGPT. You will be amazed by this open-source project called Langchain through the following example!
52+
53+
> Imagine a scenario where ChatGPT cannot answer mathematical questions or questions about events beyond 2020 (e.g., "Who will be the president in 2023?").
54+
>
55+
> * For mathematical questions: In addition to the OpenAI model, there is a specialized tool called math-llm that handles mathematical questions.
56+
> * For current questions: We can use Google search.
57+
>
58+
> Therefore, to design a powerful and versatile AI model, we need to include three tools: "chatgpt", "math-llm", and "Google search".
59+
>
60+
> If the user's question involves mathematical calculations, we use the math-llm tool to handle and answer it.
61+
>
62+
> In the non-AI era, we would use `if...else...` to decide which tool to use based on the user's question. However, Langchain provides a more flexible and powerful way to handle this.
63+
> In the AI era, we want users to directly ask their questions without having to pre-select the question type! In Langchain, there is a concept called "agent" that allows us to:
64+
65+
* Provide tools for the agent to manage, such as `tools = ['chatgpt', 'math-llm', 'google-search']`.
66+
* Include chains designed using Langchain, such as using the `retrievalQA chain` to create a question-answering model based on document content, and append this chain to the tools managed by the agent.
67+
* **Allow the agent to determine which tool to use based on the user's question** (fully automated and AI-driven).
68+
69+
With Langchain, we can create our own ChatGPT model that can be general-purpose or tailored for specific industries and commercial use!
70+
71+
---
72+
73+
### How to Use docGPT?
74+
75+
* Visit the [application](https://docgpt-app.streamlit.app/).
76+
77+
* Enter your API keys:
78+
* `OpenAI API Key`: Required.
79+
* `SERPAPI API Key`: Optional. If you want to ask questions about content not appearing in the PDF document, you need this key.
80+
81+
* Upload a PDF file from your local machine.
82+
* Start asking questions!
83+
84+
![docGPT](https://github.com/Lin-jun-xiang/docGPT-streamlit/blob/main/img/docGPT.gif?raw=true)
85+
86+
---
87+
88+
### How to Develop a docGPT with Streamlit?
89+
90+
A step-by-step tutorial to quickly build your own chatGPT!
91+
92+
First, clone the repository using `git clone https://github.com/Lin-jun-xiang/docGPT-streamlit.git`.
93+
94+
There are two methods:
95+
96+
* Local development:
97+
* `pip install -r requirements.txt`: Download the required packages for development.
98+
* `streamlit run ./app.py`: Start the service in the project's root directory.
99+
* Start exploring!
100+
101+
* Use Streamlit Community Cloud for free deployment, management, and sharing of applications:
102+
* Put your application in a public GitHub repository (make sure it has a `requirements.txt`!).
103+
* Log in to [share.streamlit.io](https://share.streamlit.io/).
104+
* Click "Deploy an App" and paste your GitHub URL.
105+
* Complete the deployment of your [application](https://docgpt-app.streamlit.app/).
106+
107+
<a href="#top">Back to top</a>

0 commit comments

Comments
 (0)