Skip to content

Ollama API: option "stop" must be of type array #279

@nielsmaerten

Description

@nielsmaerten

Bug Report

Description

Bug Summary:
Hi, thanks for this awesome project!
I ran into this issue when trying to set my stop sequence to \n\n (so my output would be limited to a single paragraph).
After saving this stop sequence, Ollama API rejects calls with the error: option "stop" must be of type array.

Steps to Reproduce:

  • Start from a fresh UI install
  • Edit advanced options: set "stop sequence" to \n\n (though any string will work)
  • Attempt to submit a chat message

Expected Behavior:

  • The Ollama API responds to the prompt

Actual Behavior:

  • API rejects the request with a 400 BAD REQUEST error and the following message: option "stop" must be of type array

Environment

Model: dolphin-mixtral
Ollama Web UI Version v1.0.0-alpha.33
Ollama Version 0.1.17

Reproduction Details

  • After inspecting my network logs, it seems the UI had stringified the stop sequence option into
"stop": "\\n\\n",

But, the API is expecting an array, so the correct value would have been

"stop": ["\n\n"],

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I have reviewed the troubleshooting.md document.
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs

Browser Console Logs:
XHR POST http://hello-ollama/ollama/api/chat
[HTTP/1.1 400 Bad Request 853ms]
VersionHTTP/1.1
Transferred 403 B (163 B size)

Docker Container Logs:
N/A

Installation Method

Docker with external Ollama instance running on same server, but outside docker

Additional Information

I've attempted a fix in https://github.com/nielsmaerten/ollama-webui/tree/bugfix/options-stop-array
While this works for me, it may need to be cleaned up a bit.

Screenshots

20l7MUtNiN
AF57uhUT2B
1xDNW3CDcc

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions