Skip to content

Add service lifetime support to DI helpers. - #5880

Merged
eiriktsarpalis merged 3 commits into
dotnet:mainfrom
eiriktsarpalis:meai-di-lifetimes
Feb 12, 2025
Merged

Add service lifetime support to DI helpers.#5880
eiriktsarpalis merged 3 commits into
dotnet:mainfrom
eiriktsarpalis:meai-di-lifetimes

Conversation

@eiriktsarpalis

@eiriktsarpaliseiriktsarpalis commented Feb 11, 2025

Copy link
Copy Markdown
Member

Adds a ServiceLifetime optional parameter to all the DI helpers, defaulting to Singleton.

Fix#5875.

Microsoft Reviewers: Open in CodeFlow

@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️Found issues‼️

ProjectCoverage TypeExpectedActual
Microsoft.Extensions.AI.OpenAILine7768.75 🔻
Microsoft.Extensions.AI.OpenAIBranch7750.41 🔻
Microsoft.Extensions.AI.OllamaLine8078.2 🔻
Microsoft.Extensions.Caching.HybridLine8682.77 🔻
Microsoft.Gen.MetadataExtractorLine9857.35 🔻
Microsoft.Gen.MetadataExtractorBranch9862.5 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

ProjectExpectedActual
Microsoft.Extensions.AI.AzureAIInference9192
Microsoft.Extensions.AI8889
Microsoft.Extensions.AI.Abstractions8385

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=948675&view=codecoverage-tab

@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️Found issues‼️

ProjectCoverage TypeExpectedActual
Microsoft.Extensions.Caching.HybridLine8682.77 🔻
Microsoft.Extensions.AI.OllamaLine8078.2 🔻
Microsoft.Extensions.AI.OpenAILine7768.75 🔻
Microsoft.Extensions.AI.OpenAIBranch7750.41 🔻
Microsoft.Gen.MetadataExtractorLine9857.35 🔻
Microsoft.Gen.MetadataExtractorBranch9862.5 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

ProjectExpectedActual
Microsoft.Extensions.AI.AzureAIInference9192
Microsoft.Extensions.AI8889
Microsoft.Extensions.AI.Abstractions8385

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=950106&view=codecoverage-tab

@eiriktsarpalis
eiriktsarpalis merged commit b67faa0 into dotnet:mainFeb 12, 2025
@eiriktsarpalis
eiriktsarpalis deleted the meai-di-lifetimes branch February 12, 2025 18:54
@jeffhandleyjeffhandley added the area-ai Microsoft.Extensions.AI libraries label Mar 7, 2025
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 6, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-aiMicrosoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MEAI] IChatClient dependency extensions should support lifetimes beyond singleton

4 participants

@eiriktsarpalis@dotnet-comment-bot@stephentoub@jeffhandley