Граф коммитов

1400 Коммитов

Автор SHA1 Сообщение Дата
Stephen Toub 5982f6abc3
Reduce a bit of LINQ in M.E.AI (#5663) 2024-11-18 10:52:08 -05:00
Stephen Toub 930af05f2b
Add AsBuilder extensions for IChatClient and IEmbeddingGenerator (#5652)
* 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
2024-11-18 10:12:30 -05:00
dotnet-maestro[bot] c4689473f5
Update dependencies from https://github.com/dotnet/arcade build 20241112.13 (#5662)
[main] Update dependencies from dotnet/arcade
2024-11-18 14:45:48 +00:00
Stephen Toub b29e149b85
Augment XML comments for AIFunctionFactory.Create (#5658)
* Augment XML comments for AIFunctionFactory.Create

* Add JSON serialization comments
2024-11-18 09:37:32 -05:00
Stephen Toub 06edb3cf05
Remove duplicate GetCacheKey methods (#5651)
* Remove duplicate GetCacheKey methods

Consolidate to only the `ReadOnlySpan<object>`-based method.

* Update XML comments to say that the values are serialized
2024-11-18 09:20:47 -05:00
Stephen Toub f085689eb2
Fix M.E.AI argument tests to validate argument names (#5653) 2024-11-18 07:48:19 -05:00
Stephen Toub e0f354a386
Annotate private DebuggerDisplay props as DebuggerBrowsableState.Never (#5656)
It's just noise.
2024-11-18 07:44:27 -05:00
Stephen Toub 475f317bc5
Add a [DebuggerDisplay] to GeneratedEmbeddings (#5657) 2024-11-18 07:44:10 -05:00
Nathanael Marchand 2977765f23
Make ActivityBaggageLogScopeWrapper implements IEnumerable<KeyValuePair<string, object?>> (#5589)
Make ActivityBaggageLogScopeWrapper implement IEnumerable<KeyValuePair<string, object?>>
2024-11-18 12:21:12 +01:00
Darius Letterman 38e7a1a45d
Allow logging of body without modifying the actual response (#5628)
Allow logging of body without modifying the actual response
2024-11-18 10:24:41 +00:00
Amadeusz Lechniak 7c398375c2
Update WaiterRemovedAfterDispose to check waitersCount first (#5646)
Co-authored-by: EUROPE\alechniak <alechniak@microsoft.com>
2024-11-15 20:49:02 -05:00
Steve Sanderson 09094aebc2
EmbeddingGeneratorBuilder API updates (#5647) 2024-11-15 07:47:41 -08:00
dotnet-maestro[bot] aa6e8f0bbe
[main] Update dependencies from dotnet/aspnetcore (#5645)
[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
2024-11-15 07:43:00 +00:00
Steve Sanderson 56e720c688
Change ChatClientBuilder to register singletons and support lambda-less chaining (#5642)
* 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
2024-11-14 08:36:08 -05:00
Genevieve Warren d39bf3dfec
docs updates (#5643) 2024-11-14 00:06:04 -05:00
Stephen Toub 430065ce56
Rework cache key handling in caching client / generator (#5641)
* 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>
2024-11-14 00:05:51 -05:00
Eirik Tsarpalis 73962c60f1
Replace STJ boilerplate in the leaf clients with AIJsonUtilities calls. (#5630)
* Replace STJ boilerplate in the leaf clients with AIJsonUtilities calls.

* Address feedback.

* Address feedback.

* Remove redundant using
2024-11-13 18:35:39 +00:00
Jose Perez Rodriguez ad3b5d0338
Merge branch release/9.0 into main (#5632) 2024-11-13 09:52:50 -08:00
Eric Erhardt 1073446964
Publish the AotCompatibility.TestApp project as part of PR validation (#5622)
- 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.
2024-11-12 22:28:07 -06:00
Eric Erhardt 4cd0228eeb Change TrimmerRootAssembly to use FileName to be correct. 2024-11-12 18:17:16 -06:00
Jose Perez Rodriguez d79192cc67 Merge branch release/9.0 into main 2024-11-12 15:08:57 -08:00
Eric Erhardt 30dae3db7a Remove testing cruft from TestApp project 2024-11-12 16:46:21 -06:00
Jose Perez Rodriguez f9edff24a9
Merge internal changes (#5631) 2024-11-12 14:19:45 -08:00
Eric Erhardt e690bbf4b7 try running during BuildAndTest.yml 2024-11-12 16:00:54 -06:00
Eric Erhardt 0a4bbeed0e Revert "Temporarily disable the test to figure out what is causing the code coverage errors."
This reverts commit 47beb96689.
2024-11-12 15:53:09 -06:00
Jose Perez Rodriguez c94cd35e54 Merge internal branch changes 2024-11-12 13:44:03 -08:00
Eric Erhardt 47beb96689 Temporarily disable the test to figure out what is causing the code coverage errors. 2024-11-12 14:10:49 -06:00
Eric Erhardt 5b339698af Remove MS.Ext.AI now that the issue is resolved. 2024-11-12 11:09:16 -06:00
Eric Erhardt f228df9b24 Merge remote-tracking branch 'upstream/main' into AotCI 2024-11-12 10:58:15 -06:00
Eric Erhardt 9c675f1913 Remove cleaning from publish 2024-11-12 10:58:04 -06:00
Eirik Tsarpalis 6487428046
Fix linker warning. (#5627) 2024-11-12 16:37:57 +00:00
Haipz 7d554db60c Cache current process object to avoid performance hit (#5597)
* 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.
2024-11-12 10:26:59 -06:00
Stephen Toub c77e368808
Fix namespace for IServiceCollection extensions (#5620)
We generally put extension methods into the same namespace as the thing they're extending.
2024-11-12 11:02:32 -05:00
Haipz 4b8dad5587
Cache current process object to avoid performance hit (#5597)
* 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.
2024-11-12 08:46:47 +01:00
Eric Erhardt 12b8949512 Exclude Microsoft.Extensions.AI as well, since it hits the warnings in #5626 2024-11-11 21:56:23 -06:00
Eric Erhardt ff0bf8ca50 Add an exclusion for Microsoft.Extensions.AI.Abstractions 2024-11-11 18:15:40 -06:00
Eric Erhardt 5b2b7a2bb4 Merge remote-tracking branch 'upstream/main' into AotCI 2024-11-11 18:11:18 -06:00
Eric Erhardt fbf2866b34 Add tracking issue links for OpenAI and Azure.AI.Inference trim/AOT compatibility. 2024-11-11 16:53:21 -06:00
Eirik Tsarpalis 95a80ccd84
Expose options for making schema generation conformant with the subset accepted by OpenAI. (#5619)
* Expose options for making schema generation conformant with the subset accepted by OpenAI.

* Uses the same set of defaults in all layers.
2024-11-11 21:54:33 +00:00
Eric Erhardt 9fbc27c38e - Add tracing issues.
- Ensure clean uses the same configuration as publish
- Fix part of Compliance.Redaction trimming issues by reenabling the Config Binder source generator.
2024-11-11 15:52:35 -06:00
Eric Erhardt 33e95b87cc Move clean logic to target.
Include the rest of the libraries in the repo
2024-11-11 15:14:53 -06:00
Eric Erhardt 10fcb7bbc9 Hook the Test target as well so the test runs in CI 2024-11-11 14:44:16 -06:00
Eric Erhardt c847f9a615 Make dotnet test publish the TestApp and fail if there are any warnings/errors 2024-11-11 13:45:26 -06:00
Stephen Toub d42d3e58c5
Tweak ChatMessage/StreamingChatCompletionUpdate.ToString (#5617)
* Tweak ChatMessage/StreamingChatCompletionUpdate.ToString

Include all text rather than just the first text content.

* Address PR feedback and fix / add tests
2024-11-11 13:43:55 -05:00
Eric Erhardt 86deeab76e 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
2024-11-11 11:05:06 -06:00
Eric Erhardt 002cdb70bf Remove AI in Microsoft.Extensions.AI.AotCompatibility.TestApp 2024-11-11 10:55:20 -06:00
Stephen Toub 81847a8c8b
Add DebuggerDisplay for DataContent (#5618) 2024-11-11 10:46:16 -05:00
Stephen Toub 148e221539
Use ToChatCompletion / ToStreamingChatCompletionUpdates in CachingChatClient (#5616)
* 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
2024-11-11 10:12:10 -05:00
Stephen Toub c163960f9e
Use ToChatCompletion in OpenTelemetryChatClient (#5614) 2024-11-11 09:38:04 -05:00
Genevieve Warren 3f1f59cd52
Docs improvements (#5613)
* docs improvements

* small addition

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2024-11-10 13:11:49 -05:00