wxywb / history_rag

825 stars 108 forks source link

可以使用GPT3.5的API吗?可否使用txt以外的文件(pdf)? #15

Closed wei851246721 closed 7 months ago

wxywb commented 7 months ago

我在几个问题上产生了不太能接受的幻觉,就用gpt-4了,你可以自己试试几个例子对比一下。

taihaozesong commented 7 months ago

俺试的时候幻觉太严重了, 模型是gpt-3.5-turbo-1106

(rag)问题:关公有哪些重要战绩,对手是谁? 关公有几个重要的战绩,对手分别是颜良、文丑、张辽、关羽、孙权等。《三国志·三国志卷六十四 蜀书十九 诸葛滕二孙 濮阳传第十九》中提到了关羽远远望见颜良的帅旗车盖,策马上前刺杀颜良于万马军中,将其首级割下返回,袁绍军中的 将领们没人敢出阵阻挡,于是解除白马之围。曹操当即上奏朝廷封关羽为汉寿亭侯。另外,《三国志·三国志卷五十五 蜀 书十 程黄韩蒋周陈董甘凌徐潘丁传第十》中也提到了关羽生擒了颜良、文丑,被升为昭武将军,封爵西安乡侯。此外,关 羽还鲁与张辽、孙权等作战。

wei851246721 commented 7 months ago

我在几个问题上产生了不太能接受的幻觉,就用gpt-4了,你可以自己试试几个例子对比一下。

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

taihaozesong commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2

KuMuRen commented 7 months ago

3.5只能说是,能用,不过对现在来说,我们没有gpt4的api,勉强检索一下也够了。 (rag) 问题: 谁被称为梦中宰相 不知道 (rag) 问题: 武丁做梦后找到了谁 武丁做梦后找到了一个圣人,名叫说。他派百官各处寻找,终于在一个叫傅险的地方找到说。这时, 说正服刑,在傅险筑路,把他带来见武丁,武丁说“:正是他。[《史记·殷本纪》]

wei851246721 commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2

感谢感谢 我晚上回家试一下 想问下你试过不检索历史,而是一些文档或者论文之类的吗

KuMuRen commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2

感谢感谢 我晚上回家试一下 想问下你试过不检索历史,而是一些文档或者论文之类的吗

他这个用的是txt文档,你放什么,建立什么文件的引擎是你自己的事。你可以参考一下那些txt文件来自己改动自己的文件去弄。另外每次检索最好是重复提问5、6次,然后选取最好的的结果。

wei851246721 commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2

感谢感谢 我晚上回家试一下 想问下你试过不检索历史,而是一些文档或者论文之类的吗

他这个用的是txt文档,你放什么,建立什么文件的引擎是你自己的事。你可以参考一下那些txt文件来自己改动自己的文件去弄。另外每次检索最好是重复提问5、6次,然后选取最好的的结果。

好的,他文档里面确实都是txt,那我可以用PDF吗,或者说txt与PDF对于引擎来说有什么不同吗

wxywb commented 7 months ago
  1. 如果你使用pdf的话,先使用zilliz pipeline方案试一下好了
  2. 对其他文本可能存在的问题,是你需要把HistorySentenceWindowNodeParser换成llamaindex中SentenceWindowNodeParse,因为HistorySentenceWindowNodeParser假定文本都是这种格式
    xx传
    xxxxxxxxxxxxxx
FoilHao commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2 配置修改为gpt-3.5-turbo后仍然会报错,超quota,请问用gpt3.5是还需要修改其他地方吗 openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

wei851246721 commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2 配置修改为gpt-3.5-turbo后仍然会报错,超quota,请问用gpt3.5是还需要修改其他地方吗 openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

换为gpt-3.5-turbo-1106试一下

wxywb commented 7 months ago

如果要用GPT3.5 API的话,需要修改程序里面的什么部分呢

可以改这一行 https://github.com/wxywb/history_rag/blob/master/cfgs/config.yaml#L2 配置修改为gpt-3.5-turbo后仍然会报错,超quota,请问用gpt3.5是还需要修改其他地方吗 openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

You exceeded your current quota, 看起你已经超出你使用openai的额度了,得充值,或者升级

wei851246721 commented 7 months ago

image

我已经把executor.py里面的HistorySentenceWindowNodeParser全部换成 了SentenceWindowNodeParse,但运行时会报错 image

wxywb commented 7 months ago

image

我已经把executor.py里面的HistorySentenceWindowNodeParser全部换成 了SentenceWindowNodeParse,但运行时会报错 image 换成

from llama_index.node_parser import SentenceWindowNodeParser

以及这一个地方也要改 https://github.com/wxywb/history_rag/blob/90272e35f9c27a1a7d141183f6b48145c8f06982/executor.py#L102

wei851246721 commented 7 months ago

我更改了这几个地方 image image image

但是build时会报 只有github上以txt结尾或文件夹可以被支持。

wxywb commented 7 months ago

你如果用的是pipeline的话不需要改的,那个是milvus方案

wei851246721 commented 7 months ago

我用的pipeline方案,你的意思是完全不修改,直接build pdf文件吗?

wei851246721 commented 7 months ago

但是build时会报 只有github上以txt结尾或文件夹可以被支持。

但是这样会报告: 只有github上以txt结尾或文件夹可以被支持。

wei851246721 commented 7 months ago

但是build时会报 只有github上以txt结尾或文件夹可以被支持。

但是这样会报告: 只有github上以txt结尾或文件夹可以被支持。

比如想构建: https://raw.githubusercontent.com/wei851246721/zilliz_paper_material/master/InfiniBand接口通信控制器的研究与FPGA实现.pdf

wxywb commented 7 months ago

@wei851246721 我现在明白的你的意思了 https://github.com/wxywb/history_rag/blob/90272e35f9c27a1a7d141183f6b48145c8f06982/executor.py#L296-L298 297行改成

 elif path.endswith('.txt') or path.endswith('.pdf'):
wei851246721 commented 7 months ago

感谢,目前可以使用PDF了,但我在问PDF相关内容时,经常回复抱歉,这是由于GPT3.5的能力限制吗? image

wxywb commented 7 months ago

可以,开启 -d ,看一下召回的片段

wei851246721 commented 7 months ago

召回的片段倒是很多,但最后给的答案是无效的 image

wxywb commented 7 months ago

你这都算不上问题, 比如你可以试试 “ QP Verb 命令模块是什么?”

wei851246721 commented 7 months ago

我试了下确实不能像我之前那样提问,需要提问中有比较精确的关键词,那么它回答正确概率很高