Skip to content

Commit 190491c

Browse files
authored
fix typing hint (#649)
1 parent 498f0e5 commit 190491c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

swift/llm/app_ui.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) Alibaba, Inc. and its affiliates.
2-
from typing import Tuple
2+
from typing import Iterator, Tuple
33

44
from swift.utils import get_logger, get_main
55
from .infer import merge_lora, prepare_model_template
@@ -21,7 +21,7 @@ def gradio_generation_demo(args: AppUIArguments) -> None:
2121
else:
2222
model, template = prepare_model_template(args)
2323

24-
def model_generation(query: str) -> str:
24+
def model_generation(query: str) -> Iterator[str]:
2525
if args.infer_backend == 'vllm':
2626
gen = inference_stream_vllm(llm_engine, template, [{
2727
'query': query
@@ -64,7 +64,8 @@ def gradio_chat_demo(args: AppUIArguments) -> None:
6464
else:
6565
model, template = prepare_model_template(args)
6666

67-
def model_chat(query: str, history: History) -> Tuple[str, History]:
67+
def model_chat(query: str,
68+
history: History) -> Iterator[Tuple[str, History]]:
6869
old_history, history = limit_history_length(template, query, history,
6970
args.max_length)
7071
if args.infer_backend == 'vllm':

0 commit comments

Comments
 (0)