-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
AzureChatCompletion.cs
38 lines (32 loc) · 1.37 KB
/
AzureChatCompletion.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Diagnostics.CodeAnalysis;
using Azure.AI.OpenAI.Chat;
using Azure.AI.OpenAI.Internal;
using OpenAI.Chat;
#pragma warning disable AZC0112
namespace Azure.AI.OpenAI;
public static partial class AzureChatCompletionExtensions
{
[Experimental("AOAI001")]
public static ContentFilterResultForPrompt GetContentFilterResultForPrompt(this ChatCompletion chatCompletion)
{
return AdditionalPropertyHelpers.GetAdditionalListProperty<ContentFilterResultForPrompt>(
chatCompletion._serializedAdditionalRawData,
"prompt_filter_results")?[0];
}
[Experimental("AOAI001")]
public static ContentFilterResultForResponse GetContentFilterResultForResponse(this ChatCompletion chatCompletion)
{
return AdditionalPropertyHelpers.GetAdditionalProperty<ContentFilterResultForResponse>(
chatCompletion.Choices?[0]?._serializedAdditionalRawData,
"content_filter_results");
}
[Experimental("AOAI001")]
public static AzureChatMessageContext GetAzureMessageContext(this ChatCompletion chatCompletion)
{
return AdditionalPropertyHelpers.GetAdditionalProperty<AzureChatMessageContext>(
chatCompletion.Choices?[0]?.Message?._serializedAdditionalRawData,
"context");
}
}