mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Can we get an ollama.stop? #143
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 @JTMarsh556 on GitHub (Sep 22, 2024).
Originally assigned to: @ParthSareen on GitHub.
ollama stop was a great addition. I was hoping we could get stop added to the API library.
Thanks
@davidearlyoung commented on GitHub (Oct 1, 2024):
I second this as well. And to keep things clear. I'm talking about making available in the ollama python lib the same behavior you get when you run
ollama stop <target_model>from terminal. Which is what I believe what JTMarsh556 is also asking.@jcgordon10 commented on GitHub (Oct 3, 2024):
+1
I'm writing a script and want to be able to call it with different models as a parameter, but I need to be able to have the script stop the model it's using at the end of it's execution, that way the way is clear for if I call with a different model.
@wallscreet commented on GitHub (Nov 7, 2024):
The generate and chat methods both accept a float for keep-alive. When hot-switching models, I set my keep-alive=0 at the call and it should unload immediately (at least that's been my observation).
@ParthSareen commented on GitHub (Nov 25, 2024):
Great - thanks for bringing - will scope in :)
@liponex commented on GitHub (Dec 18, 2024):
Also, as I understand, there can be multiple generations at once through
AsyncClient. So better would be addingstopfunction as returning handle fromclient.chat,client.generateand etc.@ckuethe commented on GitHub (Apr 12, 2025):
I'd like to see both
ollama force-quitto immediate kill all running models no matter what, regardless of any work already done; andollama drainto allow whatever requests are in progress to finish while refusing any new ones - even on open connections.@MERakram commented on GitHub (May 22, 2025):
Any updates on this? or any alternatives to the abort the generation programmatically (kill specific generation or model)
@andrea-lorenzetti commented on GitHub (Aug 22, 2025):
Was this function implemented? I dont see it in the docs