langchain ValueError: Ollama调用失败,状态码为502,详细信息

qco9c6ql  于 3个月前  发布在  其他
关注(0)|答案(9)|浏览(42)

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

文件 /mnt/nfs/wangyu/Miniconda/envs/RAG/lib/python3.10/site-packages/langchain_community/llms/ollama.py:172,在 _OllamaCommon._create_generate_stream(self, prompt, stop, images, **kwargs) 函数中
164 def _create_generate_stream(
165 self,
166 prompt: str,
(...)
169 **kwargs: Any,
170 ) -> Iterator[str]:
171 payload = {"prompt": prompt, "images": images}
--> 172 yield from self._create_stream(
173 payload=payload,
174 stop=stop,
175 api_url=f"{self.base_url}/api/generate",
176 **kwargs,
177 )
文件 /mnt/nfs/wangyu/Miniconda/envs/RAG/lib/python3.10/site-packages/langchain_community/llms/ollama.py:251,在 _OllamaCommon._create_stream(self, api_url, payload, stop, **kwargs) 函数中
249 else:
250 optional_detail = response.text
--> 251 raise ValueError(
252 f"Ollama call failed with status code {response.status_code}."
253 f" Details: {optional_detail}"
254 )
255 return response.iter_lines(decode_unicode=True)
ValueError: Ollama调用失败,状态码为502。详情:

描述

我运行了示例代码,但报告了这个错误。

系统信息

系统信息

操作系统:Linux
OS版本: #21 ~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 9 13:32:52 UTC 2
Python版本:3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0]

软件包信息

langchain_core:0.1.45
langchain:0.1.16
langchain_community:0.0.34
langsmith:0.1.49
langchain_text_splitters:0.0.1

没有安装的软件包(不一定是问题)

以下软件包未找到:
langgraph
langserve

ygya80vv

ygya80vv1#

你是否使用类似这样的方式运行了llama2模型:ollama run llama3?

7cwmlq89

7cwmlq892#

你是否已经使用llama2模型运行过这样的命令:ollama run llama3?
是的,我成功下载了llama3并尝试使用命令ollama run llama3进行操作,没有任何问题。但是在使用langchain时,出现了错误报告:

gpnt7bae

gpnt7bae4#

我希望有人能帮助我。

a2mppw5e

a2mppw5e5#

我遇到了ollama错误400。这些是否相关?
我认为在llama3发布后,我拉取了一些新的langchain更新。这个错误可能是由于那个原因导致的。

f87krz0w

f87krz0w6#

我遇到了ollama错误400。这些是否相关?我认为在llama3发布后,我拉取了一些新的langchain更新。这个错误可能是由于那个原因导致的。

我不确定,但是当我在.bashrc中注解掉代理时,它可以成功运行。

holgip5t

holgip5t7#

拥有相同问题的人也

gfttwv5a

gfttwv5a8#

我也遇到了同样的问题,已经解决了。只需在.bashrc文件中注解掉代理即可。

rsl1atfo

rsl1atfo9#

运行了这个命令 "ollama pull llama3" 后,出现了类似的错误。问题已经解决。尝试一下。

相关问题