@fencyai/js 0.1.41 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/createChatCompletion.d.ts +0 -4
- package/lib/api/createChatCompletion.js +16 -30
- package/lib/api/createStream.d.ts +14 -0
- package/lib/api/createStream.js +53 -0
- package/lib/api/createUpload.d.ts +16 -0
- package/lib/api/createUpload.js +53 -0
- package/lib/api/createWebsite.d.ts +16 -0
- package/lib/api/createWebsite.js +39 -0
- package/lib/index.d.ts +21 -8
- package/lib/index.js +10 -4
- package/lib/openapi/core/ApiError.d.ts +10 -0
- package/lib/openapi/core/ApiError.js +11 -0
- package/lib/openapi/core/ApiRequestOptions.d.ts +13 -0
- package/lib/openapi/core/ApiRequestOptions.js +1 -0
- package/lib/openapi/core/ApiResult.d.ts +7 -0
- package/lib/openapi/core/ApiResult.js +1 -0
- package/lib/openapi/core/CancelablePromise.d.ts +20 -0
- package/lib/openapi/core/CancelablePromise.js +111 -0
- package/lib/openapi/core/OpenAPI.d.ts +16 -0
- package/lib/openapi/core/OpenAPI.js +11 -0
- package/lib/openapi/core/request.d.ts +30 -0
- package/lib/openapi/core/request.js +275 -0
- package/lib/openapi/index.d.ts +31 -0
- package/lib/openapi/index.js +11 -0
- package/lib/openapi/models/ApiDtoType.d.ts +6 -0
- package/lib/openapi/models/ApiDtoType.js +11 -0
- package/lib/openapi/models/ChatCompletionDto.d.ts +10 -0
- package/lib/openapi/models/ChatCompletionDto.js +1 -0
- package/lib/openapi/models/ChatCompletionStreamCompletedEventDto.d.ts +9 -0
- package/lib/openapi/models/ChatCompletionStreamCompletedEventDto.js +1 -0
- package/lib/openapi/models/CreateAnthropicChatCompletionDto.d.ts +8 -0
- package/lib/openapi/models/CreateAnthropicChatCompletionDto.js +1 -0
- package/lib/openapi/models/CreateChatCompletionRequest.d.ts +10 -0
- package/lib/openapi/models/CreateChatCompletionRequest.js +1 -0
- package/lib/openapi/models/CreateChatCompletionStreamRequest.d.ts +3 -0
- package/lib/openapi/models/CreateChatCompletionStreamRequest.js +1 -0
- package/lib/openapi/models/CreateGeminiChatCompletionDto.d.ts +8 -0
- package/lib/openapi/models/CreateGeminiChatCompletionDto.js +1 -0
- package/lib/openapi/models/CreateOpenAiChatCompletionDto.d.ts +8 -0
- package/lib/openapi/models/CreateOpenAiChatCompletionDto.js +1 -0
- package/lib/openapi/models/CreateOpenAiChatCompletionMessageDto.d.ts +4 -0
- package/lib/openapi/models/CreateOpenAiChatCompletionMessageDto.js +1 -0
- package/lib/openapi/models/CreateStreamRequest.d.ts +6 -0
- package/lib/openapi/models/CreateStreamRequest.js +1 -0
- package/lib/openapi/models/CreateWebsiteRequest.d.ts +3 -0
- package/lib/openapi/models/CreateWebsiteRequest.js +1 -0
- package/lib/openapi/models/FileUploadCompletedEventDto.d.ts +11 -0
- package/lib/openapi/models/FileUploadCompletedEventDto.js +1 -0
- package/lib/openapi/models/NewChatCompletionStreamChunkEventDto.d.ts +10 -0
- package/lib/openapi/models/NewChatCompletionStreamChunkEventDto.js +1 -0
- package/lib/openapi/models/PubCreateUploadRequest.d.ts +6 -0
- package/lib/openapi/models/PubCreateUploadRequest.js +1 -0
- package/lib/openapi/models/PubUploadDto.d.ts +6 -0
- package/lib/openapi/models/PubUploadDto.js +1 -0
- package/lib/openapi/models/PubWebsiteDto.d.ts +5 -0
- package/lib/openapi/models/PubWebsiteDto.js +1 -0
- package/lib/openapi/models/S3PostRequestDto.d.ts +10 -0
- package/lib/openapi/models/S3PostRequestDto.js +1 -0
- package/lib/openapi/models/StoredChatCompletionId.d.ts +3 -0
- package/lib/openapi/models/StoredChatCompletionId.js +1 -0
- package/lib/openapi/models/StoredFileId.d.ts +3 -0
- package/lib/openapi/models/StoredFileId.js +1 -0
- package/lib/openapi/models/StoredStreamId.d.ts +3 -0
- package/lib/openapi/models/StoredStreamId.js +1 -0
- package/lib/openapi/models/StoredUploadId.d.ts +3 -0
- package/lib/openapi/models/StoredUploadId.js +1 -0
- package/lib/openapi/models/StreamDto.d.ts +6 -0
- package/lib/openapi/models/StreamDto.js +1 -0
- package/lib/openapi/models/StreamEventType.d.ts +7 -0
- package/lib/openapi/models/StreamEventType.js +12 -0
- package/lib/openapi/models/StreamNotFoundEventDto.d.ts +7 -0
- package/lib/openapi/models/StreamNotFoundEventDto.js +1 -0
- package/lib/openapi/models/StreamTimeoutEventDto.d.ts +7 -0
- package/lib/openapi/models/StreamTimeoutEventDto.js +1 -0
- package/lib/openapi/models/StreamType.d.ts +4 -0
- package/lib/openapi/models/StreamType.js +9 -0
- package/lib/openapi/services/PubService.d.ts +50 -0
- package/lib/openapi/services/PubService.js +71 -0
- package/lib/types/ApiError.d.ts +0 -1
- package/lib/types/ApiError.js +1 -8
- package/lib/types/CreateStreamRequest.d.ts +6 -0
- package/lib/types/CreateStreamRequest.js +1 -0
- package/lib/types/CreateStreamResponse.d.ts +9 -0
- package/lib/types/CreateStreamResponse.js +1 -0
- package/lib/types/CreateUploadRequest.d.ts +6 -0
- package/lib/types/CreateUploadRequest.js +1 -0
- package/lib/types/CreateUploadResponse.d.ts +9 -0
- package/lib/types/CreateUploadResponse.js +1 -0
- package/lib/types/CreateWebsiteRequest.d.ts +3 -0
- package/lib/types/CreateWebsiteRequest.js +1 -0
- package/lib/types/CreateWebsiteResponse.d.ts +9 -0
- package/lib/types/CreateWebsiteResponse.js +1 -0
- package/lib/types/FencyFile.d.ts +8 -0
- package/lib/types/FencyFile.js +1 -0
- package/lib/types/FencyUpload.d.ts +6 -0
- package/lib/types/FencyUpload.js +1 -0
- package/lib/types/FencyWebsite.d.ts +5 -0
- package/lib/types/FencyWebsite.js +1 -0
- package/lib/types/S3PostRequest.d.ts +10 -0
- package/lib/types/S3PostRequest.js +1 -0
- package/lib/types/Stream.d.ts +5 -0
- package/lib/types/{ChatCompletionStream.js → Stream.js} +2 -2
- package/lib/types/StreamData.d.ts +31 -0
- package/lib/types/StreamData.js +1 -0
- package/lib/utils/parseApiError.d.ts +2 -0
- package/lib/utils/parseApiError.js +14 -0
- package/lib/utils/parseErrorBody.d.ts +1 -0
- package/lib/utils/parseErrorBody.js +8 -0
- package/lib/utils/parseNonOkResponse.d.ts +2 -0
- package/lib/utils/parseNonOkResponse.js +35 -0
- package/lib/utils/version.js +1 -1
- package/package.json +5 -3
- package/lib/api/createChatCompletionStream.d.ts +0 -21
- package/lib/api/createChatCompletionStream.js +0 -44
- package/lib/types/ChatCompletionStream.d.ts +0 -5
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import { ApiError } from './ApiError';
|
|
6
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
7
|
+
export const isDefined = (value) => {
|
|
8
|
+
return value !== undefined && value !== null;
|
|
9
|
+
};
|
|
10
|
+
export const isString = (value) => {
|
|
11
|
+
return typeof value === 'string';
|
|
12
|
+
};
|
|
13
|
+
export const isStringWithValue = (value) => {
|
|
14
|
+
return isString(value) && value !== '';
|
|
15
|
+
};
|
|
16
|
+
export const isBlob = (value) => {
|
|
17
|
+
return (typeof value === 'object' &&
|
|
18
|
+
typeof value.type === 'string' &&
|
|
19
|
+
typeof value.stream === 'function' &&
|
|
20
|
+
typeof value.arrayBuffer === 'function' &&
|
|
21
|
+
typeof value.constructor === 'function' &&
|
|
22
|
+
typeof value.constructor.name === 'string' &&
|
|
23
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
24
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
25
|
+
};
|
|
26
|
+
export const isFormData = (value) => {
|
|
27
|
+
return value instanceof FormData;
|
|
28
|
+
};
|
|
29
|
+
export const base64 = (str) => {
|
|
30
|
+
try {
|
|
31
|
+
return btoa(str);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
return Buffer.from(str).toString('base64');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export const getQueryString = (params) => {
|
|
39
|
+
const qs = [];
|
|
40
|
+
const append = (key, value) => {
|
|
41
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
42
|
+
};
|
|
43
|
+
const process = (key, value) => {
|
|
44
|
+
if (isDefined(value)) {
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
value.forEach(v => {
|
|
47
|
+
process(key, v);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else if (typeof value === 'object') {
|
|
51
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
52
|
+
process(`${key}[${k}]`, v);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
append(key, value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
61
|
+
process(key, value);
|
|
62
|
+
});
|
|
63
|
+
if (qs.length > 0) {
|
|
64
|
+
return `?${qs.join('&')}`;
|
|
65
|
+
}
|
|
66
|
+
return '';
|
|
67
|
+
};
|
|
68
|
+
const getUrl = (config, options) => {
|
|
69
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
70
|
+
const path = options.url
|
|
71
|
+
.replace('{api-version}', config.VERSION)
|
|
72
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
73
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
74
|
+
return encoder(String(options.path[group]));
|
|
75
|
+
}
|
|
76
|
+
return substring;
|
|
77
|
+
});
|
|
78
|
+
const url = `${config.BASE}${path}`;
|
|
79
|
+
if (options.query) {
|
|
80
|
+
return `${url}${getQueryString(options.query)}`;
|
|
81
|
+
}
|
|
82
|
+
return url;
|
|
83
|
+
};
|
|
84
|
+
export const getFormData = (options) => {
|
|
85
|
+
if (options.formData) {
|
|
86
|
+
const formData = new FormData();
|
|
87
|
+
const process = (key, value) => {
|
|
88
|
+
if (isString(value) || isBlob(value)) {
|
|
89
|
+
formData.append(key, value);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
formData.append(key, JSON.stringify(value));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
Object.entries(options.formData)
|
|
96
|
+
.filter(([_, value]) => isDefined(value))
|
|
97
|
+
.forEach(([key, value]) => {
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
value.forEach(v => process(key, v));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
process(key, value);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return formData;
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
};
|
|
109
|
+
export const resolve = async (options, resolver) => {
|
|
110
|
+
if (typeof resolver === 'function') {
|
|
111
|
+
return resolver(options);
|
|
112
|
+
}
|
|
113
|
+
return resolver;
|
|
114
|
+
};
|
|
115
|
+
export const getHeaders = async (config, options) => {
|
|
116
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
117
|
+
resolve(options, config.TOKEN),
|
|
118
|
+
resolve(options, config.USERNAME),
|
|
119
|
+
resolve(options, config.PASSWORD),
|
|
120
|
+
resolve(options, config.HEADERS),
|
|
121
|
+
]);
|
|
122
|
+
const headers = Object.entries({
|
|
123
|
+
Accept: 'application/json',
|
|
124
|
+
...additionalHeaders,
|
|
125
|
+
...options.headers,
|
|
126
|
+
})
|
|
127
|
+
.filter(([_, value]) => isDefined(value))
|
|
128
|
+
.reduce((headers, [key, value]) => ({
|
|
129
|
+
...headers,
|
|
130
|
+
[key]: String(value),
|
|
131
|
+
}), {});
|
|
132
|
+
if (isStringWithValue(token)) {
|
|
133
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
134
|
+
}
|
|
135
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
136
|
+
const credentials = base64(`${username}:${password}`);
|
|
137
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
138
|
+
}
|
|
139
|
+
if (options.body !== undefined) {
|
|
140
|
+
if (options.mediaType) {
|
|
141
|
+
headers['Content-Type'] = options.mediaType;
|
|
142
|
+
}
|
|
143
|
+
else if (isBlob(options.body)) {
|
|
144
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
145
|
+
}
|
|
146
|
+
else if (isString(options.body)) {
|
|
147
|
+
headers['Content-Type'] = 'text/plain';
|
|
148
|
+
}
|
|
149
|
+
else if (!isFormData(options.body)) {
|
|
150
|
+
headers['Content-Type'] = 'application/json';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return new Headers(headers);
|
|
154
|
+
};
|
|
155
|
+
export const getRequestBody = (options) => {
|
|
156
|
+
if (options.body !== undefined) {
|
|
157
|
+
if (options.mediaType?.includes('/json')) {
|
|
158
|
+
return JSON.stringify(options.body);
|
|
159
|
+
}
|
|
160
|
+
else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
161
|
+
return options.body;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return JSON.stringify(options.body);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
};
|
|
169
|
+
export const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
170
|
+
const controller = new AbortController();
|
|
171
|
+
const request = {
|
|
172
|
+
headers,
|
|
173
|
+
body: body ?? formData,
|
|
174
|
+
method: options.method,
|
|
175
|
+
signal: controller.signal,
|
|
176
|
+
};
|
|
177
|
+
if (config.WITH_CREDENTIALS) {
|
|
178
|
+
request.credentials = config.CREDENTIALS;
|
|
179
|
+
}
|
|
180
|
+
onCancel(() => controller.abort());
|
|
181
|
+
return await fetch(url, request);
|
|
182
|
+
};
|
|
183
|
+
export const getResponseHeader = (response, responseHeader) => {
|
|
184
|
+
if (responseHeader) {
|
|
185
|
+
const content = response.headers.get(responseHeader);
|
|
186
|
+
if (isString(content)) {
|
|
187
|
+
return content;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
};
|
|
192
|
+
export const getResponseBody = async (response) => {
|
|
193
|
+
if (response.status !== 204) {
|
|
194
|
+
try {
|
|
195
|
+
const contentType = response.headers.get('Content-Type');
|
|
196
|
+
if (contentType) {
|
|
197
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
198
|
+
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
199
|
+
if (isJSON) {
|
|
200
|
+
return await response.json();
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return await response.text();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
console.error(error);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
};
|
|
213
|
+
export const catchErrorCodes = (options, result) => {
|
|
214
|
+
const errors = {
|
|
215
|
+
400: 'Bad Request',
|
|
216
|
+
401: 'Unauthorized',
|
|
217
|
+
403: 'Forbidden',
|
|
218
|
+
404: 'Not Found',
|
|
219
|
+
500: 'Internal Server Error',
|
|
220
|
+
502: 'Bad Gateway',
|
|
221
|
+
503: 'Service Unavailable',
|
|
222
|
+
...options.errors,
|
|
223
|
+
};
|
|
224
|
+
const error = errors[result.status];
|
|
225
|
+
if (error) {
|
|
226
|
+
throw new ApiError(options, result, error);
|
|
227
|
+
}
|
|
228
|
+
if (!result.ok) {
|
|
229
|
+
const errorStatus = result.status ?? 'unknown';
|
|
230
|
+
const errorStatusText = result.statusText ?? 'unknown';
|
|
231
|
+
const errorBody = (() => {
|
|
232
|
+
try {
|
|
233
|
+
return JSON.stringify(result.body, null, 2);
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
})();
|
|
239
|
+
throw new ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Request method
|
|
244
|
+
* @param config The OpenAPI configuration object
|
|
245
|
+
* @param options The request options from the service
|
|
246
|
+
* @returns CancelablePromise<T>
|
|
247
|
+
* @throws ApiError
|
|
248
|
+
*/
|
|
249
|
+
export const request = (config, options) => {
|
|
250
|
+
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
251
|
+
try {
|
|
252
|
+
const url = getUrl(config, options);
|
|
253
|
+
const formData = getFormData(options);
|
|
254
|
+
const body = getRequestBody(options);
|
|
255
|
+
const headers = await getHeaders(config, options);
|
|
256
|
+
if (!onCancel.isCancelled) {
|
|
257
|
+
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
258
|
+
const responseBody = await getResponseBody(response);
|
|
259
|
+
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
260
|
+
const result = {
|
|
261
|
+
url,
|
|
262
|
+
ok: response.ok,
|
|
263
|
+
status: response.status,
|
|
264
|
+
statusText: response.statusText,
|
|
265
|
+
body: responseHeader ?? responseBody,
|
|
266
|
+
};
|
|
267
|
+
catchErrorCodes(options, result);
|
|
268
|
+
resolve(result.body);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
reject(error);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { ApiError } from './core/ApiError';
|
|
2
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
3
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
4
|
+
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
5
|
+
export { ApiDtoType } from './models/ApiDtoType';
|
|
6
|
+
export type { ChatCompletionDto } from './models/ChatCompletionDto';
|
|
7
|
+
export type { ChatCompletionStreamCompletedEventDto } from './models/ChatCompletionStreamCompletedEventDto';
|
|
8
|
+
export type { CreateAnthropicChatCompletionDto } from './models/CreateAnthropicChatCompletionDto';
|
|
9
|
+
export type { CreateChatCompletionRequest } from './models/CreateChatCompletionRequest';
|
|
10
|
+
export type { CreateChatCompletionStreamRequest } from './models/CreateChatCompletionStreamRequest';
|
|
11
|
+
export type { CreateGeminiChatCompletionDto } from './models/CreateGeminiChatCompletionDto';
|
|
12
|
+
export type { CreateOpenAiChatCompletionDto } from './models/CreateOpenAiChatCompletionDto';
|
|
13
|
+
export type { CreateOpenAiChatCompletionMessageDto } from './models/CreateOpenAiChatCompletionMessageDto';
|
|
14
|
+
export type { CreateStreamRequest } from './models/CreateStreamRequest';
|
|
15
|
+
export type { CreateWebsiteRequest } from './models/CreateWebsiteRequest';
|
|
16
|
+
export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
|
|
17
|
+
export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
|
|
18
|
+
export type { PubCreateUploadRequest } from './models/PubCreateUploadRequest';
|
|
19
|
+
export type { PubUploadDto } from './models/PubUploadDto';
|
|
20
|
+
export type { PubWebsiteDto } from './models/PubWebsiteDto';
|
|
21
|
+
export type { S3PostRequestDto } from './models/S3PostRequestDto';
|
|
22
|
+
export type { StoredChatCompletionId } from './models/StoredChatCompletionId';
|
|
23
|
+
export type { StoredFileId } from './models/StoredFileId';
|
|
24
|
+
export type { StoredStreamId } from './models/StoredStreamId';
|
|
25
|
+
export type { StoredUploadId } from './models/StoredUploadId';
|
|
26
|
+
export type { StreamDto } from './models/StreamDto';
|
|
27
|
+
export { StreamEventType } from './models/StreamEventType';
|
|
28
|
+
export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
|
|
29
|
+
export type { StreamTimeoutEventDto } from './models/StreamTimeoutEventDto';
|
|
30
|
+
export { StreamType } from './models/StreamType';
|
|
31
|
+
export { PubService } from './services/PubService';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export { ApiError } from './core/ApiError';
|
|
6
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
7
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
8
|
+
export { ApiDtoType } from './models/ApiDtoType';
|
|
9
|
+
export { StreamEventType } from './models/StreamEventType';
|
|
10
|
+
export { StreamType } from './models/StreamType';
|
|
11
|
+
export { PubService } from './services/PubService';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export var ApiDtoType;
|
|
6
|
+
(function (ApiDtoType) {
|
|
7
|
+
ApiDtoType["CHAT_COMPLETION"] = "ChatCompletion";
|
|
8
|
+
ApiDtoType["STREAM"] = "Stream";
|
|
9
|
+
ApiDtoType["CHAT_COMPLETION_SESSION"] = "ChatCompletionSession";
|
|
10
|
+
ApiDtoType["USER"] = "User";
|
|
11
|
+
})(ApiDtoType || (ApiDtoType = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiDtoType } from './ApiDtoType';
|
|
2
|
+
export type ChatCompletionDto = {
|
|
3
|
+
id: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
type: ApiDtoType;
|
|
6
|
+
streamId?: string | null;
|
|
7
|
+
response?: string | null;
|
|
8
|
+
responseIsStructured?: boolean | null;
|
|
9
|
+
userId?: string | null;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StoredChatCompletionId } from './StoredChatCompletionId';
|
|
2
|
+
import type { StoredStreamId } from './StoredStreamId';
|
|
3
|
+
import type { StreamEventType } from './StreamEventType';
|
|
4
|
+
export type ChatCompletionStreamCompletedEventDto = {
|
|
5
|
+
type: StreamEventType;
|
|
6
|
+
streamId: StoredStreamId;
|
|
7
|
+
chatCompletionId: StoredChatCompletionId;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CreateOpenAiChatCompletionMessageDto } from './CreateOpenAiChatCompletionMessageDto';
|
|
2
|
+
export type CreateAnthropicChatCompletionDto = {
|
|
3
|
+
model: string;
|
|
4
|
+
temperature?: number | null;
|
|
5
|
+
topP?: number | null;
|
|
6
|
+
topK?: number | null;
|
|
7
|
+
messages: Array<CreateOpenAiChatCompletionMessageDto>;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CreateAnthropicChatCompletionDto } from './CreateAnthropicChatCompletionDto';
|
|
2
|
+
import type { CreateGeminiChatCompletionDto } from './CreateGeminiChatCompletionDto';
|
|
3
|
+
import type { CreateOpenAiChatCompletionDto } from './CreateOpenAiChatCompletionDto';
|
|
4
|
+
export type CreateChatCompletionRequest = {
|
|
5
|
+
streamId?: string | null;
|
|
6
|
+
sessionClientSecret?: string | null;
|
|
7
|
+
openai?: CreateOpenAiChatCompletionDto;
|
|
8
|
+
gemini?: CreateGeminiChatCompletionDto;
|
|
9
|
+
anthropic?: CreateAnthropicChatCompletionDto;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CreateOpenAiChatCompletionMessageDto } from './CreateOpenAiChatCompletionMessageDto';
|
|
2
|
+
export type CreateOpenAiChatCompletionDto = {
|
|
3
|
+
model: string;
|
|
4
|
+
temperature?: number | null;
|
|
5
|
+
topP?: number | null;
|
|
6
|
+
responseJsonSchema?: string | null;
|
|
7
|
+
messages: Array<CreateOpenAiChatCompletionMessageDto>;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoredFileId } from './StoredFileId';
|
|
2
|
+
import type { StoredStreamId } from './StoredStreamId';
|
|
3
|
+
import type { StoredUploadId } from './StoredUploadId';
|
|
4
|
+
import type { StreamEventType } from './StreamEventType';
|
|
5
|
+
export type FileUploadCompletedEventDto = {
|
|
6
|
+
type: StreamEventType;
|
|
7
|
+
streamId: StoredStreamId;
|
|
8
|
+
uploadId: StoredUploadId;
|
|
9
|
+
fileId: StoredFileId;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StoredChatCompletionId } from './StoredChatCompletionId';
|
|
2
|
+
import type { StoredStreamId } from './StoredStreamId';
|
|
3
|
+
import type { StreamEventType } from './StreamEventType';
|
|
4
|
+
export type NewChatCompletionStreamChunkEventDto = {
|
|
5
|
+
type: StreamEventType;
|
|
6
|
+
streamId: StoredStreamId;
|
|
7
|
+
chatCompletionId: StoredChatCompletionId;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
content: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare enum StreamEventType {
|
|
2
|
+
NEW_CHAT_COMPLETION_STREAM_CHUNK = "NewChatCompletionStreamChunk",
|
|
3
|
+
CHAT_COMPLETION_STREAM_COMPLETED = "ChatCompletionStreamCompleted",
|
|
4
|
+
STREAM_TIMEOUT = "StreamTimeout",
|
|
5
|
+
STREAM_NOT_FOUND = "StreamNotFound",
|
|
6
|
+
FILE_UPLOAD_COMPLETED = "FileUploadCompleted"
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export var StreamEventType;
|
|
6
|
+
(function (StreamEventType) {
|
|
7
|
+
StreamEventType["NEW_CHAT_COMPLETION_STREAM_CHUNK"] = "NewChatCompletionStreamChunk";
|
|
8
|
+
StreamEventType["CHAT_COMPLETION_STREAM_COMPLETED"] = "ChatCompletionStreamCompleted";
|
|
9
|
+
StreamEventType["STREAM_TIMEOUT"] = "StreamTimeout";
|
|
10
|
+
StreamEventType["STREAM_NOT_FOUND"] = "StreamNotFound";
|
|
11
|
+
StreamEventType["FILE_UPLOAD_COMPLETED"] = "FileUploadCompleted";
|
|
12
|
+
})(StreamEventType || (StreamEventType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export var StreamType;
|
|
6
|
+
(function (StreamType) {
|
|
7
|
+
StreamType["CHAT_COMPLETION_STREAM"] = "ChatCompletionStream";
|
|
8
|
+
StreamType["FILE_UPLOAD_STREAM"] = "FileUploadStream";
|
|
9
|
+
})(StreamType || (StreamType = {}));
|