53 instantiations of ChatOptions
Microsoft.Extensions.AI (2)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (1)
154options = (options ?? new()).Clone();
ChatCompletion\ConfigureOptionsChatClient.cs (1)
55options = options?.Clone() ?? new();
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatOptions.cs (1)
72ChatOptions options = new()
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatClientExtensionsTests.cs (2)
52var expectedOptions = new ChatOptions(); 79var expectedOptions = new ChatOptions();
ChatCompletion\ChatOptionsTests.cs (3)
15ChatOptions options = new(); 49ChatOptions options = new(); 115ChatOptions options = new();
ChatCompletion\DelegatingChatClientTests.cs (2)
34var expectedChatOptions = new ChatOptions(); 66var expectedChatOptions = new ChatOptions();
Microsoft.Extensions.AI.AzureAIInference.Tests (5)
AzureAIInferenceChatClientTests.cs (5)
140var response = await client.CompleteAsync("hello", new() 202await foreach (var update in client.CompleteStreamingAsync("hello", new() 315var response = await client.CompleteAsync(messages, new() 510var response = await client.CompleteAsync("How old is Alice?", new() 602await foreach (var update in client.CompleteStreamingAsync("How old is Alice?", new()
Microsoft.Extensions.AI.Integration.Tests (7)
ChatClientIntegrationTests.cs (7)
116var response = _chatClient.CompleteStreamingAsync("Explain in 10 words how AI works", new() 173var response = await chatClient.CompleteAsync(messages, new() 196var response = await chatClient.CompleteAsync("What is the result of SecretComputation on 42 and 84?", new() 212var response = chatClient.CompleteStreamingAsync("What is the result of SecretComputation on 42 and 84?", new() 240var response = await chatClient.CompleteAsync("How much older is Elsa than Anna? Return the age difference as a single number.", new() 272var response = await chatClient.CompleteAsync("Are birds real?", new() 294var response = await chatClient.CompleteAsync("What's the current secret number?", new()
Microsoft.Extensions.AI.Ollama.Tests (6)
OllamaChatClientIntegrationTests.cs (2)
48var response = await chatClient.CompleteAsync("What is the current secret number? Answer with digits only.", new ChatOptions 84var response = await chatClient.CompleteAsync("What's the stock price for Microsoft in British pounds?", new ChatOptions
OllamaChatClientTests.cs (4)
113var response = await client.CompleteAsync("hello", new() 173await foreach (var update in client.CompleteStreamingAsync("hello", new() 265var response = await client.CompleteAsync(messages, new() 365var response = await client.CompleteAsync("How old is Alice?", new()
Microsoft.Extensions.AI.OpenAI.Tests (5)
OpenAIChatClientTests.cs (5)
183var response = await client.CompleteAsync("hello", new() 249await foreach (var update in client.CompleteStreamingAsync("hello", new() 361var response = await client.CompleteAsync(messages, new() 658var response = await client.CompleteAsync("How old is Alice?", new() 753await foreach (var update in client.CompleteStreamingAsync("How old is Alice?", new()
Microsoft.Extensions.AI.Tests (16)
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
35ChatOptions? providedOptions = nullProvidedOptions ? null : new() { ModelId = "test" };
ChatCompletion\FunctionInvokingChatClientTests.cs (10)
45var options = new ChatOptions 77var options = new ChatOptions 126var options = new ChatOptions 166var options = new ChatOptions 207var options = new ChatOptions 259var options = new ChatOptions 327var options = new ChatOptions 376ChatOptions options = new() { Tools = [func1, func2] }; 402var options = new ChatOptions 458ChatOptions options = new()
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
108var options = new ChatOptions
ChatCompletion\UseDelegateChatClientTests.cs (4)
37ChatOptions expectedOptions = new(); 87ChatOptions expectedOptions = new(); 129ChatOptions expectedOptions = new(); 180ChatOptions expectedOptions = new();
Microsoft.ML.GenAI.LLaMA (2)
Llama3CausalLMChatClient.cs (2)
32options ??= new ChatOptions(); 51options ??= new ChatOptions();
Microsoft.ML.GenAI.Phi (2)
Phi3\Phi3CausalLMChatClient.cs (2)
37options ??= new ChatOptions(); 56options ??= new ChatOptions();
149 references to ChatOptions
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (1)
220static Task<ChatCompletion> TestMiddleware(IList<ChatMessage> list, ChatOptions? options, IChatClient client, CancellationToken token)
Aspire.OpenAI.Tests (1)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
221static Task<ChatCompletion> TestMiddleware(IList<ChatMessage> list, ChatOptions? options, IChatClient client, CancellationToken token)
Microsoft.Extensions.AI (54)
ChatCompletion\AnonymousDelegatingChatClient.cs (9)
20private readonly Func<IList<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, Task<ChatCompletion>>? _completeFunc; 28private readonly Func<IList<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>? _completeStreamingFunc; 74Func<IList<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, Task<ChatCompletion>>? completeFunc, 75Func<IList<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>? completeStreamingFunc) 86IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 94async Task<ChatCompletion> CompleteViaSharedAsync(IList<ChatMessage> chatMessages, ChatOptions? options, CancellationToken cancellationToken) 124IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 210ChatOptions? options, 211Func<IList<ChatMessage>, ChatOptions?, CancellationToken, Task> nextAsync,
ChatCompletion\CachingChatClient.cs (6)
48public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 68IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 135/// This is used when there is a call to <see cref="IChatClient.CompleteAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>. 144/// This is used when there is a call to <see cref="IChatClient.CompleteStreamingAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>. 153/// This is used when there is a call to <see cref="IChatClient.CompleteAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>. 163/// This is used when there is a call to <see cref="IChatClient.CompleteStreamingAsync(IList{ChatMessage}, ChatOptions?, CancellationToken)"/>.
ChatCompletion\ChatClientBuilder.cs (2)
132Func<IList<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, Task<ChatCompletion>>? completeFunc, 133Func<IList<ChatMessage>, ChatOptions?, IChatClient, CancellationToken, IAsyncEnumerable<StreamingChatCompletionUpdate>>? completeStreamingFunc)
ChatCompletion\ChatClientStructuredOutputExtensions.cs (4)
47ChatOptions? options = null, 67ChatOptions? options = null, 89ChatOptions? options = null, 115ChatOptions? options = null,
ChatCompletion\ConfigureOptionsChatClient.cs (13)
13/// <summary>Represents a delegating chat client that configures a <see cref="ChatOptions"/> instance used by the remainder of the pipeline.</summary> 17private readonly Action<ChatOptions> _configureOptions; 22/// The delegate to invoke to configure the <see cref="ChatOptions"/> instance. It is passed a clone of the caller-supplied <see cref="ChatOptions"/> instance 26/// The <paramref name="configure"/> delegate is passed either a new instance of <see cref="ChatOptions"/> if 27/// the caller didn't supply a <see cref="ChatOptions"/> instance, or a clone (via <see cref="ChatOptions.Clone"/> of the caller-supplied 30public ConfigureOptionsChatClient(IChatClient innerClient, Action<ChatOptions> configure) 37public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 44IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 52/// <summary>Creates and configures the <see cref="ChatOptions"/> to pass along to the inner client.</summary> 53private ChatOptions Configure(ChatOptions? options)
ChatCompletion\ConfigureOptionsChatClientBuilderExtensions.cs (7)
15/// Adds a callback that configures a <see cref="ChatOptions"/> to be passed to the next client in the pipeline. 19/// The delegate to invoke to configure the <see cref="ChatOptions"/> instance. 20/// It is passed a clone of the caller-supplied <see cref="ChatOptions"/> instance (or a newly constructed instance if the caller-supplied instance is <see langword="null"/>). 24/// <see cref="ChatOptions"/> if the caller didn't supply a <see cref="ChatOptions"/> instance, or a clone (via <see cref="ChatOptions.Clone"/>) 29this ChatClientBuilder builder, Action<ChatOptions> configure)
ChatCompletion\FunctionInvokingChatClient.cs (8)
20/// A delegating chat client that invokes functions defined on <see cref="ChatOptions"/>. 26/// by calling the corresponding <see cref="AIFunction"/> defined in <see cref="ChatOptions"/>, 31/// <see cref="AIFunction"/> instances employed as part of the supplied <see cref="ChatOptions"/> are also safe. 36/// ASP.NET web request should only be used as part of a single <see cref="ChatOptions"/> at a time, and only with 190public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 299IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 459IList<ChatMessage> chatMessages, ChatOptions options, IReadOnlyList<FunctionCallContent> functionCallContents, int iteration, CancellationToken cancellationToken) 519IList<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)
122public override async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 153IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 211private Activity? CreateAndConfigureActivity(ChatOptions? options)
Microsoft.Extensions.AI.Abstractions (14)
ChatCompletion\ChatClientExtensions.cs (2)
39ChatOptions? options = null, 57ChatOptions? options = null,
ChatCompletion\ChatOptions.cs (4)
63/// <summary>Produces a clone of the current <see cref="ChatOptions"/> instance.</summary> 64/// <returns>A clone of the current <see cref="ChatOptions"/> instance.</returns> 70public virtual ChatOptions Clone() 72ChatOptions options = new()
ChatCompletion\ChatToolMode.cs (3)
32/// <see cref="ChatOptions.Tools"/> can contain zero or more <see cref="AITool"/> 39/// but that any tool can 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,
Utilities\AIJsonUtilities.Defaults.cs (1)
54[JsonSerializable(typeof(ChatOptions))]
Microsoft.Extensions.AI.Abstractions.Tests (15)
ChatCompletion\ChatClientExtensionsTests.cs (2)
52var expectedOptions = new ChatOptions(); 79var expectedOptions = new ChatOptions();
ChatCompletion\ChatOptionsTests.cs (6)
15ChatOptions options = new(); 30ChatOptions clone = options.Clone(); 49ChatOptions options = new(); 96ChatOptions clone = options.Clone(); 115ChatOptions options = new(); 148ChatOptions? 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 (6)
AzureAIInferenceChatClient.cs (4)
36/// <param name="modelId">The ID of the model to use. If null, it can be provided per request via <see cref="ChatOptions.ModelId"/>.</param> 81IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 146IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 288private ChatCompletionsOptions ToAzureAIOptions(IList<ChatMessage> chatContents, ChatOptions? options)
AzureAIInferenceExtensions.cs (2)
13/// <param name="modelId">The ID of the model to use. If null, it can be provided per request via <see cref="ChatOptions.ModelId"/>.</param> 21/// <param name="modelId">The ID of the model to use. If null, it can 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 (11)
OllamaChatClient.cs (7)
39/// The ID of the model to use. This ID can also be overridden per request via <see cref="ChatOptions.ModelId"/>. 40/// Either this parameter or <see cref="ChatOptions.ModelId"/> must provide a valid model ID. 51/// The ID of the model to use. This ID can also be overridden per request via <see cref="ChatOptions.ModelId"/>. 52/// Either this parameter or <see cref="ChatOptions.ModelId"/> must provide a valid model ID. 79public async Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 111IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 257private OllamaChatRequest ToOllamaChatRequest(IList<ChatMessage> chatMessages, ChatOptions? options, bool stream)
OllamaEmbeddingGenerator.cs (4)
27/// The ID of the model to use. This ID can 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. 39/// The ID of the model to use. This ID can also be overridden per request via <see cref="ChatOptions.ModelId"/>. 40/// Either this parameter or <see cref="ChatOptions.ModelId"/> must provide a valid model ID.
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientIntegrationTests.cs (1)
99IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default)
Microsoft.Extensions.AI.OpenAI (3)
OpenAIChatClient.cs (3)
109IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 200IList<ChatMessage> chatMessages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 397private static ChatCompletionOptions ToOpenAIOptions(ChatOptions? options)
Microsoft.Extensions.AI.Tests (27)
ChatCompletion\ConfigureOptionsChatClientTests.cs (2)
35ChatOptions? providedOptions = nullProvidedOptions ? null : new() { ModelId = "test" }; 36ChatOptions? returnedOptions = null;
ChatCompletion\FunctionInvokingChatClientTests.cs (12)
45var options = new ChatOptions 77var options = new ChatOptions 126var options = new ChatOptions 166var options = new ChatOptions 207var options = new ChatOptions 259var options = new ChatOptions 327var options = new ChatOptions 376ChatOptions options = new() { Tools = [func1, func2] }; 402var options = new ChatOptions 458ChatOptions options = new() 498ChatOptions options, 567ChatOptions options,
ChatCompletion\LoggingChatClientTests.cs (1)
51new ChatOptions { FrequencyPenalty = 3.0f });
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
58IList<ChatMessage> messages, ChatOptions? options, [EnumeratorCancellation] CancellationToken cancellationToken)
ChatCompletion\UseDelegateChatClientTests.cs (6)
37ChatOptions expectedOptions = new(); 87ChatOptions expectedOptions = new(); 129ChatOptions expectedOptions = new(); 155IList<ChatMessage> chatMessages, ChatOptions? options, IChatClient innerClient, [EnumeratorCancellation] CancellationToken cancellationToken) 180ChatOptions expectedOptions = new(); 226IList<ChatMessage> chatMessages, ChatOptions? options, IChatClient innerClient, [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)
TestJsonSerializerContext.cs (1)
28[JsonSerializable(typeof(ChatOptions))]
Microsoft.ML.GenAI.Core (3)
CausalLMPipelineChatClient.cs (2)
37public virtual Task<ChatCompletion> CompleteAsync(IList<ChatMessage> chatMessages, ChatOptions? options = null, CancellationToken cancellationToken = default) 60ChatOptions? options = null,
Utility\IChatTemplateBuilder.cs (1)
35string BuildPrompt(IList<ChatMessage> messages, ChatOptions? options = null, bool appendAssistantTag = true);
Microsoft.ML.GenAI.LLaMA (3)
Llama3_1ChatTemplateBuilder.cs (1)
91public string BuildPrompt(IList<ChatMessage> messages, ChatOptions? options = null, bool appendAssistantTag = true)
Llama3CausalLMChatClient.cs (2)
29ChatOptions? options = null, 48ChatOptions? options = null,
Microsoft.ML.GenAI.Phi (3)
Phi3\Phi3CausalLMChatClient.cs (2)
34ChatOptions? options = null, 53ChatOptions? options = null,
Phi3\Phi3ChatTemplateBuilder.cs (1)
92public string BuildPrompt(IList<ChatMessage> messages, ChatOptions? options = null, bool appendAssistantTag = true)