RAG-QA-Generator icon indicating copy to clipboard operation
RAG-QA-Generator copied to clipboard

创建collection时报错

Open Xmas233 opened this issue 1 year ago • 7 comments

NameError: name 'deepseek' is not defined Traceback: File "C:\Users\13793.conda\envs\LLM\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "D:\BYSJ\RAG-QA-Generator\Code\AutoQAG.py", line 487, in main() File "D:\BYSJ\RAG-QA-Generator\Code\AutoQAG.py", line 442, in main embedding_model_id=deepseek-chat, # 这里可以替换为实际的模型ID ^^^^^^^^ 想请问一下模型ID是指的什么?是模型的型号吗

Xmas233 avatar Jan 06 '25 07:01 Xmas233

embedding_model_id为嵌入模型的id(非生成的大模型),用于将文本向量化并存储到taskingai向量数据库的模型。前置条件是安装好taskingai rag数据库,分别配置好嵌入模型和生成大模型,填入对应的信息即可。

wangxb96 avatar Jan 06 '25 10:01 wangxb96

也是创建新Collection失败,AutoQAG.py里我的配置如下:

# 配置(请在使用时替换为实际的URL和API密钥)
api_key = '*****'
base_url = 'https://oapi.tasking.ai/v1'
#base_url = 'http://localhost:8080/v1'
headers = {"Authorization": f"Bearer {api_key}"}

# OpenAI客户端配置(请在使用时替换为实际的API密钥和URL)
client = OpenAI(
    api_key="*****",
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)

看了官方文档没懂base_url到底是用https://oapi.tasking.ai/v1 还是http://localhost:8080/v1 二者都可以上传文件并且生成qa对,但网页上的qa对结果显示不完全,且也有报错:(不确定是不是因为前面url问题没解决)

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/mnt/RAG-QA-Generator-master/Code/AutoQAG.py", line 488, in <module>
    main()
  File "/mnt/RAG-QA-Generator-master/Code/AutoQAG.py", line 412, in main
    st.markdown(qa['chunk'])
                ~~^^^^^^^^^
KeyError: 'chunk'

base_url = 'https://oapi.tasking.ai/v1'的报错: API请求失败: 404 Client Error: Not Found for url: https://oapi.tasking.ai/v1collections

base_url = 'http://localhost:8080/v1'的报错: API请求失败: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /v1collections (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3c7042e290>: Failed to establish a new connection: [Errno 111] Connection refused'))

官方论坛有个帖子是类似的404错误:https://forum.tasking.ai/t/404-error-when-using-oapi-tasking-ai/104/2 但并不能解决这个问题。

xiangchitangyuan avatar Feb 12 '25 09:02 xiangchitangyuan

也是创建新Collection失败,AutoQAG.py里我的配置如下:

# 配置(请在使用时替换为实际的URL和API密钥)
api_key = '*****'
base_url = 'https://oapi.tasking.ai/v1'
#base_url = 'http://localhost:8080/v1'
headers = {"Authorization": f"Bearer {api_key}"}

# OpenAI客户端配置(请在使用时替换为实际的API密钥和URL)
client = OpenAI(
    api_key="*****",
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)

看了官方文档没懂base_url到底是用https://oapi.tasking.ai/v1 还是http://localhost:8080/v1 二者都可以上传文件并且生成qa对,但网页上的qa对结果显示不完全,且也有报错:(不确定是不是因为前面url问题没解决)

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
  File "/mnt/RAG-QA-Generator-master/Code/AutoQAG.py", line 488, in <module>
    main()
  File "/mnt/RAG-QA-Generator-master/Code/AutoQAG.py", line 412, in main
    st.markdown(qa['chunk'])
                ~~^^^^^^^^^
KeyError: 'chunk'

base_url = 'https://oapi.tasking.ai/v1'的报错: API请求失败: 404 Client Error: Not Found for url: https://oapi.tasking.ai/v1collections

base_url = 'http://localhost:8080/v1'的报错: API请求失败: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /v1collections (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3c7042e290>: Failed to establish a new connection: [Errno 111] Connection refused'))

官方论坛有个帖子是类似的404错误:https://forum.tasking.ai/t/404-error-when-using-oapi-tasking-ai/104/2 但并不能解决这个问题。

请问qa对结果显示不全解决了吗?我也是这个问题

Scot-Tong avatar Mar 17 '25 08:03 Scot-Tong

请问qa对结果显示不全解决了吗?我也是这个问题

没有诶 (TヘTo)

xiangchitangyuan avatar Mar 18 '25 01:03 xiangchitangyuan

QA对结果生成默认

请问qa对结果显示不全解决了吗?我也是这个问题

没有诶 (TヘTo)

QA对默认只显示前3条,可更改下述参数以满足需求:

if st.session_state.qa_pairs: st.subheader("前3个QA对预览") cols = st.columns(3) for i, qa in enumerate(st.session_state.qa_pairs[:3]): with st.expander(f"QA对 {i + 1}", expanded=True): st.markdown("问题:") st.markdown(qa['question']) st.markdown("答案:") st.markdown(qa['answer']) st.markdown("原文:") st.markdown(qa['chunk']) st.markdown("---")

wangxb96 avatar Mar 18 '25 01:03 wangxb96

QA对结果生成默认

请问qa对结果显示不全解决了吗?我也是这个问题

没有诶 (TヘTo)

QA对默认只显示前3条,可更改下述参数以满足需求:

if st.session_state.qa_pairs: st.subheader("前3个QA对预览") cols = st.columns(3) for i, qa in enumerate(st.session_state.qa_pairs[:3]): with st.expander(f"QA对 {i + 1}", expanded=True): st.markdown("问题:") st.markdown(qa['question']) st.markdown("答案:") st.markdown(qa['answer']) st.markdown("原文:") st.markdown(qa['chunk']) st.markdown("---")

大神,我之前的表述有问题,运行结果是只生成了1个QA对,而且会报错 KeyError: 'chunk' Traceback: File "D:\Anaconda\envs\forRAG\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "D:\PythonProject\RAG-QA-Generator-master\RAG-QA-Generator\Code\AutoQAG.py", line 487, in main() File "D:\PythonProject\RAG-QA-Generator-master\RAG-QA-Generator\Code\AutoQAG.py", line 411, in main st.markdown(qa['chunk']) ~~^^^^^^^^^ 此外我将代码中原本的qwen2.5-72b模型改成了gpt-3.5-turbo,base_url="https://api.openai-sb.com/v1",请问报错会与这个有关吗

Scot-Tong avatar Mar 20 '25 08:03 Scot-Tong

embedding_model_id为嵌入模型的id(非生成的大模型),用于将文本向量化并存储到taskingai向量数据库的模型。前置条件是安装好taskingai rag数据库,分别配置好嵌入模型和生成大模型,填入对应的信息即可。

请问这个安装tasking AI数据库是指4.2里的安装配置Tasking AI系统吗?这一步骤不在md文件里面吗?

Scot-Tong avatar Mar 26 '25 09:03 Scot-Tong