Traceback (most recent call last): File "/home/yzj/work/llm/ollamademo.py", line 10, in…
- User
Traceback (most recent call last): File "/home/yzj/work/llm/ollama_demo.py", line 10, in response = ollama.chat(model='phi3:medium', messages=[ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/yzj/.local/lib/python3.12/site-packages/ollama/_client.py", line 235, in chat return self._request_stream( ^^^^^^^^^^^^^^^^^^^^^ File "/home/yzj/.local/lib/python3.12/site-packages/ollama/_client.py", line 98, in _request_stream return self._stream(*args, **kwargs) if stream else self._request(*args, **kwargs).json() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/yzj/.local/lib/python3.12/site-packages/ollama/_client.py", line 74, in _request raise ResponseError(e.response.text, e.response.status_code) from None ollama._types.ResponseError how to debug it?
- Assistant
- User
can you give detail definition of "ollama._types.ResponseError"
- Assistant
- User
import ollama import time import traceback from ollama._types import ResponseError
start_time = time.time()
phi3:medium
mistral
try: response = ollama.chat(model='phi3:medium', messages=[ {"role": "system", "content": "You are a helpful AI assistant."}, {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"}, {"role": "user", "content": "Can you explain the above process in more detail?"}, # { # 'role': 'user', # 'content': 'Why is the sky blue?', # }, ]) except ResponseError as e: print("发生异常:", str(e)) print(f"Error: {e.error}, Status Code: {e.status_code}") when run the above snippet code, I get e.status_code = 502 error, how to handel it?
- Assistant
- User
how to setup ollama server in my host pc, for the ollama.client of python to access it, my ollama server is normal for ollama run command, like "ollama run mistral"
- Assistant