mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-07-16 15:31:12 +08:00
docs: update stream_generate return type annotation (#1121)
Improve documentation clarity by: 1. Fix return type annotation to correctly reflect GenerationResponse 2. Simplify docstring by referencing GenerationResponse class 3. Remove redundant field descriptions
This commit is contained in:
parent
adaab81029
commit
a5e173802e
@ -300,7 +300,7 @@ def stream_generate(
|
||||
prompt: Union[str, List[int]],
|
||||
max_tokens: int = 100,
|
||||
**kwargs,
|
||||
) -> Generator[Tuple[str, int, mx.array], None, None]:
|
||||
) -> Generator[GenerationResponse, None, None]:
|
||||
"""
|
||||
A generator producing text based on the given prompt from the model.
|
||||
|
||||
@ -313,8 +313,8 @@ def stream_generate(
|
||||
See :func:`generate_step` for more details.
|
||||
|
||||
Yields:
|
||||
Tuple[str, int, mx.array]:
|
||||
The next text segment, token, and vector of log probabilities.
|
||||
GenerationResponse: An instance containing the generated text segment and
|
||||
associated metadata. See :class:`GenerationResponse` for details.
|
||||
"""
|
||||
if not isinstance(tokenizer, TokenizerWrapper):
|
||||
tokenizer = TokenizerWrapper(tokenizer)
|
||||
|
Loading…
Reference in New Issue
Block a user