You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If you try to instantiate a chat using an OllamaPromptDriver, but Ollama is not currently running on your machine, it gets stuck in an infinite loop of printing warnings. If stream=True is set, then even CTRL+C can't kill the process, and the entire terminal needs to killed to stop it (or Task Manager). If stream is not set, you can CTRL+C out of it, and it just prints a stack trace and exits.
To Reproduce
With Ollama not running on your machine:
fromgriptape.driversimportOllamaPromptDriverfromgriptape.structuresimportAgentfromgriptape.utilsimportChatagent=Agent(
prompt_driver=OllamaPromptDriver(temperature=0.7, model="llama3.2"),
# stream=True # This is optional for the error, but if set, will cause SIGINT not to kill the process, leading to it running forever until terminated by Task Manager or by killing the terminal
)
Chat(agent).start()
Expected behavior
It would maybe throw one error and exit, or at least be able to CTRL+C out of it even with stream enabled.
Screenshots
Desktop (please complete the following information):
Hi @steamroller-kb, this is intended behavior. Prompt Drivers will exponentially retry max_attempts times. You can change this number by passing in max_attempts=N to the Prompt Driver.
Regarding CTRL+C, you should be able to press it a few times to have it break out fully.
I wonder if we should reduce the max_attempts? I think default is 10 - but I find 2 or 3 is usually fine in most casess.. what do you think @collindutter ?
Agreed that 10 is probably too many, but would like to get input from others. Technically this would be a breaking change so we'd have to file it as a griptape 2.0 change.
Oh, @collindutter looking back at this I mean to ask - would it be possible to check for ollama to be running & return an error about that if it isn't?
I think that's more of the issue here - @steamroller-kb didn't have ollama running, and instead of returning quickly, it tried over and over again.
Seems like a nicer response would be to let the user know they need to start ollama first?
Describe the bug
If you try to instantiate a chat using an OllamaPromptDriver, but Ollama is not currently running on your machine, it gets stuck in an infinite loop of printing warnings. If
stream=True
is set, then even CTRL+C can't kill the process, and the entire terminal needs to killed to stop it (or Task Manager). If stream is not set, you can CTRL+C out of it, and it just prints a stack trace and exits.To Reproduce
With Ollama not running on your machine:
Expected behavior
It would maybe throw one error and exit, or at least be able to CTRL+C out of it even with stream enabled.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: