-
-
Notifications
You must be signed in to change notification settings - Fork 22.6k
[Rust Frontend] Extend the existing gRPC service protocol #48033
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
Changes from all commits
cc745a6
a5a701b
ce52c03
2e15e1c
f0edef2
a4a4977
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,19 @@ service Generate { | |
| rpc GenerateStream (GenerateRequest) returns (stream GenerateResponse) {} | ||
| } | ||
|
|
||
| service Control { | ||
| rpc GetServerInfo (GetServerInfoRequest) returns (ServerInfo) {} | ||
| rpc GetModelInfo (GetModelInfoRequest) returns (ModelInfo) {} | ||
| rpc Abort (AbortRequest) returns (AbortResponse) {} | ||
| rpc Drain (DrainRequest) returns (DrainResponse) {} | ||
|
|
||
| rpc LoadLora (LoadLoraRequest) returns (LoadLoraResponse) {} | ||
| rpc UnloadLora (UnloadLoraRequest) returns (UnloadLoraResponse) {} | ||
| rpc ListLoras (ListLorasRequest) returns (ListLorasResponse) {} | ||
|
|
||
| rpc GetKvEventSources (GetKvEventSourcesRequest) returns (GetKvEventSourcesResponse) {} | ||
| } | ||
|
|
||
| // ====================================================================================== | ||
| // Generate Request | ||
| // ====================================================================================== | ||
|
|
@@ -42,6 +55,11 @@ message GenerateRequest { | |
| uint32 truncate_prompt_tokens = 11; | ||
|
|
||
| int32 priority = 12; | ||
|
|
||
| // Multimodal inputs aligned with placeholder markers in token_ids. | ||
| repeated MediaItem media = 13; | ||
| // Loaded LoRA name; empty selects the base model. | ||
| string lora_name = 14; | ||
| } | ||
|
|
||
| message RandomSampling { | ||
|
|
@@ -194,3 +212,134 @@ message TokenIds { | |
| repeated uint32 ids = 1; | ||
| } | ||
|
|
||
| // ====================================================================================== | ||
| // Media | ||
| // ====================================================================================== | ||
|
|
||
| enum Modality { | ||
| MODALITY_UNSPECIFIED = 0; | ||
| MODALITY_IMAGE = 1; | ||
| MODALITY_VIDEO = 2; | ||
| MODALITY_AUDIO = 3; | ||
| } | ||
|
|
||
| message MediaItem { | ||
| Modality modality = 1; | ||
| oneof source { | ||
| string url = 2; | ||
| string data_uri = 3; | ||
| bytes raw_bytes = 4; | ||
| } | ||
| string mime_type = 5; | ||
| string uuid = 6; | ||
| } | ||
|
|
||
| // ====================================================================================== | ||
| // Discovery and lifecycle | ||
| // ====================================================================================== | ||
|
|
||
| message GetServerInfoRequest {} | ||
|
|
||
| message ServerInfo { | ||
| string engine_version = 1; | ||
| string api_version = 2; | ||
| string instance_id = 3; | ||
| ParallelismInfo parallelism = 4; | ||
| uint32 max_model_len = 5; | ||
| uint32 kv_block_size = 6; | ||
| uint64 total_kv_blocks = 7; | ||
| uint64 max_running_requests = 8; | ||
| uint64 max_batched_tokens = 9; | ||
| uint32 max_loras = 10; | ||
| } | ||
|
|
||
| message ParallelismInfo { | ||
| uint32 tensor_parallel_size = 1; | ||
| uint32 pipeline_parallel_size = 2; | ||
| uint32 data_parallel_size = 3; | ||
| uint32 data_parallel_rank = 4; | ||
| uint32 data_parallel_start_rank = 5; | ||
| uint32 decode_context_parallel_size = 6; | ||
| } | ||
|
|
||
| message GetModelInfoRequest {} | ||
|
|
||
| message ModelInfo { | ||
| string model_id = 1; | ||
| string served_model_name = 2; | ||
| repeated string served_model_aliases = 3; | ||
| repeated string tokenizer_modes = 4; | ||
|
|
||
| bool supports_text_input = 20; | ||
| bool supports_token_ids_input = 21; | ||
| bool supports_lora = 22; | ||
| bool supports_multimodal = 23; | ||
| string reasoning_parser = 24; | ||
| string tool_call_parser = 25; | ||
| } | ||
|
|
||
| message AbortRequest { | ||
| repeated string request_ids = 1; | ||
| } | ||
|
|
||
| message AbortResponse {} | ||
|
|
||
| message DrainRequest {} | ||
|
|
||
| message DrainResponse { | ||
| DrainState state = 1; | ||
| uint32 in_flight_requests = 2; | ||
| string message = 3; | ||
| } | ||
|
|
||
| enum DrainState { | ||
| DRAIN_STATE_UNSPECIFIED = 0; | ||
| DRAIN_STATE_IN_PROGRESS = 1; | ||
| DRAIN_STATE_COMPLETE = 2; | ||
| } | ||
|
Comment on lines
+287
to
+299
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of drain here? Shouldn't the router be able to handle this by itself?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The router can stop sending new requests, but I kept this to provide a server-side admission barrier and wait for in-flight requests to finish before shutdown. This only affects this gRPC service.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the router also has full knowledge of in-flight requests and can wait for/abort them as needed. Just trying to understand what this API actually buys you...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. This was originally meant to clearly support graceful shutdowns, but I agree that it doesn't actually provide much functional value. We can remove it now and add it back later if we discover a scenario where provides real value. |
||
|
|
||
| // ====================================================================================== | ||
| // LoRA lifecycle | ||
| // ====================================================================================== | ||
|
|
||
| message LoraAdapter { | ||
| int64 lora_id = 1; | ||
| string lora_name = 2; | ||
| string source_path = 3; | ||
| } | ||
|
|
||
| message LoadLoraRequest { LoraAdapter adapter = 1; } | ||
| message LoadLoraResponse { | ||
| LoraAdapter adapter = 1; | ||
| bool already_loaded = 2; | ||
| } | ||
| message UnloadLoraRequest { string lora_name = 1; } | ||
| message UnloadLoraResponse { LoraAdapter adapter = 1; } | ||
| message ListLorasRequest {} | ||
| message ListLorasResponse { repeated LoraAdapter adapters = 1; } | ||
|
|
||
| // ====================================================================================== | ||
| // KV discovery | ||
| // ====================================================================================== | ||
|
|
||
| message GetKvEventSourcesRequest {} | ||
| message GetKvEventSourcesResponse { repeated KvEventSource sources = 1; } | ||
|
|
||
| message KvEventEndpoint { | ||
| string host = 1; | ||
| uint32 port = 2; | ||
| string protocol = 3; | ||
| } | ||
|
|
||
| message KvEventSource { | ||
| string transport = 1; | ||
| KvEventEndpoint endpoint_addr = 2; | ||
| string topic = 3; | ||
| string replay_endpoint = 4; | ||
| optional uint32 data_parallel_rank = 5; | ||
| string encoding = 6; | ||
| uint32 schema_version = 7; | ||
| uint32 buffer_steps = 8; | ||
| uint32 hwm = 9; | ||
| uint32 max_queue_size = 10; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.