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

Provide a way to cancel queries #6

Closed
Stebalien opened this issue Oct 31, 2023 · 5 comments
Closed

Provide a way to cancel queries #6

Stebalien opened this issue Oct 31, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Stebalien
Copy link
Contributor

Specifically, provide a nice way to cancel queries programatically (e.g., from ellama).

This is especially important with, e.g., a local LLM like ollama. I believe it's sufficient to return the url-request process buffer, letting the user run something like (let (kill-buffer-query-functions) (kill-buffer my-llm-buffer)).

@ahyatt ahyatt added the enhancement New feature or request label Nov 1, 2023
@ahyatt
Copy link
Owner

ahyatt commented Nov 1, 2023

This is a good idea. For ollama, do you expect that the ollama processing will be canceled as well? I think we can interrupt the connection, but what happens on the Ollama side depends on them, I think.

@Stebalien
Copy link
Contributor Author

I think so? It's written in go so I assume the process is tied to the request context.

If not... I'll report a bug upstream.

Stebalien added a commit to Stebalien/llm that referenced this issue Dec 21, 2023
That way, the user can cancel the request by killing the buffer. This
will, in turn, kill the and cancel HTTP request.

I've tested this with Ollama and it appears to kill the underlying
request as well.

fixes ahyatt#6
ahyatt added a commit that referenced this issue Dec 23, 2023
This closes the feature request in #6, and
is relevant to the conversation at #11.
@ahyatt
Copy link
Owner

ahyatt commented Dec 23, 2023

Sorry for the delay, this should do the trick. Please use the new llm-cancel-request method. If this works well, I'll make a release soon, although there's a few more things I'd like to do before this next release.

@ahyatt ahyatt closed this as completed Dec 23, 2023
@Stebalien
Copy link
Contributor Author

Hm. So, actually, binding url-http-async-sentinel prevents llm-chat-streaming from calling either the response/error callback. It's not, strictly speaking, incorrect. Just a bit annoying.

@ahyatt
Copy link
Owner

ahyatt commented Dec 24, 2023

I would expect that canceling the query shouldn't result in any more callbacks, though. Is your intuition about this different?

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

Successfully merging a pull request may close this issue.

2 participants