Skip to content

Chat Client Reasoning Non Streaming

This example assumes using Together; is in scope and apiKey contains your Together API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
using var client = new TogetherClient(apiKey);
Meai.IChatClient chatClient = client;

var response = await chatClient.GetResponseAsync(
    [new Meai.ChatMessage(Meai.ChatRole.User, "What is 25 * 37? Think step by step.")],
    new Meai.ChatOptions
    {
        ModelId = "deepseek-ai/DeepSeek-R1",
    });

var reasoning = response.Messages
    .SelectMany(m => m.Contents)
    .OfType<Meai.TextReasoningContent>()
    .ToList();

var text = response.Messages
    .SelectMany(m => m.Contents)
    .OfType<Meai.TextContent>()
    .ToList();

// DeepSeek-R1 should produce reasoning content