@smarter.sh/ui-chat 0.7.0 → 0.8.0

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