vllm.entrypoints.openai.translations.serving ¶
EngineClient ¶
Bases: ABC
Protocol class for Clients to Engine
Source code in vllm/engine/protocol.py
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
abort abstractmethod async ¶
add_lora abstractmethod async ¶
add_lora(lora_request: LoRARequest) -> bool
check_health abstractmethod async ¶
collective_rpc async ¶
collective_rpc(
method: str,
timeout: float | None = None,
args: tuple = (),
kwargs: dict | None = None,
)
Perform a collective RPC call to the given path.
do_log_stats abstractmethod async ¶
encode abstractmethod ¶
encode(
prompt: PromptType | DictPrompt | TokPrompt,
pooling_params: PoolingParams,
request_id: str,
lora_request: LoRARequest | None = None,
trace_headers: Mapping[str, str] | None = None,
priority: int = 0,
tokenization_kwargs: dict[str, Any] | None = None,
) -> AsyncGenerator[PoolingRequestOutput, None]
Generate outputs for a request from a pooling model.
Source code in vllm/engine/protocol.py
generate abstractmethod ¶
generate(
prompt: EngineCoreRequest
| PromptType
| DictPrompt
| TokPrompt
| AsyncGenerator[StreamingInput, None],
sampling_params: SamplingParams,
request_id: str,
*,
prompt_text: str | None = None,
lora_request: LoRARequest | None = None,
tokenization_kwargs: dict[str, Any] | None = None,
trace_headers: Mapping[str, str] | None = None,
priority: int = 0,
data_parallel_rank: int | None = None,
) -> AsyncGenerator[RequestOutput, None]
Generate outputs for a request.
Source code in vllm/engine/protocol.py
get_supported_tasks async ¶
get_supported_tasks() -> tuple[SupportedTask, ...]
init_weight_transfer_engine async ¶
init_weight_transfer_engine(
init_request: WeightTransferInitRequest,
) -> None
pause_generation abstractmethod async ¶
pause_generation(
*,
mode: PauseMode = "abort",
wait_for_inflight_requests: bool = False,
clear_cache: bool = True,
) -> None
Pause new generation/encoding requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode | PauseMode | How to handle in-flight requests: - | 'abort' |
wait_for_inflight_requests | bool | DEPRECATED. Use | False |
clear_cache | bool | DEPRECATED. Whether to clear KV and prefix caches after draining. | True |
Source code in vllm/engine/protocol.py
reset_encoder_cache abstractmethod async ¶
reset_mm_cache abstractmethod async ¶
reset_prefix_cache abstractmethod async ¶
Reset the prefix cache and optionally any configured connector cache
resume_generation abstractmethod async ¶
scale_elastic_ep async ¶
start_profile abstractmethod async ¶
stop_profile abstractmethod async ¶
update_weights async ¶
update_weights(
request: WeightTransferUpdateRequest,
) -> None
ErrorResponse ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/engine/protocol.py
OpenAIServingModels ¶
Shared instance to hold data about the loaded base model(s) and adapters.
Handles the routes: - /v1/models - /v1/load_lora_adapter - /v1/unload_lora_adapter
Source code in vllm/entrypoints/openai/models/serving.py
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
__init__ ¶
__init__(
engine_client: EngineClient,
base_model_paths: list[BaseModelPath],
*,
lora_modules: list[LoRAModulePath] | None = None,
)
Source code in vllm/entrypoints/openai/models/serving.py
_check_load_lora_adapter_request async ¶
_check_load_lora_adapter_request(
request: LoadLoRAAdapterRequest,
) -> ErrorResponse | None
Source code in vllm/entrypoints/openai/models/serving.py
_check_unload_lora_adapter_request async ¶
_check_unload_lora_adapter_request(
request: UnloadLoRAAdapterRequest,
) -> ErrorResponse | None
Source code in vllm/entrypoints/openai/models/serving.py
init_static_loras async ¶
Loads all static LoRA modules. Raises if any fail to load
Source code in vllm/entrypoints/openai/models/serving.py
load_lora_adapter async ¶
load_lora_adapter(
request: LoadLoRAAdapterRequest,
base_model_name: str | None = None,
) -> ErrorResponse | str
Source code in vllm/entrypoints/openai/models/serving.py
model_name ¶
model_name(lora_request: LoRARequest | None = None) -> str
Returns the appropriate model name depending on the availability and support of the LoRA or base model. Parameters: - lora: LoRARequest that contain a base_model_name. Returns: - str: The name of the base model or the first available model path.
Source code in vllm/entrypoints/openai/models/serving.py
resolve_lora async ¶
resolve_lora(lora_name: str) -> LoRARequest | ErrorResponse
Attempt to resolve a LoRA adapter using available resolvers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lora_name | str | Name/identifier of the LoRA adapter | required |
Returns:
| Type | Description |
|---|---|
LoRARequest | ErrorResponse | LoRARequest if found and loaded successfully. |
LoRARequest | ErrorResponse | ErrorResponse (404) if no resolver finds the adapter. |
LoRARequest | ErrorResponse | ErrorResponse (400) if adapter(s) are found but none load. |
Source code in vllm/entrypoints/openai/models/serving.py
show_available_models async ¶
show_available_models() -> ModelList
Show available models. This includes the base model and all adapters
Source code in vllm/entrypoints/openai/models/serving.py
unload_lora_adapter async ¶
unload_lora_adapter(
request: UnloadLoRAAdapterRequest,
) -> ErrorResponse | str
Source code in vllm/entrypoints/openai/models/serving.py
OpenAIServingTranscription ¶
Bases: OpenAISpeechToText
Handles transcription requests.
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
__init__ ¶
__init__(
engine_client: EngineClient,
models: OpenAIServingModels,
*,
request_logger: RequestLogger | None,
return_tokens_as_token_ids: bool = False,
log_error_stack: bool = False,
enable_force_include_usage: bool = False,
)
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
create_transcription async ¶
create_transcription(
audio_data: bytes,
request: TranscriptionRequest,
raw_request: Request | None = None,
) -> (
TranscriptionResponse
| TranscriptionResponseVerbose
| AsyncGenerator[str, None]
| ErrorResponse
)
Transcription API similar to OpenAI's API.
See https://platform.openai.com/docs/api-reference/audio/createTranscription for the API specification. This API mimics the OpenAI transcription API.
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
transcription_stream_generator async ¶
transcription_stream_generator(
request: TranscriptionRequest,
result_generator: list[
AsyncGenerator[RequestOutput, None]
],
request_id: str,
request_metadata: RequestResponseMetadata,
audio_duration_s: float,
) -> AsyncGenerator[str, None]
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
OpenAIServingTranslation ¶
Bases: OpenAISpeechToText
Handles translation requests.
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
__init__ ¶
__init__(
engine_client: EngineClient,
models: OpenAIServingModels,
*,
request_logger: RequestLogger | None,
return_tokens_as_token_ids: bool = False,
log_error_stack: bool = False,
enable_force_include_usage: bool = False,
)
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
create_translation async ¶
create_translation(
audio_data: bytes,
request: TranslationRequest,
raw_request: Request | None = None,
) -> (
TranslationResponse
| TranslationResponseVerbose
| AsyncGenerator[str, None]
| ErrorResponse
)
Translation API similar to OpenAI's API.
See https://platform.openai.com/docs/api-reference/audio/createTranslation for the API specification. This API mimics the OpenAI translation API.
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
translation_stream_generator async ¶
translation_stream_generator(
request: TranslationRequest,
result_generator: list[
AsyncGenerator[RequestOutput, None]
],
request_id: str,
request_metadata: RequestResponseMetadata,
audio_duration_s: float,
) -> AsyncGenerator[str, None]
Source code in vllm/entrypoints/openai/speech_to_text/serving.py
OpenAISpeechToText ¶
Bases: OpenAIServing
Base class for speech-to-text operations like transcription and translation.
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | |
enable_force_include_usage instance-attribute ¶
tokenizer instance-attribute ¶
tokenizer = cast(
PreTrainedTokenizerBase,
get_tokenizer(
tokenizer_name=tokenizer,
tokenizer_mode=tokenizer_mode,
),
)
__init__ ¶
__init__(
engine_client: EngineClient,
models: OpenAIServingModels,
*,
request_logger: RequestLogger | None,
return_tokens_as_token_ids: bool = False,
task_type: Literal[
"transcribe", "translate"
] = "transcribe",
log_error_stack: bool = False,
enable_force_include_usage: bool = False,
)
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_create_speech_to_text async ¶
_create_speech_to_text(
audio_data: bytes,
request: SpeechToTextRequest,
raw_request: Request,
response_class: type[ResponseType],
stream_generator_method: Callable[
..., AsyncGenerator[str, None]
],
) -> T | V | AsyncGenerator[str, None] | ErrorResponse
Base method for speech-to-text operations like transcription and translation.
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
_find_split_point ¶
Find the best point to split audio by looking for silence or low amplitude. Args: wav: Audio tensor [1, T] start_idx: Start index of search region end_idx: End index of search region Returns: Index of best splitting point
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_get_verbose_segments ¶
_get_verbose_segments(
tokens: tuple,
log_probs: FlatLogprobs | list[dict[int, Logprob]],
request: SpeechToTextRequest,
segment_class: type[SpeechToTextSegment],
start_time: float = 0,
) -> list[SpeechToTextSegment]
Convert tokens to verbose segments.
This method expects the model to produce timestamps as tokens (similar to Whisper). If the tokens do not include timestamp information, the segments may not be generated correctly.
Note: No_speech_prob field is not supported in this implementation and will be None. See docs for details.
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_preprocess_speech_to_text async ¶
_preprocess_speech_to_text(
request: SpeechToTextRequest, audio_data: bytes
) -> tuple[list[PromptType], float]
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_preprocess_verbose_prompt ¶
_preprocess_verbose_prompt(
prompt: EncoderDecoderDictPrompt,
)
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_speech_to_text_stream_generator async ¶
_speech_to_text_stream_generator(
request: SpeechToTextRequest,
list_result_generator: list[
AsyncGenerator[RequestOutput, None]
],
request_id: str,
request_metadata: RequestResponseMetadata,
audio_duration_s: float,
chunk_object_type: Literal[
"translation.chunk", "transcription.chunk"
],
response_stream_choice_class: type[
TranscriptionResponseStreamChoice
]
| type[TranslationResponseStreamChoice],
stream_response_class: type[TranscriptionStreamResponse]
| type[TranslationStreamResponse],
) -> AsyncGenerator[str, None]
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | |
_split_audio ¶
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_warmup_audio_preprocessing ¶
Warm up audio processing libraries to avoid first-request latency.
The first call to librosa functions (load, get_duration, mel-spectrogram) triggers JIT compilation and library initialization which can take ~7s. This method warms up these operations during server initialization.
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
_warmup_input_processor ¶
Warm up input processor with dummy audio to avoid first-request latency.
The first call to input_processor.process_inputs() with multimodal audio triggers multimodal processing initialization which can take ~2.5s. This method processes a dummy audio request to warm up the pipeline.
Source code in vllm/entrypoints/openai/speech_to_text/speech_to_text.py
RequestLogger ¶
Source code in vllm/entrypoints/logger.py
log_inputs ¶
log_inputs(
request_id: str,
prompt: str | None,
prompt_token_ids: list[int] | None,
prompt_embeds: Tensor | None,
params: SamplingParams
| PoolingParams
| BeamSearchParams
| None,
lora_request: LoRARequest | None,
) -> None
Source code in vllm/entrypoints/logger.py
log_outputs ¶
log_outputs(
request_id: str,
outputs: str,
output_token_ids: Sequence[int] | None,
finish_reason: str | None = None,
is_streaming: bool = False,
delta: bool = False,
) -> None
Source code in vllm/entrypoints/logger.py
RequestOutput ¶
The output data of a completion request to the LLM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_id | str | The unique ID of the request. | required |
prompt | str | None | The prompt string of the request. For encoder/decoder models, this is the decoder input prompt. | required |
prompt_token_ids | list[int] | None | The token IDs of the prompt. For encoder/decoder models, this is the decoder input prompt token ids. | required |
prompt_logprobs | PromptLogprobs | None | The log probabilities to return per prompt token. | required |
outputs | list[CompletionOutput] | The output sequences of the request. | required |
finished | bool | Whether the whole request is finished. | required |
metrics | RequestStateStats | None | Metrics associated with the request. | None |
lora_request | LoRARequest | None | The LoRA request that was used to generate the output. | None |
encoder_prompt | str | None | The encoder prompt string of the request. None if decoder-only. | None |
encoder_prompt_token_ids | list[int] | None | The token IDs of the encoder prompt. None if decoder-only. | None |
num_cached_tokens | int | None | The number of tokens with prefix cache hit. | None |
kv_transfer_params | dict[str, Any] | None | The params for remote K/V transfer. | None |
Source code in vllm/outputs.py
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
multi_modal_placeholders instance-attribute ¶
__init__ ¶
__init__(
request_id: str,
prompt: str | None,
prompt_token_ids: list[int] | None,
prompt_logprobs: PromptLogprobs | None,
outputs: list[CompletionOutput],
finished: bool,
metrics: RequestStateStats | None = None,
lora_request: LoRARequest | None = None,
encoder_prompt: str | None = None,
encoder_prompt_token_ids: list[int] | None = None,
num_cached_tokens: int | None = None,
*,
multi_modal_placeholders: MultiModalPlaceholderDict
| None = None,
kv_transfer_params: dict[str, Any] | None = None,
**kwargs: Any,
) -> None
Source code in vllm/outputs.py
__repr__ ¶
__repr__() -> str
Source code in vllm/outputs.py
add ¶
add(next_output: RequestOutput, aggregate: bool) -> None
Merge subsequent RequestOutput into this one
Source code in vllm/outputs.py
RequestResponseMetadata ¶
Bases: BaseModel
Source code in vllm/entrypoints/openai/engine/protocol.py
TranscriptionRequest ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
_DEFAULT_SAMPLING_PARAMS class-attribute instance-attribute ¶
_DEFAULT_SAMPLING_PARAMS: dict = {
"repetition_penalty": 1.0,
"temperature": 1.0,
"top_p": 1.0,
"top_k": 0,
"min_p": 0.0,
}
file instance-attribute ¶
The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
frequency_penalty class-attribute instance-attribute ¶
frequency_penalty: float | None = 0.0
The frequency penalty to use for sampling.
language class-attribute instance-attribute ¶
language: str | None = None
The language of the input audio.
Supplying the input language in ISO-639-1 format will improve accuracy and latency.
max_completion_tokens class-attribute instance-attribute ¶
max_completion_tokens: int | None = None
The maximum number of tokens to generate.
min_p class-attribute instance-attribute ¶
min_p: float | None = None
Filters out tokens with a probability lower than min_p, ensuring a minimum likelihood threshold during sampling.
presence_penalty class-attribute instance-attribute ¶
presence_penalty: float | None = 0.0
The presence penalty to use for sampling.
prompt class-attribute instance-attribute ¶
prompt: str = Field(default='')
An optional text to guide the model's style or continue a previous audio segment.
The prompt should match the audio language.
repetition_penalty class-attribute instance-attribute ¶
repetition_penalty: float | None = None
The repetition penalty to use for sampling.
response_format class-attribute instance-attribute ¶
response_format: AudioResponseFormat = Field(default="json")
The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.
seed class-attribute instance-attribute ¶
seed: int | None = Field(None, ge=min, le=max)
The seed to use for sampling.
stream class-attribute instance-attribute ¶
stream: bool | None = False
When set, it will enable output to be streamed in a similar fashion as the Chat Completion endpoint.
stream_continuous_usage_stats class-attribute instance-attribute ¶
stream_continuous_usage_stats: bool | None = False
temperature class-attribute instance-attribute ¶
temperature: float = Field(default=0.0)
The sampling temperature, between 0 and 1.
Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused / deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
timestamp_granularities class-attribute instance-attribute ¶
timestamp_granularities: list[
Literal["word", "segment"]
] = Field(alias="timestamp_granularities[]", default=[])
The timestamp granularities to populate for this transcription.
response_format must be set verbose_json to use timestamp granularities. Either or both of these options are supported: word, or segment. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
to_language class-attribute instance-attribute ¶
to_language: str | None = None
The language of the output audio we transcribe to.
Please note that this is not currently used by supported models at this time, but it is a placeholder for future use, matching translation api.
top_k class-attribute instance-attribute ¶
top_k: int | None = None
Limits sampling to the k most probable tokens at each step.
top_p class-attribute instance-attribute ¶
top_p: float | None = None
Enables nucleus (top-p) sampling, where tokens are selected from the smallest possible set whose cumulative probability exceeds p.
vllm_xargs class-attribute instance-attribute ¶
vllm_xargs: dict[str, str | int | float] | None = Field(
default=None,
description="Additional request parameters with string or numeric values, used by custom extensions.",
)
to_sampling_params ¶
to_sampling_params(
default_max_tokens: int,
default_sampling_params: dict | None = None,
) -> SamplingParams
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
validate_transcription_request classmethod ¶
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
TranscriptionResponse ¶
TranscriptionResponseStreamChoice ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
TranscriptionResponseVerbose ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
segments class-attribute instance-attribute ¶
segments: list[TranscriptionSegment] | None = None
Segments of the transcribed text and their corresponding details.
words class-attribute instance-attribute ¶
words: list[TranscriptionWord] | None = None
Extracted words and their corresponding timestamps.
TranscriptionStreamResponse ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
TranslationRequest ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |
_DEFAULT_SAMPLING_PARAMS class-attribute instance-attribute ¶
_DEFAULT_SAMPLING_PARAMS: dict = {'temperature': 0}
file instance-attribute ¶
The audio file object (not file name) to translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
language class-attribute instance-attribute ¶
language: str | None = None
The language of the input audio we translate from.
Supplying the input language in ISO-639-1 format will improve accuracy.
max_completion_tokens class-attribute instance-attribute ¶
max_completion_tokens: int | None = None
The maximum number of tokens to generate.
prompt class-attribute instance-attribute ¶
prompt: str = Field(default='')
An optional text to guide the model's style or continue a previous audio segment.
The prompt should match the audio language.
response_format class-attribute instance-attribute ¶
response_format: AudioResponseFormat = Field(default="json")
The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.
seed class-attribute instance-attribute ¶
seed: int | None = Field(None, ge=min, le=max)
The seed to use for sampling.
stream class-attribute instance-attribute ¶
stream: bool | None = False
Custom field not present in the original OpenAI definition. When set, it will enable output to be streamed in a similar fashion as the Chat Completion endpoint.
stream_continuous_usage_stats class-attribute instance-attribute ¶
stream_continuous_usage_stats: bool | None = False
temperature class-attribute instance-attribute ¶
temperature: float = Field(default=0.0)
The sampling temperature, between 0 and 1.
Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused / deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
to_language class-attribute instance-attribute ¶
to_language: str | None = None
The language of the input audio we translate to.
Please note that this is not supported by all models, refer to the specific model documentation for more details. For instance, Whisper only supports to_language=en.
to_sampling_params ¶
to_sampling_params(
default_max_tokens: int,
default_sampling_params: dict | None = None,
) -> SamplingParams
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
validate_stream_options classmethod ¶
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
TranslationResponse ¶
TranslationResponseStreamChoice ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
TranslationResponseVerbose ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
segments class-attribute instance-attribute ¶
segments: list[TranslationSegment] | None = None
Segments of the translated text and their corresponding details.
words class-attribute instance-attribute ¶
words: list[TranslationWord] | None = None
Extracted words and their corresponding timestamps.
TranslationStreamResponse ¶
Bases: OpenAIBaseModel
Source code in vllm/entrypoints/openai/speech_to_text/protocol.py
init_logger ¶
init_logger(name: str) -> _VllmLogger
The main purpose of this function is to ensure that loggers are retrieved in such a way that we can be sure the root vllm logger has already been configured.