_from_response(err.response) from None openai.NotFoundError: Error code: 404 - {...

2025年11月12日 15:32 状态: pending

🚨 错误信息

gchain python /home/fanzhou/learn/AI/B_LangChain/B_LangChain/test_http.py Traceback (most recent call last): File "/home/fanzhou/learn/AI/B_LangChain/B_LangChain/test_http.py", line 19, in <module> result = qa_chain.invoke({"question": "中国的首都是哪?天安门在哪?"}) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_core/runnables/base.py", line 3246, in invoke input_ = context.run(step.invoke, input_, config) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py", line 395, in invoke self.generate_prompt( File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py", line 1025, in generate_prompt return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py", line 842, in generate self._generate_with_cache( File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_core/language_models/chat_models.py", line 1091, in _generate_with_cache result = self._generate( File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_openai/chat_models/base.py", line 1213, in _generate raise e File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/langchain_openai/chat_models/base.py", line 1208, in _generate raw_response = self.client.with_raw_response.create(**payload) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/openai/_legacy_response.py", line 364, in wrapped return cast(LegacyAPIResponse[R], func(*args, **kwargs)) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/openai/_utils/_utils.py", line 286, in wrapper return func(*args, **kwargs) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/openai/resources/chat/completions/completions.py", line 1156, in create return self._post( File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/openai/_base_client.py", line 1259, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/home/fanzhou/anaconda3/envs/my_langchain/lib/python3.9/site-packages/openai/_base_client.py", line 1047, in request raise self._make_status_error_from_response(err.response) from None openai.NotFoundError: Error code: 404 - {'error': {'message': 'Invalid URL (POST /v1/chat/completions/chat/completions)', 'type': 'invalid_request_error', 'code': ''}} ERROR conda.cli.main_run:execute(49): `conda run python /home/fanzhou/learn/AI/B_LangChain/B_LangChain/test_http.py` failed. (See above for error)

🤖 AI解决方案