parent
35a7ca74c0
commit
e74fe2d950
|
|
@ -27,7 +27,7 @@ LLM API.
|
||||||
of [langchain](https://github.com/hwchase17/langchain). The goal is to build a KBQA(Knowledge based Q&A) solution that
|
of [langchain](https://github.com/hwchase17/langchain). The goal is to build a KBQA(Knowledge based Q&A) solution that
|
||||||
is friendly to Chinese scenarios and open source models and can run both offline and online.
|
is friendly to Chinese scenarios and open source models and can run both offline and online.
|
||||||
|
|
||||||
💡 Inspried by [document.ai](https://github.com/GanymedeNil/document.ai)
|
💡 Inspired by [document.ai](https://github.com/GanymedeNil/document.ai)
|
||||||
and [ChatGLM-6B Pull Request](https://github.com/THUDM/ChatGLM-6B/pull/216) , we build a local knowledge base question
|
and [ChatGLM-6B Pull Request](https://github.com/THUDM/ChatGLM-6B/pull/216) , we build a local knowledge base question
|
||||||
answering application that can be implemented using an open source model or remote LLM api throughout the process. In
|
answering application that can be implemented using an open source model or remote LLM api throughout the process. In
|
||||||
the latest version of this project, [FastChat](https://github.com/lm-sys/FastChat) is used to access Vicuna, Alpaca,
|
the latest version of this project, [FastChat](https://github.com/lm-sys/FastChat) is used to access Vicuna, Alpaca,
|
||||||
|
|
@ -41,10 +41,10 @@ to expand the access to various models and remote APIs in the future.
|
||||||
|
|
||||||
⛓️ The implementation principle of this project is shown in the graph below. The main process includes: loading files ->
|
⛓️ The implementation principle of this project is shown in the graph below. The main process includes: loading files ->
|
||||||
reading text -> text segmentation -> text vectorization -> question vectorization -> matching the `top-k` most similar
|
reading text -> text segmentation -> text vectorization -> question vectorization -> matching the `top-k` most similar
|
||||||
to the question vector in the text vector -> The matched text is added to `prompt `as context and question -> submitted
|
to the question vector in the text vector -> The matched text is added to `prompt `as context and question -> submitte
|
||||||
to `LLM` to generate an answer.
|
to `LLM` to generate an answer.
|
||||||
|
|
||||||
📺[video introdution](https://www.bilibili.com/video/BV13M4y1e7cN/?share_source=copy_web&vd_source=e6c5aafe684f30fbe41925d61ca6d514)
|
📺[video introduction](https://www.bilibili.com/video/BV13M4y1e7cN/?share_source=copy_web&vd_source=e6c5aafe684f30fbe41925d61ca6d514)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ The main process analysis from the aspect of document process:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
🚩 The training or fined-tuning are not involved in the project, but still, one always can improve performance by do
|
🚩 The training or fine-tuning are not involved in the project, but still, one always can improve performance by do
|
||||||
these.
|
these.
|
||||||
|
|
||||||
🌐 [AutoDL image](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.5) is supported, and in v9 the codes are update
|
🌐 [AutoDL image](registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.5) is supported, and in v9 the codes are update
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,9 @@ FSCHAT_MODEL_WORKERS = {
|
||||||
# "baichuan-api": {
|
# "baichuan-api": {
|
||||||
# "port": 21007,
|
# "port": 21007,
|
||||||
# },
|
# },
|
||||||
|
# "azure-api": {
|
||||||
|
# "port": 21008,
|
||||||
|
# },
|
||||||
}
|
}
|
||||||
|
|
||||||
# fastchat multi model worker server
|
# fastchat multi model worker server
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class SupportedVSType:
|
||||||
FAISS = 'faiss'
|
FAISS = 'faiss'
|
||||||
MILVUS = 'milvus'
|
MILVUS = 'milvus'
|
||||||
DEFAULT = 'default'
|
DEFAULT = 'default'
|
||||||
|
ZILLIZ = 'zilliz'
|
||||||
PG = 'pg'
|
PG = 'pg'
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -246,14 +247,16 @@ class KBServiceFactory:
|
||||||
if SupportedVSType.FAISS == vector_store_type:
|
if SupportedVSType.FAISS == vector_store_type:
|
||||||
from server.knowledge_base.kb_service.faiss_kb_service import FaissKBService
|
from server.knowledge_base.kb_service.faiss_kb_service import FaissKBService
|
||||||
return FaissKBService(kb_name, embed_model=embed_model)
|
return FaissKBService(kb_name, embed_model=embed_model)
|
||||||
if SupportedVSType.PG == vector_store_type:
|
elif SupportedVSType.PG == vector_store_type:
|
||||||
from server.knowledge_base.kb_service.pg_kb_service import PGKBService
|
from server.knowledge_base.kb_service.pg_kb_service import PGKBService
|
||||||
return PGKBService(kb_name, embed_model=embed_model)
|
return PGKBService(kb_name, embed_model=embed_model)
|
||||||
elif SupportedVSType.MILVUS == vector_store_type:
|
elif SupportedVSType.MILVUS == vector_store_type:
|
||||||
from server.knowledge_base.kb_service.milvus_kb_service import MilvusKBService
|
from server.knowledge_base.kb_service.milvus_kb_service import MilvusKBService
|
||||||
return MilvusKBService(kb_name,
|
return MilvusKBService(kb_name,embed_model=embed_model)
|
||||||
embed_model=embed_model) # other milvus parameters are set in model_config.kbs_config
|
elif SupportedVSType.ZILLIZ == vector_store_type:
|
||||||
elif SupportedVSType.DEFAULT == vector_store_type: # kb_exists of default kbservice is False, to make validation easier.
|
from server.knowledge_base.kb_service.zilliz_kb_service import ZillizKBService
|
||||||
|
return ZillizKBService(kb_name, embed_model=embed_model)
|
||||||
|
elif SupportedVSType.DEFAULT == vector_store_type:
|
||||||
from server.knowledge_base.kb_service.default_kb_service import DefaultKBService
|
from server.knowledge_base.kb_service.default_kb_service import DefaultKBService
|
||||||
return DefaultKBService(kb_name)
|
return DefaultKBService(kb_name)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue