From 7bd49e9c4e8088c0d1f714e5434d63c2cc692863 Mon Sep 17 00:00:00 2001 From: Kaiyuan Hu Date: Tue, 30 May 2023 11:38:47 +0800 Subject: [PATCH] Add readme Signed-off-by: Kaiyuan Hu --- README.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/README.md b/README.md index 4dc999c..d744793 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,94 @@ # eqa-search +# Enhanced QA Search + +## Description + +**Enhanced question-answering** is the process of creating the knowledge base and generating answers with LLMs(large language model), thus preventing illusions. It involves inserting data as knowledge base and querying questions, and **eqa-search** is used to query questions from knowledge base. + + +
+ + +## Code Example + +### **Create pipeline and set the configuration** + +> More parameters refer to the Configuration. + +```python +from towhee import AutoPipes, AutoConfig + +config = AutoConfig.load_config('eqa-search') +config.collection_name = 'chatbot' + +p = AutoPipes.pipeline('eqa-search', config=config) +res = p('https://raw.githubusercontent.com/towhee-io/towhee/main/README.md') +``` + + +
+ + + +## Enhanced QA Search Config + +### Configuration for Sentence Embedding + +***model (str):*** + +The model name in the sentence embedding pipeline, defaults to `'all-MiniLM-L6-v2'`. +You can refer to the above [Model(s) list ](https://towhee.io/tasks/detail/operator?field_name=Natural-Language-Processing&task_name=Sentence-Embedding)to set the model, some of these models are from [HuggingFace](https://huggingface.co/) (open source), and some are from [OpenAI](https://openai.com/) (not open, required API key). + +***openai_api_key (str):*** + +The api key of openai, default to `None`. +This key is required if the model is from OpenAI, you can check the model provider in the above [Model(s) list](https://towhee.io/sentence-embedding/openai). + +***embedding_device (int):*** + +The number of devices, defaults to `-1`, which means using the CPU. +If the setting is not `-1`, the specified GPU device will be used. + +### Configuration for [Milvus](https://towhee.io/ann-search/milvus-client) + +***host (str):*** + +Host of Milvus vector database, default is `'127.0.0.1'`. + +***port (str):*** + +Port of Milvus vector database, default is `'19530'`. + +***top_k (int):*** + +The number of nearest search results, defaults to 5. + +***collection_name (str):*** + +The collection name for Milvus vector database. + +***user (str):*** + +The user name for [Cloud user](https://zilliz.com/cloud), defaults to `None`. + +***password (str):*** + +The user password for [Cloud user](https://zilliz.com/cloud), defaults to `None`. + +
+ + +## Interface + +Query a question from Milvus knowledge base. + +**Parameters:** + +- ***question (str):*** The question to query. + +- ***history (List[str]):*** The chat history to provide background information. + +**Returns:** + +- ***Answer (str):*** The answer to the question.