@@ -221,6 +221,8 @@ def __call__(
221221
222222 Args:
223223 m: MelleaSession: A mellea session (optional, uses context if None)
224+ model_options: Model options to pass to the backend.
225+ *args: Additional args to be passed to the func.
224226 **kwargs: Additional Kwargs to be passed to the func
225227
226228 Returns:
@@ -239,7 +241,7 @@ def __call__(
239241
240242 # AsyncGenerativeSlots are used with async functions. In order to support that behavior,
241243 # they must return a coroutine object.
242- async def __async_call__ ():
244+ async def __async_call__ () -> R :
243245 # Use the async act func so that control flow doesn't get stuck here in async event loops.
244246 response = await m .aact (
245247 slot_copy , format = response_model , model_options = model_options
@@ -360,38 +362,3 @@ def generative(func: Callable[P, R]) -> GenerativeSlot[P, R]:
360362
361363# Export the decorator as the interface
362364__all__ = ["generative" ]
363-
364-
365- if __name__ == "__main__" :
366- from mellea import start_session
367-
368- with start_session ():
369-
370- async def asyncly () -> int : ...
371-
372- out = asyncly ()
373-
374- @generative
375- async def test_async (num : int ) -> bool : ...
376-
377- @generative
378- def test_sync (truthy : bool ) -> int : ...
379-
380- print ("running sync" )
381- print (test_sync (m = None , model_options = None , truthy = False ))
382-
383- async def runmany ():
384- print (await test_async (m = None , model_options = None , num = 6 ))
385- print (await test_async (m = None , model_options = None , num = 4 ))
386- print (await test_async (m = None , model_options = None , num = 5 ))
387-
388- coros = [
389- test_async (m = None , model_options = None , num = 1 ),
390- test_async (m = None , model_options = None , num = 2 ),
391- test_async (m = None , model_options = None , num = 3 ),
392- ]
393- results = await asyncio .gather (* coros )
394- print (results )
395-
396- print ("running async" )
397- asyncio .run (runmany ())
0 commit comments