@ragbits/api-client 0.0.3 → 1.4.0-dev.202512021005
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/README.md +51 -101
- package/__tests__/mocks/handlers.ts +98 -0
- package/__tests__/setup.ts +23 -0
- package/__tests__/utils.ts +45 -0
- package/dist/autogen.types.d.ts +495 -0
- package/dist/index.cjs +149 -55
- package/dist/index.d.ts +14 -5
- package/dist/index.js +146 -53
- package/dist/types.d.ts +38 -198
- package/package.json +8 -4
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated TypeScript interfaces from Python Pydantic models
|
|
3
|
+
* Generated by scripts/generate_typescript_from_json_schema.py
|
|
4
|
+
* DO NOT EDIT MANUALLY
|
|
5
|
+
*/
|
|
6
|
+
import type { RJSFSchema } from '@rjsf/utils';
|
|
7
|
+
export type TypeFrom<T> = T[keyof T];
|
|
8
|
+
/**
|
|
9
|
+
* Represents the FeedbackType enum
|
|
10
|
+
*/
|
|
11
|
+
export declare const FeedbackType: {
|
|
12
|
+
readonly Like: "like";
|
|
13
|
+
readonly Dislike: "dislike";
|
|
14
|
+
};
|
|
15
|
+
export type FeedbackType = TypeFrom<typeof FeedbackType>;
|
|
16
|
+
/**
|
|
17
|
+
* Represents the LiveUpdateType enum
|
|
18
|
+
*/
|
|
19
|
+
export declare const LiveUpdateType: {
|
|
20
|
+
readonly Start: "START";
|
|
21
|
+
readonly Finish: "FINISH";
|
|
22
|
+
};
|
|
23
|
+
export type LiveUpdateType = TypeFrom<typeof LiveUpdateType>;
|
|
24
|
+
/**
|
|
25
|
+
* Represents the MessageRole enum
|
|
26
|
+
*/
|
|
27
|
+
export declare const MessageRole: {
|
|
28
|
+
readonly User: "user";
|
|
29
|
+
readonly Assistant: "assistant";
|
|
30
|
+
readonly System: "system";
|
|
31
|
+
};
|
|
32
|
+
export type MessageRole = TypeFrom<typeof MessageRole>;
|
|
33
|
+
/**
|
|
34
|
+
* Represents the TaskStatus enum
|
|
35
|
+
*/
|
|
36
|
+
export declare const TaskStatus: {
|
|
37
|
+
readonly Pending: "pending";
|
|
38
|
+
readonly InProgress: "in_progress";
|
|
39
|
+
readonly Completed: "completed";
|
|
40
|
+
readonly Failed: "failed";
|
|
41
|
+
readonly Cancelled: "cancelled";
|
|
42
|
+
readonly Retrying: "retrying";
|
|
43
|
+
};
|
|
44
|
+
export type TaskStatus = TypeFrom<typeof TaskStatus>;
|
|
45
|
+
/**
|
|
46
|
+
* Represents the AuthType enum
|
|
47
|
+
*/
|
|
48
|
+
export declare const AuthType: {
|
|
49
|
+
readonly Credentials: "credentials";
|
|
50
|
+
};
|
|
51
|
+
export type AuthType = TypeFrom<typeof AuthType>;
|
|
52
|
+
/**
|
|
53
|
+
* Represents the context of a chat conversation.
|
|
54
|
+
*/
|
|
55
|
+
export interface ChatContext {
|
|
56
|
+
conversation_id: string | null;
|
|
57
|
+
message_id: string | null;
|
|
58
|
+
state: {
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
user: User | null;
|
|
62
|
+
session_id: string | null;
|
|
63
|
+
[k: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents a chunk of large content being transmitted.
|
|
67
|
+
*/
|
|
68
|
+
export interface ChunkedContent {
|
|
69
|
+
id: string;
|
|
70
|
+
content_type: string;
|
|
71
|
+
chunk_index: number;
|
|
72
|
+
total_chunks: number;
|
|
73
|
+
mime_type: string;
|
|
74
|
+
data: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Represents an live update performed by an agent.
|
|
78
|
+
*/
|
|
79
|
+
export interface LiveUpdate {
|
|
80
|
+
update_id: string;
|
|
81
|
+
type: LiveUpdateType;
|
|
82
|
+
content: LiveUpdateContent;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Represents content of a live update.
|
|
86
|
+
*/
|
|
87
|
+
export interface LiveUpdateContent {
|
|
88
|
+
label: string;
|
|
89
|
+
description: string | null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Represents a single message in the conversation history.
|
|
93
|
+
*/
|
|
94
|
+
export interface Message {
|
|
95
|
+
role: MessageRole;
|
|
96
|
+
content: string;
|
|
97
|
+
/**
|
|
98
|
+
* Extra information about the message
|
|
99
|
+
*/
|
|
100
|
+
extra: {
|
|
101
|
+
[k: string]: unknown;
|
|
102
|
+
} | null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Represents a document used as reference for the response.
|
|
106
|
+
*/
|
|
107
|
+
export interface Reference {
|
|
108
|
+
title: string;
|
|
109
|
+
content: string;
|
|
110
|
+
url: string | null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Represents an update to conversation state.
|
|
114
|
+
*/
|
|
115
|
+
export interface ServerState {
|
|
116
|
+
state: {
|
|
117
|
+
[k: string]: unknown;
|
|
118
|
+
};
|
|
119
|
+
signature: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Individual feedback configuration (like/dislike).
|
|
123
|
+
*/
|
|
124
|
+
export interface FeedbackItem {
|
|
125
|
+
/**
|
|
126
|
+
* Whether this feedback type is enabled
|
|
127
|
+
*/
|
|
128
|
+
enabled: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Form schema for this feedback type
|
|
131
|
+
*/
|
|
132
|
+
form: RJSFSchema | null;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Represents an image in the conversation.
|
|
136
|
+
*/
|
|
137
|
+
export interface Image {
|
|
138
|
+
id: string;
|
|
139
|
+
url: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Represents usage for a message. Reflects `Usage` computed properties.
|
|
143
|
+
*/
|
|
144
|
+
export interface MessageUsage {
|
|
145
|
+
n_requests: number;
|
|
146
|
+
estimated_cost: number;
|
|
147
|
+
prompt_tokens: number;
|
|
148
|
+
completion_tokens: number;
|
|
149
|
+
total_tokens: number;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Simple task representation.
|
|
153
|
+
*/
|
|
154
|
+
export interface Task {
|
|
155
|
+
id: string;
|
|
156
|
+
description: string;
|
|
157
|
+
/**
|
|
158
|
+
* Task status options.
|
|
159
|
+
*/
|
|
160
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled' | 'retrying';
|
|
161
|
+
order: number;
|
|
162
|
+
summary: string | null;
|
|
163
|
+
parent_id: string | null;
|
|
164
|
+
full_response: string | null;
|
|
165
|
+
dependencies: string[];
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Text content wrapper.
|
|
169
|
+
*/
|
|
170
|
+
export interface TextContent {
|
|
171
|
+
text: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Message ID content wrapper.
|
|
175
|
+
*/
|
|
176
|
+
export interface MessageIdContent {
|
|
177
|
+
message_id: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Conversation ID content wrapper.
|
|
181
|
+
*/
|
|
182
|
+
export interface ConversationIdContent {
|
|
183
|
+
conversation_id: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Conversation summary content wrapper.
|
|
187
|
+
*/
|
|
188
|
+
export interface ConversationSummaryContent {
|
|
189
|
+
summary: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Followup messages content wrapper.
|
|
193
|
+
*/
|
|
194
|
+
export interface FollowupMessagesContent {
|
|
195
|
+
messages: string[];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Usage statistics content wrapper.
|
|
199
|
+
*/
|
|
200
|
+
export interface UsageContent {
|
|
201
|
+
usage: {
|
|
202
|
+
[k: string]: MessageUsage;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Todo item content wrapper.
|
|
207
|
+
*/
|
|
208
|
+
export interface TodoItemContent {
|
|
209
|
+
task: Task;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Customization for the header section of the UI.
|
|
213
|
+
*/
|
|
214
|
+
export interface HeaderCustomization {
|
|
215
|
+
/**
|
|
216
|
+
* Custom title to be displayed instead of 'Ragbits Chat'
|
|
217
|
+
*/
|
|
218
|
+
title: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Custom subtitle to be displayed instead of 'by deepsense.ai'
|
|
221
|
+
*/
|
|
222
|
+
subtitle: string | null;
|
|
223
|
+
/**
|
|
224
|
+
* Custom logo URL or content. The logo can also be served from 'static' directory inside 'ui-buid'
|
|
225
|
+
*/
|
|
226
|
+
logo: string | null;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Customization for the UI.
|
|
230
|
+
*/
|
|
231
|
+
export interface UICustomization {
|
|
232
|
+
/**
|
|
233
|
+
* Custom header configuration
|
|
234
|
+
*/
|
|
235
|
+
header: HeaderCustomization | null;
|
|
236
|
+
/**
|
|
237
|
+
* Custom welcome message to be displayed on the UI. It supports Markdown.
|
|
238
|
+
*/
|
|
239
|
+
welcome_message: string | null;
|
|
240
|
+
/**
|
|
241
|
+
* Custom meta properties customization
|
|
242
|
+
*/
|
|
243
|
+
meta: PageMetaCustomization | null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Customization for the meta properites of the UI
|
|
247
|
+
*/
|
|
248
|
+
export interface PageMetaCustomization {
|
|
249
|
+
/**
|
|
250
|
+
* Custom favicon URL or content. If `None` logo is used.The favicon can also be serverd from 'static' directory inside 'ui-build'
|
|
251
|
+
*/
|
|
252
|
+
favicon: string | null;
|
|
253
|
+
/**
|
|
254
|
+
* Custom title for the page displayed in the browser's bar. If `None` header title is used.
|
|
255
|
+
*/
|
|
256
|
+
page_title: string | null;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Configuration for chat options.
|
|
260
|
+
*/
|
|
261
|
+
export interface UserSettings {
|
|
262
|
+
/**
|
|
263
|
+
* The form to use for chat options. Use Pydantic models to define form objects, that would get converted to JSONSchema and rendered in the UI.
|
|
264
|
+
*/
|
|
265
|
+
form: RJSFSchema | null;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Feedback configuration containing like and dislike settings.
|
|
269
|
+
*/
|
|
270
|
+
export interface FeedbackConfig {
|
|
271
|
+
like: FeedbackItem;
|
|
272
|
+
dislike: FeedbackItem;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Configuration response from the API.
|
|
276
|
+
*/
|
|
277
|
+
export interface ConfigResponse {
|
|
278
|
+
feedback: FeedbackConfig;
|
|
279
|
+
/**
|
|
280
|
+
* UI customization
|
|
281
|
+
*/
|
|
282
|
+
customization: UICustomization | null;
|
|
283
|
+
user_settings: UserSettings;
|
|
284
|
+
/**
|
|
285
|
+
* Debug mode flag
|
|
286
|
+
*/
|
|
287
|
+
debug_mode: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Flag to enable conversation history
|
|
290
|
+
*/
|
|
291
|
+
conversation_history: boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Flag to enable usage statistics
|
|
294
|
+
*/
|
|
295
|
+
show_usage: boolean;
|
|
296
|
+
authentication: AuthenticationConfig;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Response from feedback submission.
|
|
300
|
+
*/
|
|
301
|
+
export interface FeedbackResponse {
|
|
302
|
+
/**
|
|
303
|
+
* Status of the feedback submission
|
|
304
|
+
*/
|
|
305
|
+
status: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Client-side chat request interface.
|
|
309
|
+
*/
|
|
310
|
+
export interface ChatRequest {
|
|
311
|
+
/**
|
|
312
|
+
* The current user message
|
|
313
|
+
*/
|
|
314
|
+
message: string;
|
|
315
|
+
/**
|
|
316
|
+
* Previous message history
|
|
317
|
+
*/
|
|
318
|
+
history: Message[];
|
|
319
|
+
/**
|
|
320
|
+
* User context information
|
|
321
|
+
*/
|
|
322
|
+
context: {
|
|
323
|
+
[k: string]: unknown;
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Request body for feedback submission.
|
|
328
|
+
*/
|
|
329
|
+
export interface FeedbackRequest {
|
|
330
|
+
/**
|
|
331
|
+
* ID of the message receiving feedback
|
|
332
|
+
*/
|
|
333
|
+
message_id: string;
|
|
334
|
+
/**
|
|
335
|
+
* Type of feedback (like or dislike)
|
|
336
|
+
*/
|
|
337
|
+
feedback: 'like' | 'dislike';
|
|
338
|
+
/**
|
|
339
|
+
* Additional feedback details
|
|
340
|
+
*/
|
|
341
|
+
payload: {
|
|
342
|
+
[k: string]: unknown;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Configuration for authentication.
|
|
347
|
+
*/
|
|
348
|
+
export interface AuthenticationConfig {
|
|
349
|
+
/**
|
|
350
|
+
* Enable/disable authentication
|
|
351
|
+
*/
|
|
352
|
+
enabled: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* List of available authentication types
|
|
355
|
+
*/
|
|
356
|
+
auth_types: AuthType[];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Request body for user login
|
|
360
|
+
*/
|
|
361
|
+
export interface CredentialsLoginRequest {
|
|
362
|
+
/**
|
|
363
|
+
* Username
|
|
364
|
+
*/
|
|
365
|
+
username: string;
|
|
366
|
+
/**
|
|
367
|
+
* Password
|
|
368
|
+
*/
|
|
369
|
+
password: string;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Represents a JWT authentication jwt_token.
|
|
373
|
+
*/
|
|
374
|
+
export interface JWTToken {
|
|
375
|
+
access_token: string;
|
|
376
|
+
token_type: string;
|
|
377
|
+
expires_in: number;
|
|
378
|
+
refresh_token: string | null;
|
|
379
|
+
user: User;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Request body for user login
|
|
383
|
+
*/
|
|
384
|
+
export interface LoginRequest {
|
|
385
|
+
/**
|
|
386
|
+
* Username
|
|
387
|
+
*/
|
|
388
|
+
username: string;
|
|
389
|
+
/**
|
|
390
|
+
* Password
|
|
391
|
+
*/
|
|
392
|
+
password: string;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Response body for successful login
|
|
396
|
+
*/
|
|
397
|
+
export interface LoginResponse {
|
|
398
|
+
/**
|
|
399
|
+
* Whether login was successful
|
|
400
|
+
*/
|
|
401
|
+
success: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* User information
|
|
404
|
+
*/
|
|
405
|
+
user: User | null;
|
|
406
|
+
/**
|
|
407
|
+
* Error message if login failed
|
|
408
|
+
*/
|
|
409
|
+
error_message: string | null;
|
|
410
|
+
/**
|
|
411
|
+
* Access jwt_token
|
|
412
|
+
*/
|
|
413
|
+
jwt_token: JWTToken | null;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Request body for user logout
|
|
417
|
+
*/
|
|
418
|
+
export interface LogoutRequest {
|
|
419
|
+
/**
|
|
420
|
+
* Session ID to logout
|
|
421
|
+
*/
|
|
422
|
+
token: string;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Represents an authenticated user.
|
|
426
|
+
*/
|
|
427
|
+
export interface User {
|
|
428
|
+
user_id: string;
|
|
429
|
+
username: string;
|
|
430
|
+
email: string | null;
|
|
431
|
+
full_name: string | null;
|
|
432
|
+
roles: string[];
|
|
433
|
+
metadata: {
|
|
434
|
+
[k: string]: unknown;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Specific chat response types
|
|
439
|
+
*/
|
|
440
|
+
export interface TextChatResponse {
|
|
441
|
+
type: 'text';
|
|
442
|
+
content: TextContent;
|
|
443
|
+
}
|
|
444
|
+
export interface ReferenceChatResponse {
|
|
445
|
+
type: 'reference';
|
|
446
|
+
content: Reference;
|
|
447
|
+
}
|
|
448
|
+
export interface MessageIdChatResponse {
|
|
449
|
+
type: 'message_id';
|
|
450
|
+
content: MessageIdContent;
|
|
451
|
+
}
|
|
452
|
+
export interface ConversationIdChatResponse {
|
|
453
|
+
type: 'conversation_id';
|
|
454
|
+
content: ConversationIdContent;
|
|
455
|
+
}
|
|
456
|
+
export interface StateUpdateChatResponse {
|
|
457
|
+
type: 'state_update';
|
|
458
|
+
content: ServerState;
|
|
459
|
+
}
|
|
460
|
+
export interface LiveUpdateChatResponse {
|
|
461
|
+
type: 'live_update';
|
|
462
|
+
content: LiveUpdate;
|
|
463
|
+
}
|
|
464
|
+
export interface FollowupMessagesChatResponse {
|
|
465
|
+
type: 'followup_messages';
|
|
466
|
+
content: FollowupMessagesContent;
|
|
467
|
+
}
|
|
468
|
+
export interface ImageChatResponse {
|
|
469
|
+
type: 'image';
|
|
470
|
+
content: Image;
|
|
471
|
+
}
|
|
472
|
+
export interface MessageUsageChatResponse {
|
|
473
|
+
type: 'usage';
|
|
474
|
+
content: UsageContent;
|
|
475
|
+
}
|
|
476
|
+
export interface ClearMessageChatResponse {
|
|
477
|
+
type: 'clear_message';
|
|
478
|
+
content: unknown;
|
|
479
|
+
}
|
|
480
|
+
export interface TodoItemChatResonse {
|
|
481
|
+
type: 'todo_item';
|
|
482
|
+
content: TodoItemContent;
|
|
483
|
+
}
|
|
484
|
+
export interface ConversationSummaryResponse {
|
|
485
|
+
type: 'conversation_summary';
|
|
486
|
+
content: ConversationSummaryContent;
|
|
487
|
+
}
|
|
488
|
+
export interface ChunkedChatResponse {
|
|
489
|
+
type: 'chunked_content';
|
|
490
|
+
content: ChunkedContent;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Typed chat response union
|
|
494
|
+
*/
|
|
495
|
+
export type ChatResponse = TextChatResponse | ReferenceChatResponse | MessageIdChatResponse | ConversationIdChatResponse | StateUpdateChatResponse | LiveUpdateChatResponse | FollowupMessagesChatResponse | ImageChatResponse | MessageUsageChatResponse | ClearMessageChatResponse | TodoItemChatResonse | ConversationSummaryResponse;
|