Skip to content

Commit 79e7b6e

Browse files
committed
Fix/simplify stream overload definitions
1 parent b781458 commit 79e7b6e

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

chatlas/_chat.py

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -635,31 +635,18 @@ async def chat_async(
635635
def stream(
636636
self,
637637
*args: Content | str,
638-
) -> Generator[str, None, None]: ...
639-
640-
@overload
641-
def stream(
642-
self,
643-
*args: Content | str,
644-
echo: EchoOptions,
645-
) -> Generator[str, None, None]: ...
646-
647-
@overload
648-
def stream(
649-
self,
650-
*args: Content | str,
651-
echo: EchoOptions,
652638
content: Literal["text"],
653-
kwargs: Optional[SubmitInputArgsT],
639+
echo: EchoOptions = "none",
640+
kwargs: Optional[SubmitInputArgsT] = None,
654641
) -> Generator[str, None, None]: ...
655642

656643
@overload
657644
def stream(
658645
self,
659646
*args: Content | str,
660-
echo: EchoOptions,
661647
content: Literal["all"],
662-
kwargs: Optional[SubmitInputArgsT],
648+
echo: EchoOptions = "none",
649+
kwargs: Optional[SubmitInputArgsT] = None,
663650
) -> Generator[str | ContentToolRequest | ContentToolResult, None, None]: ...
664651

665652
def stream(
@@ -716,31 +703,18 @@ def wrapper() -> Generator[
716703
async def stream_async(
717704
self,
718705
*args: Content | str,
719-
) -> AsyncGenerator[str, None]: ...
720-
721-
@overload
722-
async def stream_async(
723-
self,
724-
*args: Content | str,
725-
echo: EchoOptions,
726-
) -> AsyncGenerator[str, None]: ...
727-
728-
@overload
729-
async def stream_async(
730-
self,
731-
*args: Content | str,
732-
echo: EchoOptions,
733706
content: Literal["text"],
734-
kwargs: Optional[SubmitInputArgsT],
707+
echo: EchoOptions = "none",
708+
kwargs: Optional[SubmitInputArgsT] = None,
735709
) -> AsyncGenerator[str, None]: ...
736710

737711
@overload
738712
async def stream_async(
739713
self,
740714
*args: Content | str,
741-
echo: EchoOptions,
742715
content: Literal["all"],
743-
kwargs: Optional[SubmitInputArgsT],
716+
echo: EchoOptions = "none",
717+
kwargs: Optional[SubmitInputArgsT] = None,
744718
) -> AsyncGenerator[str | ContentToolRequest | ContentToolResult, None]: ...
745719

746720
async def stream_async(

0 commit comments

Comments
 (0)