-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Realtime abstraction built on top of asgi (#643)
This is an experimental decorator that configures a basic websocket streaming example under the hood. The idea is to have a drop-in-place feature that lets users create streaming handlers that can do image generation, chat, etc. without writing the ASGI boilerplate. **TODO**: - [x] Add automatic type inference - [ ] Create client examples ``` from beta9 import realtime def load_model(): return "my_model" @realtime( cpu=1, memory=128, timeout=180, concurrent_requests=10, on_start=load_model, authorized=False, ) def handler(*, context, input: str): print(context.on_start_value) return input ``` The output from this echo server looks like this: ``` luke@Lukes-MBP beta9 % websocat ws://localhost:1994/asgi/public/bbfb4433-9685-4f79-9d92-68fb57b240c3 do something do something echo echo here here ```
- Loading branch information
1 parent
6bd5076
commit b6c9e64
Showing
4 changed files
with
203 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "beta9" | ||
version = "0.1.93" | ||
version = "0.1.94" | ||
description = "" | ||
authors = ["beam.cloud <[email protected]>"] | ||
packages = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters