@ragable/sdk 0.0.1 → 0.0.3
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/dist/index.d.mts +222 -24
- package/dist/index.d.ts +222 -24
- package/dist/index.js +402 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +392 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,32 +1,230 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface RagableClientOptions {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
fetch?: typeof fetch;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
}
|
|
7
|
+
type RequestOptions = Omit<RequestInit, "body"> & {
|
|
8
|
+
body?: unknown;
|
|
9
|
+
};
|
|
10
|
+
declare class RagableError extends Error {
|
|
11
|
+
readonly status: number;
|
|
12
|
+
readonly body: unknown;
|
|
13
|
+
constructor(message: string, status: number, body: unknown);
|
|
14
|
+
}
|
|
15
|
+
declare function extractErrorMessage(payload: unknown, fallback: string): string;
|
|
16
|
+
declare class RagableRequestClient {
|
|
17
|
+
private readonly apiKey;
|
|
18
|
+
private readonly baseUrl;
|
|
19
|
+
private readonly fetchImpl;
|
|
20
|
+
private readonly defaultHeaders;
|
|
21
|
+
constructor(options: RagableClientOptions);
|
|
22
|
+
toUrl(path: string): string;
|
|
23
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Low-level fetch with API key and JSON body encoding. Caller handles status and body.
|
|
26
|
+
*/
|
|
27
|
+
rawFetch(path: string, options?: RequestOptions): Promise<Response>;
|
|
28
|
+
private parseResponseBody;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ShiftIndex {
|
|
32
|
+
id: string;
|
|
2
33
|
name: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
34
|
+
description: string | null;
|
|
35
|
+
dimensions: number;
|
|
36
|
+
embeddingModel: string;
|
|
37
|
+
status: string;
|
|
38
|
+
entryCount?: number;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}
|
|
42
|
+
interface ShiftEntry {
|
|
43
|
+
id: string;
|
|
44
|
+
content: string;
|
|
45
|
+
metadata: unknown;
|
|
46
|
+
chunkIndex: number;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
}
|
|
49
|
+
interface ShiftSearchResult {
|
|
50
|
+
content: string;
|
|
51
|
+
score: number;
|
|
52
|
+
metadata: unknown;
|
|
53
|
+
}
|
|
54
|
+
interface ShiftCreateIndexParams {
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
dimensions?: number;
|
|
58
|
+
embeddingModel?: string;
|
|
59
|
+
}
|
|
60
|
+
interface ShiftUpdateIndexParams {
|
|
61
|
+
name?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
}
|
|
64
|
+
interface ShiftAddDocumentParams {
|
|
65
|
+
content: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
chunkSize?: number;
|
|
68
|
+
chunkOverlap?: number;
|
|
69
|
+
}
|
|
70
|
+
type ShiftUploadableFile = Blob | ArrayBuffer | Uint8Array;
|
|
71
|
+
interface ShiftUploadFileParams {
|
|
72
|
+
file: ShiftUploadableFile;
|
|
73
|
+
fileName?: string;
|
|
74
|
+
contentType?: string;
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
chunkSize?: number;
|
|
77
|
+
chunkOverlap?: number;
|
|
78
|
+
}
|
|
79
|
+
interface ShiftListEntriesParams {
|
|
80
|
+
take?: number;
|
|
81
|
+
skip?: number;
|
|
82
|
+
}
|
|
83
|
+
interface ShiftSearchParams {
|
|
84
|
+
query: string;
|
|
85
|
+
topK?: number;
|
|
86
|
+
}
|
|
87
|
+
interface ShiftIngestResponse {
|
|
88
|
+
chunksCreated: number;
|
|
89
|
+
entries: string[];
|
|
90
|
+
extractedText?: string;
|
|
91
|
+
message?: string;
|
|
92
|
+
}
|
|
93
|
+
interface ShiftListEntriesResponse {
|
|
94
|
+
entries: ShiftEntry[];
|
|
95
|
+
total: number;
|
|
96
|
+
}
|
|
97
|
+
declare class ShiftClient {
|
|
98
|
+
private readonly client;
|
|
99
|
+
readonly indexes: {
|
|
100
|
+
list: () => Promise<{
|
|
101
|
+
indexes: ShiftIndex[];
|
|
102
|
+
}>;
|
|
103
|
+
create: (params: ShiftCreateIndexParams) => Promise<ShiftIndex>;
|
|
104
|
+
get: (indexId: string) => Promise<ShiftIndex>;
|
|
105
|
+
update: (indexId: string, params: ShiftUpdateIndexParams) => Promise<ShiftIndex>;
|
|
106
|
+
delete: (indexId: string) => Promise<{
|
|
107
|
+
success: true;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
readonly documents: {
|
|
111
|
+
create: (indexId: string, params: ShiftAddDocumentParams) => Promise<ShiftIngestResponse>;
|
|
112
|
+
upload: (indexId: string, params: ShiftUploadFileParams) => Promise<ShiftIngestResponse>;
|
|
113
|
+
};
|
|
114
|
+
readonly entries: {
|
|
115
|
+
list: (indexId: string, params?: ShiftListEntriesParams) => Promise<ShiftListEntriesResponse>;
|
|
116
|
+
delete: (indexId: string, entryId: string) => Promise<{
|
|
117
|
+
success: true;
|
|
118
|
+
}>;
|
|
119
|
+
};
|
|
120
|
+
constructor(client: RagableRequestClient);
|
|
121
|
+
search(indexId: string, params: ShiftSearchParams): Promise<{
|
|
122
|
+
results: ShiftSearchResult[];
|
|
15
123
|
}>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface AgentSummary {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
description: string | null;
|
|
130
|
+
active: boolean;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
updatedAt: string;
|
|
133
|
+
}
|
|
134
|
+
interface AgentChatMessage {
|
|
135
|
+
role: "user" | "assistant";
|
|
136
|
+
content: string;
|
|
137
|
+
}
|
|
138
|
+
interface AgentChatParams {
|
|
139
|
+
message: string;
|
|
140
|
+
history?: AgentChatMessage[];
|
|
141
|
+
}
|
|
142
|
+
/** Mirrors backend ExecutionResult JSON shape (traces are opaque in the SDK). */
|
|
143
|
+
interface AgentChatResult {
|
|
144
|
+
response: string;
|
|
145
|
+
traces: unknown[];
|
|
146
|
+
totalDurationMs: number;
|
|
147
|
+
httpResponse?: unknown;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Loose SSE event from POST /v1/agents/:id/chat/stream — narrows with `type` at runtime.
|
|
151
|
+
*/
|
|
152
|
+
type AgentStreamEvent = Record<string, unknown> & {
|
|
153
|
+
type: string;
|
|
154
|
+
};
|
|
155
|
+
declare class AgentsClient {
|
|
156
|
+
private readonly client;
|
|
157
|
+
constructor(client: RagableRequestClient);
|
|
158
|
+
list(): Promise<{
|
|
159
|
+
agents: AgentSummary[];
|
|
19
160
|
}>;
|
|
161
|
+
get(agentId: string): Promise<AgentSummary>;
|
|
162
|
+
chat(agentId: string, params: AgentChatParams): Promise<AgentChatResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Stream agent execution as SSE (`data: {json}` lines). Yields parsed JSON objects.
|
|
165
|
+
*/
|
|
166
|
+
chatStream(agentId: string, params: AgentChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
|
|
20
167
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
168
|
+
|
|
169
|
+
/** Minimal client surface for {@link createRagPipeline} (implemented by {@link Ragable}). */
|
|
170
|
+
interface RagClientForPipeline {
|
|
171
|
+
shift: {
|
|
172
|
+
documents: {
|
|
173
|
+
create: (indexId: string, params: ShiftAddDocumentParams) => Promise<ShiftIngestResponse>;
|
|
174
|
+
upload: (indexId: string, params: ShiftUploadFileParams) => Promise<ShiftIngestResponse>;
|
|
175
|
+
};
|
|
176
|
+
search: (indexId: string, params: ShiftSearchParams) => Promise<{
|
|
177
|
+
results: ShiftSearchResult[];
|
|
178
|
+
}>;
|
|
25
179
|
};
|
|
26
180
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
181
|
+
interface FormatContextOptions {
|
|
182
|
+
/** Prepended before numbered passages (default: "Relevant passages:\\n") */
|
|
183
|
+
header?: string;
|
|
184
|
+
/** Joiner between passages (default: "\\n\\n") */
|
|
185
|
+
separator?: string;
|
|
186
|
+
/** Omit results with similarity score below this (default: no filter) */
|
|
187
|
+
minScore?: number;
|
|
188
|
+
/** Truncate total context string to this UTF-16 length (default: no limit) */
|
|
189
|
+
maxChars?: number;
|
|
190
|
+
/** Include similarity score in each block (default: false) */
|
|
191
|
+
includeScores?: boolean;
|
|
192
|
+
}
|
|
193
|
+
interface RagPipelineOptions {
|
|
194
|
+
indexId: string;
|
|
195
|
+
}
|
|
196
|
+
type RetrieveParams = ShiftSearchParams & {
|
|
197
|
+
format?: FormatContextOptions;
|
|
30
198
|
};
|
|
199
|
+
interface RagPipeline {
|
|
200
|
+
readonly indexId: string;
|
|
201
|
+
ingestText(params: ShiftAddDocumentParams): Promise<ShiftIngestResponse>;
|
|
202
|
+
ingestFile(params: ShiftUploadFileParams): Promise<ShiftIngestResponse>;
|
|
203
|
+
search(params: ShiftSearchParams): Promise<{
|
|
204
|
+
results: ShiftSearchResult[];
|
|
205
|
+
}>;
|
|
206
|
+
retrieve(params: RetrieveParams): Promise<{
|
|
207
|
+
results: ShiftSearchResult[];
|
|
208
|
+
context: string;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Turn vector search hits into a single block of text for system prompts or RAG user messages.
|
|
213
|
+
*/
|
|
214
|
+
declare function formatRetrievalContext(results: ShiftSearchResult[], options?: FormatContextOptions): string;
|
|
215
|
+
/**
|
|
216
|
+
* High-level RAG helpers bound to one Shift index: ingest, search, retrieve with prompt-ready context.
|
|
217
|
+
*/
|
|
218
|
+
declare function createRagPipeline(client: RagClientForPipeline, options: RagPipelineOptions): RagPipeline;
|
|
219
|
+
|
|
220
|
+
declare class Ragable {
|
|
221
|
+
readonly shift: ShiftClient;
|
|
222
|
+
readonly agents: AgentsClient;
|
|
223
|
+
readonly infrastructure: {
|
|
224
|
+
shift: ShiftClient;
|
|
225
|
+
};
|
|
226
|
+
constructor(options: RagableClientOptions);
|
|
227
|
+
}
|
|
228
|
+
declare function createClient(options: RagableClientOptions): Ragable;
|
|
31
229
|
|
|
32
|
-
export {
|
|
230
|
+
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentStreamEvent, type AgentSummary, AgentsClient, type FormatContextOptions, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, type RagableClientOptions, RagableError, RagableRequestClient, type RequestOptions, type RetrieveParams, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, createClient, createRagPipeline, extractErrorMessage, formatRetrievalContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,230 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface RagableClientOptions {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
fetch?: typeof fetch;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
}
|
|
7
|
+
type RequestOptions = Omit<RequestInit, "body"> & {
|
|
8
|
+
body?: unknown;
|
|
9
|
+
};
|
|
10
|
+
declare class RagableError extends Error {
|
|
11
|
+
readonly status: number;
|
|
12
|
+
readonly body: unknown;
|
|
13
|
+
constructor(message: string, status: number, body: unknown);
|
|
14
|
+
}
|
|
15
|
+
declare function extractErrorMessage(payload: unknown, fallback: string): string;
|
|
16
|
+
declare class RagableRequestClient {
|
|
17
|
+
private readonly apiKey;
|
|
18
|
+
private readonly baseUrl;
|
|
19
|
+
private readonly fetchImpl;
|
|
20
|
+
private readonly defaultHeaders;
|
|
21
|
+
constructor(options: RagableClientOptions);
|
|
22
|
+
toUrl(path: string): string;
|
|
23
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Low-level fetch with API key and JSON body encoding. Caller handles status and body.
|
|
26
|
+
*/
|
|
27
|
+
rawFetch(path: string, options?: RequestOptions): Promise<Response>;
|
|
28
|
+
private parseResponseBody;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ShiftIndex {
|
|
32
|
+
id: string;
|
|
2
33
|
name: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
34
|
+
description: string | null;
|
|
35
|
+
dimensions: number;
|
|
36
|
+
embeddingModel: string;
|
|
37
|
+
status: string;
|
|
38
|
+
entryCount?: number;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}
|
|
42
|
+
interface ShiftEntry {
|
|
43
|
+
id: string;
|
|
44
|
+
content: string;
|
|
45
|
+
metadata: unknown;
|
|
46
|
+
chunkIndex: number;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
}
|
|
49
|
+
interface ShiftSearchResult {
|
|
50
|
+
content: string;
|
|
51
|
+
score: number;
|
|
52
|
+
metadata: unknown;
|
|
53
|
+
}
|
|
54
|
+
interface ShiftCreateIndexParams {
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
dimensions?: number;
|
|
58
|
+
embeddingModel?: string;
|
|
59
|
+
}
|
|
60
|
+
interface ShiftUpdateIndexParams {
|
|
61
|
+
name?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
}
|
|
64
|
+
interface ShiftAddDocumentParams {
|
|
65
|
+
content: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
chunkSize?: number;
|
|
68
|
+
chunkOverlap?: number;
|
|
69
|
+
}
|
|
70
|
+
type ShiftUploadableFile = Blob | ArrayBuffer | Uint8Array;
|
|
71
|
+
interface ShiftUploadFileParams {
|
|
72
|
+
file: ShiftUploadableFile;
|
|
73
|
+
fileName?: string;
|
|
74
|
+
contentType?: string;
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
chunkSize?: number;
|
|
77
|
+
chunkOverlap?: number;
|
|
78
|
+
}
|
|
79
|
+
interface ShiftListEntriesParams {
|
|
80
|
+
take?: number;
|
|
81
|
+
skip?: number;
|
|
82
|
+
}
|
|
83
|
+
interface ShiftSearchParams {
|
|
84
|
+
query: string;
|
|
85
|
+
topK?: number;
|
|
86
|
+
}
|
|
87
|
+
interface ShiftIngestResponse {
|
|
88
|
+
chunksCreated: number;
|
|
89
|
+
entries: string[];
|
|
90
|
+
extractedText?: string;
|
|
91
|
+
message?: string;
|
|
92
|
+
}
|
|
93
|
+
interface ShiftListEntriesResponse {
|
|
94
|
+
entries: ShiftEntry[];
|
|
95
|
+
total: number;
|
|
96
|
+
}
|
|
97
|
+
declare class ShiftClient {
|
|
98
|
+
private readonly client;
|
|
99
|
+
readonly indexes: {
|
|
100
|
+
list: () => Promise<{
|
|
101
|
+
indexes: ShiftIndex[];
|
|
102
|
+
}>;
|
|
103
|
+
create: (params: ShiftCreateIndexParams) => Promise<ShiftIndex>;
|
|
104
|
+
get: (indexId: string) => Promise<ShiftIndex>;
|
|
105
|
+
update: (indexId: string, params: ShiftUpdateIndexParams) => Promise<ShiftIndex>;
|
|
106
|
+
delete: (indexId: string) => Promise<{
|
|
107
|
+
success: true;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
readonly documents: {
|
|
111
|
+
create: (indexId: string, params: ShiftAddDocumentParams) => Promise<ShiftIngestResponse>;
|
|
112
|
+
upload: (indexId: string, params: ShiftUploadFileParams) => Promise<ShiftIngestResponse>;
|
|
113
|
+
};
|
|
114
|
+
readonly entries: {
|
|
115
|
+
list: (indexId: string, params?: ShiftListEntriesParams) => Promise<ShiftListEntriesResponse>;
|
|
116
|
+
delete: (indexId: string, entryId: string) => Promise<{
|
|
117
|
+
success: true;
|
|
118
|
+
}>;
|
|
119
|
+
};
|
|
120
|
+
constructor(client: RagableRequestClient);
|
|
121
|
+
search(indexId: string, params: ShiftSearchParams): Promise<{
|
|
122
|
+
results: ShiftSearchResult[];
|
|
15
123
|
}>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface AgentSummary {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
description: string | null;
|
|
130
|
+
active: boolean;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
updatedAt: string;
|
|
133
|
+
}
|
|
134
|
+
interface AgentChatMessage {
|
|
135
|
+
role: "user" | "assistant";
|
|
136
|
+
content: string;
|
|
137
|
+
}
|
|
138
|
+
interface AgentChatParams {
|
|
139
|
+
message: string;
|
|
140
|
+
history?: AgentChatMessage[];
|
|
141
|
+
}
|
|
142
|
+
/** Mirrors backend ExecutionResult JSON shape (traces are opaque in the SDK). */
|
|
143
|
+
interface AgentChatResult {
|
|
144
|
+
response: string;
|
|
145
|
+
traces: unknown[];
|
|
146
|
+
totalDurationMs: number;
|
|
147
|
+
httpResponse?: unknown;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Loose SSE event from POST /v1/agents/:id/chat/stream — narrows with `type` at runtime.
|
|
151
|
+
*/
|
|
152
|
+
type AgentStreamEvent = Record<string, unknown> & {
|
|
153
|
+
type: string;
|
|
154
|
+
};
|
|
155
|
+
declare class AgentsClient {
|
|
156
|
+
private readonly client;
|
|
157
|
+
constructor(client: RagableRequestClient);
|
|
158
|
+
list(): Promise<{
|
|
159
|
+
agents: AgentSummary[];
|
|
19
160
|
}>;
|
|
161
|
+
get(agentId: string): Promise<AgentSummary>;
|
|
162
|
+
chat(agentId: string, params: AgentChatParams): Promise<AgentChatResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Stream agent execution as SSE (`data: {json}` lines). Yields parsed JSON objects.
|
|
165
|
+
*/
|
|
166
|
+
chatStream(agentId: string, params: AgentChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
|
|
20
167
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
168
|
+
|
|
169
|
+
/** Minimal client surface for {@link createRagPipeline} (implemented by {@link Ragable}). */
|
|
170
|
+
interface RagClientForPipeline {
|
|
171
|
+
shift: {
|
|
172
|
+
documents: {
|
|
173
|
+
create: (indexId: string, params: ShiftAddDocumentParams) => Promise<ShiftIngestResponse>;
|
|
174
|
+
upload: (indexId: string, params: ShiftUploadFileParams) => Promise<ShiftIngestResponse>;
|
|
175
|
+
};
|
|
176
|
+
search: (indexId: string, params: ShiftSearchParams) => Promise<{
|
|
177
|
+
results: ShiftSearchResult[];
|
|
178
|
+
}>;
|
|
25
179
|
};
|
|
26
180
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
181
|
+
interface FormatContextOptions {
|
|
182
|
+
/** Prepended before numbered passages (default: "Relevant passages:\\n") */
|
|
183
|
+
header?: string;
|
|
184
|
+
/** Joiner between passages (default: "\\n\\n") */
|
|
185
|
+
separator?: string;
|
|
186
|
+
/** Omit results with similarity score below this (default: no filter) */
|
|
187
|
+
minScore?: number;
|
|
188
|
+
/** Truncate total context string to this UTF-16 length (default: no limit) */
|
|
189
|
+
maxChars?: number;
|
|
190
|
+
/** Include similarity score in each block (default: false) */
|
|
191
|
+
includeScores?: boolean;
|
|
192
|
+
}
|
|
193
|
+
interface RagPipelineOptions {
|
|
194
|
+
indexId: string;
|
|
195
|
+
}
|
|
196
|
+
type RetrieveParams = ShiftSearchParams & {
|
|
197
|
+
format?: FormatContextOptions;
|
|
30
198
|
};
|
|
199
|
+
interface RagPipeline {
|
|
200
|
+
readonly indexId: string;
|
|
201
|
+
ingestText(params: ShiftAddDocumentParams): Promise<ShiftIngestResponse>;
|
|
202
|
+
ingestFile(params: ShiftUploadFileParams): Promise<ShiftIngestResponse>;
|
|
203
|
+
search(params: ShiftSearchParams): Promise<{
|
|
204
|
+
results: ShiftSearchResult[];
|
|
205
|
+
}>;
|
|
206
|
+
retrieve(params: RetrieveParams): Promise<{
|
|
207
|
+
results: ShiftSearchResult[];
|
|
208
|
+
context: string;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Turn vector search hits into a single block of text for system prompts or RAG user messages.
|
|
213
|
+
*/
|
|
214
|
+
declare function formatRetrievalContext(results: ShiftSearchResult[], options?: FormatContextOptions): string;
|
|
215
|
+
/**
|
|
216
|
+
* High-level RAG helpers bound to one Shift index: ingest, search, retrieve with prompt-ready context.
|
|
217
|
+
*/
|
|
218
|
+
declare function createRagPipeline(client: RagClientForPipeline, options: RagPipelineOptions): RagPipeline;
|
|
219
|
+
|
|
220
|
+
declare class Ragable {
|
|
221
|
+
readonly shift: ShiftClient;
|
|
222
|
+
readonly agents: AgentsClient;
|
|
223
|
+
readonly infrastructure: {
|
|
224
|
+
shift: ShiftClient;
|
|
225
|
+
};
|
|
226
|
+
constructor(options: RagableClientOptions);
|
|
227
|
+
}
|
|
228
|
+
declare function createClient(options: RagableClientOptions): Ragable;
|
|
31
229
|
|
|
32
|
-
export {
|
|
230
|
+
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentStreamEvent, type AgentSummary, AgentsClient, type FormatContextOptions, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, type RagableClientOptions, RagableError, RagableRequestClient, type RequestOptions, type RetrieveParams, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, createClient, createRagPipeline, extractErrorMessage, formatRetrievalContext };
|