1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Ported from: vllm/outputs.py @ e24d1b24
//
// The public request-result types the offline `LLM` API and the OpenAI server
// return: CompletionOutput (one generated sequence) and RequestOutput (the
// per-request container). These are plain value carriers; field names, order,
// defaults and the one behavioral helper (finished / Finished) are mirrored 1:1
// with upstream for the T0 generate path.
//
// Scope = the generate path. The OutputProcessor (M1.8) fills these from the
// EngineCoreOutput deltas honoring RequestOutputKind (cumulative / delta /
// final-only); here we provide only the data type + a straightforward
// constructor. The upstream RequestOutput.from_seq_group / new() factory and
// RequestOutput.add() aggregation logic are OutputProcessor territory and are
// NOT ported here (noted so the porter of M1.8 knows where they land).
//
// DEFERRED upstream state, intentionally omitted — later units slot these in
// without reshaping the structs:
// CompletionOutput: routed_experts (np.ndarray [seq_len,layer_num,topk]),
// lora_request. (logprobs now carries the real SampleLogprobs payload —
// ROAD-V1-C7.)
// RequestOutput: prompt_logprobs now carries the real PromptLogprobs payload
// (ROAD-V1-C7 output plumbing); metrics
// (RequestStateStats), lora_request, encoder_prompt /
// encoder_prompt_token_ids (encoder/decoder models), num_cached_tokens
// (prefix-cache hit count), kv_transfer_params (P/D remote K/V), the
// forward-compat **kwargs warn, and the STREAM_FINISHED sentinel.
// Pooling/embedding result variants (PoolingOutput, PoolingRequestOutput,
// EmbeddingOutput / EmbeddingRequestOutput, ClassificationOutput /
// ClassificationRequestOutput, ScoringOutput / ScoringRequestOutput) are
// the non-generate task heads and are NOT ported here.
// __repr__ has no C++ analogue.
//
// DEVIATIONS, recorded:
// - CompletionOutput.finish_reason is a STRING upstream (e.g. "stop" /
// "length"), derived from the V1 FinishReason IntEnum via str() ==
// FINISH_REASON_STRINGS[value]. We store the string form to match, and
// provide FinishReasonToString + CompletionOutput::SetFinishReason using
// that SAME mapping (vllm/v1/engine/__init__.py FINISH_REASON_STRINGS).
// - CompletionOutput.stop_reason is int | str | None upstream; represented
// here as std::optional<std::string> (same T0 deviation as EngineCoreOutput
// in vllm/v1/engine/types.h — a stop_token_id match stringifies its id, a
// stop-string match carries the string). A std::variant would be a closer
// union but is heavier than a T0 value carrier warrants.
// - RequestOutput.prompt_token_ids is list[int] | None upstream; the T0
// pure-token generate path always has a list, so it is a plain vector here
// (empty vector == the upstream None/[] case).
namespace vllm // namespace vllm