Skip to content

fkaita/openai-dotnet-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI .NET Response API Streaming with function calling Example

This repository demonstrates how to use the OpenAI .NET SDK with the new Response API.

🛠 Prerequisites

  • .NET 9 SDK
  • OpenAI API key with access to the response endpoint and gpt-4o-mini model

📦 Setup

Set your API key as an environment variable

macOS / Linux:

export OPENAI_API_KEY=sk-...

Windows (PowerShell):

$env:OPENAI_API_KEY = "sk-..."

🚀 Run Examples

Run with one of the supported arguments:

  • single – The model can make only one function call in response to the user’s question.

    dotnet run -- single
  • multi – The model can make multiple function calls across multiple steps.

    dotnet run -- multi
  • file – Demonstrates how to upload a file and ask a question about its contents..

    dotnet run -- file <file-path>

You will be prompted to enter a question like:

Enter your question: What is the weather in Tokyo?

About

Example codes for Openai .NET library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages