Agents 0.0.2
Edge AI Agents SDK
Loading...
Searching...
No Matches
agents::AsyncGenerator< T > Class Template Reference

AsyncGenerator with a Folly-compatible API: next() returns Task<optional<T>> More...

#include <coroutine_utils.h>

Classes

struct  promise_type
 Promise type for AsyncGenerator. More...
 

Public Types

using handle_type = std::coroutine_handle<promise_type>
 Handle type for AsyncGenerator.
 

Public Member Functions

 AsyncGenerator () noexcept
 Constructor with no handle.
 
 AsyncGenerator (handle_type h)
 Constructor with handle.
 
 AsyncGenerator (AsyncGenerator &&other) noexcept
 Constructor with other AsyncGenerator.
 
AsyncGeneratoroperator= (AsyncGenerator &&other) noexcept
 Operator= for AsyncGenerator.
 
 AsyncGenerator (const AsyncGenerator &)=delete
 
AsyncGeneratoroperator= (const AsyncGenerator &)=delete
 
Task< std::optional< T > > next ()
 Get the next item from the AsyncGenerator.
 

Detailed Description

template<typename T>
class agents::AsyncGenerator< T >

AsyncGenerator with a Folly-compatible API: next() returns Task<optional<T>>

Examples
multimodal_example.cpp.

Constructor & Destructor Documentation

◆ AsyncGenerator() [1/2]

template<typename T>
agents::AsyncGenerator< T >::AsyncGenerator ( handle_type h)
inlineexplicit

Constructor with handle.

Parameters
hThe handle to use

◆ AsyncGenerator() [2/2]

template<typename T>
agents::AsyncGenerator< T >::AsyncGenerator ( AsyncGenerator< T > && other)
inlinenoexcept

Constructor with other AsyncGenerator.

Parameters
otherThe other AsyncGenerator to use

Member Function Documentation

◆ next()

template<typename T>
Task< std::optional< T > > agents::AsyncGenerator< T >::next ( )
inline

Get the next item from the AsyncGenerator.

Returns
The next item from the AsyncGenerator

◆ operator=()

template<typename T>
AsyncGenerator & agents::AsyncGenerator< T >::operator= ( AsyncGenerator< T > && other)
inlinenoexcept

Operator= for AsyncGenerator.

Parameters
otherThe other AsyncGenerator to use
Returns
The AsyncGenerator