43 instantiations of ChatOptions
Microsoft.Extensions.AI (1)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
135options = (options ?? new()).Clone();
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
69ChatOptions options = new()
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatClientExtensionsTests.cs (2)
46var expectedOptions = new ChatOptions(); 73var expectedOptions = new ChatOptions();
ChatCompletion\ChatOptionsTests.cs (3)
15ChatOptions options = new(); 45ChatOptions options = new(); 105ChatOptions options = new();
ChatCompletion\DelegatingChatClientTests.cs (2)
34var expectedChatOptions = new ChatOptions(); 66var expectedChatOptions = new ChatOptions();
Microsoft.Extensions.AI.AzureAIInference.Tests (5)
AzureAIInferenceChatClientTests.cs (5)
125var response = await client.CompleteAsync("hello", new() 187await foreach (var update in client.CompleteStreamingAsync("hello", new() 300var response = await client.CompleteAsync(messages, new() 411var response = await client.CompleteAsync("How old is Alice?", new() 503await foreach (var update in client.CompleteStreamingAsync("How old is Alice?", new()
Microsoft.Extensions.AI.Integration.Tests (6)
ChatClientIntegrationTests.cs (6)
137var response = await chatClient.CompleteAsync("What is the current secret number?", new() 153var response = await chatClient.CompleteAsync("What is the result of SecretComputation on 42 and 84?", new() 169var response = chatClient.CompleteStreamingAsync("What is the result of SecretComputation on 42 and 84?", new() 197var response = await chatClient.CompleteAsync("How much older is Elsa than Anna? Return the age difference as a single number.", new() 229var response = await chatClient.CompleteAsync("Are birds real?", new() 251var response = await chatClient.CompleteAsync("What's the current secret number?", new()
Microsoft.Extensions.AI.Ollama.Tests (6)
OllamaChatClientIntegrationTests.cs (2)
45var response = await chatClient.CompleteAsync("What is the current secret number? Answer with digits only.", new ChatOptions 80var response = await chatClient.CompleteAsync("What's the stock price for Microsoft in British pounds?", new ChatOptions
OllamaChatClientTests.cs (4)
98var response = await client.CompleteAsync("hello", new() 158await foreach (var update in client.CompleteStreamingAsync("hello", new() 250var response = await client.CompleteAsync(messages, new() 350var response = await client.CompleteAsync("How old is Alice?", new()
Microsoft.Extensions.AI.OpenAI.Tests (5)
OpenAIChatClientTests.cs (5)
167var response = await client.CompleteAsync("hello", new() 233await foreach (var update in client.CompleteStreamingAsync("hello", new() 345var response = await client.CompleteAsync(messages, new() 457var response = await client.CompleteAsync("How old is Alice?", new() 552await foreach (var update in client.CompleteStreamingAsync("How old is Alice?", new()
Microsoft.Extensions.AI.Tests (12)
ChatCompletion\ConfigureOptionsChatClientTests.cs (3)
18Assert.Throws<ArgumentNullException>("innerClient", () => new ConfigureOptionsChatClient(null!, _ => new ChatOptions())); 32ChatOptions providedOptions = new(); 33ChatOptions returnedOptions = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (8)
31var options = new ChatOptions 57var options = new ChatOptions 91var options = new ChatOptions 121var options = new ChatOptions 154var options = new ChatOptions 202var options = new ChatOptions 251var options = new ChatOptions 291() => service.CompleteAsync(chat, new ChatOptions { Tools = [func1, func2] }));
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
107var options = new ChatOptions
110 references to ChatOptions
Microsoft.Extensions.AI (44)
ChatCompletion\CachingChatClient.cs (7)
42public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 63IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 199protected abstract string GetCacheKey(bool streaming, IList<ChatMessage> chatMessages, ChatOptions? options); 203/// This is used when there is a call to <see cref="IChatClient.CompleteAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>. 212/// This is used when there is a call to <see cref="IChatClient.CompleteStreamingAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>. 221/// This is used when there is a call to <see cref="IChatClient.CompleteAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>. 231/// This is used when there is a call to <see cref="IChatClient.CompleteStreamingAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>.
ChatCompletion\ChatClientStructuredOutputExtensions.cs (4)
45ChatOptions? options = null, 66ChatOptions? options = null, 89ChatOptions? options = null, 116ChatOptions? options = null,
ChatCompletion\ConfigureOptionsChatClient.cs (11)
15/// <summary>A delegating chat client that updates or replaces the <see cref="ChatOptions"/> used by the remainder of the pipeline.</summary> 18/// The configuration callback is invoked with the caller-supplied <see cref="ChatOptions"/> instance. To override the caller-supplied options 42private readonly Func<ChatOptions?, ChatOptions> _configureOptions; 47/// The delegate to invoke to configure the <see cref="ChatOptions"/> instance. It is passed the caller-supplied <see cref="ChatOptions"/> 48/// instance and should return the configured <see cref="ChatOptions"/> instance to use. 50public ConfigureOptionsChatClient(IChatClient innerClient, Func<ChatOptions?, ChatOptions> configureOptions) 57public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 64IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
ChatCompletion\ConfigureOptionsChatClientBuilderExtensions.cs (7)
15/// Adds a callback that updates or replaces <see cref="ChatOptions"/>. This can be used to set default options. 19/// The delegate to invoke to configure the <see cref="ChatOptions"/> instance. It is passed the caller-supplied <see cref="ChatOptions"/> 20/// instance and should return the configured <see cref="ChatOptions"/> instance to use. 24/// The configuration callback is invoked with the caller-supplied <see cref="ChatOptions"/> instance. To override the caller-supplied options 40this ChatClientBuilder builder, Func<ChatOptions?, ChatOptions> configureOptions)
ChatCompletion\DistributedCachingChatClient.cs (1)
93protected override string GetCacheKey(bool streaming, IList<ChatMessage> chatMessages, ChatOptions? options)
ChatCompletion\FunctionInvokingChatClient.cs (8)
16/// A delegating chat client that invokes functions defined on <see cref="ChatOptions"/>. 22/// by calling the corresponding <see cref="AIFunction"/> defined in <see cref="ChatOptions"/>, 27/// <see cref="AIFunction"/> instances employed as part of the supplied <see cref="ChatOptions"/> are also safe. 32/// ASP.NET web request should only be used as part of a single <see cref="ChatOptions"/> at a time, and only with 172public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 274IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 399IList<ChatMessage> chatMessages, ChatOptions options, IReadOnlyList<FunctionCallContent> functionCallContents, int iteration, CancellationToken cancellationToken) 459IList<ChatMessage> chatMessages, ChatOptions options, FunctionCallContent functionCallContent,
ChatCompletion\LoggingChatClient.cs (2)
47IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 93IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
ChatCompletion\OpenTelemetryChatClient.cs (3)
110public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 141IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 249private Activity? CreateAndConfigureActivity(ChatOptions? options)
Utilities\AIJsonUtilities.Defaults.cs (1)
54[JsonSerializable(typeof(ChatOptions))]
Microsoft.Extensions.AI.Abstractions (13)
ChatCompletion\ChatClientExtensions.cs (2)
23ChatOptions? options = null, 41ChatOptions? options = null,
ChatCompletion\ChatOptions.cs (4)
60/// <summary>Produces a clone of the current <see cref="ChatOptions"/> instance.</summary> 61/// <returns>A clone of the current <see cref="ChatOptions"/> instance.</returns> 67public virtual ChatOptions Clone() 69ChatOptions options = new()
ChatCompletion\ChatToolMode.cs (3)
32/// <see cref="ChatOptions.Tools"/> may contain zero or more <see cref="AITool"/> 39/// but that any tool may be selected. At least one tool must be provided in <see cref="ChatOptions.Tools"/>. 46/// must match an entry in <see cref="ChatOptions.Tools"/>.
ChatCompletion\DelegatingChatClient.cs (2)
54public virtual Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 60public virtual IAsyncEnumerable<StreamingChatCompletionUpdate> CompleteStreamingAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
ChatCompletion\IChatClient.cs (2)
39ChatOptions? options = null, 53ChatOptions? options = null,
Microsoft.Extensions.AI.Abstractions.Tests (15)
ChatCompletion\ChatClientExtensionsTests.cs (2)
46var expectedOptions = new ChatOptions(); 73var expectedOptions = new ChatOptions();
ChatCompletion\ChatOptionsTests.cs (6)
15ChatOptions options = new(); 28ChatOptions clone = options.Clone(); 45ChatOptions options = new(); 88ChatOptions clone = options.Clone(); 105ChatOptions options = new(); 136ChatOptions? deserialized = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatOptions);
ChatCompletion\DelegatingChatClientTests.cs (2)
34var expectedChatOptions = new ChatOptions(); 66var expectedChatOptions = new ChatOptions();
TestChatClient.cs (4)
17public Func<IList<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatCompletion>>? CompleteAsyncCallback { get; set; } 19public Func<IList<ChatMessage>, ChatOptions?, CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>? CompleteStreamingAsyncCallback { get; set; } 23public Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 26public IAsyncEnumerable<StreamingChatCompletionUpdate> CompleteStreamingAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
TestJsonSerializerContext.cs (1)
19[JsonSerializable(typeof(ChatOptions))]
Microsoft.Extensions.AI.AzureAIInference (5)
AzureAIInferenceChatClient.cs (4)
33/// <param name="modelId">The id of the model to use. If null, it may be provided per request via <see cref="ChatOptions.ModelId"/>.</param> 68IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 145IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 276private ChatCompletionsOptions ToAzureAIOptions(IList<ChatMessage> chatContents, ChatOptions? options)
AzureAIInferenceExtensions.cs (1)
13/// <param name="modelId">The id of the model to use. If null, it may be provided per request via <see cref="ChatOptions.ModelId"/>.</param>
Microsoft.Extensions.AI.Integration.Tests (7)
CallCountingChatClient.cs (2)
20IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 27IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
PromptBasedFunctionCallingChatClient.cs (1)
40public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestChatClient.cs (4)
17public Func<IList<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatCompletion>>? CompleteAsyncCallback { get; set; } 19public Func<IList<ChatMessage>, ChatOptions?, CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>? CompleteStreamingAsyncCallback { get; set; } 23public Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 26public IAsyncEnumerable<StreamingChatCompletionUpdate> CompleteStreamingAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
Microsoft.Extensions.AI.Ollama (7)
OllamaChatClient.cs (5)
35/// The id of the model to use. This may also be overridden per request via <see cref="ChatOptions.ModelId"/>. 36/// Either this parameter or <see cref="ChatOptions.ModelId"/> must provide a valid model id. 59public async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 91IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 229private OllamaChatRequest ToOllamaChatRequest(IList<ChatMessage> chatMessages, ChatOptions? options, bool stream)
OllamaEmbeddingGenerator.cs (2)
27/// The id of the model to use. This may also be overridden per request via <see cref="ChatOptions.ModelId"/>. 28/// Either this parameter or <see cref="ChatOptions.ModelId"/> must provide a valid model id.
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientIntegrationTests.cs (1)
95IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
Microsoft.Extensions.AI.OpenAI (3)
OpenAIChatClient.cs (3)
94IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 186IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 387private static ChatCompletionOptions ToOpenAIOptions(ChatOptions? options)
Microsoft.Extensions.AI.Tests (15)
ChatCompletion\ConfigureOptionsChatClientTests.cs (2)
32ChatOptions providedOptions = new(); 33ChatOptions returnedOptions = new();
ChatCompletion\FunctionInvokingChatClientTests.cs (7)
31var options = new ChatOptions 57var options = new ChatOptions 91var options = new ChatOptions 121var options = new ChatOptions 154var options = new ChatOptions 202var options = new ChatOptions 251var options = new ChatOptions
ChatCompletion\LoggingChatClientTests.cs (1)
49new ChatOptions { FrequencyPenalty = 3.0f });
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
58IList<ChatMessage> messages, ChatOptions? options, [EnumeratorCancellation] CancellationToken cancellationToken)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestChatClient.cs (4)
17public Func<IList<ChatMessage>, ChatOptions?, CancellationToken, Task<ChatCompletion>>? CompleteAsyncCallback { get; set; } 19public Func<IList<ChatMessage>, ChatOptions?, CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>? CompleteStreamingAsyncCallback { get; set; } 23public Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 26public IAsyncEnumerable<StreamingChatCompletionUpdate> CompleteStreamingAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)