* Add ToBuilder extensions for IChatClient and IEmbeddingGenerator
Enables a fluent style of construction of a pipeline from a client/generator, and not having to specify the generic type parameters for the embedding generator builder.
* Rename ToBuilder to AsBuilder
* Remove duplicate GetCacheKey methods
Consolidate to only the `ReadOnlySpan<object>`-based method.
* Update XML comments to say that the values are serialized
[main] Update dependencies from dotnet/aspnetcore
- Coherency Updates:
- Microsoft.Bcl.TimeProvider: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Caching.Abstractions: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Caching.Memory: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Configuration.Abstractions: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Configuration.Binder: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Configuration.Json: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Configuration: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.DependencyInjection.Abstractions: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.DependencyInjection: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Hosting.Abstractions: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Diagnostics: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Hosting: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Http: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Logging.Abstractions: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Logging.Configuration: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Logging.Console: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Logging: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Options.ConfigurationExtensions: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Extensions.Options: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.NETCore.App.Ref: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.Bcl.AsyncInterfaces: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Net.Http.Json: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Microsoft.NETCore.App.Runtime.win-x64: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Collections.Immutable: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Configuration.ConfigurationManager: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Diagnostics.DiagnosticSource: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Diagnostics.PerformanceCounter: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.IO.Hashing: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.IO.Pipelines: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Security.Cryptography.Pkcs: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Security.Cryptography.Xml: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Text.Encodings.Web: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Text.Json: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- System.Runtime.Caching: from 9.0.0 to 9.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64)
- Add missing feed
- Fix versions
* Change ChatClientBuilder to register singletons and support lambda-less chaining
* Add generic keyed version
* Improve XML doc
* Update README files
* Remove generic DI registration methods
* Rework cache key handling in caching client / generator
- Expose the default cache key helper so that customization doesn't require re-implementing the whole thing.
- Make it easy to incorporate additional state into the cache key.
- Avoid serializing all of the values for the key into a new byte[], at least on .NET 8+. There, we can serialize directly into a stream that targets an IncrementalHash.
- Include Chat/EmbeddingGenerationOptions in the cache key by default.
* Update test/Libraries/Microsoft.Extensions.AI.Tests/Embeddings/DistributedCachingEmbeddingGeneratorTest.cs
Co-authored-by: Shyam N <shyamnamboodiripad@users.noreply.github.com>
---------
Co-authored-by: Shyam N <shyamnamboodiripad@users.noreply.github.com>
- Remove AI in Microsoft.Extensions.AI.AotCompatibility.TestApp so it can be used for all projects
- Analyze all libraries except the ones that have current warnings
- Publish the app from the AzDO pipeline
- Clean up the AotCompatibility.TestApp
- Remove unnecessary code in Program.cs by turning off ReferenceTrimmer
- Make the project publishable without passing in a TFM by only targeting a single TFM
- Fix part of Compliance.Redaction trimming issues by reenabling the Config Binder source generator.
* Read working set from Environment in ProcessInfo since it has better performance.
* Add unit test for ProcessInfo.
* Remove OSSkipCondition tag from process info unit test since it's cross-platform.
* Use Environment.WorkingSet in GetMemoryUsageInBytes.
* Read working set from Environment in ProcessInfo since it has better performance.
* Add unit test for ProcessInfo.
* Remove OSSkipCondition tag from process info unit test since it's cross-platform.
* Use Environment.WorkingSet in GetMemoryUsageInBytes.
- Ensure clean uses the same configuration as publish
- Fix part of Compliance.Redaction trimming issues by reenabling the Config Binder source generator.
* Tweak ChatMessage/StreamingChatCompletionUpdate.ToString
Include all text rather than just the first text content.
* Address PR feedback and fix / add tests
- Remove unnecessary code in Program.cs by turning off ReferenceTrimmer
- Make the project publishable without passing in a TFM by only targeting a single TFM
* Use ToChatCompletion / ToStreamingChatCompletionUpdates in CachingChatClient
Adds a ToStreamingChatCompletionUpdates method that's the counterpart to the recently added ToChatCompletion.
Then uses both from CachingChatClient instead of its now bespoke coalescing implementation. When coalescing is enabled (the default), CachingChatClient caches everything as a ChatCompletion, rather than distinguishing streaming and non-streaming.
* Address PR feedback