wvivi2023
319475e0f6
编辑分块功能
2024-03-21 11:11:34 +08:00
wvivi2023
ca9b09549f
将语义检索和词汇检索相结合提高检索准确性
2024-03-12 18:24:10 +08:00
wvivi2023
df993defcc
fix faiss vector error
2024-03-01 14:04:27 +08:00
liunux4odoo
9c525b7fa5
publish 0.2.10 ( #2797 )
...
新功能:
- 优化 PDF 文件的 OCR,过滤无意义的小图片 by @liunux4odoo #2525
- 支持 Gemini 在线模型 by @yhfgyyf #2630
- 支持 GLM4 在线模型 by @zRzRzRzRzRzRzR
- elasticsearch更新https连接 by @xldistance #2390
- 增强对PPT、DOC知识库文件的OCR识别 by @596192804 #2013
- 更新 Agent 对话功能 by @zRzRzRzRzRzRzR
- 每次创建对象时从连接池获取连接,避免每次执行方法时都新建连接 by @Lijia0 #2480
- 实现 ChatOpenAI 判断token有没有超过模型的context上下文长度 by @glide-the
- 更新运行数据库报错和项目里程碑 by @zRzRzRzRzRzRzR #2659
- 更新配置文件/文档/依赖 by @imClumsyPanda @zRzRzRzRzRzRzR
- 添加日文版 readme by @eltociear #2787
修复:
- langchain 更新后,PGVector 向量库连接错误 by @HALIndex #2591
- Minimax's model worker 错误 by @xyhshen
- ES库无法向量检索.添加mappings创建向量索引 by MSZheng20 #2688
2024-01-26 06:58:49 +08:00
liunux4odoo
9ff7bef2c2
新功能:知识库管理界面支持查看、编辑、删除向量库文档 ( #2471 )
...
* 新功能:
- 知识库管理界面支持查看、编辑、删除向量库文档。暂不支持增加(aggrid添加新行比较麻烦,需要另外实现)
- 去除知识库管理界面中重建知识库和删除知识库按钮,建议用户到终端命令操作
修复:
- 所有与知识库名称、文件名称有关的数据库操作函数都改成大小写不敏感,所有路径统一为 posix 风格,避免因路径文本不一致导致数据重复和操作失效 (close #2232)
开发者:
- 添加 update_docs_by_id 函数与 API 接口。当前仅支持 FAISS,暂时未用到,未将来对知识库做更细致的修改做准备
- 统一 DocumentWithScore 与 DocumentWithVsId
- FAISS 返回的 Document.metadata 中包含 ID, 方便后续查找比对
- /knowledge_base/search_docs 接口支持 file_name, metadata 参数,可以据此检索文档
* fix bug
2023-12-26 13:44:36 +08:00
liunux4odoo
aae4144476
数据库和向量库中文档 metadata["source"] 改为相对路径,便于向量库迁移 ( #2153 )
...
修复:
- 上传知识库文件名称包括子目录时,自动创建子目录
2023-11-23 19:54:00 +08:00
liunux4odoo
68a544ea33
开发者:XXKBService.get_doc_by_id 改为批量处理,提高访问向量库效率。
2023-11-16 11:09:40 +08:00
liunux4odoo
b51ba11f45
支持通过配置项同时启动多个模型,将Wiki纳入samples知识库 ( #2002 )
...
新功能:
- 将 LLM_MODEL 配置项改为 LLM_MODELS 列表,同时启动多个模型
- 将 wiki 纳入 samples 知识库
依赖变化:
- 指定 streamlit~=1.27.0。1.26.0会报rerun错误,1.28.0会有无限刷新错误
修复优化:
- 优化 get_default_llm_model 逻辑
- 适配 Qwen 在线 API 做 Embeddings 时最大 25 行的限制
- 列出知识库磁盘文件时跳过 . 开头的文件
2023-11-09 22:15:52 +08:00
liunux4odoo
65592a45c3
支持在线 Embeddings, Lite 模式支持所有知识库相关功能 ( #1924 )
...
新功能:
- 支持在线 Embeddings:zhipu-api, qwen-api, minimax-api, qianfan-api
- API 增加 /other/embed_texts 接口
- init_database.py 增加 --embed-model 参数,可以指定使用的嵌入模型(本地或在线均可)
- 对于 FAISS 知识库,支持多向量库,默认位置:{KB_PATH}/vector_store/{embed_model}
- Lite 模式支持所有知识库相关功能。此模式下最主要的限制是:
- 不能使用本地 LLM 和 Embeddings 模型
- 知识库不支持 PDF 文件
- init_database.py 重建知识库时不再默认情况数据库表,增加 clear-tables 参数手动控制。
- API 和 WEBUI 中 score_threshold 参数范围改为 [0, 2],以更好的适应在线嵌入模型
问题修复:
- API 中 list_config_models 会删除 ONLINE_LLM_MODEL 中的敏感信息,导致第二轮API请求错误
开发者:
- 统一向量库的识别:以(kb_name,embed_model)为判断向量库唯一性的依据,避免 FAISS 知识库缓存加载逻辑错误
- KBServiceFactory.get_service_by_name 中添加 default_embed_model 参数,用于在构建新知识库时设置 embed_model
- 优化 kb_service 中 Embeddings 操作:
- 统一加载接口: server.utils.load_embeddings,利用全局缓存避免各处 Embeddings 传参
- 统一文本嵌入接口:server.knowledge_base.kb_service.base.[embed_texts, embed_documents]
- 重写 normalize 函数,去除对 scikit-learn/scipy 的依赖
2023-10-31 14:26:50 +08:00
liunux4odoo
deed92169f
支持在线 Embeddings:zhipu-api, qwen-api, minimax-api, qianfan-api ( #1907 )
...
* 新功能:
- 支持在线 Embeddings:zhipu-api, qwen-api, minimax-api, qianfan-api
- API 增加 /other/embed_texts 接口
- init_database.py 增加 --embed-model 参数,可以指定使用的嵌入模型(本地或在线均可)
问题修复:
- API 中 list_config_models 会删除 ONLINE_LLM_MODEL 中的敏感信息,导致第二轮API请求错误
开发者:
- 优化 kb_service 中 Embeddings 操作:
- 统一加载接口: server.utils.load_embeddings,利用全局缓存避免各处 Embeddings 传参
- 统一文本嵌入接口:server.embedding_api.[embed_texts, embed_documents]
2023-10-28 23:37:30 +08:00
liunux4odoo
94977c7ab1
修复:切换embed_model时,FAISS向量库未正确释放,导致`d == self.d assert ( #1766 )
...
修复:
- 切换embed_model时,FAISS向量库未正确释放,导致d == self.d assert error (close [求助] 初始化知识库发生错误 #1657 )
- ApiRequest中chat接口增加max_tokens参数
- FileDocModel模型字段错误(字段错误 #1691 )
2023-10-16 21:02:07 +08:00
liunux4odoo
1bae930691
修复faiss_pool知识库缓存key错误 ( #1507 )
2023-09-17 16:31:44 +08:00
liunux4odoo
f7c73b842a
优化configs ( #1474 )
...
* remove llm_model_dict
* optimize configs
* fix get_model_path
* 更改一些默认参数,添加千帆的默认配置
* Update server_config.py.example
2023-09-15 17:52:22 +08:00
liunux4odoo
22ff073309
修改Embeddings和FAISS缓存加载方式,知识库相关API接口支持多线程并发 ( #1434 )
...
* 修改Embeddings和FAISS缓存加载方式,支持多线程,支持内存FAISS
* 知识库相关API接口支持多线程并发
* 根据新的API接口调整ApiRequest和测试用例
* 删除webui.py失效的启动说明
2023-09-11 20:41:41 +08:00
glide-the
5550e3c1a9
增加显示详细日志开关
2023-09-08 20:48:31 +08:00
liunux4odoo
1195eb75eb
merge pr1413
2023-09-08 10:30:07 +08:00
liunux4odoo
661a0e9d72
新功能:
...
- 知识库管理中的add_docs/delete_docs/update_docs均支持批量操作,并利用多线程提高效率
- API的重建知识库接口支持多线程
- add_docs可提供参数控制上传文件后是否继续进行向量化
- add_docs/update_docs支持传入自定义docs(以json形式)。后续考虑区分完整或补充式自定义docs
- download_doc接口添加`preview`参数,支持下载或预览
- kb_service增加`save_vector_store`方法,便于保存向量库(仅FAISS,其它无操作)
- 将document_loader & text_splitter逻辑从KnowledgeFile中抽离出来,为后续对内存文件进行向量化做准备
- KowledgeFile支持docs & splitted_docs的缓存,方便在中间过程做一些自定义
其它:
- 将部分错误输出由print改为logger.error
2023-09-08 08:55:12 +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
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
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
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
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
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
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
584e3a9234
remove server/knowledge_base/knowledge_base_factory.py
2023-08-08 16:21:00 +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
imClumsyPanda
18d31f5116
add KBService and KBServiceFactory class
2023-08-06 23:44:02 +08:00