QA Retrieval
Procedure
- Execute an online QA sample. Run rag_demo_query.py by referring to the Demo. Modify default parameters such as the model path and IP address and port number of the MindIE service as required. For details, see the README.md file.
python3 rag_demo_query.py --query "Describe the requirements of the composition test of the 2024 National College Entrance Examination."
- Run the program to obtain the result.
{ 'query': 'Describe the requirements of the composition test of the 2024 National College Entrance Examination', 'result': 'Requirement: Life in the New Era\n\nMaterials:\n\nWith the development of science and technology, our life is becoming more and more convenient because of the wild use of various smart devices. However, are there any problems behind this convenience?\n\nPlease write an essay based on the above materials and your own thinking, with life in the new era as the theme.', 'source_documents': [ { 'metadata': { 'source': '/home/HwHiAiUser/gaokao.txt' }, 'page_content': 'Composition Test of the 2024 National College Entrance Examination\nRead the following materials and write a composition. (60 points)\nWith the popularization of the Internet and artificial intelligence, more and more questions can be quickly answered. So, will we have fewer problems?\nHow do you think about the above materials? Please write a composition no less than 800 words.\nRequirements: Select a proper angle and style to describe your opinions. Prepare your own title. Do not copy other articles, and do not disclose personal information.' } ] }
- The embedding model, relational database path, and vector database path used for knowledge base building and QA retrieval must be the same so that the sample can be executed properly.
- During sample code execution, if tei_emb is set to False, the embedding model is started locally and embedding_path is set to the local model directory. If tei_emb is set to True, the serving model is started and embeddingurl is set to the URI of the serving model. The same rule applies to reranker.
Parent topic: FlatL2 Retrieval Mode