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

Add ability to stop a long running request. #992

Open
richard-to opened this issue Sep 27, 2024 · 1 comment
Open

Add ability to stop a long running request. #992

richard-to opened this issue Sep 27, 2024 · 1 comment

Comments

@richard-to
Copy link
Collaborator

User has a use case where they have a long running LLM request that may yield a lot of info. If they see the info is going the wrong direction, they want the ability to stop request.

At the moment, I think potentially could be done unintentionally through this bug: #981 (lol).

@wwwillchen
Copy link
Collaborator

You can do the following pattern if Mesop websockets is enabled:

@me.stateclass
class State:
  is_cancelled: bool = False

def call_llm_handler():
    for chunk in call_llm():
        if state.is_cancelled:
            raise GeneratorExit
        yield chunk

But without websockets (and a stateful context across multiple concurrent requests), I don't think this is supported.

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