ApiBaseStreamAsyncTRequest, TResponse Method
Streams responses by sending an HTTP request with a JSON payload and
yielding the deserialized items as they arrive.
Namespace: GenerativeAI.CoreAssembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
protected IAsyncEnumerable<TResponse> StreamAsync<TRequest, TResponse>(
string url,
TRequest payload,
CancellationToken cancellationToken = default
)
- url String
- The target endpoint URL to which the request is sent.
- payload TRequest
- The request payload.
- cancellationToken CancellationToken (Optional)
- A token for cancelling the operation.
- TRequest
- The type of the request payload to serialize.
- TResponse
- The type of the response items to deserialize.
IAsyncEnumerableTResponseAn async stream of response items.