[Rust Frontend] Use enum-backed domain types for engine outputs and structured outputs (#47283)
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
@@ -11,7 +11,7 @@ use vllm_engine_core_client::protocol::logprobs::{
|
||||
};
|
||||
use vllm_engine_core_client::protocol::output::{
|
||||
EngineCoreEvent, EngineCoreEventType, EngineCoreFinishReason, EngineCoreOutput,
|
||||
EngineCoreOutputs,
|
||||
EngineCoreOutputs, RequestBatchOutputs,
|
||||
};
|
||||
use vllm_engine_core_client::protocol::request::EngineCoreRequest;
|
||||
use vllm_engine_core_client::protocol::sampling::EngineCoreSamplingParams;
|
||||
@@ -251,7 +251,7 @@ async fn generate_streams_outputs() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![
|
||||
request_output_with_logprobs(
|
||||
&request.request_id,
|
||||
@@ -270,7 +270,8 @@ async fn generate_streams_outputs() {
|
||||
],
|
||||
finished_requests: Some(BTreeSet::from([request.request_id.clone()])),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
})
|
||||
@@ -331,8 +332,7 @@ async fn collect_output_aggregates_raw_tokens_logprobs_and_terminal_metadata() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
engine_index: 0,
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![
|
||||
EngineCoreOutput {
|
||||
prefill_stats: Some(PrefillStats {
|
||||
@@ -358,13 +358,9 @@ async fn collect_output_aggregates_raw_tokens_logprobs_and_terminal_metadata() {
|
||||
Some(serde_json::json!({"connector": "x"})),
|
||||
),
|
||||
],
|
||||
scheduler_stats: None,
|
||||
timestamp: 0.0,
|
||||
utility_output: None,
|
||||
finished_requests: None,
|
||||
wave_complete: None,
|
||||
start_wave: None,
|
||||
},
|
||||
..Default::default()
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
})
|
||||
@@ -412,10 +408,12 @@ async fn generate_propagates_unexpected_close_errors() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: Vec::new(),
|
||||
finished_requests: Some(BTreeSet::from([request.request_id])),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
})
|
||||
@@ -459,10 +457,11 @@ async fn dropping_a_live_generate_stream_triggers_abort() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![request_output(&request.request_id, vec![99], None)],
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -513,7 +512,7 @@ async fn duplicate_external_request_ids_are_randomized_before_reaching_engine_co
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![request_output(
|
||||
&request_1.request_id,
|
||||
vec![],
|
||||
@@ -521,13 +520,14 @@ async fn duplicate_external_request_ids_are_randomized_before_reaching_engine_co
|
||||
)],
|
||||
finished_requests: Some(BTreeSet::from([request_1.request_id.clone()])),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![request_output(
|
||||
&request_2.request_id,
|
||||
vec![],
|
||||
@@ -535,7 +535,8 @@ async fn duplicate_external_request_ids_are_randomized_before_reaching_engine_co
|
||||
)],
|
||||
finished_requests: Some(BTreeSet::from([request_2.request_id])),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
})
|
||||
@@ -576,10 +577,11 @@ async fn abort_resolves_external_request_id_to_internal_before_reaching_engine()
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![request_output(&request.request_id, vec![7], None)],
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -643,13 +645,14 @@ async fn abort_by_external_id_aborts_all_internal_requests() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
outputs: vec![
|
||||
request_output(&request_1.request_id, vec![7], None),
|
||||
request_output(&request_2.request_id, vec![8], None),
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -710,7 +713,7 @@ async fn generate_records_request_metrics_in_prometheus_output() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
engine_index: 4,
|
||||
timestamp: 10.0,
|
||||
outputs: vec![EngineCoreOutput {
|
||||
@@ -736,13 +739,14 @@ async fn generate_records_request_metrics_in_prometheus_output() {
|
||||
)
|
||||
}],
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
engine_index: 4,
|
||||
timestamp: 11.5,
|
||||
outputs: vec![request_output_with_events(
|
||||
@@ -756,7 +760,8 @@ async fn generate_records_request_metrics_in_prometheus_output() {
|
||||
)],
|
||||
finished_requests: Some(BTreeSet::from([request.request_id])),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
})
|
||||
@@ -843,7 +848,7 @@ async fn dropping_stream_records_abort_terminal_request_metrics() {
|
||||
|
||||
send_outputs(
|
||||
push,
|
||||
EngineCoreOutputs {
|
||||
RequestBatchOutputs {
|
||||
engine_index: 5,
|
||||
timestamp: 10.0,
|
||||
outputs: vec![request_output_with_events(
|
||||
@@ -862,7 +867,8 @@ async fn dropping_stream_records_abort_terminal_request_metrics() {
|
||||
]),
|
||||
)],
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user