using var client = new AnthropicClient(apiKey);
var enumerable = client.CreateMessageAsStreamAsync(new CreateMessageRequest
{
Model = CreateMessageRequestModel.Claude35Sonnet20240620,
Messages = ["Once upon a time"],
MaxTokens = 250,
});
var deltas = new List<string>();
await foreach (var response in enumerable)
{
Console.Write(response.ContentBlockDelta?.Delta.TextDelta?.Text);
deltas.Add(response.ContentBlockDelta?.Delta.TextDelta?.Text ?? string.Empty);
}