Class RecipeClient
- Namespace
- Mabs.AudioCpp
- Assembly
- AudioCpp.dll
Multi-model recipes against POST /v1/recipes/run. Role-specific option prefixes
(tts., avatar., conversation., …) are the caller's responsibility:
put them directly in Options keys, e.g.
options["avatar.reference_image_file"] = "/path/portrait.png".
public sealed class RecipeClient
- Inheritance
-
RecipeClient
- Inherited Members
Methods
RunAsync(RecipeRunRequest, CancellationToken)
Run a recipe and return the final result.
public Task<TaskResult> RunAsync(RecipeRunRequest request, CancellationToken cancellationToken = default)
Parameters
requestRecipeRunRequestThe recipe request; Stream must be false.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TaskResult>
The final task result.
Exceptions
- AudioCppException
The request failed.
RunStreamAsync(RecipeRunRequest, Func<TaskStreamEvent, Task>, CancellationToken)
Callback variant of RunStreamAsync(RecipeRunRequest, CancellationToken).
public Task RunStreamAsync(RecipeRunRequest request, Func<TaskStreamEvent, Task> onEvent, CancellationToken cancellationToken = default)
Parameters
requestRecipeRunRequestThe recipe request.
onEventFunc<TaskStreamEvent, Task>Callback invoked for each event; iteration stops if it throws.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
Completes when the stream terminates or the callback stops consuming events.
Exceptions
- AudioCppException
The response failed or an SSE error event arrives.
RunStreamAsync(RecipeRunRequest, CancellationToken)
Run a recipe with stream:true; events use the same
task.stream.event/task.stream.done envelope as generic task streaming.
public IAsyncEnumerable<TaskStreamEvent> RunStreamAsync(RecipeRunRequest request, CancellationToken cancellationToken = default)
Parameters
requestRecipeRunRequestThe recipe request; Stream is forced to true.
cancellationTokenCancellationTokenCancellation token observed while enumerating.
Returns
- IAsyncEnumerable<TaskStreamEvent>
The event sequence; iteration ends at
[DONE]or connection close.
Exceptions
- AudioCppException
The response failed or an SSE error event arrives.