AIJsonUtilities.AddAIContentType 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| AddAIContentType(JsonSerializerOptions, Type, String) |
将自定义内容类型添加到多态配置中 AIContent。 |
| AddAIContentType<TContent>(JsonSerializerOptions, String) |
将自定义内容类型添加到多态配置中 AIContent。 |
AddAIContentType(JsonSerializerOptions, Type, String)
- Source:
- AIJsonUtilities.cs
将自定义内容类型添加到多态配置中 AIContent。
public:
[System::Runtime::CompilerServices::Extension]
static void AddAIContentType(System::Text::Json::JsonSerializerOptions ^ options, Type ^ contentType, System::String ^ typeDiscriminatorId);
public static void AddAIContentType(this System.Text.Json.JsonSerializerOptions options, Type contentType, string typeDiscriminatorId);
static member AddAIContentType : System.Text.Json.JsonSerializerOptions * Type * string -> unit
<Extension()>
Public Sub AddAIContentType (options As JsonSerializerOptions, contentType As Type, typeDiscriminatorId As String)
参数
- options
- JsonSerializerOptions
要配置的选项实例。
- contentType
- Type
要配置的自定义内容类型。
- typeDiscriminatorId
- String
内容类型的类型鉴别器 ID。
例外
options, contentType或 typeDiscriminatorId 为 null。
contentType 是内置内容类型,也不派生自 AIContent。
options 是只读实例。
适用于
AddAIContentType<TContent>(JsonSerializerOptions, String)
- Source:
- AIJsonUtilities.cs
将自定义内容类型添加到多态配置中 AIContent。
public:
generic <typename TContent>
where TContent : Microsoft::Extensions::AI::AIContent[System::Runtime::CompilerServices::Extension]
static void AddAIContentType(System::Text::Json::JsonSerializerOptions ^ options, System::String ^ typeDiscriminatorId);
public static void AddAIContentType<TContent>(this System.Text.Json.JsonSerializerOptions options, string typeDiscriminatorId) where TContent : Microsoft.Extensions.AI.AIContent;
static member AddAIContentType : System.Text.Json.JsonSerializerOptions * string -> unit (requires 'Content :> Microsoft.Extensions.AI.AIContent)
<Extension()>
Public Sub AddAIContentType(Of TContent As AIContent) (options As JsonSerializerOptions, typeDiscriminatorId As String)
类型参数
- TContent
要配置的自定义内容类型。
参数
- options
- JsonSerializerOptions
要配置的选项实例。
- typeDiscriminatorId
- String
内容类型的类型鉴别器 ID。
例外
options 或 typeDiscriminatorId 为 null.
TContent 是内置内容类型。
options 是只读实例。