zqt
e21ca447af
milvus/pg kb_service需要实现get_doc_by_id方法
2023-09-04 16:40:05 +08:00
liunux4odoo
0bc9d5c8ee
Merge branch 'dev' into opt_add_doc
2023-09-03 21:38:45 +08:00
liunux4odoo
6cb1bdf623
添加切换模型功能,支持智谱AI在线模型 ( #1342 )
...
* 添加LLM模型切换功能,需要在server_config中设置可切换的模型
* add tests for api.py/llm_model/*
* - 支持模型切换
- 支持智普AI线上模型
- startup.py增加参数`--api-worker`,自动运行所有的线上API模型。使用`-a
(--all-webui), --all-api`时默认开启该选项
* 修复被fastchat覆盖的标准输出
* 对fastchat日志进行更细致的控制,startup.py中增加-q(--quiet)开关,可以减少无用的fastchat日志输出
* 修正chatglm api的对话模板
Co-authored-by: liunux4odoo <liunu@qq.com>
2023-09-01 23:58:09 +08:00
liunux4odoo
55e417a263
升级注意
...
数据库表发生变化,需要重建知识库
新功能
- 增加FileDocModel库表,存储知识文件与向量库Document ID对应关系以及元数据,便于检索向量库
- 增加FileDocModel对应的数据库操作函数(这些函数主要是给KBService调用,用户一般无需使用):
- list_docs_from_db: 根据知识库名称、文件名称、元数据检索对应的Document IDs
- delete_docs_from_db: 根据知识库名称、文件名称删除对应的file-doc映射
- add_docs_to_db: 添加对应的file-doc映射
- KBService增加list_docs方法,可以根据文件名、元数据检索Document。当前仅支持FAISS,待milvus/pg实现get_doc_by_id方法后即自动支持。
- 去除server.utils对torch的依赖
待完善
- milvus/pg kb_service需要实现get_doc_by_id方法
2023-09-01 22:54:57 +08:00
liunux4odoo
b1201a5f23
优化LLM和Embedding模型运行设备配置,可设为auto自动检测;修复:重建知识库时FAISS未保存 ( #1330 )
...
* 避免configs对torch的依赖;
* webui自动从configs获取api地址(close #1319 )
* bug fix: 重建知识库时FAISS未保存
* 优化LLM和Embedding模型运行设备配置,可设为auto自动检测
2023-08-31 17:44:48 +08:00
liunux4odoo
16fb19d2c3
优化LLM和Embedding模型运行设备配置,可设为auto自动检测
2023-08-31 17:41:09 +08:00
liunux4odoo
80590ef5dc
bug fix: faiss vector store not saved when recreate
2023-08-31 17:34:22 +08:00
liunux4odoo
ca0ae29fef
运行startup.py时,如果不加参数直接显示配置和帮助信息后退出 ( #1284 )
...
* 统一XX_kb_service.add_doc/do_add_doc接口,不再需要embeddings参数
* 运行startup.py时,如果不加参数直接显示配置和帮助信息后退出
---------
Co-authored-by: liunux4odoo <liunu@qq.com>
2023-08-28 16:03:53 +08:00
liunux4odoo
3acbf4d5d1
增加数据库字段,重建知识库使用多线程 ( #1280 )
...
* close #1172 : 给webui_page/utils添加一些log信息,方便定位错误
* 修复:重建知识库时页面未实时显示进度
* skip model_worker running when using online model api such as chatgpt
* 修改知识库管理相关内容:
1.KnowledgeFileModel增加3个字段:file_mtime(文件修改时间),file_size(文件大小),custom_docs(是否使用自定义docs)。为后面比对上传文件做准备。
2.给所有String字段加上长度,防止mysql建表错误(pr#1177)
3.统一[faiss/milvus/pgvector]_kb_service.add_doc接口,使其支持自定义docs
4.为faiss_kb_service增加一些方法,便于调用
5.为KnowledgeFile增加一些方法,便于获取文件信息,缓存file2text的结果。
* 修复/chat/fastchat无法流式输出的问题
* 新增功能:
1、KnowledgeFileModel增加"docs_count"字段,代表该文件加载到向量库中的Document数量,并在WEBUI中进行展示。
2、重建知识库`python init_database.py --recreate-vs`支持多线程。
其它:
统一代码中知识库相关函数用词:file代表一个文件名称或路径,doc代表langchain加载后的Document。部分与API接口有关或含义重叠的函数暂未修改。
---------
Co-authored-by: liunux4odoo <liunux@qq.com>, hongkong9771
2023-08-28 13:50:35 +08:00
zqt
1fa4e906c7
适配score_threshold
2023-08-27 11:21:10 +08:00
zqt
9550c8262e
Merge branch 'master' into dev
2023-08-25 13:47:56 +08:00
Pickupppp
0c63839ff6
修正 milvus 更改错误
2023-08-24 22:53:13 +08:00
zqt
2604341e9e
调整KBService 接口函数do_search 并适配pg
2023-08-24 22:35:30 +08:00
zqt
24e7351d32
Merge branch 'master' into dev
2023-08-24 22:31:37 +08:00
Pickupppp
050a585a9d
修复 milvus 作为默认数据库初始化异常和调用search方法异常
2023-08-24 21:31:02 +08:00
zR
7291e77978
support for bge-large-zh-noinstruct and openai text-embedding-ada-002 ( #1119 )
...
* support for bge-large-zh-noinstruct and openai text-embedding-ada-002
* 完善了readme,修改了BGE模型的载入方式
* 补充了readme中bge-large-zh-noinstruct的信息
* Update faiss_kb_service.py
* Update utils.py
---------
Co-authored-by: zR <zRzRzRzRzRzRzR>
Co-authored-by: imClumsyPanda <littlepanda0716@gmail.com>
2023-08-23 22:55:53 +08:00
liunux4odoo
351b62f7a7
fix part of #1206 : add/delete/update_doc() get unexpected keyword argument 'not_refresh_vs_cache`
2023-08-23 15:26:52 +08:00
zqt
16542f20b4
修复pg和milvus kbservice代码
2023-08-22 16:52:04 +08:00
zqt996
11856cc542
Merge pull request #1160 from shutter-cp/master
...
fix bug 1159
2023-08-22 16:38:06 +08:00
liunux4odoo
f40bb69224
优化FAISS向量库多文件操作;修复recreate_vector_store,大量文件时不再超时。
2023-08-20 19:10:29 +08:00
liunux4odoo
150a78bfd9
update kb_doc_api:make faiss cache working; delete vector store docs before add duplicate docs
2023-08-20 16:52:49 +08:00
陈鹏
95d9fb0ee9
fix bug 1159
...
修复使用使用pg存储向量时,向量检索错误 {TypeError}TypeError("'Document' object is not subscriptable")
2023-08-18 14:41:11 +08:00
liunux4odoo
67b8ebef52
update api and webui:
...
1. 增加search_docs接口,返回原始知识库检索文档,close #1103
2. 为FAISS检索增加score_threshold参数。milvus和PG暂不支持
2023-08-16 13:18:58 +08:00
liunux4odoo
ec984205ae
fix knowledge base management:
...
1. docs in database were note deleted when clear vector store
2. diable buttons when local doc file not exist.
2023-08-14 19:09:02 +08:00
imClumsyPanda
afc6aa968d
update webui layout
2023-08-11 23:40:41 +08:00
liunux4odoo
2a57f49d80
update knowledge base management ui.
...
remove numpy/pandas from requirements, move them to webui requirements
2023-08-11 13:53:20 +08:00
liunux4odoo
a08fe994c2
更新API与ApiReuest:
...
1. 重新整理webui_pages/utils与server/knowledge_base间的工具依赖
2.
将delete_knowledge_base与delete_doc接口从delete改为post.delete不支持body参数
3. 修复update_doc
4. 修复部分bug
2023-08-11 08:45:26 +08:00
imClumsyPanda
8a4d9168fa
update import pkgs and format
2023-08-10 21:26:05 +08:00
liunux4odoo
17ddee38a4
fix conflict between def_fastchat and pr1037
2023-08-10 15:02:41 +08:00
zqt
d4f728dfa2
添加向量数据库pg支持,和向量库docker-compose.ym环境文件
2023-08-10 11:16:52 +08:00
imClumsyPanda
8df00d0b04
add SCORE_THRESHOLD to faiss and milvus kb service
2023-08-10 00:36:59 +08:00
imClumsyPanda
1b70fb5f9b
update faiss_kb_service.py
2023-08-09 22:57:36 +08:00
liunux4odoo
997f8b2e3f
update knowledge base api:
...
1. list_kbs_from_db return all kbs by default instead of return kbs with
file_count > 0 only.
2. KBServiceFactory.get_service_by_name could return a FaissKBService
that not in the db
2023-08-09 21:57:40 +08:00
liunux4odoo
c7b91bfaf1
update api/kb_doc_api and knowledge base management ui:
...
1. add update_doc to api which can udpate vector store from existed
content file
2. add parameter `delete_content` to delete_doc api. user can decide
whether delete local content file when delete doc.
3. fix bug in ApiReqeust.upload_doc
4. support listing docs existed in local folder bu not in db
2023-08-09 16:52:04 +08:00
liunux4odoo
b98f5fd0b9
update knowledge base kbservice and api:
...
1. make huggingfaceembeddings hashable
2. unify embeddings' loading method for all kbservie
3. make ApiRequest skip empty content when streaming json to avoid dict
KeyError
2023-08-09 10:46:01 +08:00
liunux4odoo
e918244159
move KBServiceFactory to server.knowledge_base.kb_service.base
2023-08-08 17:41:58 +08:00
liunux4odoo
c4a3995310
move commonto tools from kbservice.base to server.knowledge_base.utils
2023-08-08 16:40:18 +08:00
liunux4odoo
584e3a9234
remove server/knowledge_base/knowledge_base_factory.py
2023-08-08 16:21:00 +08:00
liunux4odoo
7e07f0bbf4
move configs to configs.model_config
2023-08-08 15:56:32 +08:00
zqt
b61e0772c9
使用orm操作数据库
2023-08-08 14:25:55 +08:00
zqt
41fd1acc9c
Merge remote-tracking branch 'origin/dev_fastchat' into dev_fastchat
...
# Conflicts:
# server/knowledge_base/kb_service/default_kb_service.py
# server/knowledge_base/kb_service/milvus_kb_service.py
# server/knowledge_base/knowledge_base_factory.py
2023-08-08 14:06:13 +08:00
liunux4odoo
08493bffbb
add a basic knowledge base management ui.
2023-08-07 21:00:55 +08:00
imClumsyPanda
035a199c32
update kb_server.base
2023-08-07 20:48:06 +08:00
liunux4odoo
44c713ef98
use KBServiceFactory to replace all the KnowledgeBase.
...
make KBServiceFactory support embed_model parameter.
rewrite api: recreate_vector_store.
fix some bugs.
2023-08-07 20:37:16 +08:00
zqt996
0f46185cfb
添加Milvus库 ( #1011 )
2023-08-07 16:56:57 +08:00
zqt
72951d95fb
添加milvus库支持
2023-08-07 16:32:34 +08:00
imClumsyPanda
18d31f5116
add KBService and KBServiceFactory class
2023-08-06 23:44:02 +08:00