[API] Add token offsets to render endpoints (/v1/.../render) (#44226)
Signed-off-by: HyunKyun Moon <mhg5303@gmail.com>
This commit is contained in:
@@ -38,6 +38,10 @@ class TokensInput(_InputOptions):
|
||||
prompt: NotRequired[str]
|
||||
"""The prompt text corresponding to the token IDs, if available."""
|
||||
|
||||
prompt_token_offsets: NotRequired[list[tuple[int, int]] | None]
|
||||
"""Char-level (start, end) offsets per token, propagated from the
|
||||
renderer's TokensPrompt when offsets were computed."""
|
||||
|
||||
|
||||
def tokens_input(
|
||||
prompt_token_ids: list[int],
|
||||
|
||||
@@ -115,6 +115,12 @@ class TokensPrompt(_PromptOptions):
|
||||
token_type_ids: NotRequired[list[int]]
|
||||
"""A list of token type IDs to pass to the cross encoder model."""
|
||||
|
||||
prompt_token_offsets: NotRequired[list[tuple[int, int]] | None]
|
||||
"""Char-level (start, end) offsets per token, relative to the
|
||||
tokenized source string. Present only when offsets were requested
|
||||
AND a Fast (Rust-backed) tokenizer was used AND no multimodal data
|
||||
was present. The list length equals the length of `prompt_token_ids`."""
|
||||
|
||||
|
||||
class EmbedsPrompt(_PromptOptions):
|
||||
"""Schema for a prompt provided via token embeddings."""
|
||||
|
||||
Reference in New Issue
Block a user