@narrative.io/data-collaboration-sdk-ts 0.0.82 → 0.0.84
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/build/index.d.ts +2 -2
- package/build/index.js +2 -2
- package/build/rosetta/types.d.ts +186 -121
- package/build/rosetta/types.js +11 -17
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -25,9 +25,9 @@ import { convertNqlObjectToForecastBody } from './nql/DataRulesConverter';
|
|
|
25
25
|
import { AuthenticationApi, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse } from './authentication';
|
|
26
26
|
import { AppsApi, type App } from './apps';
|
|
27
27
|
import type { ForecastBody } from './nql/types';
|
|
28
|
-
import { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type
|
|
28
|
+
import { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, isConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, isConversationAssistantMessageWithFunctionCall } from './rosetta/types';
|
|
29
29
|
declare class NarrativeApi extends BaseApi {
|
|
30
30
|
}
|
|
31
31
|
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi {
|
|
32
32
|
}
|
|
33
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, type App, type Resource, type UploadsResponse, type PingStatus, type Attribute, type RefAttribute, type SubAttribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type ConversationAssistantMessage, type ConversationFunctionMessage, type
|
|
33
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, type App, type Resource, type UploadsResponse, type PingStatus, type Attribute, type RefAttribute, type SubAttribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall };
|
package/build/index.js
CHANGED
|
@@ -18,8 +18,8 @@ import { getNqlObject, buildNql } from './nql/NQLParser';
|
|
|
18
18
|
import { convertNqlObjectToForecastBody } from './nql/DataRulesConverter';
|
|
19
19
|
import { AuthenticationApi } from './authentication';
|
|
20
20
|
import { AppsApi } from './apps';
|
|
21
|
-
import { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall } from './rosetta/types';
|
|
21
|
+
import { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall } from './rosetta/types';
|
|
22
22
|
class NarrativeApi extends BaseApi {
|
|
23
23
|
}
|
|
24
24
|
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi]);
|
|
25
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall };
|
|
25
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall };
|
package/build/rosetta/types.d.ts
CHANGED
|
@@ -6,24 +6,24 @@ declare const ChatCompletionRequestMessageName: z.ZodEffects<z.ZodString, string
|
|
|
6
6
|
type ConversationMessageName = z.infer<typeof ChatCompletionRequestMessageName>;
|
|
7
7
|
declare const isConversationMessageName: (input: unknown) => input is string;
|
|
8
8
|
declare const ChatCompletionRequestUserMessageSchema: z.ZodObject<{
|
|
9
|
-
role: z.
|
|
9
|
+
role: z.ZodEnum<["user"]>;
|
|
10
10
|
content: z.ZodString;
|
|
11
11
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
12
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
role: "
|
|
14
|
+
role: "user";
|
|
15
15
|
content: string;
|
|
16
16
|
name?: string | undefined;
|
|
17
17
|
timestamp?: number | undefined;
|
|
18
18
|
}, {
|
|
19
|
-
role: "
|
|
19
|
+
role: "user";
|
|
20
20
|
content: string;
|
|
21
21
|
name?: string | undefined;
|
|
22
22
|
timestamp?: number | undefined;
|
|
23
23
|
}>;
|
|
24
24
|
type ConversationUserMessage = z.infer<typeof ChatCompletionRequestUserMessageSchema>;
|
|
25
25
|
declare const isConversationUserMessage: (input: unknown) => input is {
|
|
26
|
-
role: "
|
|
26
|
+
role: "user";
|
|
27
27
|
content: string;
|
|
28
28
|
name?: string | undefined;
|
|
29
29
|
timestamp?: number | undefined;
|
|
@@ -43,20 +43,61 @@ declare const isConversationMessageFunctionCall: (input: unknown) => input is {
|
|
|
43
43
|
name: string;
|
|
44
44
|
arguments: string;
|
|
45
45
|
};
|
|
46
|
+
declare const ChatCompletionRequestAssistantMessageWithFunctionCall: z.ZodObject<{
|
|
47
|
+
role: z.ZodEnum<["assistant"]>;
|
|
48
|
+
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
49
|
+
function_call: z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
arguments: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
name: string;
|
|
54
|
+
arguments: string;
|
|
55
|
+
}, {
|
|
56
|
+
name: string;
|
|
57
|
+
arguments: string;
|
|
58
|
+
}>;
|
|
59
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
role: "assistant";
|
|
62
|
+
content: string | null;
|
|
63
|
+
function_call: {
|
|
64
|
+
name: string;
|
|
65
|
+
arguments: string;
|
|
66
|
+
};
|
|
67
|
+
timestamp?: number | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
role: "assistant";
|
|
70
|
+
content: string | null;
|
|
71
|
+
function_call: {
|
|
72
|
+
name: string;
|
|
73
|
+
arguments: string;
|
|
74
|
+
};
|
|
75
|
+
timestamp?: number | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
type ConversationAssistantMessageWithFunctionCall = z.infer<typeof ChatCompletionRequestAssistantMessageWithFunctionCall>;
|
|
78
|
+
declare const isConversationAssistantMessageWithFunctionCall: (input: unknown) => input is {
|
|
79
|
+
role: "assistant";
|
|
80
|
+
content: string | null;
|
|
81
|
+
function_call: {
|
|
82
|
+
name: string;
|
|
83
|
+
arguments: string;
|
|
84
|
+
};
|
|
85
|
+
timestamp?: number | undefined;
|
|
86
|
+
};
|
|
46
87
|
declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
47
|
-
role: z.
|
|
88
|
+
role: z.ZodEnum<["assistant"]>;
|
|
48
89
|
content: z.ZodString;
|
|
49
90
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
50
91
|
}, "strict", z.ZodTypeAny, {
|
|
51
|
-
role: "
|
|
92
|
+
role: "assistant";
|
|
52
93
|
content: string;
|
|
53
94
|
timestamp?: number | undefined;
|
|
54
95
|
}, {
|
|
55
|
-
role: "
|
|
96
|
+
role: "assistant";
|
|
56
97
|
content: string;
|
|
57
98
|
timestamp?: number | undefined;
|
|
58
99
|
}>, z.ZodObject<{
|
|
59
|
-
role: z.
|
|
100
|
+
role: z.ZodEnum<["assistant"]>;
|
|
60
101
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
61
102
|
function_call: z.ZodObject<{
|
|
62
103
|
name: z.ZodString;
|
|
@@ -70,7 +111,7 @@ declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
|
70
111
|
}>;
|
|
71
112
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
72
113
|
}, "strict", z.ZodTypeAny, {
|
|
73
|
-
role: "
|
|
114
|
+
role: "assistant";
|
|
74
115
|
content: string | null;
|
|
75
116
|
function_call: {
|
|
76
117
|
name: string;
|
|
@@ -78,7 +119,7 @@ declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
|
78
119
|
};
|
|
79
120
|
timestamp?: number | undefined;
|
|
80
121
|
}, {
|
|
81
|
-
role: "
|
|
122
|
+
role: "assistant";
|
|
82
123
|
content: string | null;
|
|
83
124
|
function_call: {
|
|
84
125
|
name: string;
|
|
@@ -88,7 +129,7 @@ declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
|
88
129
|
}>]>;
|
|
89
130
|
type ConversationAssistantMessage = z.infer<typeof ChatCompletionAssistantMessage>;
|
|
90
131
|
declare const isConversationAssistantMessage: (input: unknown) => input is {
|
|
91
|
-
role: "
|
|
132
|
+
role: "assistant";
|
|
92
133
|
content: string | null;
|
|
93
134
|
function_call: {
|
|
94
135
|
name: string;
|
|
@@ -96,73 +137,77 @@ declare const isConversationAssistantMessage: (input: unknown) => input is {
|
|
|
96
137
|
};
|
|
97
138
|
timestamp?: number | undefined;
|
|
98
139
|
} | {
|
|
99
|
-
role: "
|
|
140
|
+
role: "assistant";
|
|
100
141
|
content: string;
|
|
101
142
|
timestamp?: number | undefined;
|
|
102
143
|
};
|
|
103
144
|
declare const ChatCompletionSystemMessageSchema: z.ZodObject<{
|
|
104
|
-
role: z.
|
|
145
|
+
role: z.ZodEnum<["system"]>;
|
|
105
146
|
content: z.ZodString;
|
|
106
147
|
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
role: "
|
|
148
|
+
role: "system";
|
|
108
149
|
content: string;
|
|
109
150
|
}, {
|
|
110
|
-
role: "
|
|
151
|
+
role: "system";
|
|
111
152
|
content: string;
|
|
112
153
|
}>;
|
|
113
154
|
type ConversationSystemMessage = z.infer<typeof ChatCompletionSystemMessageSchema>;
|
|
114
155
|
declare const isConversationSystemMessage: (input: unknown) => input is {
|
|
115
|
-
role: "
|
|
156
|
+
role: "system";
|
|
116
157
|
content: string;
|
|
117
158
|
};
|
|
118
159
|
declare const ChatCompletionFunctionMessageSchema: z.ZodObject<{
|
|
119
|
-
role: z.
|
|
160
|
+
role: z.ZodEnum<["function"]>;
|
|
120
161
|
content: z.ZodString;
|
|
121
162
|
name: z.ZodString;
|
|
163
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
122
164
|
}, "strip", z.ZodTypeAny, {
|
|
123
165
|
name: string;
|
|
124
|
-
role: "function"
|
|
166
|
+
role: "function";
|
|
125
167
|
content: string;
|
|
168
|
+
timestamp?: number | undefined;
|
|
126
169
|
}, {
|
|
127
170
|
name: string;
|
|
128
|
-
role: "function"
|
|
171
|
+
role: "function";
|
|
129
172
|
content: string;
|
|
173
|
+
timestamp?: number | undefined;
|
|
130
174
|
}>;
|
|
131
175
|
type ConversationFunctionMessage = z.infer<typeof ChatCompletionFunctionMessageSchema>;
|
|
132
176
|
declare const isConversationFunctionMessage: (input: unknown) => input is {
|
|
133
177
|
name: string;
|
|
134
|
-
role: "function"
|
|
178
|
+
role: "function";
|
|
135
179
|
content: string;
|
|
180
|
+
timestamp?: number | undefined;
|
|
136
181
|
};
|
|
137
182
|
declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
138
|
-
role: z.
|
|
183
|
+
role: z.ZodEnum<["user"]>;
|
|
139
184
|
content: z.ZodString;
|
|
140
185
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
141
186
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
142
187
|
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
role: "
|
|
188
|
+
role: "user";
|
|
144
189
|
content: string;
|
|
145
190
|
name?: string | undefined;
|
|
146
191
|
timestamp?: number | undefined;
|
|
147
192
|
}, {
|
|
148
|
-
role: "
|
|
193
|
+
role: "user";
|
|
149
194
|
content: string;
|
|
150
195
|
name?: string | undefined;
|
|
151
196
|
timestamp?: number | undefined;
|
|
152
197
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
153
|
-
role: z.
|
|
198
|
+
role: z.ZodEnum<["assistant"]>;
|
|
154
199
|
content: z.ZodString;
|
|
155
200
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
156
201
|
}, "strict", z.ZodTypeAny, {
|
|
157
|
-
role: "
|
|
202
|
+
role: "assistant";
|
|
158
203
|
content: string;
|
|
159
204
|
timestamp?: number | undefined;
|
|
160
205
|
}, {
|
|
161
|
-
role: "
|
|
206
|
+
role: "assistant";
|
|
162
207
|
content: string;
|
|
163
208
|
timestamp?: number | undefined;
|
|
164
209
|
}>, z.ZodObject<{
|
|
165
|
-
role: z.
|
|
210
|
+
role: z.ZodEnum<["assistant"]>;
|
|
166
211
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
167
212
|
function_call: z.ZodObject<{
|
|
168
213
|
name: z.ZodString;
|
|
@@ -176,7 +221,7 @@ declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
176
221
|
}>;
|
|
177
222
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
178
223
|
}, "strict", z.ZodTypeAny, {
|
|
179
|
-
role: "
|
|
224
|
+
role: "assistant";
|
|
180
225
|
content: string | null;
|
|
181
226
|
function_call: {
|
|
182
227
|
name: string;
|
|
@@ -184,7 +229,7 @@ declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
184
229
|
};
|
|
185
230
|
timestamp?: number | undefined;
|
|
186
231
|
}, {
|
|
187
|
-
role: "
|
|
232
|
+
role: "assistant";
|
|
188
233
|
content: string | null;
|
|
189
234
|
function_call: {
|
|
190
235
|
name: string;
|
|
@@ -192,35 +237,38 @@ declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
192
237
|
};
|
|
193
238
|
timestamp?: number | undefined;
|
|
194
239
|
}>]>, z.ZodObject<{
|
|
195
|
-
role: z.
|
|
240
|
+
role: z.ZodEnum<["system"]>;
|
|
196
241
|
content: z.ZodString;
|
|
197
242
|
}, "strip", z.ZodTypeAny, {
|
|
198
|
-
role: "
|
|
243
|
+
role: "system";
|
|
199
244
|
content: string;
|
|
200
245
|
}, {
|
|
201
|
-
role: "
|
|
246
|
+
role: "system";
|
|
202
247
|
content: string;
|
|
203
248
|
}>, z.ZodObject<{
|
|
204
|
-
role: z.
|
|
249
|
+
role: z.ZodEnum<["function"]>;
|
|
205
250
|
content: z.ZodString;
|
|
206
251
|
name: z.ZodString;
|
|
252
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
207
253
|
}, "strip", z.ZodTypeAny, {
|
|
208
254
|
name: string;
|
|
209
|
-
role: "function"
|
|
255
|
+
role: "function";
|
|
210
256
|
content: string;
|
|
257
|
+
timestamp?: number | undefined;
|
|
211
258
|
}, {
|
|
212
259
|
name: string;
|
|
213
|
-
role: "function"
|
|
260
|
+
role: "function";
|
|
214
261
|
content: string;
|
|
262
|
+
timestamp?: number | undefined;
|
|
215
263
|
}>]>;
|
|
216
264
|
type ConversationMessage = z.infer<typeof ChatCompletionRequestMessageSchema>;
|
|
217
265
|
declare const isConversationMessage: (input: unknown) => input is {
|
|
218
|
-
role: "
|
|
266
|
+
role: "user";
|
|
219
267
|
content: string;
|
|
220
268
|
name?: string | undefined;
|
|
221
269
|
timestamp?: number | undefined;
|
|
222
270
|
} | {
|
|
223
|
-
role: "
|
|
271
|
+
role: "assistant";
|
|
224
272
|
content: string | null;
|
|
225
273
|
function_call: {
|
|
226
274
|
name: string;
|
|
@@ -228,46 +276,47 @@ declare const isConversationMessage: (input: unknown) => input is {
|
|
|
228
276
|
};
|
|
229
277
|
timestamp?: number | undefined;
|
|
230
278
|
} | {
|
|
231
|
-
role: "
|
|
279
|
+
role: "assistant";
|
|
232
280
|
content: string;
|
|
233
281
|
timestamp?: number | undefined;
|
|
234
282
|
} | {
|
|
235
|
-
role: "
|
|
283
|
+
role: "system";
|
|
236
284
|
content: string;
|
|
237
285
|
} | {
|
|
238
286
|
name: string;
|
|
239
|
-
role: "function"
|
|
287
|
+
role: "function";
|
|
240
288
|
content: string;
|
|
289
|
+
timestamp?: number | undefined;
|
|
241
290
|
};
|
|
242
291
|
declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
243
|
-
role: z.
|
|
292
|
+
role: z.ZodEnum<["user"]>;
|
|
244
293
|
content: z.ZodString;
|
|
245
294
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
246
295
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
247
296
|
}, "strip", z.ZodTypeAny, {
|
|
248
|
-
role: "
|
|
297
|
+
role: "user";
|
|
249
298
|
content: string;
|
|
250
299
|
name?: string | undefined;
|
|
251
300
|
timestamp?: number | undefined;
|
|
252
301
|
}, {
|
|
253
|
-
role: "
|
|
302
|
+
role: "user";
|
|
254
303
|
content: string;
|
|
255
304
|
name?: string | undefined;
|
|
256
305
|
timestamp?: number | undefined;
|
|
257
306
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
258
|
-
role: z.
|
|
307
|
+
role: z.ZodEnum<["assistant"]>;
|
|
259
308
|
content: z.ZodString;
|
|
260
309
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
261
310
|
}, "strict", z.ZodTypeAny, {
|
|
262
|
-
role: "
|
|
311
|
+
role: "assistant";
|
|
263
312
|
content: string;
|
|
264
313
|
timestamp?: number | undefined;
|
|
265
314
|
}, {
|
|
266
|
-
role: "
|
|
315
|
+
role: "assistant";
|
|
267
316
|
content: string;
|
|
268
317
|
timestamp?: number | undefined;
|
|
269
318
|
}>, z.ZodObject<{
|
|
270
|
-
role: z.
|
|
319
|
+
role: z.ZodEnum<["assistant"]>;
|
|
271
320
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
272
321
|
function_call: z.ZodObject<{
|
|
273
322
|
name: z.ZodString;
|
|
@@ -281,7 +330,7 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
281
330
|
}>;
|
|
282
331
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
283
332
|
}, "strict", z.ZodTypeAny, {
|
|
284
|
-
role: "
|
|
333
|
+
role: "assistant";
|
|
285
334
|
content: string | null;
|
|
286
335
|
function_call: {
|
|
287
336
|
name: string;
|
|
@@ -289,7 +338,7 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
289
338
|
};
|
|
290
339
|
timestamp?: number | undefined;
|
|
291
340
|
}, {
|
|
292
|
-
role: "
|
|
341
|
+
role: "assistant";
|
|
293
342
|
content: string | null;
|
|
294
343
|
function_call: {
|
|
295
344
|
name: string;
|
|
@@ -297,33 +346,36 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
297
346
|
};
|
|
298
347
|
timestamp?: number | undefined;
|
|
299
348
|
}>]>, z.ZodObject<{
|
|
300
|
-
role: z.
|
|
349
|
+
role: z.ZodEnum<["system"]>;
|
|
301
350
|
content: z.ZodString;
|
|
302
351
|
}, "strip", z.ZodTypeAny, {
|
|
303
|
-
role: "
|
|
352
|
+
role: "system";
|
|
304
353
|
content: string;
|
|
305
354
|
}, {
|
|
306
|
-
role: "
|
|
355
|
+
role: "system";
|
|
307
356
|
content: string;
|
|
308
357
|
}>, z.ZodObject<{
|
|
309
|
-
role: z.
|
|
358
|
+
role: z.ZodEnum<["function"]>;
|
|
310
359
|
content: z.ZodString;
|
|
311
360
|
name: z.ZodString;
|
|
361
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
312
362
|
}, "strip", z.ZodTypeAny, {
|
|
313
363
|
name: string;
|
|
314
|
-
role: "function"
|
|
364
|
+
role: "function";
|
|
315
365
|
content: string;
|
|
366
|
+
timestamp?: number | undefined;
|
|
316
367
|
}, {
|
|
317
368
|
name: string;
|
|
318
|
-
role: "function"
|
|
369
|
+
role: "function";
|
|
319
370
|
content: string;
|
|
371
|
+
timestamp?: number | undefined;
|
|
320
372
|
}>]>, "many">, ({
|
|
321
|
-
role: "
|
|
373
|
+
role: "user";
|
|
322
374
|
content: string;
|
|
323
375
|
name?: string | undefined;
|
|
324
376
|
timestamp?: number | undefined;
|
|
325
377
|
} | {
|
|
326
|
-
role: "
|
|
378
|
+
role: "assistant";
|
|
327
379
|
content: string | null;
|
|
328
380
|
function_call: {
|
|
329
381
|
name: string;
|
|
@@ -331,23 +383,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
331
383
|
};
|
|
332
384
|
timestamp?: number | undefined;
|
|
333
385
|
} | {
|
|
334
|
-
role: "
|
|
386
|
+
role: "assistant";
|
|
335
387
|
content: string;
|
|
336
388
|
timestamp?: number | undefined;
|
|
337
389
|
} | {
|
|
338
|
-
role: "
|
|
390
|
+
role: "system";
|
|
339
391
|
content: string;
|
|
340
392
|
} | {
|
|
341
393
|
name: string;
|
|
342
|
-
role: "function"
|
|
394
|
+
role: "function";
|
|
343
395
|
content: string;
|
|
396
|
+
timestamp?: number | undefined;
|
|
344
397
|
})[], ({
|
|
345
|
-
role: "
|
|
398
|
+
role: "user";
|
|
346
399
|
content: string;
|
|
347
400
|
name?: string | undefined;
|
|
348
401
|
timestamp?: number | undefined;
|
|
349
402
|
} | {
|
|
350
|
-
role: "
|
|
403
|
+
role: "assistant";
|
|
351
404
|
content: string | null;
|
|
352
405
|
function_call: {
|
|
353
406
|
name: string;
|
|
@@ -355,23 +408,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
355
408
|
};
|
|
356
409
|
timestamp?: number | undefined;
|
|
357
410
|
} | {
|
|
358
|
-
role: "
|
|
411
|
+
role: "assistant";
|
|
359
412
|
content: string;
|
|
360
413
|
timestamp?: number | undefined;
|
|
361
414
|
} | {
|
|
362
|
-
role: "
|
|
415
|
+
role: "system";
|
|
363
416
|
content: string;
|
|
364
417
|
} | {
|
|
365
418
|
name: string;
|
|
366
|
-
role: "function"
|
|
419
|
+
role: "function";
|
|
367
420
|
content: string;
|
|
421
|
+
timestamp?: number | undefined;
|
|
368
422
|
})[]>, ({
|
|
369
|
-
role: "
|
|
423
|
+
role: "user";
|
|
370
424
|
content: string;
|
|
371
425
|
name?: string | undefined;
|
|
372
426
|
timestamp?: number | undefined;
|
|
373
427
|
} | {
|
|
374
|
-
role: "
|
|
428
|
+
role: "assistant";
|
|
375
429
|
content: string | null;
|
|
376
430
|
function_call: {
|
|
377
431
|
name: string;
|
|
@@ -379,23 +433,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
379
433
|
};
|
|
380
434
|
timestamp?: number | undefined;
|
|
381
435
|
} | {
|
|
382
|
-
role: "
|
|
436
|
+
role: "assistant";
|
|
383
437
|
content: string;
|
|
384
438
|
timestamp?: number | undefined;
|
|
385
439
|
} | {
|
|
386
|
-
role: "
|
|
440
|
+
role: "system";
|
|
387
441
|
content: string;
|
|
388
442
|
} | {
|
|
389
443
|
name: string;
|
|
390
|
-
role: "function"
|
|
444
|
+
role: "function";
|
|
391
445
|
content: string;
|
|
446
|
+
timestamp?: number | undefined;
|
|
392
447
|
})[], ({
|
|
393
|
-
role: "
|
|
448
|
+
role: "user";
|
|
394
449
|
content: string;
|
|
395
450
|
name?: string | undefined;
|
|
396
451
|
timestamp?: number | undefined;
|
|
397
452
|
} | {
|
|
398
|
-
role: "
|
|
453
|
+
role: "assistant";
|
|
399
454
|
content: string | null;
|
|
400
455
|
function_call: {
|
|
401
456
|
name: string;
|
|
@@ -403,23 +458,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
403
458
|
};
|
|
404
459
|
timestamp?: number | undefined;
|
|
405
460
|
} | {
|
|
406
|
-
role: "
|
|
461
|
+
role: "assistant";
|
|
407
462
|
content: string;
|
|
408
463
|
timestamp?: number | undefined;
|
|
409
464
|
} | {
|
|
410
|
-
role: "
|
|
465
|
+
role: "system";
|
|
411
466
|
content: string;
|
|
412
467
|
} | {
|
|
413
468
|
name: string;
|
|
414
|
-
role: "function"
|
|
469
|
+
role: "function";
|
|
415
470
|
content: string;
|
|
471
|
+
timestamp?: number | undefined;
|
|
416
472
|
})[]>, ({
|
|
417
|
-
role: "
|
|
473
|
+
role: "user";
|
|
418
474
|
content: string;
|
|
419
475
|
name?: string | undefined;
|
|
420
476
|
timestamp?: number | undefined;
|
|
421
477
|
} | {
|
|
422
|
-
role: "
|
|
478
|
+
role: "assistant";
|
|
423
479
|
content: string | null;
|
|
424
480
|
function_call: {
|
|
425
481
|
name: string;
|
|
@@ -427,23 +483,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
427
483
|
};
|
|
428
484
|
timestamp?: number | undefined;
|
|
429
485
|
} | {
|
|
430
|
-
role: "
|
|
486
|
+
role: "assistant";
|
|
431
487
|
content: string;
|
|
432
488
|
timestamp?: number | undefined;
|
|
433
489
|
} | {
|
|
434
|
-
role: "
|
|
490
|
+
role: "system";
|
|
435
491
|
content: string;
|
|
436
492
|
} | {
|
|
437
493
|
name: string;
|
|
438
|
-
role: "function"
|
|
494
|
+
role: "function";
|
|
439
495
|
content: string;
|
|
496
|
+
timestamp?: number | undefined;
|
|
440
497
|
})[], ({
|
|
441
|
-
role: "
|
|
498
|
+
role: "user";
|
|
442
499
|
content: string;
|
|
443
500
|
name?: string | undefined;
|
|
444
501
|
timestamp?: number | undefined;
|
|
445
502
|
} | {
|
|
446
|
-
role: "
|
|
503
|
+
role: "assistant";
|
|
447
504
|
content: string | null;
|
|
448
505
|
function_call: {
|
|
449
506
|
name: string;
|
|
@@ -451,23 +508,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
451
508
|
};
|
|
452
509
|
timestamp?: number | undefined;
|
|
453
510
|
} | {
|
|
454
|
-
role: "
|
|
511
|
+
role: "assistant";
|
|
455
512
|
content: string;
|
|
456
513
|
timestamp?: number | undefined;
|
|
457
514
|
} | {
|
|
458
|
-
role: "
|
|
515
|
+
role: "system";
|
|
459
516
|
content: string;
|
|
460
517
|
} | {
|
|
461
518
|
name: string;
|
|
462
|
-
role: "function"
|
|
519
|
+
role: "function";
|
|
463
520
|
content: string;
|
|
521
|
+
timestamp?: number | undefined;
|
|
464
522
|
})[]>, ({
|
|
465
|
-
role: "
|
|
523
|
+
role: "user";
|
|
466
524
|
content: string;
|
|
467
525
|
name?: string | undefined;
|
|
468
526
|
timestamp?: number | undefined;
|
|
469
527
|
} | {
|
|
470
|
-
role: "
|
|
528
|
+
role: "assistant";
|
|
471
529
|
content: string | null;
|
|
472
530
|
function_call: {
|
|
473
531
|
name: string;
|
|
@@ -475,23 +533,24 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
475
533
|
};
|
|
476
534
|
timestamp?: number | undefined;
|
|
477
535
|
} | {
|
|
478
|
-
role: "
|
|
536
|
+
role: "assistant";
|
|
479
537
|
content: string;
|
|
480
538
|
timestamp?: number | undefined;
|
|
481
539
|
} | {
|
|
482
|
-
role: "
|
|
540
|
+
role: "system";
|
|
483
541
|
content: string;
|
|
484
542
|
} | {
|
|
485
543
|
name: string;
|
|
486
|
-
role: "function"
|
|
544
|
+
role: "function";
|
|
487
545
|
content: string;
|
|
546
|
+
timestamp?: number | undefined;
|
|
488
547
|
})[], ({
|
|
489
|
-
role: "
|
|
548
|
+
role: "user";
|
|
490
549
|
content: string;
|
|
491
550
|
name?: string | undefined;
|
|
492
551
|
timestamp?: number | undefined;
|
|
493
552
|
} | {
|
|
494
|
-
role: "
|
|
553
|
+
role: "assistant";
|
|
495
554
|
content: string | null;
|
|
496
555
|
function_call: {
|
|
497
556
|
name: string;
|
|
@@ -499,25 +558,26 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
499
558
|
};
|
|
500
559
|
timestamp?: number | undefined;
|
|
501
560
|
} | {
|
|
502
|
-
role: "
|
|
561
|
+
role: "assistant";
|
|
503
562
|
content: string;
|
|
504
563
|
timestamp?: number | undefined;
|
|
505
564
|
} | {
|
|
506
|
-
role: "
|
|
565
|
+
role: "system";
|
|
507
566
|
content: string;
|
|
508
567
|
} | {
|
|
509
568
|
name: string;
|
|
510
|
-
role: "function"
|
|
569
|
+
role: "function";
|
|
511
570
|
content: string;
|
|
571
|
+
timestamp?: number | undefined;
|
|
512
572
|
})[]>;
|
|
513
573
|
type ConversationMessages = z.infer<typeof ChatCompletionRequestMessagesSchema>;
|
|
514
574
|
declare const isConversationMessages: (input: unknown) => input is ({
|
|
515
|
-
role: "
|
|
575
|
+
role: "user";
|
|
516
576
|
content: string;
|
|
517
577
|
name?: string | undefined;
|
|
518
578
|
timestamp?: number | undefined;
|
|
519
579
|
} | {
|
|
520
|
-
role: "
|
|
580
|
+
role: "assistant";
|
|
521
581
|
content: string | null;
|
|
522
582
|
function_call: {
|
|
523
583
|
name: string;
|
|
@@ -525,46 +585,47 @@ declare const isConversationMessages: (input: unknown) => input is ({
|
|
|
525
585
|
};
|
|
526
586
|
timestamp?: number | undefined;
|
|
527
587
|
} | {
|
|
528
|
-
role: "
|
|
588
|
+
role: "assistant";
|
|
529
589
|
content: string;
|
|
530
590
|
timestamp?: number | undefined;
|
|
531
591
|
} | {
|
|
532
|
-
role: "
|
|
592
|
+
role: "system";
|
|
533
593
|
content: string;
|
|
534
594
|
} | {
|
|
535
595
|
name: string;
|
|
536
|
-
role: "function"
|
|
596
|
+
role: "function";
|
|
537
597
|
content: string;
|
|
598
|
+
timestamp?: number | undefined;
|
|
538
599
|
})[];
|
|
539
600
|
declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
540
|
-
role: z.
|
|
601
|
+
role: z.ZodEnum<["user"]>;
|
|
541
602
|
content: z.ZodString;
|
|
542
603
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
543
604
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
544
605
|
}, "strip", z.ZodTypeAny, {
|
|
545
|
-
role: "
|
|
606
|
+
role: "user";
|
|
546
607
|
content: string;
|
|
547
608
|
name?: string | undefined;
|
|
548
609
|
timestamp?: number | undefined;
|
|
549
610
|
}, {
|
|
550
|
-
role: "
|
|
611
|
+
role: "user";
|
|
551
612
|
content: string;
|
|
552
613
|
name?: string | undefined;
|
|
553
614
|
timestamp?: number | undefined;
|
|
554
615
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
555
|
-
role: z.
|
|
616
|
+
role: z.ZodEnum<["assistant"]>;
|
|
556
617
|
content: z.ZodString;
|
|
557
618
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
558
619
|
}, "strict", z.ZodTypeAny, {
|
|
559
|
-
role: "
|
|
620
|
+
role: "assistant";
|
|
560
621
|
content: string;
|
|
561
622
|
timestamp?: number | undefined;
|
|
562
623
|
}, {
|
|
563
|
-
role: "
|
|
624
|
+
role: "assistant";
|
|
564
625
|
content: string;
|
|
565
626
|
timestamp?: number | undefined;
|
|
566
627
|
}>, z.ZodObject<{
|
|
567
|
-
role: z.
|
|
628
|
+
role: z.ZodEnum<["assistant"]>;
|
|
568
629
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
569
630
|
function_call: z.ZodObject<{
|
|
570
631
|
name: z.ZodString;
|
|
@@ -578,7 +639,7 @@ declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
578
639
|
}>;
|
|
579
640
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
580
641
|
}, "strict", z.ZodTypeAny, {
|
|
581
|
-
role: "
|
|
642
|
+
role: "assistant";
|
|
582
643
|
content: string | null;
|
|
583
644
|
function_call: {
|
|
584
645
|
name: string;
|
|
@@ -586,7 +647,7 @@ declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
586
647
|
};
|
|
587
648
|
timestamp?: number | undefined;
|
|
588
649
|
}, {
|
|
589
|
-
role: "
|
|
650
|
+
role: "assistant";
|
|
590
651
|
content: string | null;
|
|
591
652
|
function_call: {
|
|
592
653
|
name: string;
|
|
@@ -594,26 +655,29 @@ declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
594
655
|
};
|
|
595
656
|
timestamp?: number | undefined;
|
|
596
657
|
}>]>, z.ZodObject<{
|
|
597
|
-
role: z.
|
|
658
|
+
role: z.ZodEnum<["function"]>;
|
|
598
659
|
content: z.ZodString;
|
|
599
660
|
name: z.ZodString;
|
|
661
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
600
662
|
}, "strip", z.ZodTypeAny, {
|
|
601
663
|
name: string;
|
|
602
|
-
role: "function"
|
|
664
|
+
role: "function";
|
|
603
665
|
content: string;
|
|
666
|
+
timestamp?: number | undefined;
|
|
604
667
|
}, {
|
|
605
668
|
name: string;
|
|
606
|
-
role: "function"
|
|
669
|
+
role: "function";
|
|
607
670
|
content: string;
|
|
671
|
+
timestamp?: number | undefined;
|
|
608
672
|
}>]>;
|
|
609
|
-
type
|
|
673
|
+
type ConversationIOMessage = z.infer<typeof ChatCompletionRequestInputMessageSchema>;
|
|
610
674
|
declare const isConversationInputMessage: (input: unknown) => input is {
|
|
611
|
-
role: "
|
|
675
|
+
role: "user";
|
|
612
676
|
content: string;
|
|
613
677
|
name?: string | undefined;
|
|
614
678
|
timestamp?: number | undefined;
|
|
615
679
|
} | {
|
|
616
|
-
role: "
|
|
680
|
+
role: "assistant";
|
|
617
681
|
content: string | null;
|
|
618
682
|
function_call: {
|
|
619
683
|
name: string;
|
|
@@ -621,17 +685,18 @@ declare const isConversationInputMessage: (input: unknown) => input is {
|
|
|
621
685
|
};
|
|
622
686
|
timestamp?: number | undefined;
|
|
623
687
|
} | {
|
|
624
|
-
role: "
|
|
688
|
+
role: "assistant";
|
|
625
689
|
content: string;
|
|
626
690
|
timestamp?: number | undefined;
|
|
627
691
|
} | {
|
|
628
692
|
name: string;
|
|
629
|
-
role: "function"
|
|
693
|
+
role: "function";
|
|
630
694
|
content: string;
|
|
695
|
+
timestamp?: number | undefined;
|
|
631
696
|
};
|
|
632
697
|
interface AddMessageEvent {
|
|
633
698
|
type: 'addMessage';
|
|
634
|
-
data:
|
|
699
|
+
data: ConversationIOMessage;
|
|
635
700
|
}
|
|
636
701
|
interface PingEvent {
|
|
637
702
|
type: 'ping';
|
|
@@ -648,11 +713,11 @@ interface RosettaMessageEvent extends MessageEvent {
|
|
|
648
713
|
}
|
|
649
714
|
interface AddMessageResponse {
|
|
650
715
|
type: 'newMessage';
|
|
651
|
-
data:
|
|
716
|
+
data: ConversationIOMessage;
|
|
652
717
|
}
|
|
653
718
|
interface HistoryResponse {
|
|
654
719
|
type: 'history';
|
|
655
|
-
data:
|
|
720
|
+
data: ConversationIOMessage[];
|
|
656
721
|
}
|
|
657
722
|
interface ClearHistoryResponse {
|
|
658
723
|
type: 'historyCleared';
|
|
@@ -665,4 +730,4 @@ interface RosettaResponseMessageEvent extends MessageEvent {
|
|
|
665
730
|
data: RosettaResponseMessage;
|
|
666
731
|
}
|
|
667
732
|
declare function isType<T>(input: unknown, schema: z.ZodType<T>): input is T;
|
|
668
|
-
export { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type
|
|
733
|
+
export { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, isConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, isConversationAssistantMessageWithFunctionCall };
|
package/build/rosetta/types.js
CHANGED
|
@@ -21,9 +21,7 @@ const ChatCompletionRequestMessageTimestamp = z.number().int().min(1670112000000
|
|
|
21
21
|
// User Message
|
|
22
22
|
/// ///////////////////
|
|
23
23
|
const ChatCompletionRequestUserMessageSchema = z.object({
|
|
24
|
-
role:
|
|
25
|
-
message: 'Role must be user'
|
|
26
|
-
}),
|
|
24
|
+
role: z.enum(['user']),
|
|
27
25
|
content: z.string().min(1),
|
|
28
26
|
name: ChatCompletionRequestMessageName.optional(),
|
|
29
27
|
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
@@ -45,17 +43,16 @@ const isConversationMessageFunctionCall = (input) => {
|
|
|
45
43
|
// Assistant Message
|
|
46
44
|
/// ///////////////////
|
|
47
45
|
const ChatCompletionRequestAssistantMessageWithFunctionCall = z.object({
|
|
48
|
-
role:
|
|
49
|
-
message: 'Role must be assistant'
|
|
50
|
-
}),
|
|
46
|
+
role: z.enum(['assistant']),
|
|
51
47
|
content: z.null().or(z.string()),
|
|
52
48
|
function_call: ChatCompletionRequestMessageFunctionCall,
|
|
53
49
|
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
54
50
|
}).strict();
|
|
51
|
+
const isConversationAssistantMessageWithFunctionCall = (input) => {
|
|
52
|
+
return ChatCompletionRequestAssistantMessageWithFunctionCall.safeParse(input).success;
|
|
53
|
+
};
|
|
55
54
|
const ChatCompletionRequestAssistantMessage = z.object({
|
|
56
|
-
role:
|
|
57
|
-
message: 'Role must be assistant'
|
|
58
|
-
}),
|
|
55
|
+
role: z.enum(['assistant']),
|
|
59
56
|
content: z.string(),
|
|
60
57
|
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
61
58
|
}).strict();
|
|
@@ -67,9 +64,7 @@ const isConversationAssistantMessage = (input) => {
|
|
|
67
64
|
// System Message
|
|
68
65
|
/// ///////////////////
|
|
69
66
|
const ChatCompletionSystemMessageSchema = z.object({
|
|
70
|
-
role:
|
|
71
|
-
message: 'Role must be system'
|
|
72
|
-
}),
|
|
67
|
+
role: z.enum(['system']),
|
|
73
68
|
content: z.string()
|
|
74
69
|
});
|
|
75
70
|
const isConversationSystemMessage = (input) => {
|
|
@@ -79,11 +74,10 @@ const isConversationSystemMessage = (input) => {
|
|
|
79
74
|
// Function Message
|
|
80
75
|
/// ///////////////////
|
|
81
76
|
const ChatCompletionFunctionMessageSchema = z.object({
|
|
82
|
-
role:
|
|
83
|
-
message: 'Role must be function'
|
|
84
|
-
}),
|
|
77
|
+
role: z.enum(['function']),
|
|
85
78
|
content: z.string(),
|
|
86
|
-
name: z.string()
|
|
79
|
+
name: z.string(),
|
|
80
|
+
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
87
81
|
});
|
|
88
82
|
const isConversationFunctionMessage = (input) => {
|
|
89
83
|
return ChatCompletionFunctionMessageSchema.safeParse(input).success;
|
|
@@ -167,4 +161,4 @@ function isType(input, schema) {
|
|
|
167
161
|
/// ///////////////////
|
|
168
162
|
// Exports
|
|
169
163
|
/// ///////////////////
|
|
170
|
-
export { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall };
|
|
164
|
+
export { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall };
|