Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ollama.stop option #180

Open
space0blaster opened this issue Dec 17, 2024 · 4 comments
Open

ollama.stop option #180

space0blaster opened this issue Dec 17, 2024 · 4 comments

Comments

@space0blaster
Copy link

Any plans to add ollama.stop as a function similar to the CLI to stop running models?

@hopperelec
Copy link
Contributor

Do you mean aborting?

@space0blaster
Copy link
Author

I thought that only aborts generation but doesn't completely stop the model?
Does it function the same as ollama stop {model-name}?

@hopperelec
Copy link
Contributor

hopperelec commented Dec 17, 2024

Oh, I didn't know about ollama stop, I thought you meant stopping a generation. Looking at the source code for the Ollama API (I don't know Go, so I'm making an educated guess), it unloads a model by requesting it to generate from a null prompt (the same way you can pre-load a model). This method works for pre-loading models via the API, so presumably it'll also work for unloading them (even though it appears to be undocumented for the API). Sadly, this is not type-safe in ollama-js, but I have brought this up in #162

@space0blaster
Copy link
Author

I was looking for that so thank you, I'm sending a null prompt as well to warm-up the model so it's ready to go instead of loading it on the first actual prompt.
A way to unload would be great. stop does that in the CLI. I'm using a child process at the moment to execute the stop command from inside JS which isn't ideal. Gets complicated if you're in a separate Docker container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants