Skip to content

Commit

Permalink
docs: update stream_generate return type annotation (#1121)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
madroidmaq authored Nov 25, 2024
1 parent adaab81 commit a5e1738
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llms/mlx_lm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit a5e1738

Please sign in to comment.