Skip to content

Response API with streaming and function call example #403

Answered by fkaita
testermax asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @testermax !

I ran into the exact same question about how to wire up function calls in an async/streaming context, so I put together a quick example. You can also check out the my repo here: https://github.com/fkaita/openai-dotnet-example

    public static async Task SingleFunctionCallingStreamingAsync()
    {
        OpenAIResponseClient client = new(
            model: "gpt-4o-mini",
            apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY"));

        // Ask user for a prompt
        Console.Write("Enter your question: ");
        string? input = Console.ReadLine();
        string question = string.IsNullOrWhiteSpace(input) 
            ? "What is the current weathe…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@testermax
Comment options

Answer selected by testermax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants