openrag-sdk 0.1.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.
- package/README.md +320 -0
- package/dist/index.d.mts +516 -0
- package/dist/index.d.ts +516 -0
- package/dist/index.js +709 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +696 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenRAG SDK types.
|
|
3
|
+
*/
|
|
4
|
+
interface Source {
|
|
5
|
+
filename: string;
|
|
6
|
+
text: string;
|
|
7
|
+
score: number;
|
|
8
|
+
page?: number | null;
|
|
9
|
+
mimetype?: string | null;
|
|
10
|
+
}
|
|
11
|
+
interface ChatResponse {
|
|
12
|
+
response: string;
|
|
13
|
+
chatId?: string | null;
|
|
14
|
+
sources: Source[];
|
|
15
|
+
}
|
|
16
|
+
interface ContentEvent {
|
|
17
|
+
type: "content";
|
|
18
|
+
delta: string;
|
|
19
|
+
}
|
|
20
|
+
interface SourcesEvent {
|
|
21
|
+
type: "sources";
|
|
22
|
+
sources: Source[];
|
|
23
|
+
}
|
|
24
|
+
interface DoneEvent {
|
|
25
|
+
type: "done";
|
|
26
|
+
chatId?: string | null;
|
|
27
|
+
}
|
|
28
|
+
type StreamEvent = ContentEvent | SourcesEvent | DoneEvent;
|
|
29
|
+
interface SearchResult {
|
|
30
|
+
filename: string;
|
|
31
|
+
text: string;
|
|
32
|
+
score: number;
|
|
33
|
+
page?: number | null;
|
|
34
|
+
mimetype?: string | null;
|
|
35
|
+
}
|
|
36
|
+
interface SearchResponse {
|
|
37
|
+
results: SearchResult[];
|
|
38
|
+
}
|
|
39
|
+
interface SearchFilters {
|
|
40
|
+
data_sources?: string[];
|
|
41
|
+
document_types?: string[];
|
|
42
|
+
}
|
|
43
|
+
interface IngestResponse {
|
|
44
|
+
task_id: string;
|
|
45
|
+
status?: string | null;
|
|
46
|
+
filename?: string | null;
|
|
47
|
+
}
|
|
48
|
+
interface IngestTaskStatus {
|
|
49
|
+
task_id: string;
|
|
50
|
+
status: string;
|
|
51
|
+
total_files: number;
|
|
52
|
+
processed_files: number;
|
|
53
|
+
successful_files: number;
|
|
54
|
+
failed_files: number;
|
|
55
|
+
files: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
interface DeleteDocumentResponse {
|
|
58
|
+
success: boolean;
|
|
59
|
+
deleted_chunks: number;
|
|
60
|
+
}
|
|
61
|
+
interface Message {
|
|
62
|
+
role: string;
|
|
63
|
+
content: string;
|
|
64
|
+
timestamp?: string | null;
|
|
65
|
+
}
|
|
66
|
+
interface Conversation {
|
|
67
|
+
chatId: string;
|
|
68
|
+
title: string;
|
|
69
|
+
createdAt?: string | null;
|
|
70
|
+
lastActivity?: string | null;
|
|
71
|
+
messageCount: number;
|
|
72
|
+
}
|
|
73
|
+
interface ConversationDetail extends Conversation {
|
|
74
|
+
messages: Message[];
|
|
75
|
+
}
|
|
76
|
+
interface ConversationListResponse {
|
|
77
|
+
conversations: Conversation[];
|
|
78
|
+
}
|
|
79
|
+
interface AgentSettings {
|
|
80
|
+
llm_provider?: string | null;
|
|
81
|
+
llm_model?: string | null;
|
|
82
|
+
}
|
|
83
|
+
interface KnowledgeSettings {
|
|
84
|
+
embedding_provider?: string | null;
|
|
85
|
+
embedding_model?: string | null;
|
|
86
|
+
chunk_size?: number | null;
|
|
87
|
+
chunk_overlap?: number | null;
|
|
88
|
+
}
|
|
89
|
+
interface SettingsResponse {
|
|
90
|
+
agent: AgentSettings;
|
|
91
|
+
knowledge: KnowledgeSettings;
|
|
92
|
+
}
|
|
93
|
+
/** Options for updating settings. */
|
|
94
|
+
interface SettingsUpdateOptions {
|
|
95
|
+
/** LLM model name. */
|
|
96
|
+
llm_model?: string;
|
|
97
|
+
/** LLM provider (openai, anthropic, watsonx, ollama). */
|
|
98
|
+
llm_provider?: string;
|
|
99
|
+
/** System prompt for the agent. */
|
|
100
|
+
system_prompt?: string;
|
|
101
|
+
/** Embedding model name. */
|
|
102
|
+
embedding_model?: string;
|
|
103
|
+
/** Embedding provider (openai, watsonx, ollama). */
|
|
104
|
+
embedding_provider?: string;
|
|
105
|
+
/** Chunk size for document splitting. */
|
|
106
|
+
chunk_size?: number;
|
|
107
|
+
/** Chunk overlap for document splitting. */
|
|
108
|
+
chunk_overlap?: number;
|
|
109
|
+
/** Enable table structure parsing. */
|
|
110
|
+
table_structure?: boolean;
|
|
111
|
+
/** Enable OCR for text extraction. */
|
|
112
|
+
ocr?: boolean;
|
|
113
|
+
/** Enable picture descriptions. */
|
|
114
|
+
picture_descriptions?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/** Response from settings update. */
|
|
117
|
+
interface SettingsUpdateResponse {
|
|
118
|
+
message: string;
|
|
119
|
+
}
|
|
120
|
+
/** Query configuration stored in a knowledge filter. */
|
|
121
|
+
interface KnowledgeFilterQueryData {
|
|
122
|
+
/** Semantic search query text. */
|
|
123
|
+
query?: string;
|
|
124
|
+
/** Filter criteria for documents. */
|
|
125
|
+
filters?: {
|
|
126
|
+
data_sources?: string[];
|
|
127
|
+
document_types?: string[];
|
|
128
|
+
owners?: string[];
|
|
129
|
+
connector_types?: string[];
|
|
130
|
+
};
|
|
131
|
+
/** Maximum number of results. */
|
|
132
|
+
limit?: number;
|
|
133
|
+
/** Minimum relevance score threshold. */
|
|
134
|
+
scoreThreshold?: number;
|
|
135
|
+
/** UI color for the filter. */
|
|
136
|
+
color?: string;
|
|
137
|
+
/** UI icon for the filter. */
|
|
138
|
+
icon?: string;
|
|
139
|
+
}
|
|
140
|
+
/** A knowledge filter definition. */
|
|
141
|
+
interface KnowledgeFilter {
|
|
142
|
+
id: string;
|
|
143
|
+
name: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
queryData: KnowledgeFilterQueryData;
|
|
146
|
+
owner?: string;
|
|
147
|
+
createdAt?: string;
|
|
148
|
+
updatedAt?: string;
|
|
149
|
+
}
|
|
150
|
+
/** Options for creating a knowledge filter. */
|
|
151
|
+
interface CreateKnowledgeFilterOptions {
|
|
152
|
+
/** Filter name (required). */
|
|
153
|
+
name: string;
|
|
154
|
+
/** Filter description. */
|
|
155
|
+
description?: string;
|
|
156
|
+
/** Query configuration for the filter. */
|
|
157
|
+
queryData: KnowledgeFilterQueryData;
|
|
158
|
+
}
|
|
159
|
+
/** Options for updating a knowledge filter. */
|
|
160
|
+
interface UpdateKnowledgeFilterOptions {
|
|
161
|
+
/** New filter name. */
|
|
162
|
+
name?: string;
|
|
163
|
+
/** New filter description. */
|
|
164
|
+
description?: string;
|
|
165
|
+
/** New query configuration. */
|
|
166
|
+
queryData?: KnowledgeFilterQueryData;
|
|
167
|
+
}
|
|
168
|
+
/** Response from creating a knowledge filter. */
|
|
169
|
+
interface CreateKnowledgeFilterResponse {
|
|
170
|
+
success: boolean;
|
|
171
|
+
id?: string;
|
|
172
|
+
error?: string;
|
|
173
|
+
}
|
|
174
|
+
/** Response from searching knowledge filters. */
|
|
175
|
+
interface KnowledgeFilterSearchResponse {
|
|
176
|
+
success: boolean;
|
|
177
|
+
filters: KnowledgeFilter[];
|
|
178
|
+
}
|
|
179
|
+
/** Response from getting a knowledge filter. */
|
|
180
|
+
interface GetKnowledgeFilterResponse {
|
|
181
|
+
success: boolean;
|
|
182
|
+
filter?: KnowledgeFilter;
|
|
183
|
+
error?: string;
|
|
184
|
+
}
|
|
185
|
+
/** Response from deleting a knowledge filter. */
|
|
186
|
+
interface DeleteKnowledgeFilterResponse {
|
|
187
|
+
success: boolean;
|
|
188
|
+
error?: string;
|
|
189
|
+
}
|
|
190
|
+
interface OpenRAGClientOptions {
|
|
191
|
+
/** API key for authentication. Falls back to OPENRAG_API_KEY env var. */
|
|
192
|
+
apiKey?: string;
|
|
193
|
+
/** Base URL for the API. Falls back to OPENRAG_URL env var. */
|
|
194
|
+
baseUrl?: string;
|
|
195
|
+
/** Request timeout in milliseconds (default 30000). */
|
|
196
|
+
timeout?: number;
|
|
197
|
+
}
|
|
198
|
+
interface ChatCreateOptions {
|
|
199
|
+
message: string;
|
|
200
|
+
stream?: boolean;
|
|
201
|
+
chatId?: string;
|
|
202
|
+
filters?: SearchFilters;
|
|
203
|
+
limit?: number;
|
|
204
|
+
scoreThreshold?: number;
|
|
205
|
+
/** Knowledge filter ID to apply to the chat. */
|
|
206
|
+
filterId?: string;
|
|
207
|
+
}
|
|
208
|
+
interface SearchQueryOptions {
|
|
209
|
+
query: string;
|
|
210
|
+
filters?: SearchFilters;
|
|
211
|
+
limit?: number;
|
|
212
|
+
scoreThreshold?: number;
|
|
213
|
+
/** Knowledge filter ID to apply to the search. */
|
|
214
|
+
filterId?: string;
|
|
215
|
+
}
|
|
216
|
+
declare class OpenRAGError extends Error {
|
|
217
|
+
statusCode?: number | undefined;
|
|
218
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
219
|
+
}
|
|
220
|
+
declare class AuthenticationError extends OpenRAGError {
|
|
221
|
+
constructor(message: string, statusCode?: number);
|
|
222
|
+
}
|
|
223
|
+
declare class NotFoundError extends OpenRAGError {
|
|
224
|
+
constructor(message: string, statusCode?: number);
|
|
225
|
+
}
|
|
226
|
+
declare class ValidationError extends OpenRAGError {
|
|
227
|
+
constructor(message: string, statusCode?: number);
|
|
228
|
+
}
|
|
229
|
+
declare class RateLimitError extends OpenRAGError {
|
|
230
|
+
constructor(message: string, statusCode?: number);
|
|
231
|
+
}
|
|
232
|
+
declare class ServerError extends OpenRAGError {
|
|
233
|
+
constructor(message: string, statusCode?: number);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* OpenRAG SDK chat client with streaming support.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Streaming chat response with helpers.
|
|
242
|
+
*
|
|
243
|
+
* Usage:
|
|
244
|
+
* ```typescript
|
|
245
|
+
* using stream = await client.chat.stream({ message: "Hello" });
|
|
246
|
+
* for await (const event of stream) {
|
|
247
|
+
* if (event.type === "content") console.log(event.delta);
|
|
248
|
+
* }
|
|
249
|
+
* console.log(stream.chatId);
|
|
250
|
+
* console.log(stream.text);
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
declare class ChatStream implements AsyncIterable<StreamEvent>, Disposable {
|
|
254
|
+
private client;
|
|
255
|
+
private options;
|
|
256
|
+
private _text;
|
|
257
|
+
private _chatId;
|
|
258
|
+
private _sources;
|
|
259
|
+
private _consumed;
|
|
260
|
+
private _reader;
|
|
261
|
+
private _response;
|
|
262
|
+
constructor(client: OpenRAGClient, options: ChatCreateOptions);
|
|
263
|
+
/** The accumulated text from content events. */
|
|
264
|
+
get text(): string;
|
|
265
|
+
/** The chat ID for continuing the conversation. */
|
|
266
|
+
get chatId(): string | null;
|
|
267
|
+
/** The sources retrieved during the conversation. */
|
|
268
|
+
get sources(): Source[];
|
|
269
|
+
/** @internal Initialize the stream. */
|
|
270
|
+
_init(): Promise<void>;
|
|
271
|
+
[Symbol.asyncIterator](): AsyncIterator<StreamEvent>;
|
|
272
|
+
/**
|
|
273
|
+
* Iterate over just the text deltas.
|
|
274
|
+
*/
|
|
275
|
+
get textStream(): AsyncIterable<string>;
|
|
276
|
+
/**
|
|
277
|
+
* Consume the stream and return the complete text.
|
|
278
|
+
*/
|
|
279
|
+
finalText(): Promise<string>;
|
|
280
|
+
/** Clean up resources. */
|
|
281
|
+
[Symbol.dispose](): void;
|
|
282
|
+
/** Close the stream. */
|
|
283
|
+
close(): void;
|
|
284
|
+
}
|
|
285
|
+
declare class ChatClient {
|
|
286
|
+
private client;
|
|
287
|
+
constructor(client: OpenRAGClient);
|
|
288
|
+
/**
|
|
289
|
+
* Send a chat message (non-streaming).
|
|
290
|
+
*/
|
|
291
|
+
create(options: ChatCreateOptions & {
|
|
292
|
+
stream?: false;
|
|
293
|
+
}): Promise<ChatResponse>;
|
|
294
|
+
/**
|
|
295
|
+
* Send a chat message (streaming).
|
|
296
|
+
*/
|
|
297
|
+
create(options: ChatCreateOptions & {
|
|
298
|
+
stream: true;
|
|
299
|
+
}): Promise<AsyncIterable<StreamEvent>>;
|
|
300
|
+
private _createNonStreaming;
|
|
301
|
+
private _createStreamingIterator;
|
|
302
|
+
/**
|
|
303
|
+
* Create a streaming chat context manager.
|
|
304
|
+
*
|
|
305
|
+
* @param options - Chat options.
|
|
306
|
+
* @returns ChatStream with helpers.
|
|
307
|
+
*/
|
|
308
|
+
stream(options: Omit<ChatCreateOptions, "stream">): Promise<ChatStream>;
|
|
309
|
+
/**
|
|
310
|
+
* List all conversations.
|
|
311
|
+
*/
|
|
312
|
+
list(): Promise<ConversationListResponse>;
|
|
313
|
+
/**
|
|
314
|
+
* Get a specific conversation with full message history.
|
|
315
|
+
*
|
|
316
|
+
* @param chatId - The ID of the conversation to retrieve.
|
|
317
|
+
*/
|
|
318
|
+
get(chatId: string): Promise<ConversationDetail>;
|
|
319
|
+
/**
|
|
320
|
+
* Delete a conversation.
|
|
321
|
+
*
|
|
322
|
+
* @param chatId - The ID of the conversation to delete.
|
|
323
|
+
*/
|
|
324
|
+
delete(chatId: string): Promise<boolean>;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* OpenRAG SDK documents client.
|
|
329
|
+
*/
|
|
330
|
+
|
|
331
|
+
interface IngestOptions {
|
|
332
|
+
/** Path to file (Node.js only). */
|
|
333
|
+
filePath?: string;
|
|
334
|
+
/** File object (browser or Node.js). */
|
|
335
|
+
file?: File | Blob;
|
|
336
|
+
/** Filename when providing file/blob. */
|
|
337
|
+
filename?: string;
|
|
338
|
+
/** If true, poll until ingestion completes. Default: true. */
|
|
339
|
+
wait?: boolean;
|
|
340
|
+
/** Seconds between status checks when waiting. Default: 1. */
|
|
341
|
+
pollInterval?: number;
|
|
342
|
+
/** Maximum seconds to wait for completion. Default: 300. */
|
|
343
|
+
timeout?: number;
|
|
344
|
+
}
|
|
345
|
+
declare class DocumentsClient {
|
|
346
|
+
private client;
|
|
347
|
+
constructor(client: OpenRAGClient);
|
|
348
|
+
/**
|
|
349
|
+
* Ingest a document into the knowledge base.
|
|
350
|
+
*
|
|
351
|
+
* @param options - Ingest options (filePath or file+filename).
|
|
352
|
+
* @returns IngestTaskStatus with final status if wait=true, IngestResponse with task_id if wait=false.
|
|
353
|
+
*/
|
|
354
|
+
ingest(options: IngestOptions): Promise<IngestResponse | IngestTaskStatus>;
|
|
355
|
+
/**
|
|
356
|
+
* Get the status of an ingestion task.
|
|
357
|
+
*
|
|
358
|
+
* @param taskId - The task ID returned from ingest().
|
|
359
|
+
* @returns IngestTaskStatus with current task status.
|
|
360
|
+
*/
|
|
361
|
+
getTaskStatus(taskId: string): Promise<IngestTaskStatus>;
|
|
362
|
+
/**
|
|
363
|
+
* Wait for an ingestion task to complete.
|
|
364
|
+
*
|
|
365
|
+
* @param taskId - The task ID to wait for.
|
|
366
|
+
* @param pollInterval - Seconds between status checks.
|
|
367
|
+
* @param timeout - Maximum seconds to wait.
|
|
368
|
+
* @returns IngestTaskStatus with final status.
|
|
369
|
+
*/
|
|
370
|
+
waitForTask(taskId: string, pollInterval?: number, timeout?: number): Promise<IngestTaskStatus>;
|
|
371
|
+
private sleep;
|
|
372
|
+
/**
|
|
373
|
+
* Delete a document from the knowledge base.
|
|
374
|
+
*
|
|
375
|
+
* @param filename - Name of the file to delete.
|
|
376
|
+
* @returns DeleteDocumentResponse with deleted chunk count.
|
|
377
|
+
*/
|
|
378
|
+
delete(filename: string): Promise<DeleteDocumentResponse>;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* OpenRAG SDK search client.
|
|
383
|
+
*/
|
|
384
|
+
|
|
385
|
+
declare class SearchClient {
|
|
386
|
+
private client;
|
|
387
|
+
constructor(client: OpenRAGClient);
|
|
388
|
+
/**
|
|
389
|
+
* Perform semantic search on documents.
|
|
390
|
+
*
|
|
391
|
+
* @param query - The search query text.
|
|
392
|
+
* @param options - Optional search options.
|
|
393
|
+
* @returns SearchResponse containing the search results.
|
|
394
|
+
*/
|
|
395
|
+
query(query: string, options?: Omit<SearchQueryOptions, "query">): Promise<SearchResponse>;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* OpenRAG SDK knowledge filters client.
|
|
400
|
+
*/
|
|
401
|
+
|
|
402
|
+
declare class KnowledgeFiltersClient {
|
|
403
|
+
private client;
|
|
404
|
+
constructor(client: OpenRAGClient);
|
|
405
|
+
/**
|
|
406
|
+
* Create a new knowledge filter.
|
|
407
|
+
*
|
|
408
|
+
* @param options - The filter options including name and queryData.
|
|
409
|
+
* @returns The created filter response with ID.
|
|
410
|
+
*/
|
|
411
|
+
create(options: CreateKnowledgeFilterOptions): Promise<CreateKnowledgeFilterResponse>;
|
|
412
|
+
/**
|
|
413
|
+
* Search for knowledge filters by name, description, or query content.
|
|
414
|
+
*
|
|
415
|
+
* @param query - Optional search query text.
|
|
416
|
+
* @param limit - Maximum number of results (default 20).
|
|
417
|
+
* @returns List of matching knowledge filters.
|
|
418
|
+
*/
|
|
419
|
+
search(query?: string, limit?: number): Promise<KnowledgeFilter[]>;
|
|
420
|
+
/**
|
|
421
|
+
* Get a specific knowledge filter by ID.
|
|
422
|
+
*
|
|
423
|
+
* @param filterId - The ID of the filter to retrieve.
|
|
424
|
+
* @returns The knowledge filter or null if not found.
|
|
425
|
+
*/
|
|
426
|
+
get(filterId: string): Promise<KnowledgeFilter | null>;
|
|
427
|
+
/**
|
|
428
|
+
* Update an existing knowledge filter.
|
|
429
|
+
*
|
|
430
|
+
* @param filterId - The ID of the filter to update.
|
|
431
|
+
* @param options - The fields to update.
|
|
432
|
+
* @returns Success status.
|
|
433
|
+
*/
|
|
434
|
+
update(filterId: string, options: UpdateKnowledgeFilterOptions): Promise<boolean>;
|
|
435
|
+
/**
|
|
436
|
+
* Delete a knowledge filter.
|
|
437
|
+
*
|
|
438
|
+
* @param filterId - The ID of the filter to delete.
|
|
439
|
+
* @returns Success status.
|
|
440
|
+
*/
|
|
441
|
+
delete(filterId: string): Promise<boolean>;
|
|
442
|
+
/**
|
|
443
|
+
* Parse a filter from API response, handling JSON-stringified queryData.
|
|
444
|
+
*/
|
|
445
|
+
private _parseFilter;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* OpenRAG SDK client.
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
declare class SettingsClient {
|
|
453
|
+
private client;
|
|
454
|
+
constructor(client: OpenRAGClient);
|
|
455
|
+
/**
|
|
456
|
+
* Get current OpenRAG configuration.
|
|
457
|
+
*/
|
|
458
|
+
get(): Promise<SettingsResponse>;
|
|
459
|
+
/**
|
|
460
|
+
* Update OpenRAG configuration.
|
|
461
|
+
*
|
|
462
|
+
* @param options - The settings to update.
|
|
463
|
+
* @returns Success response with message.
|
|
464
|
+
*/
|
|
465
|
+
update(options: SettingsUpdateOptions): Promise<SettingsUpdateResponse>;
|
|
466
|
+
}
|
|
467
|
+
interface RequestOptions {
|
|
468
|
+
body?: string | FormData;
|
|
469
|
+
isMultipart?: boolean;
|
|
470
|
+
stream?: boolean;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* OpenRAG API client.
|
|
474
|
+
*
|
|
475
|
+
* The client can be configured via constructor arguments or environment variables:
|
|
476
|
+
* - OPENRAG_API_KEY: API key for authentication
|
|
477
|
+
* - OPENRAG_URL: Base URL for the OpenRAG API (default: http://localhost:8080)
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```typescript
|
|
481
|
+
* // Using environment variables
|
|
482
|
+
* const client = new OpenRAGClient();
|
|
483
|
+
* const response = await client.chat.create({ message: "Hello" });
|
|
484
|
+
*
|
|
485
|
+
* // Using explicit arguments
|
|
486
|
+
* const client = new OpenRAGClient({
|
|
487
|
+
* apiKey: "orag_...",
|
|
488
|
+
* baseUrl: "https://api.example.com"
|
|
489
|
+
* });
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
declare class OpenRAGClient {
|
|
493
|
+
private static readonly DEFAULT_BASE_URL;
|
|
494
|
+
private readonly _apiKey;
|
|
495
|
+
private readonly _baseUrl;
|
|
496
|
+
private readonly _timeout;
|
|
497
|
+
/** Chat client for conversations. */
|
|
498
|
+
readonly chat: ChatClient;
|
|
499
|
+
/** Search client for semantic search. */
|
|
500
|
+
readonly search: SearchClient;
|
|
501
|
+
/** Documents client for ingestion and deletion. */
|
|
502
|
+
readonly documents: DocumentsClient;
|
|
503
|
+
/** Settings client for configuration. */
|
|
504
|
+
readonly settings: SettingsClient;
|
|
505
|
+
/** Knowledge filters client for managing filters. */
|
|
506
|
+
readonly knowledgeFilters: KnowledgeFiltersClient;
|
|
507
|
+
constructor(options?: OpenRAGClientOptions);
|
|
508
|
+
/** @internal Get request headers with authentication. */
|
|
509
|
+
_getHeaders(isMultipart?: boolean): Record<string, string>;
|
|
510
|
+
/** @internal Make an authenticated request to the API. */
|
|
511
|
+
_request(method: string, path: string, options?: RequestOptions): Promise<Response>;
|
|
512
|
+
/** @internal Handle error responses. */
|
|
513
|
+
_handleError(response: Response): void;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export { type AgentSettings, AuthenticationError, ChatClient, type ChatCreateOptions, type ChatResponse, ChatStream, type ContentEvent, type Conversation, type ConversationDetail, type ConversationListResponse, type CreateKnowledgeFilterOptions, type CreateKnowledgeFilterResponse, type DeleteDocumentResponse, type DeleteKnowledgeFilterResponse, DocumentsClient, type DoneEvent, type GetKnowledgeFilterResponse, type IngestResponse, type KnowledgeFilter, type KnowledgeFilterQueryData, type KnowledgeFilterSearchResponse, KnowledgeFiltersClient, type KnowledgeSettings, type Message, NotFoundError, OpenRAGClient, type OpenRAGClientOptions, OpenRAGError, RateLimitError, SearchClient, type SearchFilters, type SearchQueryOptions, type SearchResponse, type SearchResult, ServerError, type SettingsResponse, type SettingsUpdateOptions, type SettingsUpdateResponse, type Source, type SourcesEvent, type StreamEvent, type UpdateKnowledgeFilterOptions, ValidationError };
|