You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/practical_tutorials/document_scene_information_extraction(deepseek)_tutorial.en.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ After executing the above code, you can obtain the following result:
54
54
55
55
The result shows that PP-ChatOCRv3 can extract text information from the image and pass the extracted text information to the DeepSeek-V3 large model for question understanding and information extraction, returning the required extraction result.
56
56
57
-
## 2. New Model Can Quickly Adapt to Multi-page PDF Files for Efficient Information Extraction
57
+
## 3. New Model Can Quickly Adapt to Multi-page PDF Files for Efficient Information Extraction
58
58
59
59
In practical application scenarios, besides a large number of image files, more document information extraction tasks involve multi-page PDF files. Since multi-page PDF files often contain a vast amount of text information, passing all this text information to a large language model at once not only increases the invocation cost but also reduces the accuracy of text information extraction. To address this issue, the PP-ChatOCRv3 pipeline integrates vector retrieval technology, which stores the text information from multi-page PDF files in the form of a vector database and retrieves the most relevant fragments through vector retrieval technology to pass them to the large language model, significantly reducing the invocation cost of the large language model and improving the accuracy of text information extraction. The Baidu Cloud Qianfan platform provides four vector models for establishing vector databases of text information. For the specific model support list and their functional characteristics, refer to the vector model section in the [API List](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Nlks5zkzu_en). Next, we will use the `embedding-v1` model to establish a vector database of text information and pass the most relevant fragments to the `DeepSeek-V3` large language model through vector retrieval technology, thereby efficiently extracting key information from multi-page PDF files.
60
60
@@ -156,7 +156,7 @@ Total Time: 6.9693s
156
156
157
157
By comparing the results of the two executions, it can be observed that during the first execution, the PP-ChatOCRv3 Pipeline extracts all text information from multi-page PDF files and establishes a vector library, which takes a longer time. During subsequent executions, the PP-ChatOCRv3 Pipeline only needs to load and retrieve the vector library, significantly reducing the overall time consumption. The PP-ChatOCRv3 Pipeline, combined with vector retrieval technology, effectively reduces the number of calls to large language models when extracting ultra-long text, achieving faster text information extraction speed and more accurate key information location. This provides a more efficient solution for us in actual multi-page PDF file information extraction scenarios.
158
158
159
-
## 3. Exploring the Thinking Mode of Large Models in Text and Image Information Extraction
159
+
## 4. Exploring the Thinking Mode of Large Models in Text and Image Information Extraction
160
160
161
161
DeepSeek-R1 impresses with its exceptional text dialogue capabilities and in-depth problem-solving thinking abilities. When executing complex tasks or processing user instructions, in addition to normally completing dialogue tasks, the model can also demonstrate its thinking process during problem-solving. The PP-ChatOCRv3 Pipeline already supports the ability to adaptively return the output of thinking model results. For models that support returning the thinking process, PP-ChatOCRv3 can return the thinking process through an additional `reasoning_content` output field. This field is a list field containing the thinking results of the PP-ChatOCRv3 when calling the large language model multiple times. By observing these thinking results, we can gain insight into how the model gradually extracts the answer to the question from the given text information, and these thinking results can help us provide more improvement ideas for prompt optimization of the model. Next, we will take a specific legal document information extraction task as an example, using the `DeepSeek-R1` model as the large language model called in PP-ChatOCRv3 for key information extraction, and briefly explore the thinking process of the DeepSeek-R1 model.
162
162
@@ -200,7 +200,7 @@ print(chat_result)
200
200
201
201
The result shows that the use of the `DeepSeek-R1` model not only helps us complete the relationship information extraction task for the question 'When was this regulation announced?' but also returns its thinking process when solving the information extraction problem in the `reasoning_content` field. For example, when thinking, the model carefully distinguishes between the publication date and the implementation date of the regulation and rechecks the returned results.
202
202
203
-
## 4. Supporting Custom Prompt Engineering to Expand the Functional Boundaries of Large Language Models
203
+
## 5. Supporting Custom Prompt Engineering to Expand the Functional Boundaries of Large Language Models
204
204
205
205
In document information extraction tasks, in addition to directly extracting key information from text information, we can also expand the functional boundaries of large language models through custom prompt engineering. For example, we can design new prompt rules to allow large language models to summarize these text information, thereby helping us quickly locate the key information we need from a large amount of text information, or allowing large language models to think and judge user questions based on the content in the text and give suggestions, etc. The PP-ChatOCRv3 Pipeline already supports custom prompt functionality, and the default prompts used by the Pipeline can be referred to in the Pipeline's [configuration file](../../paddlex/configs/pipelines/PP-ChatOCRv3-doc.yaml). We can refer to the prompt logic in the default configuration to customize and modify the prompts in the chat interface. Below is a brief introduction to the meaning of prompt parameters related to text content:
在实际的应用场景中,除了大量的图片文件外,更多的文档信息抽取任务会涉及到多页 PDF 文件的处理。由于多页 PDF 文件中往往包含大量的文本信息,而将大量的文本信息一次性传递给大语言模型,除了会增加大语言模型的调用成本外,还会降低大语言模型文本信息抽取的准确性。为了解决这一问题,PP-ChatOCRv3 产线中集成了向量检索技术,能够将多页 PDF 文件中的文本信息通过建立向量库的方式进行存储,并通过向量检索技术将文本信息检索到最相关的片段传递给大语言模型,从而大幅降低大语言模型的调用成本并提高文本信息抽取的准确性。在百度云千帆平台,提供了4个向量模型用于建立文本信息的向量库,具体的模型支持列表及其功能特点可参考 [API列表](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Nlks5zkzu) 中的向量模型部分。接下来我们将使用 `embedding-v1` 模型建立文本信息的向量库,并通过向量检索技术将最相关的片段传递给 `DeepSeek-V3` 大语言模型,从而实现高效抽取多页 PDF 文件中的关键信息。
60
60
@@ -156,7 +156,7 @@ Total Time: 6.9693s
156
156
157
157
通过对比两次执行结果可以发现,在首次执行时,PP-ChatOCRv3 产线会对多页 PDF 文件中的所有文本信息进行抽取和向量库的建立,耗时较长。而在后续执行时,PP-ChatOCRv3 产线仅需要对向量库进行加载和检索操作,大幅降低了整体的耗时。结合了向量检索技术的 PP-ChatOCRv3 产线有效的降低了对于超长文本进行抽取时大语言模型调用的次数,实现了更加快速的文本信息抽取速度和更加精准的关键信息定位,为我们在实际的多页 PDF 文件信息抽取场景中提供了更加高效的解决方案。
0 commit comments