[Learning LangChain] Building a question-and-answer knowledge base based on PDF documents (2) Creating a project

Here we use fastapi as the web framework of the project. It is a fast (high-performance) web framework and easy to use.

1. Create a FastAPI project

In the IDE, we select FastAPI on the left and create a new virtual environment on the right.

 If the creation is successful, there will be a main.py, which is the entry file of the project.

 Let's run it to see if there is any error. If there is no problem, then we have successfully integrated FastAPI.

2. Project Hierarchy

 The project is roughly divided into routers and util, the former is mainly for routing, and the latter is mainly for putting different module tools.

3. Load dependencies

Add the following dependencies to the requirements.txt file and install the dependencies. Try to use the following version, because different versions may be incompatible.

fastapi==0.97.0
langchain==0.0.184
PyPDF2==3.0.1
python-dotenv==1.0.0
openai==0.27.8
tiktoken==0.4.0
faiss-cpu==1.7.4
uvicorn==0.22.0

After the installation, you will see that many dependent packages are loaded in the venv environment.

Guess you like

Origin blog.csdn.net/lrb0677/article/details/132194883