mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
Can't get Async to stop #27
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 @grahama1970 on GitHub (Feb 8, 2024).
the below results in an infinite number of new lines after the text retrurns. How do I give the async the stop command?
@mxyng commented on GitHub (Feb 12, 2024):
the llm can generate forever in some scenarios. here are a few techniques to terminate:
use
options['stop']. models should come with stop parameters preconfigured but this might not match your specific output.use
options['num_predict']. this tells the llm to stop after a set number of tokens.stop the python (async) generator. the llm will stop generation when the client connection exits. this means you can implement 1 or 2 from above client side, or implement your own termination criteria