extensions 0.3.25
extensions: ^0.3.25 copied to clipboard
A set of APIs for commonly used programming patterns and utilities, such as dependency injection, logging, and configuration.
0.3.25 #
- AI — OpenAI provider:
- Added
OpenAIChatClient— aChatClientimplementation for the OpenAI chat completions API (POST /chat/completions). Supports streaming (SSE), tool calls, response format control (text,json_object,json_schema), and allChatOptionsfields. ConfiguringOpenAIClientOptions.endpointto a local server (e.g.http://localhost:1234/v1) makes it compatible with LM Studio, Ollama, and other OpenAI-compatible servers. - Added
OpenAIEmbeddingGenerator— anEmbeddingGenerator<String, float>for the OpenAI embeddings API, with optionaldimensionsanddefaultModelDimensionssupport. - Added
OpenAIImageGenerator— anImageGeneratorfor DALL-E andgpt-image-1, returningDataContent(base-64) orUriContent(URL). - Added
OpenAISpeechToTextClient— aSpeechToTextClientbacked by the Whisper transcription and translation endpoints via multipart upload. - Added
OpenAITextToSpeechClient— aTextToSpeechClientwith both non-streaming and streaming audio delivery. - Added
OpenAIClientOptions— holdsendpointURI (default:https://api.openai.com/v1) and an injectablehttp.Clientfor testing. - Added
OpenAIServiceCollectionExtensions— DI convenience methods (addOpenAIChatClient,addOpenAIEmbeddingGenerator, etc.) onServiceCollection. - Added
LoggingChatClientBuilderExtensions.useLogging()— integratesLoggingChatClientinto aChatClientBuilderpipeline, skipping the logging step when the resolved factory isNullLoggerFactory.
- Added
0.3.24 #
-
VectorData — expanded abstractions:
- Added annotation types:
VectorStoreDataAttribute,VectorStoreKeyAttribute,VectorStoreVectorAttributefor decorating record classes (intended for code generators or explicit schema construction). - Added
DistanceFunctionandIndexKindstring-constant classes for use in vector property configuration. - Added full
VectorStoreCollectionDefinitionrecord schema withVectorStoreProperty,VectorStoreKeyProperty,VectorStoreDataProperty, andVectorStoreVectorProperty. - Added
VectorSearchOptions,VectorSearchResult<TRecord>, andRecordRetrievalOptions. - Added
FilteredRecordRetrievalOptions<TRecord>for filtered, ordered, paginated record retrieval, withOrderByClause.ascending/OrderByClause.descendinghelpers. - Added
HybridSearchOptionsfor keyword + vector hybrid search. - Added
IVectorSearchable<TRecord>andIKeywordHybridSearchable<TRecord>interfaces. - Added deprecated legacy filter clause hierarchy (
FilterClause,EqualToFilterClause,AnyTagEqualToFilterClause) for compatibility with code targeting the old C# API surface; preferVectorStoreFilterand its sealed subclasses.
- Added annotation types:
-
AI — Bug fix:
- Added
namefield toFunctionResultContent;FunctionInvokingChatClientnow populates it so providers can correlate results back to the originating function declaration.
- Added
-
Logging — Cleanup:
- Renamed
ILoggerProviderConfiguration<T>toLoggerProviderConfiguration<T>— theI-prefixed name and its typedef alias have been removed. Update any direct references to the abstract class.
- Renamed
-
Dependency Injection — Bug fix:
- Fixed
getRequiredServiceerror message: was printingType.runtimeType(always"Type") instead of the actual type name.
- Fixed
-
System — Bug fix:
ExceptionBase.toString()now returns"TypeName: message"instead of the defaultInstance of 'TypeName'.
0.3.23 #
- Fixed missing
export 'ai.dart'in theextensions.dartbarrel file.
0.3.22 #
-
AI — Microsoft.Extensions.AI port (Phases 1–4):
-
Phase 1 — Core API gaps:
- Added
ReasoningOptions,ReasoningEffort, andReasoningOutputtypes for model reasoning control - Added
allowBackgroundResponsesandrawRepresentationFactorytoChatOptions - Replaced merged content types with proper call/result pairs:
CodeInterpreterToolCallContent/CodeInterpreterToolResultContent,ImageGenerationToolCallContent/ImageGenerationToolResultContent,McpServerToolCallContent/McpServerToolResultContent,InputRequestContent/InputResponseContent,WebSearchToolCallContent/WebSearchToolResultContent - Added abstract
ToolCallContentandToolResultContentbase classes - Added
ToolApprovalRequestContent/ToolApprovalResponseContentfor user-in-the-loop approval flows - Added
AIFunctionDeclaration,AIFunctionFactoryOptions,DelegatingAIFunctionDeclaration,ApprovalRequiredAIFunction - Added
HostedToolSearchToolandHostedMcpServerToolapproval mode hierarchy (AlwaysRequire,NeverRequire,RequireSpecific) - Added
AIContentExtensionswithfirstOfType<T>()andallOfType<T>()helpers - Added
AutoChatToolModeto the public API
- Added
-
Phase 2 — New client types:
- Added
TextToSpeechClientpipeline:TextToSpeechClient,TextToSpeechOptions,TextToSpeechResponse,TextToSpeechResponseUpdate,TextToSpeechClientMetadata,DelegatingTextToSpeechClient,ConfigureOptionsTextToSpeechClient,LoggingTextToSpeechClient,TextToSpeechClientBuilder - Added
HostedFileClientpipeline:HostedFileClient,DelegatingHostedFileClient,LoggingHostedFileClient,HostedFileClientBuilder
- Added
-
Phase 3 — OpenTelemetry middleware:
- Added
OpenTelemetryChatClient,OpenTelemetryEmbeddingGenerator,OpenTelemetryImageGenerator,OpenTelemetryTextToSpeechClientdecorators - Added
useOpenTelemetry()builder extension for each client type - Added
OpenTelemetryConstswith span and attribute name constants
- Added
-
Phase 4 — Evaluation framework:
- NLP evaluators:
BleuEvaluator,F1Evaluator,GleuEvaluatorwith supporting algorithms (BleuAlgorithm,F1Algorithm,GleuAlgorithm,NGram,SimpleWordTokenizer) - Quality evaluators:
CoherenceEvaluator,CompletenessEvaluator,EquivalenceEvaluator,FluencyEvaluator,GroundednessEvaluator,IntentResolutionEvaluator,RelevanceTruthAndCompletenessEvaluator,RetrievalEvaluator,TaskAdherenceEvaluator,ToolCallAccuracyEvaluator - Safety evaluators:
CodeVulnerabilityEvaluator,ContentHarmEvaluator,HateAndUnfairnessEvaluator,IndirectAttackEvaluator,ProtectedMaterialEvaluator,SelfHarmEvaluator,SexualEvaluator,ViolenceEvaluator,UngroundedAttributesEvaluator,GroundednessProEvaluator - Reporting:
ScenarioRun,ReportingConfiguration,ResponseCachingChatClient, disk-basedResponseCache,ResultStore, andReportingConfigurationfactory
- NLP evaluators:
-
-
VectorData — Microsoft.Extensions.VectorData.Abstractions port:
- Added
VectorStore,VectorStoreCollection<TKey, TRecord>, andVectorStoreRecordCollection<TKey, TRecord>abstractions - Added
VectorStoreFiltersealed hierarchy:EqualToVectorStoreFilter,AnyTagEqualToVectorStoreFilter,AndVectorStoreFilter,OrVectorStoreFilter - Added record definition types:
VectorStoreRecordDefinition,VectorStoreRecordDataProperty,VectorStoreRecordKeyProperty,VectorStoreRecordVectorProperty - Added attribute annotations:
VectorStoreRecordData,VectorStoreRecordKey,VectorStoreRecordVector - Added options types for all collection operations with distinct method names (
getAsync/getBatchAsync/getFilteredAsync,upsertAsync/upsertBatchAsync,deleteAsync/deleteBatchAsync) - Added
OrderByClausewithascending(field)/descending(field)factory methods - Exported from
package:extensions/vector_data.dartand included inpackage:extensions/extensions.dart
- Added
-
Bug Fix — Dependency Injection:
- Fixed
getKeyedServices<T>(key)always returning empty or throwing aTypeError. The method now correctly requestsIterable<T>from the provider (mirroring the non-keyedgetServices<T>()and the C#GetKeyedServices<T>()implementation), which routes throughCallSiteFactory.tryCreateIterable()and aggregates all registrations under the given key. getKeyedServicesFromType(Type, key)now throwsUnsupportedErrorwith a clear message (Dart cannot constructIterable<T>from a runtimeType; usegetKeyedServices<T>()instead).
- Fixed
0.3.21 #
- Updates.
0.3.20 #
- Updates.
0.3.19 #
- Code Quality:
- Improved export visibility in hosting libraries by hiding internal implementation functions (
addCommandLineConfig,addDefaultServices,applyDefaultAppConfiguration,createDefaultServiceProviderOptions) - Code formatting improvements in AI logging clients (line length fixes)
- Improved import naming conventions in
HostApplicationBuilderto follow Dart style guidelines - Fixed documentation reference in
FunctionInvocationContext
- Improved export visibility in hosting libraries by hiding internal implementation functions (
0.3.18 #
-
Bug Fixes:
- Fixed
PhysicalFileProvider.getFileInfo()andgetDirectoryContents()incorrectly handling nested directory paths by removing the first path separator anywhere in the path instead of only at the beginning - Fixed
LoggerFactory.addProvider()throwingRangeErrorwhen adding providers after loggers were already created due to incorrect list index assignment - Improved
_isUnderneathRoot()validation to prevent false positive matches on paths with common prefixes - Fixed file polling tests to account for file system timestamp granularity (1-second precision)
- Fixed
-
Code Quality:
- Fixed all analyzer issues (import ordering, naming conventions, line length, unused imports/variables)
- Renamed
ArgumentOutOfRangeException.ThrowNegative()andThrowNegativeOrZero()to follow Dart naming conventions (lowerCamelCase) - Improved test reliability by ensuring proper timing for file system timestamp changes
- Disabled
cascade_invocationslint rule to reduce noise in test files
-
Test Improvements:
- Fixed and re-enabled 3 previously skipped tests
- All 508 tests now pass with improved timing reliability
- Added better handling for platform-specific file system behavior
0.3.17 #
- Bug fixes and improvements.
0.3.16 #
-
Major Feature Additions:
- Added comprehensive Caching module with in-memory and distributed cache support
- Added HTTP Client Logging with configurable formatters and redaction
- Added high-performance LoggerMessage API for zero-allocation logging
- Added Typed Logger support (
Logger<T>) - Added advanced Console Formatters (Simple, JSON, Systemd)
- Added File System Globbing with advanced pattern matching
- Added Diagnostics module for activity tracking and metrics
-
Caching:
- New
MemoryCachewith size limits, priorities, and eviction policies DistributedCacheabstraction with in-memory implementation- Post-eviction callbacks and cache statistics
- Sliding and absolute expiration support
- Examples: example_caching.dart
- New
-
Logging:
- High-performance
LoggerMessage.defineAPI for cached log delegates BufferedLogRecordfor structured logging scenariosNullTypedLogger<T>for testing and no-op scenarios- Console formatters with customizable output (simple, JSON, systemd)
- Color support and timestamp formatting
- Examples: example_advanced_logging.dart, example_console_formatters.dart
- High-performance
-
HTTP:
- HTTP client logging with request/response tracking
- Header redaction for sensitive data
- Configurable handler lifetime
- Scoped logging integration
- Example: example_http_client_logging.dart
-
File Providers:
- Enhanced polling change tokens with debouncing
- Physical file provider options
- Improved file watching reliability
- Example: example_file_providers.dart
-
File System Globbing:
- Advanced pattern matching with multiple patterns
- Exclusion support
- Case-sensitive/insensitive matching
- Example: example_file_system_globbing.dart
-
Diagnostics:
- Activity tracking and propagation
- Diagnostic listeners
- Example: example_diagnostics.dart
-
Testing:
- Added 1000+ new test cases across all modules
- Comprehensive test coverage for caching, logging, and primitives
-
Code Quality:
- Fixed all analyzer warnings and errors
- Improved type inference in examples
- Removed unused imports and variables
-
Breaking Changes:
- None - all additions are backward compatible
0.3.15 #
- Changed logging scope for lifetime messages and added additional tests.
0.3.14 #
- Updates.
0.3.13 #
- Bug fixes.
0.3.12 #
- Updates.
0.3.11 #
- Exported CancellationTokenRegistration.
0.3.10 #
- Added const constructor to NullLoggerFactory.
0.3.9 #
- Exported NullLogger, NullLoggerFactory, and CancellationTokenSource. Changed Logger.logError to not require and exception.
0.3.8 #
- Bug fixes and updates.
0.3.7 #
- Bug fixes and updates.
0.3.6 #
- Downgrading
asyncpackage.
0.3.5 #
- Bug fixes and updates.
0.3.4 #
- Bug fixes and updates.
0.3.3 #
- Bug fixes and updates.
0.3.2 #
- Bug fixes and updates.
0.3.1 #
- Bug fixes and updates.
0.3.0 #
- Initial version