taketwo / llm-ollama

LLM plugin providing access to local Ollama models using HTTP API
Apache License 2.0
147 stars 8 forks source link

404 response from ollama on prompt #2

Closed nhoffman closed 10 months ago

nhoffman commented 10 months ago

Hi there - I installed llm and this project using pipx, and there seems to be an error accessing the ollama server. Here are some details - please let me know what additional information would be helpful.

% ollama list
NAME            ID              SIZE    MODIFIED
llama2:latest   7da22eda89ac    3.8 GB  3 months ago

% curl -s http://localhost:11434/api/generate -d '{"model": "llama2", "prompt":"what is 2 + 2", "stream":false}' | jq -r -c '.response'
 The answer to 2 + 2 is 4.

% pipx runpip llm freeze | grep -E 'llm|ollama'
llm==0.13.1
llm-ollama==0.2.0
ollama==0.1.4

% llm ollama list-models
llama2:latest

% llm -m llama2:latest 'How much is 2+2?'
Error: 404 page not found
taketwo commented 10 months ago

Unfortunately, I cannot reproduce this, although I have the same package versions as you.

The plugin uses the /chat endpoint even when you run single prompts (I did not figure out a way to differentiate between llm and llm chat invocations). Thus, to rule out problems with endpoint access, please check that the following works:

$ curl http://localhost:11434/api/chat -d '{
  "model": "llama2:latest",
  "messages": [
    {
      "role": "user",
      "content": "why is the sky blue?"
    }
  ]
}'

If this works, then additional troubleshooting ideas are:

nhoffman commented 10 months ago

Thanks for the help troubleshooting. The /api/chat endpoint gives me a 404 (and works on another machine), so that's my problem right there. No idea what's wrong since the /api/generate endpoint seems fine, but I'm closing this since the problem is clearly on my end. Thanks for the plugin!