-
-
Notifications
You must be signed in to change notification settings - Fork 13
OpenAI
Rasmus Wulff Jensen edited this page May 20, 2026
·
4 revisions
- AgentFactory (
OpenAIAgentFactory) - AIToolsFactory integration (tools in
AgentOptions.Tools) - EmbeddingFactory (
OpenAIEmbeddingFactory) - BatchRunner (
OpenAIBatchRunner) - OpenAI reasoning controls and
ClientType(ChatClient or ResponsesApi) -
StoredOutputEnabledfor the OpenAIstoresetting -
ServiceTierfor OpenAI service tier selection
dotnet add package AgentFrameworkToolkit.OpenAI
OpenAIAgentFactory agentFactory = new("<apiKey>");
OpenAIAgent agent = agentFactory.CreateAgent(new AgentOptions
{
Model = "gpt-5",
ReasoningEffort = OpenAIReasoningEffort.Low,
Instructions = "You are a nice AI"
});
AgentRunResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);OpenAIEmbeddingFactory embeddingFactory = new("<apiKey>");
IEmbeddingGenerator<string, Embedding<float>> generator =
embeddingFactory.GetEmbeddingGenerator("text-embedding-3-small");
Embedding<float> embedding = await generator.GenerateAsync("Hello");-
ApiKey(required) -
Endpoint(optional, use for OpenAI-compatible providers) NetworkTimeoutDefaultClientTypeAdditionalOpenAIClientOptions
ReasoningEffort-
ReasoningSummaryVerbosity(Responses API) -
StoredOutputEnabled(maps to OpenAI'sstoresetting) -
ServiceTier(OpenAI direct only) -
ClientType(ChatClient or ResponsesApi)
builder.Services.AddOpenAIAgentFactory("<apiKey>");
builder.Services.AddOpenAIAgentFactory(new OpenAIConnection
{
ApiKey = "<apiKey>",
NetworkTimeout = TimeSpan.FromMinutes(5)
});
builder.Services.AddOpenAIEmbeddingFactory("<apiKey>");- See AgentFactories for shared options and middleware.
- See EmbeddingFactories for more examples.
- See AIToolsFactory for tool creation and MCP support.
- See BatchRunners for OpenAI batch jobs.