Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Generators.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\ProjectStaging.targets" />

<PropertyGroup>
<!-- Workaround https://github.com/dotnet/sdk/issues/51265 - can be removed when updating to .NET 10.0.100 (GA) SDK -->
<RestoreEnablePackagePruning Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">false</RestoreEnablePackagePruning>
</PropertyGroup>

<!-- Warning stuff -->
<PropertyGroup>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NETSDK1138;MSB3270</MSBuildWarningsAsMessages>
Expand Down
6 changes: 1 addition & 5 deletions eng/MSBuild/LegacySupport.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup Condition="'$(InjectCompilerFeatureRequiredOnLegacy)' == 'true' AND ('$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp3.1')">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\CompilerFeatureRequiredAttribute\*.cs" LinkBase="LegacySupport\CompilerFeatureRequiredAttribute" />
</ItemGroup>

<ItemGroup Condition="'$(InjectRequiredMemberOnLegacy)' == 'true' AND ('$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp3.1')">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\RequiredMemberAttribute\*.cs" LinkBase="LegacySupport\RequiredMemberAttribute" />
</ItemGroup>
Expand Down Expand Up @@ -47,10 +47,6 @@
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\StringSyntaxAttribute\*.cs" LinkBase="LegacySupport\StringSyntaxAttribute" />
</ItemGroup>

<ItemGroup Condition="'$(InjectJsonSchemaExporterOnLegacy)' == 'true' AND ('$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0')">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\Shared\JsonSchemaExporter\**\*.cs" LinkBase="Shared\EmptyCollections" />
</ItemGroup>

<ItemGroup Condition="'$(InjectGetOrAddOnLegacy)' == 'true' AND ('$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0')">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\GetOrAdd\*.cs" LinkBase="LegacySupport\GetOrAdd" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
<Description>Abstractions representing generative AI components.</Description>
<Workstream>AI</Workstream>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -21,21 +22,20 @@

<PropertyGroup>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectJsonSchemaExporterOnLegacy>true</InjectJsonSchemaExporterOnLegacy>
<InjectRequiredMemberOnLegacy>true</InjectRequiredMemberOnLegacy>
<InjectSharedEmptyCollections>true</InjectSharedEmptyCollections>
<InjectStringHashOnLegacy>true</InjectStringHashOnLegacy>
<InjectStringSyntaxAttributeOnLegacy>true</InjectStringSyntaxAttributeOnLegacy>
<InjectSystemIndexOnLegacy>true</InjectSystemIndexOnLegacy>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<ItemGroup>
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Net.Http" />
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.Extensions.AI;
/// Defines the context in which a JSON schema within a type graph is being generated.
/// </summary>
/// <remarks>
/// This struct is being passed to the user-provided <see cref="AIJsonSchemaCreateOptions.TransformSchemaNode"/>
/// This struct is being passed to the user-provided <see cref="AIJsonSchemaCreateOptions.TransformSchemaNode"/>
/// callback by the <see cref="AIJsonUtilities.CreateJsonSchema"/> method and cannot be instantiated directly.
/// </remarks>
public readonly struct AIJsonSchemaCreateContext
Expand Down Expand Up @@ -51,32 +51,20 @@ internal AIJsonSchemaCreateContext(JsonSchemaExporterContext exporterContext)
/// Gets the declaring type of the property or parameter being processed.
/// </summary>
public Type? DeclaringType =>
#if NET9_0_OR_GREATER
_exporterContext.PropertyInfo?.DeclaringType;
#else
_exporterContext.DeclaringType;
#endif

/// <summary>
/// Gets the <see cref="ICustomAttributeProvider"/> corresponding to the property or field being processed.
/// </summary>
public ICustomAttributeProvider? PropertyAttributeProvider =>
#if NET9_0_OR_GREATER
_exporterContext.PropertyInfo?.AttributeProvider;
#else
_exporterContext.PropertyAttributeProvider;
#endif

/// <summary>
/// Gets the <see cref="System.Reflection.ICustomAttributeProvider"/> of the
/// constructor parameter associated with the accompanying <see cref="PropertyInfo"/>.
/// </summary>
public ICustomAttributeProvider? ParameterAttributeProvider =>
#if NET9_0_OR_GREATER
_exporterContext.PropertyInfo?.AssociatedParameter?.AttributeProvider;
#else
_exporterContext.ParameterInfo;
#endif

/// <summary>
/// Retrieves a custom attribute of a specified type that is applied to the specified schema node context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
<Description>Implementation of generative AI abstractions for Azure.AI.Inference.</Description>
<Workstream>AI</Workstream>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -29,9 +30,6 @@

<ItemGroup>
<PackageReference Include="Azure.AI.Inference" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Memory.Data" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
<Description>Implementation of generative AI abstractions for OpenAI-compatible endpoints.</Description>
<Workstream>AI</Workstream>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -31,9 +32,6 @@

