graphor 0.13.0 → 0.15.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/CHANGELOG.md +56 -0
- package/README.md +320 -31
- package/client.d.mts +2 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -5
- package/client.d.ts.map +1 -1
- package/client.js +6 -8
- package/client.js.map +1 -1
- package/client.mjs +6 -8
- package/client.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +0 -3
- package/internal/utils/query.d.mts.map +1 -1
- package/internal/utils/query.d.ts +0 -3
- package/internal/utils/query.d.ts.map +1 -1
- package/internal/utils/query.js +3 -16
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs +2 -16
- package/internal/utils/query.mjs.map +1 -1
- package/package.json +7 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/sources.d.mts +501 -337
- package/resources/sources.d.mts.map +1 -1
- package/resources/sources.d.ts +501 -337
- package/resources/sources.d.ts.map +1 -1
- package/resources/sources.js +201 -242
- package/resources/sources.js.map +1 -1
- package/resources/sources.mjs +201 -242
- package/resources/sources.mjs.map +1 -1
- package/src/client.ts +40 -24
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/utils/query.ts +2 -18
- package/src/resources/index.ts +17 -8
- package/src/resources/sources.ts +621 -370
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/resources/sources.d.mts
CHANGED
|
@@ -11,12 +11,17 @@ export declare class Sources extends APIResource {
|
|
|
11
11
|
* type, origin) along with its current processing status and a human-readable
|
|
12
12
|
* status message.
|
|
13
13
|
*
|
|
14
|
+
* **Query parameters:**
|
|
15
|
+
*
|
|
16
|
+
* - **file_ids** (list, optional): If provided, only sources whose file_id is in
|
|
17
|
+
* this list are returned. Repeat the param for multiple IDs (e.g.
|
|
18
|
+
* ?file_ids=id1&file_ids=id2).
|
|
19
|
+
*
|
|
14
20
|
* **Status messages returned per source:**
|
|
15
21
|
*
|
|
16
22
|
* - `"completed"` → _"Source processed successfully"_
|
|
17
23
|
* - `"processing"` → _"Source is being processed"_
|
|
18
24
|
* - `"failed"` → _"Source processing failed"_
|
|
19
|
-
* - `"new"` → _"Source uploaded, awaiting processing"_
|
|
20
25
|
*
|
|
21
26
|
* **Returns** a JSON array of `PublicSourceResponse` objects.
|
|
22
27
|
*
|
|
@@ -29,7 +34,7 @@ export declare class Sources extends APIResource {
|
|
|
29
34
|
* const publicSources = await client.sources.list();
|
|
30
35
|
* ```
|
|
31
36
|
*/
|
|
32
|
-
list(options?: RequestOptions): APIPromise<SourceListResponse>;
|
|
37
|
+
list(query?: SourceListParams | null | undefined, options?: RequestOptions): APIPromise<SourceListResponse>;
|
|
33
38
|
/**
|
|
34
39
|
* Delete a source from the project's knowledge graph and all associated data.
|
|
35
40
|
*
|
|
@@ -154,272 +159,167 @@ export declare class Sources extends APIResource {
|
|
|
154
159
|
*/
|
|
155
160
|
extract(body: SourceExtractParams, options?: RequestOptions): APIPromise<SourceExtractResponse>;
|
|
156
161
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* -
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* -
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* -
|
|
162
|
+
* Return the status and optional parsed elements for an async build identified by
|
|
163
|
+
* `build_id`.
|
|
164
|
+
*
|
|
165
|
+
* Use this endpoint to poll the result of an async ingestion or re-process
|
|
166
|
+
* request. The `build_id` is returned in the response of:
|
|
167
|
+
*
|
|
168
|
+
* - `POST /v2/sources/upload` (async file upload)
|
|
169
|
+
* - `POST /v2/sources/upload-url-source` (async URL ingestion)
|
|
170
|
+
* - `POST /v2/sources/upload-github-source` (async GitHub ingestion)
|
|
171
|
+
* - `POST /v2/sources/upload-youtube-source` (async YouTube ingestion)
|
|
172
|
+
* - `POST /v2/sources/process` (async re-process)
|
|
173
|
+
*
|
|
174
|
+
* **Path parameter:**
|
|
175
|
+
*
|
|
176
|
+
* - **build_id** (str, required): The build identifier returned when the job was
|
|
177
|
+
* scheduled.
|
|
178
|
+
*
|
|
179
|
+
* **Query parameters:**
|
|
180
|
+
*
|
|
181
|
+
* - **suppress_elements** (bool, default `false`): When `true`, elements are
|
|
182
|
+
* omitted from the response. When `false` (default), the response includes the
|
|
183
|
+
* parsed elements (chunks/partitions) for the build if it completed
|
|
184
|
+
* successfully. Same structure as `POST /sources/elements` (each element has
|
|
185
|
+
* `page_content` and `metadata`). If `page` and `page_size` are not passed, all
|
|
186
|
+
* elements are returned.
|
|
187
|
+
* - **suppress_img_base64** (bool, default `false`): When `true`, `img_base64` is
|
|
188
|
+
* omitted from each element (useful to reduce payload size when images are not
|
|
189
|
+
* needed).
|
|
190
|
+
* - **page** (int, optional): 1-based page number. Only used when
|
|
191
|
+
* `suppress_elements=false` and pagination is used (pass either `page` or
|
|
192
|
+
* `page_size` to enable pagination).
|
|
193
|
+
* - **page_size** (int, optional): Number of elements per page (max 100). Only
|
|
194
|
+
* used when `suppress_elements=false` and pagination is used.
|
|
195
|
+
*
|
|
196
|
+
* **Response fields:**
|
|
197
|
+
*
|
|
198
|
+
* - **build_id**: The requested build identifier.
|
|
199
|
+
* - **status**: SourceNodeStatus value when history exists (e.g. Processed,
|
|
200
|
+
* Processing, Processing failed). `not_found` when no history exists (build in
|
|
201
|
+
* progress or invalid id).
|
|
202
|
+
* - **success**: `true` only when `status == "Completed"`
|
|
203
|
+
* (SourceNodeStatus.COMPLETED).
|
|
204
|
+
* - **file_id**, **file_name**: Source identifiers; present when the build has
|
|
205
|
+
* been persisted (history exists).
|
|
206
|
+
* - **error**: Error message from the pipeline when the build failed.
|
|
207
|
+
* - **method**, **total_partitions**, **total_pages**: Build metadata when history
|
|
208
|
+
* exists.
|
|
209
|
+
* - **created_at**, **updated_at**: ISO8601 timestamps when history exists.
|
|
210
|
+
* - **document_annotation**: Document-level summary/annotation from the build
|
|
211
|
+
* history when available.
|
|
212
|
+
* - **message**: Human-readable message (e.g. when status is `not_found`).
|
|
213
|
+
* - **elements**: List of `{ page_content, metadata }` when
|
|
214
|
+
* `suppress_elements=false` and the build completed successfully.
|
|
215
|
+
* - **total_elements**, **page**, **page_size**, **total_pages_elements**:
|
|
216
|
+
* Pagination metadata for `elements` when `suppress_elements=false`.
|
|
186
217
|
*
|
|
187
218
|
* **Error responses:**
|
|
188
219
|
*
|
|
189
|
-
* - `400` — Invalid input (e.g. neither identifier provided).
|
|
190
|
-
* - `404` — Source file not found.
|
|
191
220
|
* - `500` — Unexpected internal error.
|
|
192
221
|
*
|
|
193
222
|
* @example
|
|
194
223
|
* ```ts
|
|
195
|
-
* const response = await client.sources.
|
|
224
|
+
* const response = await client.sources.getBuildStatus(
|
|
225
|
+
* 'build_id',
|
|
226
|
+
* );
|
|
196
227
|
* ```
|
|
197
228
|
*/
|
|
198
|
-
|
|
229
|
+
getBuildStatus(buildID: string, query?: SourceGetBuildStatusParams | null | undefined, options?: RequestOptions): APIPromise<SourceGetBuildStatusResponse>;
|
|
199
230
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* Use this endpoint to re-run the data-ingestion pipeline on a source that is
|
|
203
|
-
* already present in the knowledge graph — for example, after changing the
|
|
204
|
-
* partitioning strategy. The endpoint locates the source node, sets its status to
|
|
205
|
-
* `PROCESSING`, applies the requested partition method, and executes the full
|
|
206
|
-
* ingestion pipeline synchronously (partitioning, chunking, embedding, and graph
|
|
207
|
-
* persistence).
|
|
231
|
+
* Retrieve the parsed elements (chunks/partitions) of a source in the same format
|
|
232
|
+
* as get_build_status.
|
|
208
233
|
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* to re-process.
|
|
213
|
-
* - **file_name** (str, optional — deprecated): The display name of the source.
|
|
214
|
-
* Use `file_id` instead when possible. At least one of `file_id` or `file_name`
|
|
215
|
-
* must be provided.
|
|
216
|
-
* - **partition_method** (str, default `"basic"`): The partitioning strategy to
|
|
217
|
-
* apply. One of: `basic` (Fast), `hi_res` (Balanced), `hi_res_ft` (Accurate),
|
|
218
|
-
* `mai` (VLM), `graphorlm` (Agentic).
|
|
234
|
+
* Returns elements with explicit fields: element_id, element_type, text, markdown,
|
|
235
|
+
* html, img_base64 (optional), position, page_number, bounding_box, page_layout,
|
|
236
|
+
* etc.
|
|
219
237
|
*
|
|
220
|
-
* **
|
|
238
|
+
* **Query parameters:**
|
|
221
239
|
*
|
|
222
|
-
* **
|
|
240
|
+
* - **file_id** (str, required): Unique identifier of the source.
|
|
241
|
+
* - **page** (int, optional): 1-based page number. Use with page_size to enable
|
|
242
|
+
* pagination.
|
|
243
|
+
* - **page_size** (int, optional): Number of elements per page (max 100).
|
|
244
|
+
* - **suppress_img_base64** (bool, default false): When true, img_base64 is
|
|
245
|
+
* omitted from each element.
|
|
246
|
+
* - **type** (str, optional): Filter by element type (e.g. NarrativeText, Title,
|
|
247
|
+
* Table).
|
|
248
|
+
* - **page_numbers** (list, optional): Restrict to specific page numbers (repeat
|
|
249
|
+
* param for multiple).
|
|
250
|
+
* - **elementsToRemove** (list, optional): Element types to exclude (repeat param
|
|
251
|
+
* for multiple).
|
|
223
252
|
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
253
|
+
* **Returns** Paginated response with items as BuildStatusElement list (same shape
|
|
254
|
+
* as GET /builds/{build_id} elements).
|
|
226
255
|
*
|
|
227
256
|
* @example
|
|
228
257
|
* ```ts
|
|
229
|
-
* const
|
|
230
|
-
*
|
|
231
|
-
*/
|
|
232
|
-
parse(body: SourceParseParams, options?: RequestOptions): APIPromise<PublicSource>;
|
|
233
|
-
/**
|
|
234
|
-
* Retrieve relevant document chunks from the prebuilt RAG vector store.
|
|
235
|
-
*
|
|
236
|
-
* Performs a semantic similarity search over the project's prebuilt RAG store
|
|
237
|
-
* using Google File Search with grounding. Returns the most relevant text chunks
|
|
238
|
-
* along with their source metadata (file name, page number, relevance score). This
|
|
239
|
-
* is a pure retrieval endpoint — it does **not** generate an answer; use
|
|
240
|
-
* `/ask-sources` for Q&A.
|
|
241
|
-
*
|
|
242
|
-
* **Parameters (JSON body):**
|
|
243
|
-
*
|
|
244
|
-
* - **query** (str, required): The natural-language search query used to find
|
|
245
|
-
* relevant chunks.
|
|
246
|
-
* - **file_ids** (list[str], optional — preferred): Restrict retrieval to specific
|
|
247
|
-
* source file IDs.
|
|
248
|
-
* - **file_names** (list[str], optional — deprecated): Restrict retrieval to
|
|
249
|
-
* specific source file names. Use `file_ids` when possible.
|
|
250
|
-
*
|
|
251
|
-
* **Returns** a `PublicRetrieveResponse` containing:
|
|
252
|
-
*
|
|
253
|
-
* - `query` — the original search query.
|
|
254
|
-
* - `chunks` — a list of `PublicRetrieveChunk` objects, each with `text`,
|
|
255
|
-
* `file_name`, `page_number`, `score`, and additional `metadata`.
|
|
256
|
-
* - `total` — the total number of chunks returned.
|
|
257
|
-
*
|
|
258
|
-
* **Error responses:**
|
|
259
|
-
*
|
|
260
|
-
* - `500` — Unexpected internal error during retrieval.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* ```ts
|
|
264
|
-
* const response = await client.sources.retrieveChunks({
|
|
265
|
-
* query: 'query',
|
|
258
|
+
* const response = await client.sources.getElements({
|
|
259
|
+
* file_id: 'file_id',
|
|
266
260
|
* });
|
|
267
261
|
* ```
|
|
268
262
|
*/
|
|
269
|
-
|
|
263
|
+
getElements(query: SourceGetElementsParams, options?: RequestOptions): APIPromise<SourceGetElementsResponse>;
|
|
270
264
|
/**
|
|
271
|
-
* Upload a local file and
|
|
272
|
-
* graph.
|
|
273
|
-
*
|
|
274
|
-
* This endpoint accepts a **`multipart/form-data`** request containing the file to
|
|
275
|
-
* upload. It validates the file size (max 100 MB) and extension against the list
|
|
276
|
-
* of allowed types, stores the file, and then runs the full data-ingestion
|
|
277
|
-
* pipeline synchronously — including partitioning, chunking, embedding, and graph
|
|
278
|
-
* persistence.
|
|
279
|
-
*
|
|
280
|
-
* **Usage via SDK (AI agent / MCP context):**
|
|
281
|
-
*
|
|
282
|
-
* The SDK executes code in a **remote sandboxed container** that does **not** have
|
|
283
|
-
* access to the local filesystem. Because of this, `fs.createReadStream()` with a
|
|
284
|
-
* local file path will **not work** — the file does not exist inside the
|
|
285
|
-
* container.
|
|
286
|
-
*
|
|
287
|
-
* For **text-based files** (md, txt, csv, html, etc.), you can read the file
|
|
288
|
-
* content with a local tool (e.g. IDE file-read) and create a `File` object in
|
|
289
|
-
* memory:
|
|
290
|
-
*
|
|
291
|
-
* ```
|
|
292
|
-
* const content = `...file contents read locally...`;
|
|
293
|
-
* const file = new File([content], "my-document.md", { type: "text/markdown" });
|
|
294
|
-
* const result = await client.sources.upload({ file });
|
|
295
|
-
* ```
|
|
265
|
+
* Upload a local file and schedule ingestion in the background.
|
|
296
266
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* ```
|
|
302
|
-
* import { execSync } from "child_process";
|
|
303
|
-
*
|
|
304
|
-
* const result = execSync(`
|
|
305
|
-
* curl -s -X POST "{base_url}/source/upload" \
|
|
306
|
-
* -H "Authorization: Bearer {access_key}" \
|
|
307
|
-
* -F "file=@/local/path/to/document.pdf" \
|
|
308
|
-
* -F "partition_method=graphorlm"
|
|
309
|
-
* `).toString();
|
|
310
|
-
* ```
|
|
311
|
-
*
|
|
312
|
-
* Or with Python `subprocess`:
|
|
313
|
-
*
|
|
314
|
-
* ```
|
|
315
|
-
* import subprocess, json
|
|
316
|
-
*
|
|
317
|
-
* result = subprocess.run([
|
|
318
|
-
* "curl", "-s", "-X", "POST", "{base_url}/source/upload",
|
|
319
|
-
* "-H", "Authorization: Bearer {access_key}",
|
|
320
|
-
* "-F", "file=@/local/path/to/document.pdf",
|
|
321
|
-
* "-F", "partition_method=graphorlm",
|
|
322
|
-
* ], capture_output=True, text=True)
|
|
323
|
-
* response = json.loads(result.stdout)
|
|
324
|
-
* ```
|
|
325
|
-
*
|
|
326
|
-
* **Important:** Do NOT use `fs.createReadStream("/local/path")` inside the SDK
|
|
327
|
-
* code — it will fail because the execution environment cannot access local paths.
|
|
328
|
-
* Always prefer `curl`/`requests` executed locally for binary uploads.
|
|
329
|
-
*
|
|
330
|
-
* **Usage via curl:**
|
|
331
|
-
*
|
|
332
|
-
* ```
|
|
333
|
-
* curl -X POST "{base_url}/source/upload" \
|
|
334
|
-
* -H "Authorization: Bearer {access_key}" \
|
|
335
|
-
* -F "file=@/path/to/document.pdf" \
|
|
336
|
-
* -F "partition_method=graphorlm"
|
|
337
|
-
* ```
|
|
338
|
-
*
|
|
339
|
-
* **Usage via Python `requests`:**
|
|
340
|
-
*
|
|
341
|
-
* ```
|
|
342
|
-
* import requests
|
|
343
|
-
*
|
|
344
|
-
* with open("document.pdf", "rb") as f:
|
|
345
|
-
* response = requests.post(
|
|
346
|
-
* "{base_url}/source/upload",
|
|
347
|
-
* headers={"Authorization": "Bearer {access_key}"},
|
|
348
|
-
* files={"file": ("document.pdf", f, "application/pdf")},
|
|
349
|
-
* data={"partition_method": "graphorlm"}, # optional
|
|
350
|
-
* )
|
|
351
|
-
* ```
|
|
267
|
+
* Accepts **`multipart/form-data`** with the file. Validates size (max 100 MB) and
|
|
268
|
+
* extension, stores the file, then schedules the full data-ingestion pipeline in
|
|
269
|
+
* the background. Returns immediately with a `build_id` to poll for status.
|
|
352
270
|
*
|
|
353
271
|
* **Parameters:**
|
|
354
272
|
*
|
|
355
|
-
* - **file** (`multipart/form-data`): The file to upload. Must include
|
|
356
|
-
* `Content-Length`
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* One of: `basic` (Fast), `hi_res` (Balanced), `hi_res_ft` (Accurate), `mai`
|
|
361
|
-
* (VLM), `graphorlm` (Agentic). When omitted, the system default is used.
|
|
362
|
-
*
|
|
363
|
-
* **Returns** a `PublicSourceResponse` with the resulting source metadata (file
|
|
364
|
-
* ID, name, size, type, source origin, partition method, and processing status).
|
|
365
|
-
*
|
|
366
|
-
* **Error responses:**
|
|
273
|
+
* - **file** (`multipart/form-data`): The file to upload. Must include
|
|
274
|
+
* `Content-Length` and have a supported extension (pdf, doc, docx, csv, txt, md,
|
|
275
|
+
* etc.).
|
|
276
|
+
* - **method** (`form`, optional): Partitioning strategy. One of: `fast`,
|
|
277
|
+
* `balanced`, `accurate`, `vlm`, `agentic`. Default when omitted.
|
|
367
278
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
* - `413` — File exceeds the 100 MB size limit.
|
|
371
|
-
* - `403` — Permission denied.
|
|
372
|
-
* - `404` — File not found during processing.
|
|
373
|
-
* - `500` — Unexpected internal error.
|
|
279
|
+
* **Returns** `AsyncIngestResponse` with `build_id`. Use it to check processing
|
|
280
|
+
* status.
|
|
374
281
|
*
|
|
375
282
|
* @example
|
|
376
283
|
* ```ts
|
|
377
|
-
* const
|
|
284
|
+
* const response = await client.sources.ingestFile({
|
|
378
285
|
* file: fs.createReadStream('path/to/file'),
|
|
379
286
|
* });
|
|
380
287
|
* ```
|
|
381
288
|
*/
|
|
382
|
-
|
|
289
|
+
ingestFile(body: SourceIngestFileParams, options?: RequestOptions): APIPromise<SourceIngestFileResponse>;
|
|
383
290
|
/**
|
|
384
291
|
* Ingest a GitHub repository as a source into the project's knowledge graph.
|
|
385
292
|
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
* embeddings, and persists everything in the knowledge graph synchronously.
|
|
293
|
+
* Schedules the ingestion in the background and returns immediately with a
|
|
294
|
+
* `build_id`. Use the returned `build_id` to poll for processing status.
|
|
389
295
|
*
|
|
390
296
|
* **Parameters (JSON body):**
|
|
391
297
|
*
|
|
392
298
|
* - **url** (str, required): The GitHub repository URL to ingest (e.g.
|
|
393
299
|
* `https://github.com/owner/repo`).
|
|
394
300
|
*
|
|
395
|
-
* **Returns**
|
|
396
|
-
* ID, name, size, type, source origin, partition method, and processing status).
|
|
397
|
-
*
|
|
398
|
-
* **Error responses:**
|
|
399
|
-
*
|
|
400
|
-
* - `500` — Unexpected internal error during GitHub source processing.
|
|
301
|
+
* **Returns** `AsyncIngestResponse` with `build_id`.
|
|
401
302
|
*
|
|
402
303
|
* @example
|
|
403
304
|
* ```ts
|
|
404
|
-
* const
|
|
305
|
+
* const response = await client.sources.ingestGitHub({
|
|
405
306
|
* url: 'url',
|
|
406
307
|
* });
|
|
407
308
|
* ```
|
|
408
309
|
*/
|
|
409
|
-
|
|
310
|
+
ingestGitHub(body: SourceIngestGitHubParams, options?: RequestOptions): APIPromise<SourceIngestGitHubResponse>;
|
|
410
311
|
/**
|
|
411
312
|
* Ingest a web page (or a set of crawled pages) as a source into the project's
|
|
412
313
|
* knowledge graph.
|
|
413
314
|
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* synchronously.
|
|
315
|
+
* Unlike the synchronous version, this endpoint schedules the ingestion in the
|
|
316
|
+
* background and returns immediately with a `processing` status. The source will
|
|
317
|
+
* be fully available once background processing completes.
|
|
418
318
|
*
|
|
419
319
|
* If the URL points directly to a downloadable file (detected via URL path
|
|
420
|
-
* extension or HTTP Content-Type), the file is downloaded
|
|
421
|
-
*
|
|
422
|
-
*
|
|
320
|
+
* extension or HTTP Content-Type), the file is first downloaded and uploaded to
|
|
321
|
+
* storage synchronously, then the partition/embedding pipeline runs in the
|
|
322
|
+
* background.
|
|
423
323
|
*
|
|
424
324
|
* **Parameters (JSON body):**
|
|
425
325
|
*
|
|
@@ -427,12 +327,13 @@ export declare class Sources extends APIResource {
|
|
|
427
327
|
* - **crawlUrls** (bool, optional, default `false`): When `true`, the system will
|
|
428
328
|
* also follow and ingest links found on the page. Ignored when the URL resolves
|
|
429
329
|
* to a file.
|
|
430
|
-
* - **
|
|
431
|
-
*
|
|
432
|
-
*
|
|
330
|
+
* - **method** (str, optional): The partitioning strategy to use. One of: `fast`,
|
|
331
|
+
* `balanced`, `accurate`, `vlm`, `agentic`. When omitted the system default is
|
|
332
|
+
* applied.
|
|
433
333
|
*
|
|
434
|
-
* **Returns** a `PublicSourceResponse` with
|
|
435
|
-
*
|
|
334
|
+
* **Returns** a `PublicSourceResponse` with `status: "processing"` immediately.
|
|
335
|
+
* Poll the source status endpoint using the returned `file_id` to track
|
|
336
|
+
* completion.
|
|
436
337
|
*
|
|
437
338
|
* **Error responses:**
|
|
438
339
|
*
|
|
@@ -441,52 +342,174 @@ export declare class Sources extends APIResource {
|
|
|
441
342
|
*
|
|
442
343
|
* @example
|
|
443
344
|
* ```ts
|
|
444
|
-
* const
|
|
345
|
+
* const response = await client.sources.ingestURL({
|
|
445
346
|
* url: 'url',
|
|
446
347
|
* });
|
|
447
348
|
* ```
|
|
448
349
|
*/
|
|
449
|
-
|
|
350
|
+
ingestURL(body: SourceIngestURLParams, options?: RequestOptions): APIPromise<SourceIngestURLResponse>;
|
|
450
351
|
/**
|
|
451
352
|
* Ingest a YouTube video as a source into the project's knowledge graph.
|
|
452
353
|
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
354
|
+
* Schedules the ingestion in the background and returns immediately with a
|
|
355
|
+
* `build_id`. The endpoint will download the transcript/captions and process them
|
|
356
|
+
* in the background. Use the returned `build_id` to poll for processing status.
|
|
456
357
|
*
|
|
457
358
|
* **Parameters (JSON body):**
|
|
458
359
|
*
|
|
459
360
|
* - **url** (str, required): The YouTube video URL to ingest (e.g.
|
|
460
361
|
* `https://www.youtube.com/watch?v=...`).
|
|
461
362
|
*
|
|
462
|
-
* **Returns**
|
|
463
|
-
*
|
|
363
|
+
* **Returns** `AsyncIngestResponse` with `build_id`.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* const response = await client.sources.ingestYoutube({
|
|
368
|
+
* url: 'url',
|
|
369
|
+
* });
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
ingestYoutube(body: SourceIngestYoutubeParams, options?: RequestOptions): APIPromise<SourceIngestYoutubeResponse>;
|
|
373
|
+
/**
|
|
374
|
+
* Re-process (re-parse) an existing source in the background.
|
|
375
|
+
*
|
|
376
|
+
* Schedules the data-ingestion pipeline (partitioning, chunking, embedding) for an
|
|
377
|
+
* existing source and returns immediately with a `build_id`. Use it to poll for
|
|
378
|
+
* status.
|
|
379
|
+
*
|
|
380
|
+
* **Parameters (JSON body):**
|
|
381
|
+
*
|
|
382
|
+
* - **file_id** (str, required): Unique identifier of the source to re-process.
|
|
383
|
+
* - **method** (str, default `"fast"`): Partitioning strategy. One of: `fast`,
|
|
384
|
+
* `balanced`, `accurate`, `vlm`, `agentic`.
|
|
385
|
+
*
|
|
386
|
+
* **Returns** `AsyncIngestResponse` with `build_id`.
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```ts
|
|
390
|
+
* const response = await client.sources.reprocess({
|
|
391
|
+
* file_id: 'file_id',
|
|
392
|
+
* });
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
reprocess(body: SourceReprocessParams, options?: RequestOptions): APIPromise<SourceReprocessResponse>;
|
|
396
|
+
/**
|
|
397
|
+
* Retrieve relevant document chunks from the prebuilt RAG vector store.
|
|
398
|
+
*
|
|
399
|
+
* Performs a semantic similarity search over the project's prebuilt RAG store
|
|
400
|
+
* using Google File Search with grounding. Returns the most relevant text chunks
|
|
401
|
+
* along with their source metadata (file name, page number, relevance score). This
|
|
402
|
+
* is a pure retrieval endpoint — it does **not** generate an answer; use
|
|
403
|
+
* `/ask-sources` for Q&A.
|
|
404
|
+
*
|
|
405
|
+
* **Parameters (JSON body):**
|
|
406
|
+
*
|
|
407
|
+
* - **query** (str, required): The natural-language search query used to find
|
|
408
|
+
* relevant chunks.
|
|
409
|
+
* - **file_ids** (list[str], optional — preferred): Restrict retrieval to specific
|
|
410
|
+
* source file IDs.
|
|
411
|
+
* - **file_names** (list[str], optional — deprecated): Restrict retrieval to
|
|
412
|
+
* specific source file names. Use `file_ids` when possible.
|
|
413
|
+
*
|
|
414
|
+
* **Returns** a `PublicRetrieveResponse` containing:
|
|
415
|
+
*
|
|
416
|
+
* - `query` — the original search query.
|
|
417
|
+
* - `chunks` — a list of `PublicRetrieveChunk` objects, each with `text`,
|
|
418
|
+
* `file_name`, `page_number`, `score`, and additional `metadata`.
|
|
419
|
+
* - `total` — the total number of chunks returned.
|
|
464
420
|
*
|
|
465
421
|
* **Error responses:**
|
|
466
422
|
*
|
|
467
|
-
* - `500` — Unexpected internal error during
|
|
423
|
+
* - `500` — Unexpected internal error during retrieval.
|
|
468
424
|
*
|
|
469
425
|
* @example
|
|
470
426
|
* ```ts
|
|
471
|
-
* const
|
|
472
|
-
*
|
|
427
|
+
* const response = await client.sources.retrieveChunks({
|
|
428
|
+
* query: 'query',
|
|
473
429
|
* });
|
|
474
430
|
* ```
|
|
475
431
|
*/
|
|
476
|
-
|
|
432
|
+
retrieveChunks(body: SourceRetrieveChunksParams, options?: RequestOptions): APIPromise<SourceRetrieveChunksResponse>;
|
|
477
433
|
}
|
|
478
434
|
/**
|
|
479
|
-
*
|
|
435
|
+
* A single parsed element (chunk/partition) from a source, with explicit fields.
|
|
436
|
+
*/
|
|
437
|
+
export interface Element {
|
|
438
|
+
/**
|
|
439
|
+
* Bounding box (e.g. left, top, width, height) when available.
|
|
440
|
+
*/
|
|
441
|
+
bounding_box?: {
|
|
442
|
+
[key: string]: unknown;
|
|
443
|
+
} | null;
|
|
444
|
+
/**
|
|
445
|
+
* Unique identifier for the element.
|
|
446
|
+
*/
|
|
447
|
+
element_id?: string | null;
|
|
448
|
+
/**
|
|
449
|
+
* Type of the element (Title, NarrativeText, Image, Table, etc.).
|
|
450
|
+
*/
|
|
451
|
+
element_type?: 'Title' | 'NarrativeText' | 'TextBlock' | 'ListItem' | 'Table' | 'TableRow' | 'Image' | 'Footer' | 'Formula' | 'CompositeElement' | 'FigureCaption' | 'PageBreak' | 'Address' | 'EmailAddress' | 'PageNumber' | 'CodeSnippet' | 'Header' | 'FormKeysValues' | 'Link' | 'UncategorizedText' | 'Abstract' | 'AsideText' | 'Reference' | 'ReferenceContent' | 'Chart' | 'Seal' | 'FormulaNumber' | null;
|
|
452
|
+
/**
|
|
453
|
+
* HTML representation of the content, when available.
|
|
454
|
+
*/
|
|
455
|
+
html?: string | null;
|
|
456
|
+
/**
|
|
457
|
+
* Base64-encoded image data, when the element is an image.
|
|
458
|
+
*/
|
|
459
|
+
img_base64?: string | null;
|
|
460
|
+
/**
|
|
461
|
+
* Markdown representation of the content, when available.
|
|
462
|
+
*/
|
|
463
|
+
markdown?: string | null;
|
|
464
|
+
/**
|
|
465
|
+
* Additional metadata.
|
|
466
|
+
*/
|
|
467
|
+
metadata?: {
|
|
468
|
+
[key: string]: unknown;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* Annotation/summary for the page containing this element.
|
|
472
|
+
*/
|
|
473
|
+
page_annotation?: string | null;
|
|
474
|
+
/**
|
|
475
|
+
* Keywords extracted for the page.
|
|
476
|
+
*/
|
|
477
|
+
page_keywords?: Array<string> | null;
|
|
478
|
+
/**
|
|
479
|
+
* Page dimensions (width, height) when available.
|
|
480
|
+
*/
|
|
481
|
+
page_layout?: {
|
|
482
|
+
[key: string]: unknown;
|
|
483
|
+
} | null;
|
|
484
|
+
/**
|
|
485
|
+
* Page number (1-based) where the element appears.
|
|
486
|
+
*/
|
|
487
|
+
page_number?: number | null;
|
|
488
|
+
/**
|
|
489
|
+
* Topics extracted for the page.
|
|
490
|
+
*/
|
|
491
|
+
page_topics?: Array<string> | null;
|
|
492
|
+
/**
|
|
493
|
+
* Order/position of the element within the document.
|
|
494
|
+
*/
|
|
495
|
+
position?: number | null;
|
|
496
|
+
/**
|
|
497
|
+
* Plain text content of the element.
|
|
498
|
+
*/
|
|
499
|
+
text?: string;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Public-facing partition method names for API v2.
|
|
480
503
|
*
|
|
481
|
-
*
|
|
504
|
+
* Maps to internal PartitionMethod as:
|
|
482
505
|
*
|
|
483
|
-
* -
|
|
484
|
-
* -
|
|
485
|
-
* -
|
|
486
|
-
* -
|
|
487
|
-
* -
|
|
506
|
+
* - fast → basic
|
|
507
|
+
* - balanced → hi_res
|
|
508
|
+
* - accurate → hi_res_ft
|
|
509
|
+
* - vlm → mai
|
|
510
|
+
* - agentic → graphorlm
|
|
488
511
|
*/
|
|
489
|
-
export type
|
|
512
|
+
export type Method = 'fast' | 'balanced' | 'accurate' | 'vlm' | 'agentic';
|
|
490
513
|
export interface PublicSource {
|
|
491
514
|
/**
|
|
492
515
|
* Display name of the source file
|
|
@@ -526,10 +549,10 @@ export interface PublicSource {
|
|
|
526
549
|
*/
|
|
527
550
|
file_id?: string | null;
|
|
528
551
|
/**
|
|
529
|
-
* Partitioning strategy used during ingestion.
|
|
530
|
-
*
|
|
552
|
+
* Partitioning strategy used during ingestion. V1 API: basic, hi_res, hi_res_ft,
|
|
553
|
+
* mai, graphorlm. V2 API: fast, balanced, accurate, vlm, agentic.
|
|
531
554
|
*/
|
|
532
|
-
|
|
555
|
+
method?: string | null;
|
|
533
556
|
}
|
|
534
557
|
export type SourceListResponse = Array<PublicSource>;
|
|
535
558
|
export interface SourceDeleteResponse {
|
|
@@ -602,11 +625,109 @@ export interface SourceExtractResponse {
|
|
|
602
625
|
[key: string]: unknown;
|
|
603
626
|
} | null;
|
|
604
627
|
}
|
|
605
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Status and optional result for an async build (ingestion/re-process) identified
|
|
630
|
+
* by build_id.
|
|
631
|
+
*
|
|
632
|
+
* Returned by GET /v2/sources/builds/{build_id}. When the build has completed
|
|
633
|
+
* successfully, includes file_id, file_name, and optionally paginated elements
|
|
634
|
+
* (parsed chunks).
|
|
635
|
+
*/
|
|
636
|
+
export interface SourceGetBuildStatusResponse {
|
|
637
|
+
/**
|
|
638
|
+
* The build identifier returned when the ingestion was scheduled.
|
|
639
|
+
*/
|
|
640
|
+
build_id: string;
|
|
641
|
+
/**
|
|
642
|
+
* Current build status. When a build history exists, this is a SourceNodeStatus
|
|
643
|
+
* value (e.g. Completed, Processing, Processing failed). When no history exists
|
|
644
|
+
* yet: not_found.
|
|
645
|
+
*/
|
|
646
|
+
status: string;
|
|
647
|
+
/**
|
|
648
|
+
* True if the build completed successfully (status is Completed).
|
|
649
|
+
*/
|
|
650
|
+
success: boolean;
|
|
651
|
+
/**
|
|
652
|
+
* ISO8601 timestamp when the build (history) was created. Present when history
|
|
653
|
+
* exists.
|
|
654
|
+
*/
|
|
655
|
+
created_at?: string | null;
|
|
656
|
+
/**
|
|
657
|
+
* Document-level summary/annotation from the build history. Present when history
|
|
658
|
+
* exists.
|
|
659
|
+
*/
|
|
660
|
+
document_annotation?: string | null;
|
|
661
|
+
/**
|
|
662
|
+
* Paginated list of parsed elements (chunks) for this build. Only present when
|
|
663
|
+
* suppress_elements=false and the build has completed (status Completed).
|
|
664
|
+
*/
|
|
665
|
+
elements?: Array<Element> | null;
|
|
666
|
+
/**
|
|
667
|
+
* Error message from the pipeline, if the build failed (e.g. processing_failed).
|
|
668
|
+
*/
|
|
669
|
+
error?: string | null;
|
|
670
|
+
/**
|
|
671
|
+
* Source file identifier. Present when the build has been persisted (history
|
|
672
|
+
* exists).
|
|
673
|
+
*/
|
|
674
|
+
file_id?: string | null;
|
|
675
|
+
/**
|
|
676
|
+
* Display name of the source file. Present when the build has been persisted.
|
|
677
|
+
*/
|
|
678
|
+
file_name?: string | null;
|
|
679
|
+
/**
|
|
680
|
+
* Human-readable message (e.g. when status is not_found or processing).
|
|
681
|
+
*/
|
|
682
|
+
message?: string | null;
|
|
683
|
+
/**
|
|
684
|
+
* Public-facing partition method names for API v2.
|
|
685
|
+
*
|
|
686
|
+
* Maps to internal PartitionMethod as:
|
|
687
|
+
*
|
|
688
|
+
* - fast → basic
|
|
689
|
+
* - balanced → hi_res
|
|
690
|
+
* - accurate → hi_res_ft
|
|
691
|
+
* - vlm → mai
|
|
692
|
+
* - agentic → graphorlm
|
|
693
|
+
*/
|
|
694
|
+
method?: Method | null;
|
|
695
|
+
/**
|
|
696
|
+
* Current page of elements (1-based). Null when no pagination was requested (all
|
|
697
|
+
* elements returned).
|
|
698
|
+
*/
|
|
699
|
+
page?: number | null;
|
|
700
|
+
/**
|
|
701
|
+
* Number of elements per page. Null when no pagination was requested.
|
|
702
|
+
*/
|
|
703
|
+
page_size?: number | null;
|
|
704
|
+
/**
|
|
705
|
+
* Total number of elements for this build. Present when suppress_elements=false.
|
|
706
|
+
*/
|
|
707
|
+
total_elements?: number | null;
|
|
708
|
+
/**
|
|
709
|
+
* Total pages in the source for this build. Present when history exists.
|
|
710
|
+
*/
|
|
711
|
+
total_pages?: number | null;
|
|
712
|
+
/**
|
|
713
|
+
* Total number of pages of elements. Null when no pagination was requested.
|
|
714
|
+
*/
|
|
715
|
+
total_pages_elements?: number | null;
|
|
716
|
+
/**
|
|
717
|
+
* Total number of partitions created in this build. Present when history exists.
|
|
718
|
+
*/
|
|
719
|
+
total_partitions?: number | null;
|
|
720
|
+
/**
|
|
721
|
+
* ISO8601 timestamp when the build (history) was last updated. Present when
|
|
722
|
+
* history exists.
|
|
723
|
+
*/
|
|
724
|
+
updated_at?: string | null;
|
|
725
|
+
}
|
|
726
|
+
export interface SourceGetElementsResponse {
|
|
606
727
|
/**
|
|
607
728
|
* List of items in the current page
|
|
608
729
|
*/
|
|
609
|
-
items: Array<
|
|
730
|
+
items: Array<Element>;
|
|
610
731
|
/**
|
|
611
732
|
* Total number of items
|
|
612
733
|
*/
|
|
@@ -624,29 +745,75 @@ export interface SourceLoadElementsResponse {
|
|
|
624
745
|
*/
|
|
625
746
|
total_pages?: number | null;
|
|
626
747
|
}
|
|
627
|
-
export
|
|
748
|
+
export interface SourceIngestFileResponse {
|
|
628
749
|
/**
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
* Example:
|
|
632
|
-
*
|
|
633
|
-
* .. code-block:: python
|
|
634
|
-
*
|
|
635
|
-
* from langchain_core.documents import Document
|
|
636
|
-
*
|
|
637
|
-
* document = Document(
|
|
638
|
-
* page_content="Hello, world!",
|
|
639
|
-
* metadata={"source": "https://example.com"}
|
|
640
|
-
* )
|
|
750
|
+
* The ID of the build. This ID can be used to check the status of the request.
|
|
641
751
|
*/
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
752
|
+
build_id: string;
|
|
753
|
+
/**
|
|
754
|
+
* If the request was not successful, this will contain an error message.
|
|
755
|
+
*/
|
|
756
|
+
error?: string | null;
|
|
757
|
+
/**
|
|
758
|
+
* Whether the request was successfully scheduled.
|
|
759
|
+
*/
|
|
760
|
+
success?: boolean;
|
|
761
|
+
}
|
|
762
|
+
export interface SourceIngestGitHubResponse {
|
|
763
|
+
/**
|
|
764
|
+
* The ID of the build. This ID can be used to check the status of the request.
|
|
765
|
+
*/
|
|
766
|
+
build_id: string;
|
|
767
|
+
/**
|
|
768
|
+
* If the request was not successful, this will contain an error message.
|
|
769
|
+
*/
|
|
770
|
+
error?: string | null;
|
|
771
|
+
/**
|
|
772
|
+
* Whether the request was successfully scheduled.
|
|
773
|
+
*/
|
|
774
|
+
success?: boolean;
|
|
775
|
+
}
|
|
776
|
+
export interface SourceIngestURLResponse {
|
|
777
|
+
/**
|
|
778
|
+
* The ID of the build. This ID can be used to check the status of the request.
|
|
779
|
+
*/
|
|
780
|
+
build_id: string;
|
|
781
|
+
/**
|
|
782
|
+
* If the request was not successful, this will contain an error message.
|
|
783
|
+
*/
|
|
784
|
+
error?: string | null;
|
|
785
|
+
/**
|
|
786
|
+
* Whether the request was successfully scheduled.
|
|
787
|
+
*/
|
|
788
|
+
success?: boolean;
|
|
789
|
+
}
|
|
790
|
+
export interface SourceIngestYoutubeResponse {
|
|
791
|
+
/**
|
|
792
|
+
* The ID of the build. This ID can be used to check the status of the request.
|
|
793
|
+
*/
|
|
794
|
+
build_id: string;
|
|
795
|
+
/**
|
|
796
|
+
* If the request was not successful, this will contain an error message.
|
|
797
|
+
*/
|
|
798
|
+
error?: string | null;
|
|
799
|
+
/**
|
|
800
|
+
* Whether the request was successfully scheduled.
|
|
801
|
+
*/
|
|
802
|
+
success?: boolean;
|
|
803
|
+
}
|
|
804
|
+
export interface SourceReprocessResponse {
|
|
805
|
+
/**
|
|
806
|
+
* The ID of the build. This ID can be used to check the status of the request.
|
|
807
|
+
*/
|
|
808
|
+
build_id: string;
|
|
809
|
+
/**
|
|
810
|
+
* If the request was not successful, this will contain an error message.
|
|
811
|
+
*/
|
|
812
|
+
error?: string | null;
|
|
813
|
+
/**
|
|
814
|
+
* Whether the request was successfully scheduled.
|
|
815
|
+
*/
|
|
816
|
+
success?: boolean;
|
|
650
817
|
}
|
|
651
818
|
export interface SourceRetrieveChunksResponse {
|
|
652
819
|
/**
|
|
@@ -692,6 +859,13 @@ export declare namespace SourceRetrieveChunksResponse {
|
|
|
692
859
|
score?: number | null;
|
|
693
860
|
}
|
|
694
861
|
}
|
|
862
|
+
export interface SourceListParams {
|
|
863
|
+
/**
|
|
864
|
+
* Optional list of file_id to filter by (only these sources are returned). Repeat
|
|
865
|
+
* the param for multiple IDs.
|
|
866
|
+
*/
|
|
867
|
+
file_ids?: Array<string> | null;
|
|
868
|
+
}
|
|
695
869
|
export interface SourceDeleteParams {
|
|
696
870
|
/**
|
|
697
871
|
* Unique identifier for the source (preferred)
|
|
@@ -764,99 +938,64 @@ export interface SourceExtractParams {
|
|
|
764
938
|
*/
|
|
765
939
|
thinking_level?: 'fast' | 'balanced' | 'accurate' | null;
|
|
766
940
|
}
|
|
767
|
-
export interface
|
|
768
|
-
/**
|
|
769
|
-
* Unique identifier for the source (preferred)
|
|
770
|
-
*/
|
|
771
|
-
file_id?: string | null;
|
|
772
|
-
/**
|
|
773
|
-
* The name of the file (deprecated, use file_id)
|
|
774
|
-
*/
|
|
775
|
-
file_name?: string | null;
|
|
776
|
-
/**
|
|
777
|
-
* Optional filter to narrow down the returned elements
|
|
778
|
-
*/
|
|
779
|
-
filter?: SourceLoadElementsParams.Filter | null;
|
|
780
|
-
/**
|
|
781
|
-
* Current page number
|
|
782
|
-
*/
|
|
941
|
+
export interface SourceGetBuildStatusParams {
|
|
783
942
|
page?: number | null;
|
|
784
|
-
/**
|
|
785
|
-
* Number of items per page
|
|
786
|
-
*/
|
|
787
943
|
page_size?: number | null;
|
|
944
|
+
suppress_elements?: boolean;
|
|
945
|
+
suppress_img_base64?: boolean;
|
|
788
946
|
}
|
|
789
|
-
export
|
|
947
|
+
export interface SourceGetElementsParams {
|
|
790
948
|
/**
|
|
791
|
-
*
|
|
949
|
+
* Unique identifier of the source
|
|
792
950
|
*/
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* List of element types to exclude from the results
|
|
796
|
-
*/
|
|
797
|
-
elementsToRemove?: Array<string> | null;
|
|
798
|
-
/**
|
|
799
|
-
* Restrict results to specific page numbers from the original document
|
|
800
|
-
*/
|
|
801
|
-
page_numbers?: Array<number> | null;
|
|
802
|
-
/**
|
|
803
|
-
* Filter by element type (e.g. NarrativeText, Title, Table)
|
|
804
|
-
*/
|
|
805
|
-
type?: string | null;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
export interface SourceParseParams {
|
|
951
|
+
file_id: string;
|
|
809
952
|
/**
|
|
810
|
-
*
|
|
953
|
+
* Element types to exclude
|
|
811
954
|
*/
|
|
812
|
-
|
|
955
|
+
elementsToRemove?: Array<string> | null;
|
|
813
956
|
/**
|
|
814
|
-
*
|
|
957
|
+
* 1-based page number (use with page_size)
|
|
815
958
|
*/
|
|
816
|
-
|
|
959
|
+
page?: number | null;
|
|
817
960
|
/**
|
|
818
|
-
*
|
|
819
|
-
* (Balanced), hi_res_ft (Accurate), mai (VLM), graphorlm (Agentic)
|
|
961
|
+
* Restrict to specific page numbers
|
|
820
962
|
*/
|
|
821
|
-
|
|
822
|
-
}
|
|
823
|
-
export interface SourceRetrieveChunksParams {
|
|
963
|
+
page_numbers?: Array<number> | null;
|
|
824
964
|
/**
|
|
825
|
-
*
|
|
965
|
+
* Number of elements per page
|
|
826
966
|
*/
|
|
827
|
-
|
|
967
|
+
page_size?: number | null;
|
|
828
968
|
/**
|
|
829
|
-
*
|
|
969
|
+
* When true, img_base64 is omitted from each element
|
|
830
970
|
*/
|
|
831
|
-
|
|
971
|
+
suppress_img_base64?: boolean;
|
|
832
972
|
/**
|
|
833
|
-
*
|
|
834
|
-
* file_ids)
|
|
973
|
+
* Filter by element type (e.g. NarrativeText, Title)
|
|
835
974
|
*/
|
|
836
|
-
|
|
975
|
+
type?: string | null;
|
|
837
976
|
}
|
|
838
|
-
export interface
|
|
977
|
+
export interface SourceIngestFileParams {
|
|
839
978
|
file: Uploadable;
|
|
840
979
|
/**
|
|
841
|
-
*
|
|
980
|
+
* Public-facing partition method names for API v2.
|
|
842
981
|
*
|
|
843
|
-
*
|
|
982
|
+
* Maps to internal PartitionMethod as:
|
|
844
983
|
*
|
|
845
|
-
* -
|
|
846
|
-
* -
|
|
847
|
-
* -
|
|
848
|
-
* -
|
|
849
|
-
* -
|
|
984
|
+
* - fast → basic
|
|
985
|
+
* - balanced → hi_res
|
|
986
|
+
* - accurate → hi_res_ft
|
|
987
|
+
* - vlm → mai
|
|
988
|
+
* - agentic → graphorlm
|
|
850
989
|
*/
|
|
851
|
-
|
|
990
|
+
method?: Method | null;
|
|
852
991
|
}
|
|
853
|
-
export interface
|
|
992
|
+
export interface SourceIngestGitHubParams {
|
|
854
993
|
/**
|
|
855
994
|
* The GitHub repository URL to ingest (e.g. https://github.com/owner/repo)
|
|
856
995
|
*/
|
|
857
996
|
url: string;
|
|
858
997
|
}
|
|
859
|
-
export interface
|
|
998
|
+
export interface SourceIngestURLParams {
|
|
860
999
|
/**
|
|
861
1000
|
* The web page URL to ingest
|
|
862
1001
|
*/
|
|
@@ -866,26 +1005,51 @@ export interface SourceUploadURLParams {
|
|
|
866
1005
|
*/
|
|
867
1006
|
crawlUrls?: boolean;
|
|
868
1007
|
/**
|
|
869
|
-
*
|
|
1008
|
+
* Public-facing partition method names for API v2.
|
|
870
1009
|
*
|
|
871
|
-
*
|
|
1010
|
+
* Maps to internal PartitionMethod as:
|
|
872
1011
|
*
|
|
873
|
-
* -
|
|
874
|
-
* -
|
|
875
|
-
* -
|
|
876
|
-
* -
|
|
877
|
-
* -
|
|
1012
|
+
* - fast → basic
|
|
1013
|
+
* - balanced → hi_res
|
|
1014
|
+
* - accurate → hi_res_ft
|
|
1015
|
+
* - vlm → mai
|
|
1016
|
+
* - agentic → graphorlm
|
|
878
1017
|
*/
|
|
879
|
-
|
|
1018
|
+
method?: Method | null;
|
|
880
1019
|
}
|
|
881
|
-
export interface
|
|
1020
|
+
export interface SourceIngestYoutubeParams {
|
|
882
1021
|
/**
|
|
883
1022
|
* The YouTube video URL to ingest (e.g.
|
|
884
1023
|
* https://www.youtube.com/watch?v=dQw4w9WgXcQ)
|
|
885
1024
|
*/
|
|
886
1025
|
url: string;
|
|
887
1026
|
}
|
|
1027
|
+
export interface SourceReprocessParams {
|
|
1028
|
+
/**
|
|
1029
|
+
* Unique identifier of the source to re-process.
|
|
1030
|
+
*/
|
|
1031
|
+
file_id: string;
|
|
1032
|
+
/**
|
|
1033
|
+
* Partitioning strategy. One of: fast, balanced, accurate, vlm, agentic.
|
|
1034
|
+
*/
|
|
1035
|
+
method?: Method;
|
|
1036
|
+
}
|
|
1037
|
+
export interface SourceRetrieveChunksParams {
|
|
1038
|
+
/**
|
|
1039
|
+
* The natural-language search query to find relevant chunks
|
|
1040
|
+
*/
|
|
1041
|
+
query: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Optional list of file IDs to restrict retrieval scope (preferred)
|
|
1044
|
+
*/
|
|
1045
|
+
file_ids?: Array<string> | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* Optional list of file names to restrict retrieval scope (deprecated, use
|
|
1048
|
+
* file_ids)
|
|
1049
|
+
*/
|
|
1050
|
+
file_names?: Array<string> | null;
|
|
1051
|
+
}
|
|
888
1052
|
export declare namespace Sources {
|
|
889
|
-
export { type
|
|
1053
|
+
export { type Element as Element, type Method as Method, type PublicSource as PublicSource, type SourceListResponse as SourceListResponse, type SourceDeleteResponse as SourceDeleteResponse, type SourceAskResponse as SourceAskResponse, type SourceExtractResponse as SourceExtractResponse, type SourceGetBuildStatusResponse as SourceGetBuildStatusResponse, type SourceGetElementsResponse as SourceGetElementsResponse, type SourceIngestFileResponse as SourceIngestFileResponse, type SourceIngestGitHubResponse as SourceIngestGitHubResponse, type SourceIngestURLResponse as SourceIngestURLResponse, type SourceIngestYoutubeResponse as SourceIngestYoutubeResponse, type SourceReprocessResponse as SourceReprocessResponse, type SourceRetrieveChunksResponse as SourceRetrieveChunksResponse, type SourceListParams as SourceListParams, type SourceDeleteParams as SourceDeleteParams, type SourceAskParams as SourceAskParams, type SourceExtractParams as SourceExtractParams, type SourceGetBuildStatusParams as SourceGetBuildStatusParams, type SourceGetElementsParams as SourceGetElementsParams, type SourceIngestFileParams as SourceIngestFileParams, type SourceIngestGitHubParams as SourceIngestGitHubParams, type SourceIngestURLParams as SourceIngestURLParams, type SourceIngestYoutubeParams as SourceIngestYoutubeParams, type SourceReprocessParams as SourceReprocessParams, type SourceRetrieveChunksParams as SourceRetrieveChunksParams, };
|
|
890
1054
|
}
|
|
891
1055
|
//# sourceMappingURL=sources.d.mts.map
|