-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathindex.ts
183 lines (164 loc) · 7.18 KB
/
index.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Disable eslint for declaration merging using namespace
/* eslint-disable @typescript-eslint/no-namespace */
import type {
Completion,
CompletionCreateParamsNonStreaming,
CompletionCreateParamsStreaming,
ChatCompletionCreateParamsNonStreaming,
ChatCompletionCreateParamsStreaming,
ChatCompletion,
ChatCompletionChunk,
ChatCompletionMessage,
} from "openai/resources/index";
import type {
ContentFilterResultsForPromptOutput,
ContentFilterResultsForChoiceOutput,
AzureChatExtensionsMessageContextOutput,
ImageGenerationPromptFilterResults,
ImageGenerationContentFilterResults,
} from "./outputModels.js";
import type { AzureChatExtensionConfiguration } from "./models.js";
declare module "openai/resources/index" {
interface Completion {
/**
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
prompt_filter_results?: Array<ContentFilterResultsForPromptOutput>;
}
interface ChatCompletionCreateParamsNonStreaming {
/**
* The configuration entries for Azure OpenAI chat extensions that use them.
* This additional specification is only compatible with Azure OpenAI.
*/
data_sources?: Array<AzureChatExtensionConfiguration>;
user_security_context?: AzureUserSecurityContext;
}
interface ChatCompletionCreateParamsStreaming {
/**
* The configuration entries for Azure OpenAI chat extensions that use them.
* This additional specification is only compatible with Azure OpenAI.
*/
data_sources?: Array<AzureChatExtensionConfiguration>;
user_security_context?: AzureUserSecurityContext;
}
interface ChatCompletion {
/**
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
prompt_filter_results?: Array<ContentFilterResultsForPromptOutput>;
}
interface ChatCompletionMessage {
/**
* If Azure OpenAI chat extensions are configured, this array represents the incremental steps performed by those
* extensions while processing the chat completions request.
*/
context?: AzureChatExtensionsMessageContextOutput;
}
interface CompletionChoice {
/**
* Information about the content filtering category (hate, sexual, violence, self_harm), if it
* has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*/
content_filter_results?: ContentFilterResultsForChoiceOutput;
}
namespace ChatCompletion {
interface Choice {
/**
* Information about the content filtering category (hate, sexual, violence, self_harm), if it
* has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*/
content_filter_results?: ContentFilterResultsForChoiceOutput;
}
}
interface ChatCompletionChunk {
/**
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
prompt_filter_results?: Array<ContentFilterResultsForPromptOutput>;
}
namespace ChatCompletionChunk {
interface Choice {
/**
* Information about the content filtering category (hate, sexual, violence, self_harm), if it
* has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*/
content_filter_results?: ContentFilterResultsForChoiceOutput;
}
namespace Choice {
/**
* A chat completion delta generated by streamed model responses.
*/
interface Delta {
/**
* If Azure OpenAI chat extensions are configured, this array represents the incremental steps performed by those
* extensions while processing the chat completions request.
*/
context?: AzureChatExtensionsMessageContextOutput;
}
}
}
interface ImagesResponse {
/**
* Information about the content filtering category (hate, sexual, violence, self_harm), if
* it has been detected, as well as the severity level (very_low, low, medium, high-scale
* that determines the intensity and risk level of harmful content) and if it has been
* filtered or not. Information about jailbreak content and profanity, if it has been detected,
* and if it has been filtered or not. And information about customer block list, if it has
* been filtered and its id.
*/
content_filter_results?: ImageGenerationContentFilterResults;
/**
* Information about the content filtering category (hate, sexual, violence, self_harm), if
* it has been detected, as well as the severity level (very_low, low, medium, high-scale
* that determines the intensity and risk level of harmful content) and if it has been
* filtered or not. Information about jailbreak content and profanity, if it has been detected,
* and if it has been filtered or not. And information about customer block list, if it has
* been filtered and its id.
*/
prompt_filter_results?: ImageGenerationPromptFilterResults;
}
export interface AzureUserSecurityContext {
/**
* Azure-only field. User security context contains several parameters that describe the
* application itself, and the end user that interacts with the application. These fields assist
* your security operations teams to investigate and mitigate security incidents by providing
* a comprehensive approach to protecting your AI applications.
* [Learn more](https://aka.ms/TP4AI/Documentation/EndUserContext) about protecting AI applications using
* Microsoft Defender for Cloud. The name of the application. Sensitive personal information should not be
* included in this field.
*/
application_name?: string;
/** This identifier is the Microsoft Entra ID (formerly Azure Active Directory) user object ID used to authenticate end-users within the generative AI application. Sensitive personal information should not be included in this field. */
end_user_id?: string;
/** The Microsoft 365 tenant ID the end user belongs to. It's required when the generative AI application is multitenant. */
end_user_tenant_id?: string;
/** Captures the original client's IP address. */
source_ip?: string;
}
export interface UploadPart {
/**
* Azure-only field.
*/
azure_block_id?: string;
}
}
export {
Completion,
CompletionCreateParamsNonStreaming,
CompletionCreateParamsStreaming,
ChatCompletionCreateParamsNonStreaming,
ChatCompletionCreateParamsStreaming,
ChatCompletion,
ChatCompletionChunk,
ChatCompletionMessage,
};
export * from "./outputModels.js";
export * from "./models.js";