<ItemGroup>
<PackageReference Include="OpenAI" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Memory.Data" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public class ChatResponse<T> : ChatResponse
{
private static readonly JsonReaderOptions _allowMultipleValuesJsonReaderOptions = new()
{
#if NET9_0_OR_GREATER
AllowMultipleValues = true
#endif
};
private readonly JsonSerializerOptions _serializerOptions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,15 @@ public OpenTelemetryChatClient(IChatClient innerClient, ILogger? logger = null,
_tokenUsageHistogram = _meter.CreateHistogram<int>(
OpenTelemetryConsts.GenAI.Client.TokenUsage.Name,
OpenTelemetryConsts.TokensUnit,
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
);

_operationDurationHistogram = _meter.CreateHistogram<double>(
OpenTelemetryConsts.GenAI.Client.OperationDuration.Name,
OpenTelemetryConsts.SecondsUnit,
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
);

_jsonSerializerOptions = AIJsonUtilities.DefaultOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,15 @@ public OpenTelemetryImageGenerator(IImageGenerator innerGenerator, ILogger? logg
_tokenUsageHistogram = _meter.CreateHistogram<int>(
OpenTelemetryConsts.GenAI.Client.TokenUsage.Name,
OpenTelemetryConsts.TokensUnit,
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
);

_operationDurationHistogram = _meter.CreateHistogram<double>(
OpenTelemetryConsts.GenAI.Client.OperationDuration.Name,
OpenTelemetryConsts.SecondsUnit,
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,15 @@ public OpenTelemetryEmbeddingGenerator(IEmbeddingGenerator<TInput, TEmbedding> i
_tokenUsageHistogram = _meter.CreateHistogram<int>(
OpenTelemetryConsts.GenAI.Client.TokenUsage.Name,
OpenTelemetryConsts.TokensUnit,
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
);

_operationDurationHistogram = _meter.CreateHistogram<double>(
OpenTelemetryConsts.GenAI.Client.OperationDuration.Name,
OpenTelemetryConsts.SecondsUnit,
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<RootNamespace>Microsoft.Extensions.AI</RootNamespace>
<Description>Utilities for working with generative AI components.</Description>
<Workstream>AI</Workstream>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -24,7 +25,7 @@
at all then to spot ones that use false rather than true. Alternatively, we could try to avoid using ConfigureAwait(false)
only on paths that could lead up to the invocation of an AIFunction, but that is challenging to maintain correctly. -->
<NoWarn>$(NoWarn);CA2007</NoWarn>

<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableNETStandardCompatErrors>true</DisableNETStandardCompatErrors>
</PropertyGroup>
Expand All @@ -47,7 +48,7 @@
<PackageReference Include="System.Numerics.Tensors" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Threading.Channels" />
Expand All @@ -56,5 +57,5 @@
<ItemGroup>
<ProjectReference Include="..\Microsoft.Extensions.AI.Abstractions\Microsoft.Extensions.AI.Abstractions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,15 @@ public OpenTelemetrySpeechToTextClient(ISpeechToTextClient innerClient, ILogger?
_tokenUsageHistogram = _meter.CreateHistogram<int>(
OpenTelemetryConsts.GenAI.Client.TokenUsage.Name,
OpenTelemetryConsts.TokensUnit,
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.TokenUsage.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.TokenUsage.ExplicitBucketBoundaries }
);

_operationDurationHistogram = _meter.CreateHistogram<double>(
OpenTelemetryConsts.GenAI.Client.OperationDuration.Name,
OpenTelemetryConsts.SecondsUnit,
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description
#if NET9_0_OR_GREATER
, advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
#endif
OpenTelemetryConsts.GenAI.Client.OperationDuration.Description,
advice: new() { HistogramBucketBoundaries = OpenTelemetryConsts.GenAI.Client.OperationDuration.ExplicitBucketBoundaries }
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>Abstractions representing Data Ingestion components for RAG.</Description>
<Workstream>RAG</Workstream>
<PackageTags>RAG;ingestion;documents</PackageTags>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<Stage>preview</Stage>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>75</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>Implementation of IngestionDocumentReader abstraction for MarkItDown.</Description>
<Workstream>RAG</Workstream>
<PackageTags>RAG;ingestion;documents;markitdown</PackageTags>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<Stage>preview</Stage>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>75</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>Implementation of IngestionDocumentReader abstraction for Markdown.</Description>
<Workstream>RAG</Workstream>
<PackageTags>RAG;ingestion;documents;markdown</PackageTags>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<Stage>preview</Stage>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>75</MinCodeCoverage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<PackageTags>RAG;ingestion;documents</PackageTags>
<UseLoggingGenerator>true</UseLoggingGenerator>
<DisableMicrosoftExtensionsLoggingSourceGenerator>false</DisableMicrosoftExtensionsLoggingSourceGenerator>
<ForceLatestDotnetVersions>true</ForceLatestDotnetVersions>
<Stage>preview</Stage>
<EnablePackageValidation>false</EnablePackageValidation>
<MinCodeCoverage>75</MinCodeCoverage>
Expand All @@ -23,16 +24,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" />
<PackageReference Include="Microsoft.ML.Tokenizers" />
<PackageReference Include="System.Numerics.Tensors" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<!-- Workaround https://github.com/microsoft/semantic-kernel/issues/13316 -->
<PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonVersion)" />
<PackageReference Include="System.Numerics.Tensors" />
</ItemGroup>

</Project>
Loading