mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Running without network error: ollama._types.ResponseError #46
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Gloridust on GitHub (Mar 8, 2024).
Really helpful project! However, I met some problem When I turn off WI-FI connection.
All of my program can work well with internet connection. But when I turn off the wifi switch, it totally error.
U can see my project at:https://github.com/Gloridust/LocalChatLLM
I really need it to run completely offline, any solutions?
@hj199717 commented on GitHub (Mar 31, 2024):
遇到同样的问题了,只要网络不通就报这个错,您这边解决这个问题了吗。
可以尝试下openai的API看行不行:
from openai import OpenAI
client = OpenAI(
base_url='http://localhost:11434/v1/',
api_key='ollama', # required but ignored
)
chat_completion = client.chat.completions.create(
messages=[
{
'role': 'user',
'content': 'Say this is a test',
}
],
model='qwen:4b',
)
@Gloridust commented on GitHub (Apr 3, 2024):
仍然有一些问题。
首先这个openai的接口在输出格式上有一些问题,直接'print(chat_completion),你会发现输出格式如下:
There are still some issues.
First of all, this openai interface has some problems with the output format. Directly 'print(chat_completion)', you will find that the output format is as follows:
然后我做出了些许修改:
Then I made some changes:
至此,在联网状况下正常运行,但是一旦断开网络链接,就出现了更多问题:
At this point, it runs normally when connected to the Internet, but once the network connection is disconnected, more problems occur:
貌似是OpenAI的接口需要联网。在创建chat completion时出现了内部服务器错误(Error code: 502)。这意味着在尝试与OpenAI服务器通信时出现了问题。
It seems that the OpenAI interface needs to be connected to the Internet. An internal server error occurred while creating the chat completion (Error code: 502). This means there is a problem while trying to communicate with the OpenAI server.
@likw99 commented on GitHub (Aug 2, 2024):
Met similar issue that direct me here, fixed by turning off the global proxy.
Tried turning off the wifi, and it still works (on MacOS).
@rymquym commented on GitHub (Aug 8, 2024):
be sure if running offline to use ollama serve
@aopstudio commented on GitHub (Oct 14, 2024):
It works for me. Thanks!
@immmor commented on GitHub (Jan 2, 2025):
@xzyJJboom commented on GitHub (Jan 20, 2025):
It works for me. Thanks! Until now, I used the Intranet to penetrate the tunnel