Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.get_Results</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.set_Results(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.get_Results</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.set_Results(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.get_Results</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.set_Results(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.get_Results</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.set_Results(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.get_Results</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Extensions.AI.WebSearchToolResultContent.set_Results(System.Collections.Generic.IList{Microsoft.Extensions.AI.AIContent})</Target>
<Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,10 @@ namespace Microsoft.Extensions.AI;
[JsonDerivedType(typeof(McpServerToolResultContent), typeDiscriminator: "mcpServerToolResult")]
[JsonDerivedType(typeof(ImageGenerationToolCallContent), typeDiscriminator: "imageGenerationToolCall")]
[JsonDerivedType(typeof(ImageGenerationToolResultContent), typeDiscriminator: "imageGenerationToolResult")]

// These should be added in once they're no longer [Experimental]. If they're included while still
// experimental, any JsonSerializerContext that includes AIContent will incur errors about using
// experimental types in its source generated files. When [Experimental] is removed from these types,
// these lines should be uncommented and the corresponding lines in AIJsonUtilities.CreateDefaultOptions
// as well as the [JsonSerializable] attributes for them on the JsonContext should be removed.
// [JsonDerivedType(typeof(CodeInterpreterToolCallContent), typeDiscriminator: "codeInterpreterToolCall")]
// [JsonDerivedType(typeof(CodeInterpreterToolResultContent), typeDiscriminator: "codeInterpreterToolResult")]
// [JsonDerivedType(typeof(WebSearchToolCallContent), typeDiscriminator: "webSearchToolCall")]
// [JsonDerivedType(typeof(WebSearchToolResultContent), typeDiscriminator: "webSearchToolResult")]

[JsonDerivedType(typeof(CodeInterpreterToolCallContent), typeDiscriminator: "codeInterpreterToolCall")]
[JsonDerivedType(typeof(CodeInterpreterToolResultContent), typeDiscriminator: "codeInterpreterToolResult")]
[JsonDerivedType(typeof(WebSearchToolCallContent), typeDiscriminator: "webSearchToolCall")]
[JsonDerivedType(typeof(WebSearchToolResultContent), typeDiscriminator: "webSearchToolResult")]
public class AIContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.AI;

Expand All @@ -14,7 +12,6 @@ namespace Microsoft.Extensions.AI;
/// This content type represents when a hosted AI service invokes a code interpreter tool.
/// It is informational only and represents the call itself, not the result.
/// </remarks>
[Experimental(DiagnosticIds.Experiments.AICodeInterpreter, UrlFormat = DiagnosticIds.UrlFormat)]
public sealed class CodeInterpreterToolCallContent : ToolCallContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.AI;

/// <summary>
/// Represents the result of a code interpreter tool invocation by a hosted service.
/// </summary>
[Experimental(DiagnosticIds.Experiments.AICodeInterpreter, UrlFormat = DiagnosticIds.UrlFormat)]
public sealed class CodeInterpreterToolResultContent : ToolResultContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ namespace Microsoft.Extensions.AI;
[JsonDerivedType(typeof(FunctionCallContent), "functionCall")]
[JsonDerivedType(typeof(McpServerToolCallContent), "mcpServerToolCall")]
[JsonDerivedType(typeof(ImageGenerationToolCallContent), "imageGenerationToolCall")]

// Same as in AIContent.
// These should be added in once they're no longer [Experimental]. If they're included while still
// experimental, any JsonSerializerContext that includes ToolCallContent will incur errors about using
// experimental types in its source generated files. When [Experimental] is removed from these types,
// these lines should be uncommented and the corresponding lines in AIJsonUtilities.CreateDefaultOptions
// as well as the [JsonSerializable] attributes for them on the JsonContext should be removed.
// [JsonDerivedType(typeof(CodeInterpreterToolCallContent), "codeInterpreterToolCall")]
// [JsonDerivedType(typeof(WebSearchToolCallContent), "webSearchToolCall")]
[JsonDerivedType(typeof(CodeInterpreterToolCallContent), "codeInterpreterToolCall")]
[JsonDerivedType(typeof(WebSearchToolCallContent), "webSearchToolCall")]
public class ToolCallContent : AIContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ namespace Microsoft.Extensions.AI;
[JsonDerivedType(typeof(FunctionResultContent), "functionResult")]
[JsonDerivedType(typeof(McpServerToolResultContent), "mcpServerToolResult")]
[JsonDerivedType(typeof(ImageGenerationToolResultContent), "imageGenerationToolResult")]

// Same as in AIContent.
// These should be added in once they're no longer [Experimental]. If they're included while still
// experimental, any JsonSerializerContext that includes ToolResultContent will incur errors about using
// experimental types in its source generated files. When [Experimental] is removed from these types,
// these lines should be uncommented and the corresponding lines in AIJsonUtilities.CreateDefaultOptions
// as well as the [JsonSerializable] attributes for them on the JsonContext should be removed.
// [JsonDerivedType(typeof(CodeInterpreterToolResultContent), "codeInterpreterToolResult")]
// [JsonDerivedType(typeof(WebSearchToolResultContent), "webSearchToolResult")]
[JsonDerivedType(typeof(CodeInterpreterToolResultContent), "codeInterpreterToolResult")]
[JsonDerivedType(typeof(WebSearchToolResultContent), "webSearchToolResult")]
public class ToolResultContent : AIContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.AI;

Expand All @@ -14,7 +12,6 @@ namespace Microsoft.Extensions.AI;
/// This content type represents when a hosted AI service invokes a web search tool.
/// It is informational only and represents the call itself, not the result.
/// </remarks>
[Experimental(DiagnosticIds.Experiments.AIWebSearch, UrlFormat = DiagnosticIds.UrlFormat)]
public sealed class WebSearchToolCallContent : ToolCallContent
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.AI;

Expand All @@ -15,7 +13,6 @@ namespace Microsoft.Extensions.AI;
/// The results contain a list of <see cref="AIContent"/> items describing the web pages
/// found during the search, typically as <see cref="UriContent"/> instances.
/// </remarks>
[Experimental(DiagnosticIds.Experiments.AIWebSearch, UrlFormat = DiagnosticIds.UrlFormat)]
public sealed class WebSearchToolResultContent : ToolResultContent
{
/// <summary>
Expand All @@ -28,12 +25,12 @@ public WebSearchToolResultContent(string callId)
}

/// <summary>
/// Gets or sets the web search results.
/// Gets or sets the web search outputs.
/// </summary>
/// <remarks>
/// Each item represents a web page found during the search, typically as a <see cref="UriContent"/> instance.
/// Each output represents a web page result found during the search, typically as a <see cref="UriContent"/> instance.
/// If a title is available for a result, it may be stored in the item's <see cref="AIContent.AdditionalProperties"/>
/// under the key <c>"title"</c>.
/// </remarks>
public IList<AIContent>? Results { get; set; }
public IList<AIContent>? Outputs { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -1477,33 +1477,33 @@
},
{
"Type": "sealed class Microsoft.Extensions.AI.CodeInterpreterToolCallContent : Microsoft.Extensions.AI.ToolCallContent",
"Stage": "Experimental",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.AI.CodeInterpreterToolCallContent.CodeInterpreterToolCallContent(string callId);",
"Stage": "Experimental"
"Stage": "Stable"
}
],
"Properties": [
{
"Member": "System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent>? Microsoft.Extensions.AI.CodeInterpreterToolCallContent.Inputs { get; set; }",
"Stage": "Experimental"
"Stage": "Stable"
}
]
},
{
"Type": "sealed class Microsoft.Extensions.AI.CodeInterpreterToolResultContent : Microsoft.Extensions.AI.ToolResultContent",
"Stage": "Experimental",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.AI.CodeInterpreterToolResultContent.CodeInterpreterToolResultContent(string callId);",
"Stage": "Experimental"
"Stage": "Stable"
}
],
"Properties": [
{
"Member": "System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent>? Microsoft.Extensions.AI.CodeInterpreterToolResultContent.Outputs { get; set; }",
"Stage": "Experimental"
"Stage": "Stable"
}
]
},
Expand Down Expand Up @@ -4812,33 +4812,33 @@
},
{
"Type": "sealed class Microsoft.Extensions.AI.WebSearchToolCallContent : Microsoft.Extensions.AI.ToolCallContent",
"Stage": "Experimental",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.AI.WebSearchToolCallContent.WebSearchToolCallContent(string callId);",
"Stage": "Experimental"
"Stage": "Stable"
}
],
"Properties": [
{
"Member": "System.Collections.Generic.IList<string>? Microsoft.Extensions.AI.WebSearchToolCallContent.Queries { get; set; }",
"Stage": "Experimental"
"Stage": "Stable"
}
]
},
{
"Type": "sealed class Microsoft.Extensions.AI.WebSearchToolResultContent : Microsoft.Extensions.AI.ToolResultContent",
"Stage": "Experimental",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.AI.WebSearchToolResultContent.WebSearchToolResultContent(string callId);",
"Stage": "Experimental"
"Stage": "Stable"
}
],
"Properties": [
{
"Member": "System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent>? Microsoft.Extensions.AI.WebSearchToolResultContent.Results { get; set; }",
"Stage": "Experimental"
"Member": "System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent>? Microsoft.Extensions.AI.WebSearchToolResultContent.Outputs { get; set; }",
"Stage": "Stable"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ private static JsonSerializerOptions CreateDefaultOptions()
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};

// Temporary workaround: these types are [Experimental] and can't be added as [JsonDerivedType] on AIContent yet,
// or else consuming assemblies that used source generation with AIContent would implicitly reference them.
// Once they're no longer [Experimental] and added as [JsonDerivedType] on AIContent, these lines should be removed.
AddAIContentTypeChain(options, typeof(CodeInterpreterToolCallContent), typeDiscriminatorId: "codeInterpreterToolCall", checkBuiltIn: false);
AddAIContentTypeChain(options, typeof(CodeInterpreterToolResultContent), typeDiscriminatorId: "codeInterpreterToolResult", checkBuiltIn: false);
AddAIContentTypeChain(options, typeof(WebSearchToolCallContent), typeDiscriminatorId: "webSearchToolCall", checkBuiltIn: false);
AddAIContentTypeChain(options, typeof(WebSearchToolResultContent), typeDiscriminatorId: "webSearchToolResult", checkBuiltIn: false);

if (JsonSerializer.IsReflectionEnabledByDefault)
{
// If reflection-based serialization is enabled by default, use it as a fallback for all other types.
Expand Down Expand Up @@ -117,12 +109,6 @@ private static JsonSerializerOptions CreateDefaultOptions()
[JsonSerializable(typeof(AIContent))]
[JsonSerializable(typeof(IEnumerable<AIContent>))]

// Temporary workaround: These should be implicitly added in once they're no longer [Experimental]
// and are included via [JsonDerivedType] on AIContent.
[JsonSerializable(typeof(CodeInterpreterToolCallContent))]
[JsonSerializable(typeof(CodeInterpreterToolResultContent))]
[JsonSerializable(typeof(WebSearchToolCallContent))]
[JsonSerializable(typeof(WebSearchToolResultContent))]
[JsonSerializable(typeof(ResponseContinuationToken))]

// IEmbeddingGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ internal static IEnumerable<ChatMessage> ToChatMessages(IEnumerable<ResponseItem

message.Contents.Add(new WebSearchToolResultContent(wscri.Id)
{
Results = GetWebSearchSources(wscri),
Outputs = GetWebSearchSources(wscri),
RawRepresentation = wscri,
});
break;
Expand Down Expand Up @@ -566,7 +566,7 @@ ChatResponseUpdate CreateUpdate(AIContent? content = null) =>
// Also yield the WebSearchToolResultContent.
yield return CreateUpdate(new WebSearchToolResultContent(wscri.Id)
{
Results = GetWebSearchSources(wscri),
Outputs = GetWebSearchSources(wscri),
RawRepresentation = wscri,
});
break;
Expand Down
2 changes: 0 additions & 2 deletions src/Shared/DiagnosticIds/DiagnosticIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ internal static class Experiments

internal const string AIChatReduction = AIExperiments;
internal const string AIResponseContinuations = AIExperiments;
internal const string AICodeInterpreter = AIExperiments;
internal const string AIWebSearch = AIExperiments;
internal const string AIToolSearch = AIExperiments;
internal const string AIRealTime = AIExperiments;
internal const string AIFiles = AIExperiments;
Expand Down
Loading
Loading