binary-husky / gpt_academic

为GPT/GLM等LLM大语言模型提供实用化交互接口,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm3等本地模型。接入通义千问, deepseekcoder, 讯飞星火, 文心一言, llama2, rwkv, claude2, moss等。
https://github.com/binary-husky/gpt_academic/wiki/online
GNU General Public License v3.0
65.48k stars 8.05k forks source link

[Bug]: 知识库插件异常 #1334

Open xiao-yuling opened 11 months ago

xiao-yuling commented 11 months ago

Installation Method | 安装方法与平台

Pip Install (I used latest requirements.txt)

Version | 版本

Latest | 最新版

OS | 操作系统

Windows

Describe the bug | 简述

知识库问答 TypeError: 'HuggingFaceEmbeddings' object is not callable

[Local Message] 插件调用出错:

Traceback (most recent call last): File ".\toolbox.py", line 156, in decorated yield from f(main_input, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, *args, **kwargs) File ".\crazy_functions\Langchain知识库.py", line 96, in 读取知识库作答 resp, prompt = kai.answer_with_archive_by_id(txt, kai_id) File ".\crazy_functions\crazy_utils.py", line 706, in answer_with_archive_by_id resp, prompt = self.qa_handle.get_knowledge_based_conent_test( File "C:\Users\pc\AppData\Roaming\Python\Python310\site-packages\zh_langchain\chains\local_doc_qa.py", line 238, in get_knowledge_based_conent_test embedding = self.vector_store.embedding_function(query) TypeError: 'HuggingFaceEmbeddings' object is not callable

当前代理可用性:

代理配置 无, 代理所在地:Japan

Screen Shot | 有帮助的截图

QQ图片20231128132359

Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

No response

danfouer commented 11 months ago

I met exactly the same problem:

Traceback (most recent call last):
  File ".\toolbox.py", line 156, in decorated
    yield from f(main_input, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, *args, **kwargs)
  File ".\crazy_functions\Langchain知识库.py", line 96, in 读取知识库作答
    resp, prompt = kai.answer_with_archive_by_id(txt, kai_id)
  File ".\crazy_functions\crazy_utils.py", line 706, in answer_with_archive_by_id
    resp, prompt = self.qa_handle.get_knowledge_based_conent_test(
  File "D:\ProgramData\anaconda3\envs\gptac\lib\site-packages\zh_langchain\chains\local_doc_qa.py", line 238, in get_knowledge_based_conent_test
    embedding = self.vector_store.embedding_function(query)
TypeError: 'HuggingFaceEmbeddings' object is not callable
文件加载完毕,正在生成向量库
Batches: 100%|██████████| 42/42 [00:06<00:00,  6.13it/s]
代理配置 http://127.0.0.1:7890, 代理所在地:Japan - Google LLC
 gpt-3.5-turbo : 0 : 'HuggingFaceEmbeddings' object is not callable ..........
 gpt-3.5-turbo : 1 :  File "D:\ProgramData\anaconda3\envs\gptac\lib\site-packages\zh_langchain\chains\local_doc_qa.py", l ..........
 gpt-3.5-turbo : 2 : Traceback (most recent call last):
  File ".\toolbox.py", line 156, in decorated
    yield from f(ma ..........
SonixLegend commented 11 months ago

from langchain_core.embeddings import Embeddings if isinstance(self.vector_store.embedding_function, Embeddings): embedding = self.vector_store.embedding_function.embed_query(s) else: embedding = self.vector_store.embedding_function(s)

xiao-yuling commented 11 months ago

@binary-husky

Miku2G commented 11 months ago

@binary-husky 我也遇到相同的问题

Miku2G commented 11 months ago

Traceback (most recent call last): File ".\crazy_functions\Langchain知识库.py", line 28, in 知识库问答 from zh_langchain import construct_vector_store ModuleNotFoundError: No module named 'zh_langchain'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File ".\toolbox.py", line 156, in decorated yield from f(main_input, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, *args, **kwargs) File ".\crazy_functions\Langchain知识库.py", line 35, in 知识库问答 try_install_deps(['zh_langchain==0.2.1', 'pypinyin'], reload_m=['pypinyin', 'zh_langchain']) File ".\crazy_functions\crazy_utils.py", line 770, in try_install_deps importlib.reload(import(m)) ModuleNotFoundError: No module named 'pypinyin'