THUDM / WebGLM

WebGLM: An Efficient Web-enhanced Question Answering System (KDD 2023)
Apache License 2.0
1.57k stars 135 forks source link

"Invalid API key"怎么引起的? #16

Closed realsky-lgh closed 1 year ago

realsky-lgh commented 1 year ago

(wenglm) D:\LLM\WebGLM>python web_demo.py WebGLM Initializing... Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 14/14 [01:41<00:00, 7.23s/it] WebGLM Loaded Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). [System] Searching ... Traceback (most recent call last): File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\gradio\blocks.py", line 1067, in call_function prediction = await utils.async_iteration(iterator) File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\gradio\utils.py", line 336, in async_iteration return await iterator.anext() File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\gradio\utils.py", line 329, in anext return await anyio.to_thread.run_sync( File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, *args) File "D:\ProgramData\anaconda3\envs\wenglm\lib\site-packages\gradio\utils.py", line 312, in run_sync_iterator_async return next(iterator) File "D:\LLM\WebGLM\web_demo.py", line 49, in query for resp in webglm.stream_query(query): File "D:\LLM\WebGLM\model\modeling_webglm.py", line 35, in stream_query refs = self.ref_retriever.query(question) File "D:\LLM\WebGLM\model\retriever__init.py", line 18, in query search_results = self.searcher.search(question) File "D:\LLM\WebGLM\model\retriever\searching__init__.py", line 62, in search return serp_api(query) File "D:\LLM\WebGLM\model\retriever\searching\init__.py", line 19, in serp_api raise Exception("Serpapi returned %d\n%s"%(resp.status_code, resp.text)) Exception: Serpapi returned 401 { "error": "Invalid API key. Your API key should be here: https://serpapi.com/manage-api-key" } ———————————————————————————— 环境:win11 已经运行:set SERPAPI_KEY=“xxxx5217658144a17782a2bxxxxxxxxx2acd5b8002370729e0”

Longin-Yu commented 1 year ago

可以试一试通过 -s 显式地赋值是否可行。 另外,我们在最新版中加入了 Bing Search,你可以通过 --searcher bing 跳过 SerpAPI 的步骤 😆

realsky-lgh commented 1 year ago

加上--searcher bing 后就可以了,感谢!

ilovesouthpark commented 1 year ago

可以直接把key输入解决。