@smarter.sh/ui-chat 0.3.0 → 0.7.1
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/LICENSE +2 -2
- package/README.md +235 -173
- package/dist/smarter-chat-library.es.js +44331 -12089
- package/dist/smarter-chat-library.es.js.map +1 -1
- package/dist/smarter-chat-library.umd.js +340 -121
- package/dist/smarter-chat-library.umd.js.map +1 -1
- package/dist/types/src/components/AppTitle/Component.d.ts +13 -0
- package/dist/types/src/components/AppTitle/index.d.ts +2 -0
- package/dist/types/src/components/Console/Component.d.ts +17 -0
- package/dist/types/src/components/Console/ServerLogs.d.ts +8 -0
- package/dist/types/src/components/Console/data.d.ts +7 -0
- package/dist/types/src/components/Console/enums.d.ts +9 -0
- package/dist/types/src/components/Console/index.d.ts +2 -0
- package/dist/types/src/components/ErrorBoundary/Component.d.ts +17 -0
- package/dist/types/src/components/ErrorBoundary/index.d.ts +2 -0
- package/dist/types/src/components/SmarterChat/Component.d.ts +26 -0
- package/dist/types/src/components/SmarterChat/icons.d.ts +17 -0
- package/dist/types/src/components/SmarterChat/index.d.ts +2 -0
- package/dist/types/src/const.d.ts +5 -0
- package/dist/types/src/contract.gen.d.ts +1146 -0
- package/dist/types/src/index.d.ts +13 -0
- package/dist/types/src/lib/ansi.d.ts +33 -0
- package/dist/types/src/lib/api.d.ts +96 -0
- package/dist/types/src/lib/code.d.ts +32 -0
- package/dist/types/src/lib/cookie.d.ts +17 -0
- package/dist/types/src/lib/enums.d.ts +26 -0
- package/dist/types/src/lib/layout.d.ts +42 -0
- package/dist/types/src/lib/logStream.d.ts +30 -0
- package/dist/types/src/lib/math.d.ts +18 -0
- package/dist/types/src/lib/mermaid.d.ts +27 -0
- package/dist/types/src/lib/messages.d.ts +52 -0
- package/dist/types/src/types.d.ts +108 -0
- package/dist/ui-chat.css +2 -1
- package/package.json +90 -59
- package/src/components/Console/Component.css +0 -47
- package/src/components/Console/Component.jsx +0 -186
- package/src/components/Console/HeadStyles.jsx +0 -20
- package/src/components/Console/enums.js +0 -7
- package/src/components/Console/index.js +0 -2
- package/src/components/ErrorModal/ErrorModal.css +0 -35
- package/src/components/ErrorModal/ErrorModal.jsx +0 -56
- package/src/components/ErrorModal/index.js +0 -3
- package/src/components/SmarterChat/Component.jsx +0 -431
- package/src/components/SmarterChat/ErrorBoundary.jsx +0 -32
- package/src/components/SmarterChat/Layout.js +0 -47
- package/src/components/SmarterChat/api.js +0 -200
- package/src/components/SmarterChat/enums.js +0 -17
- package/src/components/SmarterChat/index.js +0 -3
- package/src/components/SmarterChat/styles.css +0 -152
- package/src/components/SmarterChat/utils.jsx +0 -148
- package/src/components/enums.js +0 -1
- package/src/components/index.js +0 -3
- package/src/components/shared/cookie.js +0 -51
- package/src/constants.js +0 -2
- package/src/index.js +0 -4
- package/src/types/index.js +0 -2
- package/src/types/propTypes.js +0 -154
- package/src/version.js +0 -2
- package/types/index.d.ts +0 -17
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Smarter Chat api contract: generated from contract/chat-contract.schema.json by
|
|
3
|
+
* scripts/contract-types.mjs. Do not edit; run `npm run contract:types`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
7
|
+
* via the `definition` "JsonValue".
|
|
8
|
+
*/
|
|
9
|
+
export type JsonValue = unknown;
|
|
10
|
+
/**
|
|
11
|
+
* The requests and responses of the Smarter Chat configuration and prompt apis, versions 1 and 2. Generated from smarter.apps.prompt.contract.models; do not edit.
|
|
12
|
+
*/
|
|
13
|
+
export interface SmarterChatAPIContract {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A message's audio part.
|
|
18
|
+
*
|
|
19
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
20
|
+
* via the `definition` "PromptChatApiAudioPart".
|
|
21
|
+
*/
|
|
22
|
+
export interface PromptChatApiAudioPart {
|
|
23
|
+
input_audio: PromptChatApiInputAudio;
|
|
24
|
+
type: "input_audio";
|
|
25
|
+
[k: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The audio of an audio part: base64 encoded.
|
|
29
|
+
*
|
|
30
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
31
|
+
* via the `definition` "PromptChatApiInputAudio".
|
|
32
|
+
*/
|
|
33
|
+
export interface PromptChatApiInputAudio {
|
|
34
|
+
data: string;
|
|
35
|
+
format: "wav" | "mp3";
|
|
36
|
+
[k: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated
|
|
40
|
+
* The LLMClient, in version 1 of the configuration, whose keys are renamed: llmclient becomes chatbot.
|
|
41
|
+
*
|
|
42
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
43
|
+
* via the `definition` "PromptChatApiChatbotV1".
|
|
44
|
+
*/
|
|
45
|
+
export interface PromptChatApiChatbotV1 {
|
|
46
|
+
app_assistant?: string | null;
|
|
47
|
+
app_example_prompts?: string[] | null;
|
|
48
|
+
app_file_attachment?: boolean | null;
|
|
49
|
+
app_info_url?: string | null;
|
|
50
|
+
app_name?: string | null;
|
|
51
|
+
app_placeholder?: string | null;
|
|
52
|
+
app_welcome_message?: string | null;
|
|
53
|
+
default_model?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* The system prompt of a new chat session.
|
|
56
|
+
*/
|
|
57
|
+
default_system_role?: string | null;
|
|
58
|
+
deployed?: boolean | null;
|
|
59
|
+
id: number;
|
|
60
|
+
name: string;
|
|
61
|
+
provider?: string | null;
|
|
62
|
+
/**
|
|
63
|
+
* The url of the LLMClient's prompt api.
|
|
64
|
+
*/
|
|
65
|
+
url_chatbot: string;
|
|
66
|
+
version?: string | null;
|
|
67
|
+
[k: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A choice of a chat completion.
|
|
71
|
+
*
|
|
72
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
73
|
+
* via the `definition` "PromptChatApiChoice".
|
|
74
|
+
*/
|
|
75
|
+
export interface PromptChatApiChoice {
|
|
76
|
+
/**
|
|
77
|
+
* e.g. stop, length or tool_calls.
|
|
78
|
+
*/
|
|
79
|
+
finish_reason?: string | null;
|
|
80
|
+
index?: number;
|
|
81
|
+
message?: PromptChatApiMessage | null;
|
|
82
|
+
[k: string]: unknown;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A message, in the format of the OpenAI chat completion api.
|
|
86
|
+
*
|
|
87
|
+
* Smarter adds two roles, which are only displayed and never sent to an LLM: ``smarter``, a note
|
|
88
|
+
* about what the backend did, and ``smarter_error``, a failed prompt's error.
|
|
89
|
+
*
|
|
90
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
91
|
+
* via the `definition` "PromptChatApiMessage".
|
|
92
|
+
*/
|
|
93
|
+
export interface PromptChatApiMessage {
|
|
94
|
+
/**
|
|
95
|
+
* The message's text, or its parts. Null for an assistant message that only calls tools.
|
|
96
|
+
*/
|
|
97
|
+
content?: string | (PromptChatApiTextPart | PromptChatApiImagePart | PromptChatApiAudioPart | PromptChatApiFilePart | PromptChatApiRefusalPart)[] | null;
|
|
98
|
+
/**
|
|
99
|
+
* The name of a tool message's function.
|
|
100
|
+
*/
|
|
101
|
+
name?: string | null;
|
|
102
|
+
/**
|
|
103
|
+
* system, assistant, user, tool, smarter or smarter_error.
|
|
104
|
+
*/
|
|
105
|
+
role: string;
|
|
106
|
+
/**
|
|
107
|
+
* The tool call that a tool message answers.
|
|
108
|
+
*/
|
|
109
|
+
tool_call_id?: string | null;
|
|
110
|
+
/**
|
|
111
|
+
* An assistant message's tool calls.
|
|
112
|
+
*/
|
|
113
|
+
tool_calls?: PromptChatApiToolCall[] | null;
|
|
114
|
+
[k: string]: unknown;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A message's text part, in the format of the OpenAI chat completion api.
|
|
118
|
+
*
|
|
119
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
120
|
+
* via the `definition` "PromptChatApiTextPart".
|
|
121
|
+
*/
|
|
122
|
+
export interface PromptChatApiTextPart {
|
|
123
|
+
text: string;
|
|
124
|
+
type: "text";
|
|
125
|
+
[k: string]: unknown;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A message's image part.
|
|
129
|
+
*
|
|
130
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
131
|
+
* via the `definition` "PromptChatApiImagePart".
|
|
132
|
+
*/
|
|
133
|
+
export interface PromptChatApiImagePart {
|
|
134
|
+
image_url: PromptChatApiImageUrl;
|
|
135
|
+
type: "image_url";
|
|
136
|
+
[k: string]: unknown;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The image of an image part: an http(s) or base64 data url.
|
|
140
|
+
*
|
|
141
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
142
|
+
* via the `definition` "PromptChatApiImageUrl".
|
|
143
|
+
*/
|
|
144
|
+
export interface PromptChatApiImageUrl {
|
|
145
|
+
detail?: ("auto" | "low" | "high") | null;
|
|
146
|
+
url: string;
|
|
147
|
+
[k: string]: unknown;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A message's file part.
|
|
151
|
+
*
|
|
152
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
153
|
+
* via the `definition` "PromptChatApiFilePart".
|
|
154
|
+
*/
|
|
155
|
+
export interface PromptChatApiFilePart {
|
|
156
|
+
file: PromptChatApiFileRef;
|
|
157
|
+
type: "file";
|
|
158
|
+
[k: string]: unknown;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The file of a file part: its base64 data, or the id of an uploaded file.
|
|
162
|
+
*
|
|
163
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
164
|
+
* via the `definition` "PromptChatApiFileRef".
|
|
165
|
+
*/
|
|
166
|
+
export interface PromptChatApiFileRef {
|
|
167
|
+
file_data?: string | null;
|
|
168
|
+
file_id?: string | null;
|
|
169
|
+
filename?: string | null;
|
|
170
|
+
[k: string]: unknown;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* An assistant message's refusal part.
|
|
174
|
+
*
|
|
175
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
176
|
+
* via the `definition` "PromptChatApiRefusalPart".
|
|
177
|
+
*/
|
|
178
|
+
export interface PromptChatApiRefusalPart {
|
|
179
|
+
refusal: string;
|
|
180
|
+
type: "refusal";
|
|
181
|
+
[k: string]: unknown;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A tool call of an assistant message, in the format of the OpenAI chat completion api.
|
|
185
|
+
*
|
|
186
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
187
|
+
* via the `definition` "PromptChatApiToolCall".
|
|
188
|
+
*/
|
|
189
|
+
export interface PromptChatApiToolCall {
|
|
190
|
+
function: PromptChatApiFunctionCall;
|
|
191
|
+
id: string;
|
|
192
|
+
type?: "function";
|
|
193
|
+
[k: string]: unknown;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The function that an assistant message calls.
|
|
197
|
+
*
|
|
198
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
199
|
+
* via the `definition` "PromptChatApiFunctionCall".
|
|
200
|
+
*/
|
|
201
|
+
export interface PromptChatApiFunctionCall {
|
|
202
|
+
/**
|
|
203
|
+
* The function's arguments, as a JSON string.
|
|
204
|
+
*/
|
|
205
|
+
arguments: string;
|
|
206
|
+
name: string;
|
|
207
|
+
[k: string]: unknown;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The LLM's chat completion, in the format of the OpenAI api, with only these fields.
|
|
211
|
+
*
|
|
212
|
+
* Smarter's own additions, ``smarter`` and ``metadata``, are not part of it: the messages, plugins and
|
|
213
|
+
* tools are in :class:`PromptChatApiPromptResult`, and ``metadata``, which describes the tool calls
|
|
214
|
+
* with their plugins' owners, is returned only to the cli.
|
|
215
|
+
*
|
|
216
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
217
|
+
* via the `definition` "PromptChatApiCompletion".
|
|
218
|
+
*/
|
|
219
|
+
export interface PromptChatApiCompletion {
|
|
220
|
+
choices?: PromptChatApiChoice[];
|
|
221
|
+
created?: number | null;
|
|
222
|
+
id?: string | null;
|
|
223
|
+
model?: string | null;
|
|
224
|
+
object?: string | null;
|
|
225
|
+
service_tier?: string | null;
|
|
226
|
+
system_fingerprint?: string | null;
|
|
227
|
+
usage?: PromptChatApiUsage | null;
|
|
228
|
+
[k: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* A chat completion's token usage.
|
|
232
|
+
*
|
|
233
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
234
|
+
* via the `definition` "PromptChatApiUsage".
|
|
235
|
+
*/
|
|
236
|
+
export interface PromptChatApiUsage {
|
|
237
|
+
completion_tokens?: number | null;
|
|
238
|
+
completion_tokens_details?: PromptChatApiTokenDetails | null;
|
|
239
|
+
prompt_tokens?: number | null;
|
|
240
|
+
prompt_tokens_details?: PromptChatApiTokenDetails | null;
|
|
241
|
+
total_tokens?: number | null;
|
|
242
|
+
[k: string]: unknown;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The breakdown of a completion's tokens.
|
|
246
|
+
*
|
|
247
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
248
|
+
* via the `definition` "PromptChatApiTokenDetails".
|
|
249
|
+
*/
|
|
250
|
+
export interface PromptChatApiTokenDetails {
|
|
251
|
+
audio_tokens?: number | null;
|
|
252
|
+
cached_tokens?: number | null;
|
|
253
|
+
reasoning_tokens?: number | null;
|
|
254
|
+
[k: string]: unknown;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @deprecated
|
|
258
|
+
* The parsed body of a successful prompt, version 1: a chat completion, with Smarter's additions.
|
|
259
|
+
*
|
|
260
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
261
|
+
* via the `definition` "PromptChatApiCompletionV1".
|
|
262
|
+
*/
|
|
263
|
+
export interface PromptChatApiCompletionV1 {
|
|
264
|
+
smarter: PromptChatApiSmarterCompletionV1;
|
|
265
|
+
[k: string]: unknown;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* @deprecated
|
|
269
|
+
* Smarter's additions to a completion, version 1.
|
|
270
|
+
*
|
|
271
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
272
|
+
* via the `definition` "PromptChatApiSmarterCompletionV1".
|
|
273
|
+
*/
|
|
274
|
+
export interface PromptChatApiSmarterCompletionV1 {
|
|
275
|
+
messages?: PromptChatApiMessage[];
|
|
276
|
+
plugins?: string[];
|
|
277
|
+
tools?: string[];
|
|
278
|
+
[k: string]: unknown;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The configuration, version 2.
|
|
282
|
+
*
|
|
283
|
+
* ``PromptConfigView.config()`` builds one, from which every response is derived:
|
|
284
|
+
* :meth:`public` for a deployed LLMClient's own host, and :meth:`to_v1` for older clients.
|
|
285
|
+
*
|
|
286
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
287
|
+
* via the `definition` "PromptChatApiConfig".
|
|
288
|
+
*/
|
|
289
|
+
export interface PromptChatApiConfig {
|
|
290
|
+
contract?: 2;
|
|
291
|
+
/**
|
|
292
|
+
* The ENABLE_REACTAPP_DEBUG_MODE waffle switch.
|
|
293
|
+
*/
|
|
294
|
+
debug_mode: boolean;
|
|
295
|
+
functions?: PromptChatApiFunctionList | null;
|
|
296
|
+
history: PromptChatApiHistory;
|
|
297
|
+
llmclient: PromptChatApiLLMClient;
|
|
298
|
+
meta_data: PromptChatApiMetaData;
|
|
299
|
+
plugins: PromptChatApiPluginList;
|
|
300
|
+
/**
|
|
301
|
+
* True for a workbench url.
|
|
302
|
+
*/
|
|
303
|
+
sandbox_mode: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* The chat session's key.
|
|
306
|
+
*/
|
|
307
|
+
session_key: string;
|
|
308
|
+
[k: string]: unknown;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* The LLMClient's built-in functions.
|
|
312
|
+
*
|
|
313
|
+
* The list itself is returned only in the complete configuration.
|
|
314
|
+
*
|
|
315
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
316
|
+
* via the `definition` "PromptChatApiFunctionList".
|
|
317
|
+
*/
|
|
318
|
+
export interface PromptChatApiFunctionList {
|
|
319
|
+
functions?: PromptChatApiLLMClientFunction[];
|
|
320
|
+
meta_data: PromptChatApiListMetaData;
|
|
321
|
+
[k: string]: unknown;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* A built-in function of the LLMClient: a :class:`smarter.apps.llmclient.models.LLMClientFunctions`.
|
|
325
|
+
*
|
|
326
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
327
|
+
* via the `definition` "PromptChatApiLLMClientFunction".
|
|
328
|
+
*/
|
|
329
|
+
export interface PromptChatApiLLMClientFunction {
|
|
330
|
+
/**
|
|
331
|
+
* TimestampedModel.created_at.
|
|
332
|
+
*/
|
|
333
|
+
created_at?: string | null;
|
|
334
|
+
/**
|
|
335
|
+
* The row's primary key.
|
|
336
|
+
*/
|
|
337
|
+
id: number;
|
|
338
|
+
/**
|
|
339
|
+
* LLMClientFunctions.llmclient: the LLMClient's id.
|
|
340
|
+
*/
|
|
341
|
+
llmclient: number;
|
|
342
|
+
/**
|
|
343
|
+
* LLMClientFunctions.name.
|
|
344
|
+
*/
|
|
345
|
+
name?: ("get_current_weather" | "date_calculator" | "calculator") | null;
|
|
346
|
+
/**
|
|
347
|
+
* TimestampedModel.updated_at.
|
|
348
|
+
*/
|
|
349
|
+
updated_at?: string | null;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* The counts of a list of the LLMClient's plugins or functions.
|
|
353
|
+
*
|
|
354
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
355
|
+
* via the `definition` "PromptChatApiListMetaData".
|
|
356
|
+
*/
|
|
357
|
+
export interface PromptChatApiListMetaData {
|
|
358
|
+
functions_returned?: number | null;
|
|
359
|
+
plugins_returned?: number | null;
|
|
360
|
+
total_functions?: number | null;
|
|
361
|
+
total_plugins?: number | null;
|
|
362
|
+
[k: string]: unknown;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* The chat session's history, in version 2.
|
|
366
|
+
*
|
|
367
|
+
* Only ``chat_history`` is public.
|
|
368
|
+
*
|
|
369
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
370
|
+
* via the `definition` "PromptChatApiHistory".
|
|
371
|
+
*/
|
|
372
|
+
export interface PromptChatApiHistory {
|
|
373
|
+
/**
|
|
374
|
+
* The session's messages, which restore the chat thread.
|
|
375
|
+
*/
|
|
376
|
+
chat_history?: PromptChatApiMessage[];
|
|
377
|
+
llmclient_request_history?: PromptChatApiLLMClientRequest[] | null;
|
|
378
|
+
plugin_selector_history?: PromptChatApiPluginSelection[] | null;
|
|
379
|
+
prompt_plugin_usage_history?: PromptChatApiPromptPluginUsage[] | null;
|
|
380
|
+
prompt_tool_call_history?: PromptChatApiPromptToolCall[] | null;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* A request to the LLMClient's prompt api: a :class:`smarter.apps.llmclient.models.LLMClientRequests`.
|
|
384
|
+
*
|
|
385
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
386
|
+
* via the `definition` "PromptChatApiLLMClientRequest".
|
|
387
|
+
*/
|
|
388
|
+
export interface PromptChatApiLLMClientRequest {
|
|
389
|
+
/**
|
|
390
|
+
* TimestampedModel.created_at.
|
|
391
|
+
*/
|
|
392
|
+
created_at?: string | null;
|
|
393
|
+
/**
|
|
394
|
+
* The row's primary key.
|
|
395
|
+
*/
|
|
396
|
+
id: number;
|
|
397
|
+
/**
|
|
398
|
+
* LLMClientRequests.is_aggregation.
|
|
399
|
+
*/
|
|
400
|
+
is_aggregation?: boolean | null;
|
|
401
|
+
/**
|
|
402
|
+
* LLMClientRequests.llmclient: the LLMClient's id.
|
|
403
|
+
*/
|
|
404
|
+
llmclient: number;
|
|
405
|
+
/**
|
|
406
|
+
* LLMClientRequests.request.
|
|
407
|
+
*/
|
|
408
|
+
request?: PromptChatApiPromptRequest | null;
|
|
409
|
+
/**
|
|
410
|
+
* LLMClientRequests.session_key.
|
|
411
|
+
*/
|
|
412
|
+
session_key?: string | null;
|
|
413
|
+
/**
|
|
414
|
+
* TimestampedModel.updated_at.
|
|
415
|
+
*/
|
|
416
|
+
updated_at?: string | null;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The prompt api's request body: the chat thread, with only the roles that LLMs accept.
|
|
420
|
+
*
|
|
421
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
422
|
+
* via the `definition` "PromptChatApiPromptRequest".
|
|
423
|
+
*/
|
|
424
|
+
export interface PromptChatApiPromptRequest {
|
|
425
|
+
messages: PromptChatApiMessage[];
|
|
426
|
+
session_key?: string | null;
|
|
427
|
+
[k: string]: unknown;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* A plugin selector's activation: a :class:`smarter.apps.plugin.models.PluginSelectorHistory`.
|
|
431
|
+
*
|
|
432
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
433
|
+
* via the `definition` "PromptChatApiPluginSelection".
|
|
434
|
+
*/
|
|
435
|
+
export interface PromptChatApiPluginSelection {
|
|
436
|
+
/**
|
|
437
|
+
* TimestampedModel.created_at.
|
|
438
|
+
*/
|
|
439
|
+
created_at?: string | null;
|
|
440
|
+
/**
|
|
441
|
+
* The row's primary key.
|
|
442
|
+
*/
|
|
443
|
+
id: number;
|
|
444
|
+
/**
|
|
445
|
+
* PluginSelectorHistory.messages.
|
|
446
|
+
*/
|
|
447
|
+
messages?: PromptChatApiMessage[] | null;
|
|
448
|
+
/**
|
|
449
|
+
* PluginSelectorHistory.plugin_selector: the PluginSelector's id.
|
|
450
|
+
*/
|
|
451
|
+
plugin_selector: number;
|
|
452
|
+
/**
|
|
453
|
+
* PluginSelectorHistory.search_term.
|
|
454
|
+
*/
|
|
455
|
+
search_term?: string | null;
|
|
456
|
+
/**
|
|
457
|
+
* PluginSelectorHistory.session_key.
|
|
458
|
+
*/
|
|
459
|
+
session_key?: string | null;
|
|
460
|
+
/**
|
|
461
|
+
* TimestampedModel.updated_at.
|
|
462
|
+
*/
|
|
463
|
+
updated_at?: string | null;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* A plugin that the chat session used: a :class:`smarter.apps.prompt.models.PromptPluginUsage`.
|
|
467
|
+
*
|
|
468
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
469
|
+
* via the `definition` "PromptChatApiPromptPluginUsage".
|
|
470
|
+
*/
|
|
471
|
+
export interface PromptChatApiPromptPluginUsage {
|
|
472
|
+
/**
|
|
473
|
+
* TimestampedModel.created_at.
|
|
474
|
+
*/
|
|
475
|
+
created_at?: string | null;
|
|
476
|
+
/**
|
|
477
|
+
* The row's primary key.
|
|
478
|
+
*/
|
|
479
|
+
id: number;
|
|
480
|
+
/**
|
|
481
|
+
* PromptPluginUsage.input_text.
|
|
482
|
+
*/
|
|
483
|
+
input_text?: string | null;
|
|
484
|
+
/**
|
|
485
|
+
* PromptPluginUsage.plugin: the PluginMeta's id.
|
|
486
|
+
*/
|
|
487
|
+
plugin: number;
|
|
488
|
+
/**
|
|
489
|
+
* PromptPluginUsage.prompt: the chat session's id.
|
|
490
|
+
*/
|
|
491
|
+
prompt: number;
|
|
492
|
+
/**
|
|
493
|
+
* TimestampedModel.updated_at.
|
|
494
|
+
*/
|
|
495
|
+
updated_at?: string | null;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* A tool call of the chat session: a :class:`smarter.apps.prompt.models.PromptToolCall`.
|
|
499
|
+
*
|
|
500
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
501
|
+
* via the `definition` "PromptChatApiPromptToolCall".
|
|
502
|
+
*/
|
|
503
|
+
export interface PromptChatApiPromptToolCall {
|
|
504
|
+
/**
|
|
505
|
+
* TimestampedModel.created_at.
|
|
506
|
+
*/
|
|
507
|
+
created_at?: string | null;
|
|
508
|
+
/**
|
|
509
|
+
* PromptToolCall.function_args.
|
|
510
|
+
*/
|
|
511
|
+
function_args?: string | null;
|
|
512
|
+
/**
|
|
513
|
+
* PromptToolCall.function_name.
|
|
514
|
+
*/
|
|
515
|
+
function_name?: string | null;
|
|
516
|
+
/**
|
|
517
|
+
* The row's primary key.
|
|
518
|
+
*/
|
|
519
|
+
id: number;
|
|
520
|
+
/**
|
|
521
|
+
* PromptToolCall.plugin: the PluginMeta's id, for a plugin.
|
|
522
|
+
*/
|
|
523
|
+
plugin?: number | null;
|
|
524
|
+
/**
|
|
525
|
+
* PromptToolCall.prompt: the chat session's id.
|
|
526
|
+
*/
|
|
527
|
+
prompt: number;
|
|
528
|
+
request?: unknown;
|
|
529
|
+
response?: unknown;
|
|
530
|
+
/**
|
|
531
|
+
* TimestampedModel.updated_at.
|
|
532
|
+
*/
|
|
533
|
+
updated_at?: string | null;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* The LLMClient, in version 2 of the configuration.
|
|
537
|
+
*
|
|
538
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
539
|
+
* via the `definition` "PromptChatApiLLMClient".
|
|
540
|
+
*/
|
|
541
|
+
export interface PromptChatApiLLMClient {
|
|
542
|
+
app_assistant?: string | null;
|
|
543
|
+
app_example_prompts?: string[] | null;
|
|
544
|
+
app_file_attachment?: boolean | null;
|
|
545
|
+
app_info_url?: string | null;
|
|
546
|
+
app_name?: string | null;
|
|
547
|
+
app_placeholder?: string | null;
|
|
548
|
+
app_welcome_message?: string | null;
|
|
549
|
+
default_model?: string | null;
|
|
550
|
+
/**
|
|
551
|
+
* The system prompt of a new chat session.
|
|
552
|
+
*/
|
|
553
|
+
default_system_role?: string | null;
|
|
554
|
+
deployed?: boolean | null;
|
|
555
|
+
id: number;
|
|
556
|
+
name: string;
|
|
557
|
+
provider?: string | null;
|
|
558
|
+
/**
|
|
559
|
+
* The url of the LLMClient's prompt api.
|
|
560
|
+
*/
|
|
561
|
+
url_llmclient: string;
|
|
562
|
+
version?: string | null;
|
|
563
|
+
[k: string]: unknown;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* The LLMClient's state.
|
|
567
|
+
*
|
|
568
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
569
|
+
* via the `definition` "PromptChatApiMetaData".
|
|
570
|
+
*/
|
|
571
|
+
export interface PromptChatApiMetaData {
|
|
572
|
+
is_deployed?: boolean | null;
|
|
573
|
+
is_valid?: boolean | null;
|
|
574
|
+
ready?: boolean | null;
|
|
575
|
+
[k: string]: unknown;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* The LLMClient's plugins.
|
|
579
|
+
*
|
|
580
|
+
* The list itself is returned only in the complete configuration.
|
|
581
|
+
*
|
|
582
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
583
|
+
* via the `definition` "PromptChatApiPluginList".
|
|
584
|
+
*/
|
|
585
|
+
export interface PromptChatApiPluginList {
|
|
586
|
+
meta_data: PromptChatApiListMetaData;
|
|
587
|
+
plugins?: PromptChatApiLLMClientPlugin[];
|
|
588
|
+
[k: string]: unknown;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* A plugin of the LLMClient: a :class:`smarter.apps.llmclient.models.LLMClientPlugin`.
|
|
592
|
+
*
|
|
593
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
594
|
+
* via the `definition` "PromptChatApiLLMClientPlugin".
|
|
595
|
+
*/
|
|
596
|
+
export interface PromptChatApiLLMClientPlugin {
|
|
597
|
+
/**
|
|
598
|
+
* TimestampedModel.created_at.
|
|
599
|
+
*/
|
|
600
|
+
created_at?: string | null;
|
|
601
|
+
/**
|
|
602
|
+
* The row's primary key.
|
|
603
|
+
*/
|
|
604
|
+
id: number;
|
|
605
|
+
/**
|
|
606
|
+
* LLMClientPlugin.llmclient: the LLMClient's id.
|
|
607
|
+
*/
|
|
608
|
+
llmclient: number;
|
|
609
|
+
plugin_meta: PromptChatApiPluginMeta;
|
|
610
|
+
/**
|
|
611
|
+
* TimestampedModel.updated_at.
|
|
612
|
+
*/
|
|
613
|
+
updated_at?: string | null;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* LLMClientPlugin.plugin_meta.
|
|
617
|
+
*/
|
|
618
|
+
export interface PromptChatApiPluginMeta {
|
|
619
|
+
/**
|
|
620
|
+
* MetaDataModel.annotations: a list of key-value pairs, or, in legacy rows, an object.
|
|
621
|
+
*/
|
|
622
|
+
annotations?: {
|
|
623
|
+
[k: string]: JsonValue;
|
|
624
|
+
}[] | {
|
|
625
|
+
[k: string]: JsonValue;
|
|
626
|
+
} | null;
|
|
627
|
+
/**
|
|
628
|
+
* TimestampedModel.created_at.
|
|
629
|
+
*/
|
|
630
|
+
created_at?: string | null;
|
|
631
|
+
/**
|
|
632
|
+
* MetaDataModel.description.
|
|
633
|
+
*/
|
|
634
|
+
description?: string | null;
|
|
635
|
+
/**
|
|
636
|
+
* The row's primary key.
|
|
637
|
+
*/
|
|
638
|
+
id: number;
|
|
639
|
+
/**
|
|
640
|
+
* MetaDataModel.name, in snake_case.
|
|
641
|
+
*/
|
|
642
|
+
name: string;
|
|
643
|
+
/**
|
|
644
|
+
* PluginMeta.plugin_class.
|
|
645
|
+
*/
|
|
646
|
+
plugin_class: "api" | "skill" | "sql" | "static" | "websearch" | "imagesearch";
|
|
647
|
+
/**
|
|
648
|
+
* MetaDataModel.tags, by name.
|
|
649
|
+
*/
|
|
650
|
+
tags?: string[];
|
|
651
|
+
/**
|
|
652
|
+
* TimestampedModel.updated_at.
|
|
653
|
+
*/
|
|
654
|
+
updated_at?: string | null;
|
|
655
|
+
/**
|
|
656
|
+
* MetaDataModel.version, e.g. 1.0.0.
|
|
657
|
+
*/
|
|
658
|
+
version?: string | null;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* The configuration api's request body.
|
|
662
|
+
*
|
|
663
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
664
|
+
* via the `definition` "PromptChatApiConfigRequest".
|
|
665
|
+
*/
|
|
666
|
+
export interface PromptChatApiConfigRequest {
|
|
667
|
+
/**
|
|
668
|
+
* The chat session's key, or empty for a new session.
|
|
669
|
+
*/
|
|
670
|
+
session_key?: string | null;
|
|
671
|
+
[k: string]: unknown;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* The configuration api's response, version 2.
|
|
675
|
+
*
|
|
676
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
677
|
+
* via the `definition` "PromptChatApiConfigResponse".
|
|
678
|
+
*/
|
|
679
|
+
export interface PromptChatApiConfigResponse {
|
|
680
|
+
/**
|
|
681
|
+
* The api version, e.g. "smarter.sh/v1".
|
|
682
|
+
*/
|
|
683
|
+
api: string;
|
|
684
|
+
data: PromptChatApiConfig;
|
|
685
|
+
metadata?: PromptChatApiJournalMetadata;
|
|
686
|
+
[k: string]: unknown;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* The journal's command and thing.
|
|
690
|
+
*/
|
|
691
|
+
export interface PromptChatApiJournalMetadata {
|
|
692
|
+
/**
|
|
693
|
+
* The journal's command, e.g. prompt.
|
|
694
|
+
*/
|
|
695
|
+
command?: string | null;
|
|
696
|
+
/**
|
|
697
|
+
* The journal's thing, e.g. LLMClient.
|
|
698
|
+
*/
|
|
699
|
+
thing?: string | null;
|
|
700
|
+
[k: string]: unknown;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* @deprecated
|
|
704
|
+
* The configuration api's response, version 1.
|
|
705
|
+
*
|
|
706
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
707
|
+
* via the `definition` "PromptChatApiConfigResponseV1".
|
|
708
|
+
*/
|
|
709
|
+
export interface PromptChatApiConfigResponseV1 {
|
|
710
|
+
/**
|
|
711
|
+
* The api version, e.g. "smarter.sh/v1".
|
|
712
|
+
*/
|
|
713
|
+
api: string;
|
|
714
|
+
data: PromptChatApiConfigV1;
|
|
715
|
+
metadata?: PromptChatApiJournalMetadata1;
|
|
716
|
+
[k: string]: unknown;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* @deprecated
|
|
720
|
+
* The configuration, version 1.
|
|
721
|
+
*
|
|
722
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
723
|
+
* via the `definition` "PromptChatApiConfigV1".
|
|
724
|
+
*/
|
|
725
|
+
export interface PromptChatApiConfigV1 {
|
|
726
|
+
chatbot: PromptChatApiChatbotV1;
|
|
727
|
+
/**
|
|
728
|
+
* The ENABLE_REACTAPP_DEBUG_MODE waffle switch.
|
|
729
|
+
*/
|
|
730
|
+
debug_mode: boolean;
|
|
731
|
+
functions?: PromptChatApiFunctionListV1 | null;
|
|
732
|
+
history: PromptChatApiHistoryV1;
|
|
733
|
+
meta_data: PromptChatApiMetaData;
|
|
734
|
+
plugins: PromptChatApiPluginListV1;
|
|
735
|
+
/**
|
|
736
|
+
* True for a workbench url.
|
|
737
|
+
*/
|
|
738
|
+
sandbox_mode: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* The chat session's key.
|
|
741
|
+
*/
|
|
742
|
+
session_key: string;
|
|
743
|
+
[k: string]: unknown;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* @deprecated
|
|
747
|
+
* The LLMClient's built-in functions, in version 1.
|
|
748
|
+
*
|
|
749
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
750
|
+
* via the `definition` "PromptChatApiFunctionListV1".
|
|
751
|
+
*/
|
|
752
|
+
export interface PromptChatApiFunctionListV1 {
|
|
753
|
+
functions?: PromptChatApiLLMClientFunctionV1[];
|
|
754
|
+
meta_data: PromptChatApiListMetaData;
|
|
755
|
+
[k: string]: unknown;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* @deprecated
|
|
759
|
+
* A built-in function of the LLMClient, in version 1, whose ``llmclient`` is renamed ``chatbot``.
|
|
760
|
+
*
|
|
761
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
762
|
+
* via the `definition` "PromptChatApiLLMClientFunctionV1".
|
|
763
|
+
*/
|
|
764
|
+
export interface PromptChatApiLLMClientFunctionV1 {
|
|
765
|
+
/**
|
|
766
|
+
* LLMClientFunctions.llmclient: the LLMClient's id.
|
|
767
|
+
*/
|
|
768
|
+
chatbot: number;
|
|
769
|
+
/**
|
|
770
|
+
* TimestampedModel.created_at.
|
|
771
|
+
*/
|
|
772
|
+
created_at?: string | null;
|
|
773
|
+
/**
|
|
774
|
+
* The row's primary key.
|
|
775
|
+
*/
|
|
776
|
+
id: number;
|
|
777
|
+
name?: ("get_current_weather" | "date_calculator" | "calculator") | null;
|
|
778
|
+
/**
|
|
779
|
+
* TimestampedModel.updated_at.
|
|
780
|
+
*/
|
|
781
|
+
updated_at?: string | null;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* @deprecated
|
|
785
|
+
* The chat session's history, in version 1.
|
|
786
|
+
*
|
|
787
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
788
|
+
* via the `definition` "PromptChatApiHistoryV1".
|
|
789
|
+
*/
|
|
790
|
+
export interface PromptChatApiHistoryV1 {
|
|
791
|
+
/**
|
|
792
|
+
* The session's messages, which restore the chat thread.
|
|
793
|
+
*/
|
|
794
|
+
chat_history?: PromptChatApiMessage[];
|
|
795
|
+
chatbot_request_history?: PromptChatApiLLMClientRequestV1[] | null;
|
|
796
|
+
plugin_selector_history?: PromptChatApiPluginSelection[] | null;
|
|
797
|
+
prompt_plugin_usage_history?: PromptChatApiPromptPluginUsage[] | null;
|
|
798
|
+
prompt_tool_call_history?: PromptChatApiPromptToolCall[] | null;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* @deprecated
|
|
802
|
+
* A request to the LLMClient's prompt api, in version 1, whose ``llmclient`` is renamed ``chatbot``.
|
|
803
|
+
*
|
|
804
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
805
|
+
* via the `definition` "PromptChatApiLLMClientRequestV1".
|
|
806
|
+
*/
|
|
807
|
+
export interface PromptChatApiLLMClientRequestV1 {
|
|
808
|
+
/**
|
|
809
|
+
* LLMClientRequests.llmclient: the LLMClient's id.
|
|
810
|
+
*/
|
|
811
|
+
chatbot: number;
|
|
812
|
+
/**
|
|
813
|
+
* TimestampedModel.created_at.
|
|
814
|
+
*/
|
|
815
|
+
created_at?: string | null;
|
|
816
|
+
/**
|
|
817
|
+
* The row's primary key.
|
|
818
|
+
*/
|
|
819
|
+
id: number;
|
|
820
|
+
is_aggregation?: boolean | null;
|
|
821
|
+
request?: PromptChatApiPromptRequest | null;
|
|
822
|
+
session_key?: string | null;
|
|
823
|
+
/**
|
|
824
|
+
* TimestampedModel.updated_at.
|
|
825
|
+
*/
|
|
826
|
+
updated_at?: string | null;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* @deprecated
|
|
830
|
+
* The LLMClient's plugins, in version 1.
|
|
831
|
+
*
|
|
832
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
833
|
+
* via the `definition` "PromptChatApiPluginListV1".
|
|
834
|
+
*/
|
|
835
|
+
export interface PromptChatApiPluginListV1 {
|
|
836
|
+
meta_data: PromptChatApiListMetaData;
|
|
837
|
+
plugins?: PromptChatApiLLMClientPluginV1[];
|
|
838
|
+
[k: string]: unknown;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* @deprecated
|
|
842
|
+
* A plugin of the LLMClient, in version 1, whose ``llmclient`` is renamed ``chatbot``.
|
|
843
|
+
*
|
|
844
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
845
|
+
* via the `definition` "PromptChatApiLLMClientPluginV1".
|
|
846
|
+
*/
|
|
847
|
+
export interface PromptChatApiLLMClientPluginV1 {
|
|
848
|
+
/**
|
|
849
|
+
* LLMClientPlugin.llmclient: the LLMClient's id.
|
|
850
|
+
*/
|
|
851
|
+
chatbot: number;
|
|
852
|
+
/**
|
|
853
|
+
* TimestampedModel.created_at.
|
|
854
|
+
*/
|
|
855
|
+
created_at?: string | null;
|
|
856
|
+
/**
|
|
857
|
+
* The row's primary key.
|
|
858
|
+
*/
|
|
859
|
+
id: number;
|
|
860
|
+
plugin_meta: PromptChatApiPluginMeta1;
|
|
861
|
+
/**
|
|
862
|
+
* TimestampedModel.updated_at.
|
|
863
|
+
*/
|
|
864
|
+
updated_at?: string | null;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* A plugin's metadata: a :class:`smarter.apps.plugin.models.PluginMeta`.
|
|
868
|
+
*
|
|
869
|
+
* Its owner is left out: the configuration never includes a user's profile.
|
|
870
|
+
*
|
|
871
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
872
|
+
* via the `definition` "PromptChatApiPluginMeta".
|
|
873
|
+
*/
|
|
874
|
+
export interface PromptChatApiPluginMeta1 {
|
|
875
|
+
/**
|
|
876
|
+
* MetaDataModel.annotations: a list of key-value pairs, or, in legacy rows, an object.
|
|
877
|
+
*/
|
|
878
|
+
annotations?: {
|
|
879
|
+
[k: string]: JsonValue;
|
|
880
|
+
}[] | {
|
|
881
|
+
[k: string]: JsonValue;
|
|
882
|
+
} | null;
|
|
883
|
+
/**
|
|
884
|
+
* TimestampedModel.created_at.
|
|
885
|
+
*/
|
|
886
|
+
created_at?: string | null;
|
|
887
|
+
/**
|
|
888
|
+
* MetaDataModel.description.
|
|
889
|
+
*/
|
|
890
|
+
description?: string | null;
|
|
891
|
+
/**
|
|
892
|
+
* The row's primary key.
|
|
893
|
+
*/
|
|
894
|
+
id: number;
|
|
895
|
+
/**
|
|
896
|
+
* MetaDataModel.name, in snake_case.
|
|
897
|
+
*/
|
|
898
|
+
name: string;
|
|
899
|
+
/**
|
|
900
|
+
* PluginMeta.plugin_class.
|
|
901
|
+
*/
|
|
902
|
+
plugin_class: "api" | "skill" | "sql" | "static" | "websearch" | "imagesearch";
|
|
903
|
+
/**
|
|
904
|
+
* MetaDataModel.tags, by name.
|
|
905
|
+
*/
|
|
906
|
+
tags?: string[];
|
|
907
|
+
/**
|
|
908
|
+
* TimestampedModel.updated_at.
|
|
909
|
+
*/
|
|
910
|
+
updated_at?: string | null;
|
|
911
|
+
/**
|
|
912
|
+
* MetaDataModel.version, e.g. 1.0.0.
|
|
913
|
+
*/
|
|
914
|
+
version?: string | null;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* The journal's command and thing.
|
|
918
|
+
*/
|
|
919
|
+
export interface PromptChatApiJournalMetadata1 {
|
|
920
|
+
/**
|
|
921
|
+
* The journal's command, e.g. prompt.
|
|
922
|
+
*/
|
|
923
|
+
command?: string | null;
|
|
924
|
+
/**
|
|
925
|
+
* The journal's thing, e.g. LLMClient.
|
|
926
|
+
*/
|
|
927
|
+
thing?: string | null;
|
|
928
|
+
[k: string]: unknown;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* The error of a failed request: the same shape for every error of the configuration and prompt apis.
|
|
932
|
+
*
|
|
933
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
934
|
+
* via the `definition` "PromptChatApiErrorBody".
|
|
935
|
+
*/
|
|
936
|
+
export interface PromptChatApiErrorBody {
|
|
937
|
+
/**
|
|
938
|
+
* A human-readable description, which Smarter Chat displays.
|
|
939
|
+
*/
|
|
940
|
+
description: string;
|
|
941
|
+
/**
|
|
942
|
+
* The name of the error's class, e.g. NotFound or LLMProviderError.
|
|
943
|
+
*/
|
|
944
|
+
errorClass: string;
|
|
945
|
+
/**
|
|
946
|
+
* The http status.
|
|
947
|
+
*/
|
|
948
|
+
status: number;
|
|
949
|
+
[k: string]: unknown;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* The body of an error response of the configuration or prompt apis, in both versions of the contract.
|
|
953
|
+
*
|
|
954
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
955
|
+
* via the `definition` "PromptChatApiErrorResponse".
|
|
956
|
+
*/
|
|
957
|
+
export interface PromptChatApiErrorResponse {
|
|
958
|
+
api?: string | null;
|
|
959
|
+
error: PromptChatApiErrorBody;
|
|
960
|
+
metadata?: PromptChatApiJournalMetadata2 | null;
|
|
961
|
+
[k: string]: unknown;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* The journal's record of a request, which every journaled response carries.
|
|
965
|
+
*
|
|
966
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
967
|
+
* via the `definition` "PromptChatApiJournalMetadata".
|
|
968
|
+
*/
|
|
969
|
+
export interface PromptChatApiJournalMetadata2 {
|
|
970
|
+
/**
|
|
971
|
+
* The journal's command, e.g. prompt.
|
|
972
|
+
*/
|
|
973
|
+
command?: string | null;
|
|
974
|
+
/**
|
|
975
|
+
* The journal's thing, e.g. LLMClient.
|
|
976
|
+
*/
|
|
977
|
+
thing?: string | null;
|
|
978
|
+
[k: string]: unknown;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* @deprecated
|
|
982
|
+
* The parsed body of a failed prompt, version 1.
|
|
983
|
+
*
|
|
984
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
985
|
+
* via the `definition` "PromptChatApiFailureV1".
|
|
986
|
+
*/
|
|
987
|
+
export interface PromptChatApiFailureV1 {
|
|
988
|
+
error: PromptChatApiProviderErrorV1;
|
|
989
|
+
response: PromptChatApiCompletionV1;
|
|
990
|
+
[k: string]: unknown;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* @deprecated
|
|
994
|
+
* The LLM provider's error, version 1.
|
|
995
|
+
*
|
|
996
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
997
|
+
* via the `definition` "PromptChatApiProviderErrorV1".
|
|
998
|
+
*/
|
|
999
|
+
export interface PromptChatApiProviderErrorV1 {
|
|
1000
|
+
message: string;
|
|
1001
|
+
status: number;
|
|
1002
|
+
[k: string]: unknown;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* @deprecated
|
|
1006
|
+
* A prompt's result, version 1: an AWS Lambda style response, whose body is a JSON string.
|
|
1007
|
+
*
|
|
1008
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
1009
|
+
* via the `definition` "PromptChatApiLambdaResponseV1".
|
|
1010
|
+
*/
|
|
1011
|
+
export interface PromptChatApiLambdaResponseV1 {
|
|
1012
|
+
/**
|
|
1013
|
+
* A PromptChatApiCompletionV1, or a PromptChatApiFailureV1, as a JSON string.
|
|
1014
|
+
*/
|
|
1015
|
+
body: string;
|
|
1016
|
+
headers?: {
|
|
1017
|
+
[k: string]: string;
|
|
1018
|
+
};
|
|
1019
|
+
isBase64Encoded?: boolean;
|
|
1020
|
+
statusCode: number;
|
|
1021
|
+
[k: string]: unknown;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* The data of a ``progress`` event: a step of a running prompt.
|
|
1025
|
+
*
|
|
1026
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
1027
|
+
* via the `definition` "PromptChatApiProgressEvent".
|
|
1028
|
+
*/
|
|
1029
|
+
export interface PromptChatApiProgressEvent {
|
|
1030
|
+
/**
|
|
1031
|
+
* A short sentence, which Smarter Chat displays as is.
|
|
1032
|
+
*/
|
|
1033
|
+
message: string;
|
|
1034
|
+
type: "llm_request" | "tool_requested" | "tool_responded" | "plugin_called" | "mcp_tool_called" | "mcp_tool_responded" | "mcp_tool_failed";
|
|
1035
|
+
[k: string]: unknown;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* The data of the final ``result`` event.
|
|
1039
|
+
*
|
|
1040
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
1041
|
+
* via the `definition` "PromptChatApiProgressResult".
|
|
1042
|
+
*/
|
|
1043
|
+
export interface PromptChatApiProgressResult {
|
|
1044
|
+
/**
|
|
1045
|
+
* Exactly the JSON of a non-streaming response.
|
|
1046
|
+
*/
|
|
1047
|
+
response: PromptChatApiPromptResponse | PromptChatApiPromptResponseV1 | PromptChatApiErrorResponse;
|
|
1048
|
+
/**
|
|
1049
|
+
* The prompt's http status.
|
|
1050
|
+
*/
|
|
1051
|
+
status: number;
|
|
1052
|
+
[k: string]: unknown;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* The prompt api's response, version 2.
|
|
1056
|
+
*
|
|
1057
|
+
* A failed prompt has ``error`` too, and its http status is the LLM provider's. Its ``data.messages``
|
|
1058
|
+
* include a ``smarter_error`` message, which is also saved in the session's history.
|
|
1059
|
+
*
|
|
1060
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
1061
|
+
* via the `definition` "PromptChatApiPromptResponse".
|
|
1062
|
+
*/
|
|
1063
|
+
export interface PromptChatApiPromptResponse {
|
|
1064
|
+
/**
|
|
1065
|
+
* The api version, e.g. "smarter.sh/v1".
|
|
1066
|
+
*/
|
|
1067
|
+
api: string;
|
|
1068
|
+
data: PromptChatApiPromptResult;
|
|
1069
|
+
error?: PromptChatApiErrorBody | null;
|
|
1070
|
+
metadata?: PromptChatApiJournalMetadata3;
|
|
1071
|
+
[k: string]: unknown;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* The result of a prompt, version 2.
|
|
1075
|
+
*
|
|
1076
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
1077
|
+
* via the `definition` "PromptChatApiPromptResult".
|
|
1078
|
+
*/
|
|
1079
|
+
export interface PromptChatApiPromptResult {
|
|
1080
|
+
/**
|
|
1081
|
+
* The LLM's chat completion, in the format of the OpenAI api: its choices and usage.
|
|
1082
|
+
*/
|
|
1083
|
+
completion?: PromptChatApiCompletion | null;
|
|
1084
|
+
contract?: 2;
|
|
1085
|
+
/**
|
|
1086
|
+
* The messages that the prompt added to the chat thread, in order.
|
|
1087
|
+
*/
|
|
1088
|
+
messages?: PromptChatApiMessage[];
|
|
1089
|
+
/**
|
|
1090
|
+
* The plugins that Smarter selected.
|
|
1091
|
+
*/
|
|
1092
|
+
plugins?: string[];
|
|
1093
|
+
/**
|
|
1094
|
+
* The prompt's http status: 200, or the LLM provider's error status.
|
|
1095
|
+
*/
|
|
1096
|
+
status: number;
|
|
1097
|
+
/**
|
|
1098
|
+
* The functions that the LLM could call.
|
|
1099
|
+
*/
|
|
1100
|
+
tools?: string[];
|
|
1101
|
+
[k: string]: unknown;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* The journal's record of a request, which every journaled response carries.
|
|
1105
|
+
*/
|
|
1106
|
+
export interface PromptChatApiJournalMetadata3 {
|
|
1107
|
+
/**
|
|
1108
|
+
* The journal's command, e.g. prompt.
|
|
1109
|
+
*/
|
|
1110
|
+
command?: string | null;
|
|
1111
|
+
/**
|
|
1112
|
+
* The journal's thing, e.g. LLMClient.
|
|
1113
|
+
*/
|
|
1114
|
+
thing?: string | null;
|
|
1115
|
+
[k: string]: unknown;
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* @deprecated
|
|
1119
|
+
* The prompt api's response, version 1.
|
|
1120
|
+
*
|
|
1121
|
+
* This interface was referenced by `SmarterChatAPIContract`'s JSON-Schema
|
|
1122
|
+
* via the `definition` "PromptChatApiPromptResponseV1".
|
|
1123
|
+
*/
|
|
1124
|
+
export interface PromptChatApiPromptResponseV1 {
|
|
1125
|
+
/**
|
|
1126
|
+
* The api version, e.g. "smarter.sh/v1".
|
|
1127
|
+
*/
|
|
1128
|
+
api: string;
|
|
1129
|
+
data: PromptChatApiLambdaResponseV1;
|
|
1130
|
+
metadata?: PromptChatApiJournalMetadata4;
|
|
1131
|
+
[k: string]: unknown;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* The journal's record of a request, which every journaled response carries.
|
|
1135
|
+
*/
|
|
1136
|
+
export interface PromptChatApiJournalMetadata4 {
|
|
1137
|
+
/**
|
|
1138
|
+
* The journal's command, e.g. prompt.
|
|
1139
|
+
*/
|
|
1140
|
+
command?: string | null;
|
|
1141
|
+
/**
|
|
1142
|
+
* The journal's thing, e.g. LLMClient.
|
|
1143
|
+
*/
|
|
1144
|
+
thing?: string | null;
|
|
1145
|
+
[k: string]: unknown;
|
|
1146
|
+
}
|