4444 Path ,
4545 PathBuilder ,
4646)
47- from pydantic_graph .beta .step import NodeStep , Step , StepAsyncIteratorFunction , StepContext , StepFunction , StepNode
47+ from pydantic_graph .beta .step import NodeStep , Step , StepContext , StepFunction , StepNode , StreamFunction
4848from pydantic_graph .beta .util import TypeOrTypeExpression , get_callable_name , unpack_type_expression
4949from pydantic_graph .exceptions import GraphBuildingError
5050from pydantic_graph .nodes import BaseNode , End
@@ -215,50 +215,50 @@ def decorator(
215215 return step
216216
217217 @overload
218- def step_async_iterable (
218+ def stream (
219219 self ,
220220 * ,
221221 node_id : str | None = None ,
222222 label : str | None = None ,
223223 ) -> Callable [
224- [StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ]], Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]]
224+ [StreamFunction [StateT , DepsT , InputT , OutputT ]], Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]]
225225 ]: ...
226226 @overload
227- def step_async_iterable (
227+ def stream (
228228 self ,
229- call : StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ],
229+ call : StreamFunction [StateT , DepsT , InputT , OutputT ],
230230 * ,
231231 node_id : str | None = None ,
232232 label : str | None = None ,
233233 ) -> Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]]: ...
234234 @overload
235- def step_async_iterable (
235+ def stream (
236236 self ,
237- call : StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ] | None = None ,
237+ call : StreamFunction [StateT , DepsT , InputT , OutputT ] | None = None ,
238238 * ,
239239 node_id : str | None = None ,
240240 label : str | None = None ,
241241 ) -> (
242242 Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]]
243243 | Callable [
244- [StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ]],
244+ [StreamFunction [StateT , DepsT , InputT , OutputT ]],
245245 Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]],
246246 ]
247247 ): ...
248- def step_async_iterable (
248+ def stream (
249249 self ,
250- call : StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ] | None = None ,
250+ call : StreamFunction [StateT , DepsT , InputT , OutputT ] | None = None ,
251251 * ,
252252 node_id : str | None = None ,
253253 label : str | None = None ,
254254 ) -> (
255255 Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]]
256256 | Callable [
257- [StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ]],
257+ [StreamFunction [StateT , DepsT , InputT , OutputT ]],
258258 Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]],
259259 ]
260260 ):
261- """Create a step from a step function .
261+ """Create a step from an async iterator (which functions like a "stream") .
262262
263263 This method can be used as a decorator or called directly to create
264264 a step node from an async function.
@@ -274,9 +274,9 @@ def step_async_iterable(
274274 if call is None :
275275
276276 def decorator (
277- func : StepAsyncIteratorFunction [StateT , DepsT , InputT , OutputT ],
277+ func : StreamFunction [StateT , DepsT , InputT , OutputT ],
278278 ) -> Step [StateT , DepsT , InputT , AsyncIterable [OutputT ]]:
279- return self .step_async_iterable (call = func , node_id = node_id , label = label )
279+ return self .stream (call = func , node_id = node_id , label = label )
280280
281281 return decorator
282282
0 commit comments