Use LangChain to build a question-and-answer chat robot case (2)

Use LangChain to build a question-and-answer chatbot case.
Interpret line by line and verify the full life cycle Prompting
. Now we use GPT-4 as the driving force of the language model. This model will become the engine of the entire application, driving the entire application to run. At the same time, the application It is also implemented based on Cpython, as shown in Figure 14-8, Pyodide is a port from CPython to WebAssembly/Emscripten. Pyodide makes it possible to install and run Python libraries in the browser using microip. Any pure Python library is supported on PyPi, and many general-purpose software libraries have also been ported to Pyodide, such as: regex, PyYAML, lxml, and scientific Python software libraries, including NumPy, panda, SciPy, Matplotlib, and scikit-learn. Gavin's WeChat account: NLP_Matrix_Space
insert image description here

Figure 14-8 Pyodide
The official website of Pyodide has made it very clear that it provides a simulation environment or platform, even in a browser, you can run Python code directly. So where does this Python code come from? In fact, these codes are generated by GPT-4, and the generation process of GPT-4 is actually called by LangChain. In the following code, we can see that a chain (Chain) is run on line 8 and its run method is called to get relevant information.
Code implementation of app.py:

1.	@post(</

Guess you like

Origin blog.csdn.net/duan_zhihua/article/details/132003382