@@ -458,7 +458,7 @@ async def _(user_input: str):
458458                            user_input ,
459459                            kwargs = kwargs ,
460460                            echo = echo  or  "none" ,
461-                             content = content ,
461+                             stream = " content"   if   content   ==   "all"   else   "text" ,
462462                        )
463463                    )
464464                else :
@@ -569,7 +569,7 @@ def chat(
569569            self ._chat_impl (
570570                turn ,
571571                echo = echo ,
572-                 content = "text" ,
572+                 yield_content = False ,
573573                stream = stream ,
574574                kwargs = kwargs ,
575575            )
@@ -619,7 +619,7 @@ async def chat_async(
619619            self ._chat_impl_async (
620620                turn ,
621621                echo = echo ,
622-                 content = "text" ,
622+                 yield_content = False ,
623623                stream = stream ,
624624                kwargs = kwargs ,
625625            ),
@@ -635,7 +635,7 @@ async def chat_async(
635635    def  stream (
636636        self ,
637637        * args : Content  |  str ,
638-         content : Literal ["text" ],
638+         stream : Literal ["text" ],
639639        echo : EchoOptions  =  "none" ,
640640        kwargs : Optional [SubmitInputArgsT ] =  None ,
641641    ) ->  Generator [str , None , None ]: ...
@@ -644,7 +644,7 @@ def stream(
644644    def  stream (
645645        self ,
646646        * args : Content  |  str ,
647-         content : Literal ["all " ],
647+         stream : Literal ["content " ],
648648        echo : EchoOptions  =  "none" ,
649649        kwargs : Optional [SubmitInputArgsT ] =  None ,
650650    ) ->  Generator [str  |  ContentToolRequest  |  ContentToolResult , None , None ]: ...
@@ -653,7 +653,7 @@ def stream(
653653        self ,
654654        * args : Content  |  str ,
655655        echo : EchoOptions  =  "none" ,
656-         content : Literal ["text" , "all " ] =  "text" ,
656+         stream : Literal ["text" , "content " ] =  "text" ,
657657        kwargs : Optional [SubmitInputArgsT ] =  None ,
658658    ) ->  Generator [str  |  ContentToolRequest  |  ContentToolResult , None , None ]:
659659        """ 
@@ -667,7 +667,8 @@ def stream(
667667            Whether to echo text content, all content (i.e., tool calls), or no 
668668            content. 
669669        content 
670-             Whether to yield just text content, or all content (i.e., tool calls). 
670+             Whether to yield just text content, or rich content objects (e.g., tool 
671+             calls) when relevant. 
671672        kwargs 
672673            Additional keyword arguments to pass to the method used for requesting 
673674            the response. 
@@ -686,7 +687,7 @@ def stream(
686687            turn ,
687688            stream = True ,
688689            echo = echo ,
689-             content = content ,
690+             yield_content = stream   ==   " content"  ,
690691            kwargs = kwargs ,
691692        )
692693
@@ -703,7 +704,7 @@ def wrapper() -> Generator[
703704    async  def  stream_async (
704705        self ,
705706        * args : Content  |  str ,
706-         content : Literal ["text" ],
707+         stream : Literal ["text" ],
707708        echo : EchoOptions  =  "none" ,
708709        kwargs : Optional [SubmitInputArgsT ] =  None ,
709710    ) ->  AsyncGenerator [str , None ]: ...
@@ -712,7 +713,7 @@ async def stream_async(
712713    async  def  stream_async (
713714        self ,
714715        * args : Content  |  str ,
715-         content : Literal ["all " ],
716+         stream : Literal ["content " ],
716717        echo : EchoOptions  =  "none" ,
717718        kwargs : Optional [SubmitInputArgsT ] =  None ,
718719    ) ->  AsyncGenerator [str  |  ContentToolRequest  |  ContentToolResult , None ]: ...
@@ -721,7 +722,7 @@ async def stream_async(
721722        self ,
722723        * args : Content  |  str ,
723724        echo : EchoOptions  =  "none" ,
724-         content : Literal ["text" , "all " ] =  "text" ,
725+         stream : Literal ["text" , "content " ] =  "text" ,
725726        kwargs : Optional [SubmitInputArgsT ] =  None ,
726727    ) ->  AsyncGenerator [str  |  ContentToolRequest  |  ContentToolResult , None ]:
727728        """ 
@@ -758,7 +759,7 @@ async def wrapper() -> AsyncGenerator[
758759                    turn ,
759760                    stream = True ,
760761                    echo = echo ,
761-                     content = content ,
762+                     yield_content = stream   ==   " content"  ,
762763                    kwargs = kwargs ,
763764                ):
764765                    yield  chunk 
@@ -1192,7 +1193,7 @@ def _chat_impl(
11921193        self ,
11931194        user_turn : Turn ,
11941195        echo : EchoOptions ,
1195-         content : Literal ["text" ],
1196+         yield_content : Literal [False ],
11961197        stream : bool ,
11971198        kwargs : Optional [SubmitInputArgsT ] =  None ,
11981199    ) ->  Generator [str , None , None ]: ...
@@ -1202,7 +1203,7 @@ def _chat_impl(
12021203        self ,
12031204        user_turn : Turn ,
12041205        echo : EchoOptions ,
1205-         content : Literal ["all" ],
1206+         yield_content : Literal [True ],
12061207        stream : bool ,
12071208        kwargs : Optional [SubmitInputArgsT ] =  None ,
12081209    ) ->  Generator [str  |  ContentToolRequest  |  ContentToolResult , None , None ]: ...
@@ -1211,7 +1212,7 @@ def _chat_impl(
12111212        self ,
12121213        user_turn : Turn ,
12131214        echo : EchoOptions ,
1214-         content :  Literal [ "text" ,  "all" ] ,
1215+         yield_content :  bool ,
12151216        stream : bool ,
12161217        kwargs : Optional [SubmitInputArgsT ] =  None ,
12171218    ) ->  Generator [str  |  ContentToolRequest  |  ContentToolResult , None , None ]:
@@ -1234,12 +1235,12 @@ def _chat_impl(
12341235                if  isinstance (x , ContentToolRequest ):
12351236                    if  echo  ==  "output" :
12361237                        self ._echo_content (f"\n \n { x } \n \n " )
1237-                     if  content   ==   "all" :
1238+                     if  yield_content :
12381239                        yield  x 
12391240                    res  =  self ._invoke_tool (x )
12401241                    if  echo  ==  "output" :
12411242                        self ._echo_content (f"\n \n { res } \n \n " )
1242-                     if  content   ==   "all" :
1243+                     if  yield_content :
12431244                        yield  res 
12441245                    results .append (res )
12451246
@@ -1251,7 +1252,7 @@ def _chat_impl_async(
12511252        self ,
12521253        user_turn : Turn ,
12531254        echo : EchoOptions ,
1254-         content : Literal ["text" ],
1255+         yield_content : Literal [False ],
12551256        stream : bool ,
12561257        kwargs : Optional [SubmitInputArgsT ] =  None ,
12571258    ) ->  AsyncGenerator [str , None ]: ...
@@ -1261,7 +1262,7 @@ def _chat_impl_async(
12611262        self ,
12621263        user_turn : Turn ,
12631264        echo : EchoOptions ,
1264-         content : Literal ["all" ],
1265+         yield_content : Literal [True ],
12651266        stream : bool ,
12661267        kwargs : Optional [SubmitInputArgsT ] =  None ,
12671268    ) ->  AsyncGenerator [str  |  ContentToolRequest  |  ContentToolResult , None ]: ...
@@ -1270,7 +1271,7 @@ async def _chat_impl_async(
12701271        self ,
12711272        user_turn : Turn ,
12721273        echo : EchoOptions ,
1273-         content :  Literal [ "text" ,  "all" ] ,
1274+         yield_content :  bool ,
12741275        stream : bool ,
12751276        kwargs : Optional [SubmitInputArgsT ] =  None ,
12761277    ) ->  AsyncGenerator [str  |  ContentToolRequest  |  ContentToolResult , None ]:
@@ -1293,12 +1294,12 @@ async def _chat_impl_async(
12931294                if  isinstance (x , ContentToolRequest ):
12941295                    if  echo  ==  "output" :
12951296                        self ._echo_content (f"\n \n { x } \n \n " )
1296-                     if  content   ==   "all" :
1297+                     if  yield_content :
12971298                        yield  x 
12981299                    res  =  await  self ._invoke_tool_async (x )
12991300                    if  echo  ==  "output" :
13001301                        self ._echo_content (f"\n \n { res } \n \n " )
1301-                     if  content   ==   "all" :
1302+                     if  yield_content :
13021303                        yield  res 
13031304                    else :
13041305                        yield  "\n \n " 
0 commit comments