graphor 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/resources/sources.d.mts +418 -60
- package/resources/sources.d.mts.map +1 -1
- package/resources/sources.d.ts +418 -60
- package/resources/sources.d.ts.map +1 -1
- package/resources/sources.js +348 -19
- package/resources/sources.js.map +1 -1
- package/resources/sources.mjs +348 -19
- package/resources/sources.mjs.map +1 -1
- package/src/resources/sources.ts +418 -60
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../src/resources/sources.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OACnB,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../src/resources/sources.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OACnB,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAI9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAI5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,GAAG,CAA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wBAAwB,EACzD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
|
package/resources/sources.js
CHANGED
|
@@ -6,79 +6,408 @@ const resource_1 = require("../core/resource.js");
|
|
|
6
6
|
const uploads_1 = require("../internal/uploads.js");
|
|
7
7
|
class Sources extends resource_1.APIResource {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* List all sources in the project's knowledge graph.
|
|
10
|
+
*
|
|
11
|
+
* Returns every source node currently stored in the knowledge graph for the
|
|
12
|
+
* authenticated project. Each item includes the file metadata (ID, name, size,
|
|
13
|
+
* type, origin) along with its current processing status and a human-readable
|
|
14
|
+
* status message.
|
|
15
|
+
*
|
|
16
|
+
* **Status messages returned per source:**
|
|
17
|
+
*
|
|
18
|
+
* - `"completed"` → _"Source processed successfully"_
|
|
19
|
+
* - `"processing"` → _"Source is being processed"_
|
|
20
|
+
* - `"failed"` → _"Source processing failed"_
|
|
21
|
+
* - `"new"` → _"Source uploaded, awaiting processing"_
|
|
22
|
+
*
|
|
23
|
+
* **Returns** a JSON array of `PublicSourceResponse` objects.
|
|
24
|
+
*
|
|
25
|
+
* **Error responses:**
|
|
26
|
+
*
|
|
27
|
+
* - `500` — Unexpected internal error while retrieving sources.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const publicSources = await client.sources.list();
|
|
32
|
+
* ```
|
|
10
33
|
*/
|
|
11
34
|
list(options) {
|
|
12
35
|
return this._client.get('/sources', options);
|
|
13
36
|
}
|
|
14
37
|
/**
|
|
15
|
-
* Delete a source from the project
|
|
38
|
+
* Delete a source from the project's knowledge graph and all associated data.
|
|
39
|
+
*
|
|
40
|
+
* Removes the source node, its partitions/chunks, embeddings, and any stored files
|
|
41
|
+
* from the knowledge graph and object storage. The operation is irreversible.
|
|
42
|
+
*
|
|
43
|
+
* **Parameters (JSON body):**
|
|
44
|
+
*
|
|
45
|
+
* - **file_id** (str, optional — preferred): The unique identifier of the source
|
|
46
|
+
* to delete.
|
|
47
|
+
* - **file_name** (str, optional — deprecated): The display name of the source.
|
|
48
|
+
* Use `file_id` instead when possible. At least one of `file_id` or `file_name`
|
|
49
|
+
* must be provided.
|
|
16
50
|
*
|
|
17
|
-
*
|
|
51
|
+
* **Returns** a `PublicDeleteSourceResponse` with the deletion status, file ID,
|
|
52
|
+
* file name, project ID, and project name.
|
|
53
|
+
*
|
|
54
|
+
* **Error responses:**
|
|
55
|
+
*
|
|
56
|
+
* - `400` — Invalid input (e.g. neither identifier provided).
|
|
57
|
+
* - `403` — Permission denied.
|
|
58
|
+
* - `404` — Source not found.
|
|
59
|
+
* - `500` — Unexpected internal error.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const source = await client.sources.delete();
|
|
64
|
+
* ```
|
|
18
65
|
*/
|
|
19
66
|
delete(body, options) {
|
|
20
67
|
return this._client.delete('/sources/delete', { body, ...options });
|
|
21
68
|
}
|
|
22
69
|
/**
|
|
23
|
-
*
|
|
70
|
+
* Ask a natural-language question grounded on the project's ingested sources.
|
|
71
|
+
*
|
|
72
|
+
* This is the primary Q&A endpoint. It sends the question through the GenAI File
|
|
73
|
+
* Search pipeline, which retrieves relevant chunks from the knowledge graph,
|
|
74
|
+
* grounds the answer in the source documents, and returns a natural-language
|
|
75
|
+
* response. Optionally, you can request a structured JSON output by supplying an
|
|
76
|
+
* `output_schema`.
|
|
77
|
+
*
|
|
78
|
+
* Conversation memory is supported: pass a `conversation_id` to continue an
|
|
79
|
+
* existing conversation, or set `reset` to `true` to start fresh.
|
|
80
|
+
*
|
|
81
|
+
* **Parameters (JSON body):**
|
|
82
|
+
*
|
|
83
|
+
* - **question** (str, required): The question to ask about the sources.
|
|
84
|
+
* - **conversation_id** (str, optional): An existing conversation identifier to
|
|
85
|
+
* maintain context across multiple turns.
|
|
86
|
+
* - **reset** (bool, optional, default `false`): When `true`, starts a new
|
|
87
|
+
* conversation discarding any previous history.
|
|
88
|
+
* - **file_ids** (list[str], optional — preferred): Restrict the search scope to
|
|
89
|
+
* specific source file IDs.
|
|
90
|
+
* - **file_names** (list[str], optional — deprecated): Restrict the search scope
|
|
91
|
+
* to specific source file names. Use `file_ids` when possible.
|
|
92
|
+
* - **output_schema** (dict, optional): A JSON Schema for requesting structured
|
|
93
|
+
* output. When provided, the response includes a `structured_output` field
|
|
94
|
+
* validated against this schema and the `raw_json` produced by the model.
|
|
95
|
+
* - **thinking_level** (str, optional, default `"accurate"`): Controls the
|
|
96
|
+
* model/thinking budget — one of `"fast"`, `"balanced"`, or `"accurate"`.
|
|
97
|
+
*
|
|
98
|
+
* **Returns** a `PublicAskSourcesResponse` containing:
|
|
99
|
+
*
|
|
100
|
+
* - `answer` — the natural-language answer (or a status message when
|
|
101
|
+
* `output_schema` is provided).
|
|
102
|
+
* - `structured_output` — the validated structured object (when `output_schema` is
|
|
103
|
+
* provided).
|
|
104
|
+
* - `raw_json` — the raw JSON text before validation (when `output_schema` is
|
|
105
|
+
* provided).
|
|
106
|
+
* - `conversation_id` — the conversation identifier for follow-up questions.
|
|
107
|
+
*
|
|
108
|
+
* **Error responses:**
|
|
109
|
+
*
|
|
110
|
+
* - `500` — Unexpected internal error while asking sources.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const response = await client.sources.ask({
|
|
115
|
+
* question: 'question',
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
24
118
|
*/
|
|
25
119
|
ask(body, options) {
|
|
26
120
|
return this._client.post('/sources/ask-sources', { body, ...options });
|
|
27
121
|
}
|
|
28
122
|
/**
|
|
29
|
-
* Run a one-off
|
|
123
|
+
* Run a one-off structured data extraction against one or more sources.
|
|
124
|
+
*
|
|
125
|
+
* This endpoint uses the GenAI File Search pipeline to read the specified sources,
|
|
126
|
+
* apply the user-provided instruction, and return structured JSON output
|
|
127
|
+
* conforming to the supplied `output_schema`. Internally it builds a grounded
|
|
128
|
+
* prompt, queries the model, and validates/corrects the raw JSON against the
|
|
129
|
+
* schema.
|
|
130
|
+
*
|
|
131
|
+
* **Parameters (JSON body):**
|
|
132
|
+
*
|
|
133
|
+
* - **file_ids** (list[str], optional — preferred): List of source file IDs to
|
|
134
|
+
* extract from.
|
|
135
|
+
* - **file_names** (list[str], optional — deprecated): List of source file names
|
|
136
|
+
* to extract from. Use `file_ids` when possible. At least one of the two lists
|
|
137
|
+
* must be provided and non-empty.
|
|
138
|
+
* - **user_instruction** (str, required): A natural-language instruction that
|
|
139
|
+
* guides what information to extract from the documents.
|
|
140
|
+
* - **output_schema** (dict, required): A JSON Schema object describing the
|
|
141
|
+
* desired structured output shape. The model will produce data conforming to
|
|
142
|
+
* this schema.
|
|
143
|
+
* - **thinking_level** (str, optional, default `"accurate"`): Controls the
|
|
144
|
+
* model/thinking budget — one of `"fast"`, `"balanced"`, or `"accurate"`.
|
|
145
|
+
*
|
|
146
|
+
* **Returns** a `PublicRunExtractionResultResponse` containing:
|
|
147
|
+
*
|
|
148
|
+
* - `structured_output` — the validated structured object.
|
|
149
|
+
* - `raw_json` — the raw JSON text produced by the model before validation.
|
|
150
|
+
*
|
|
151
|
+
* **Error responses:**
|
|
152
|
+
*
|
|
153
|
+
* - `500` — Unexpected internal error during extraction.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const response = await client.sources.extract({
|
|
158
|
+
* output_schema: { foo: 'bar' },
|
|
159
|
+
* user_instruction: 'user_instruction',
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
30
162
|
*/
|
|
31
163
|
extract(body, options) {
|
|
32
164
|
return this._client.post('/sources/run-extraction', { body, ...options });
|
|
33
165
|
}
|
|
34
166
|
/**
|
|
35
|
-
*
|
|
167
|
+
* Retrieve the parsed elements (chunks/partitions) of a specific source with
|
|
168
|
+
* pagination.
|
|
36
169
|
*
|
|
37
|
-
*
|
|
170
|
+
* Returns the individual document partitions (text chunks) that were generated
|
|
171
|
+
* during ingestion for a given source. This is useful for inspecting how a file
|
|
172
|
+
* was segmented, reviewing chunk content, or building custom retrieval logic on
|
|
173
|
+
* top of the raw partitions.
|
|
174
|
+
*
|
|
175
|
+
* **Parameters (JSON body):**
|
|
176
|
+
*
|
|
177
|
+
* - **file_id** (str, optional — preferred): The unique identifier of the source
|
|
178
|
+
* whose elements to retrieve.
|
|
179
|
+
* - **file_name** (str, optional — deprecated): The display name of the source.
|
|
180
|
+
* Use `file_id` when possible. At least one of `file_id` or `file_name` must be
|
|
181
|
+
* provided.
|
|
182
|
+
* - **page** (int, optional): The 1-based page number for pagination.
|
|
183
|
+
* - **page_size** (int, optional): The number of elements per page. Both `page`
|
|
184
|
+
* and `page_size` must be provided together to enable pagination.
|
|
185
|
+
* - **filter** (object, optional): An optional filter object with:
|
|
186
|
+
* - `type` — filter by element type.
|
|
187
|
+
* - `page_numbers` — restrict to specific source page numbers.
|
|
188
|
+
* - `elementsToRemove` — list of element types to exclude.
|
|
189
|
+
*
|
|
190
|
+
* **Returns** a `PaginatedResponse[Document]` containing:
|
|
191
|
+
*
|
|
192
|
+
* - `items` — list of `Document` objects (LangChain format) with `page_content`
|
|
193
|
+
* and `metadata`.
|
|
194
|
+
* - `total` — total number of matching elements.
|
|
195
|
+
* - `page`, `page_size`, `total_pages` — pagination metadata.
|
|
196
|
+
*
|
|
197
|
+
* **Error responses:**
|
|
198
|
+
*
|
|
199
|
+
* - `400` — Invalid input (e.g. neither identifier provided).
|
|
200
|
+
* - `404` — Source file not found.
|
|
201
|
+
* - `500` — Unexpected internal error.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* const response = await client.sources.loadElements();
|
|
206
|
+
* ```
|
|
38
207
|
*/
|
|
39
208
|
loadElements(body, options) {
|
|
40
209
|
return this._client.post('/sources/elements', { body, ...options });
|
|
41
210
|
}
|
|
42
211
|
/**
|
|
43
|
-
*
|
|
212
|
+
* Re-process (re-parse) an existing source that has already been uploaded.
|
|
213
|
+
*
|
|
214
|
+
* Use this endpoint to re-run the data-ingestion pipeline on a source that is
|
|
215
|
+
* already present in the knowledge graph — for example, after changing the
|
|
216
|
+
* partitioning strategy. The endpoint locates the source node, sets its status to
|
|
217
|
+
* `PROCESSING`, applies the requested partition method, and executes the full
|
|
218
|
+
* ingestion pipeline synchronously (partitioning, chunking, embedding, and graph
|
|
219
|
+
* persistence).
|
|
220
|
+
*
|
|
221
|
+
* **Parameters (JSON body):**
|
|
44
222
|
*
|
|
45
|
-
*
|
|
223
|
+
* - **file_id** (str, optional — preferred): The unique identifier of the source
|
|
224
|
+
* to re-process.
|
|
225
|
+
* - **file_name** (str, optional — deprecated): The display name of the source.
|
|
226
|
+
* Use `file_id` instead when possible. At least one of `file_id` or `file_name`
|
|
227
|
+
* must be provided.
|
|
228
|
+
* - **partition_method** (str, default `"basic"`): The partitioning strategy to
|
|
229
|
+
* apply (e.g. `"basic"`, `"hi_res"`, `"fast"`).
|
|
230
|
+
*
|
|
231
|
+
* **Returns** a `PublicSourceResponse` with the updated source metadata.
|
|
232
|
+
*
|
|
233
|
+
* **Error responses:**
|
|
234
|
+
*
|
|
235
|
+
* - `404` — Source node not found for the given identifier.
|
|
236
|
+
* - `500` — Processing or unexpected internal error.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```ts
|
|
240
|
+
* const publicSource = await client.sources.parse();
|
|
241
|
+
* ```
|
|
46
242
|
*/
|
|
47
243
|
parse(body, options) {
|
|
48
244
|
return this._client.post('/sources/process', { body, ...options });
|
|
49
245
|
}
|
|
50
246
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
247
|
+
* Retrieve relevant document chunks from the prebuilt RAG vector store.
|
|
248
|
+
*
|
|
249
|
+
* Performs a semantic similarity search over the project's prebuilt RAG store
|
|
250
|
+
* using Google File Search with grounding. Returns the most relevant text chunks
|
|
251
|
+
* along with their source metadata (file name, page number, relevance score). This
|
|
252
|
+
* is a pure retrieval endpoint — it does **not** generate an answer; use
|
|
253
|
+
* `/ask-sources` for Q&A.
|
|
254
|
+
*
|
|
255
|
+
* **Parameters (JSON body):**
|
|
256
|
+
*
|
|
257
|
+
* - **query** (str, required): The natural-language search query used to find
|
|
258
|
+
* relevant chunks.
|
|
259
|
+
* - **file_ids** (list[str], optional — preferred): Restrict retrieval to specific
|
|
260
|
+
* source file IDs.
|
|
261
|
+
* - **file_names** (list[str], optional — deprecated): Restrict retrieval to
|
|
262
|
+
* specific source file names. Use `file_ids` when possible.
|
|
263
|
+
*
|
|
264
|
+
* **Returns** a `PublicRetrieveResponse` containing:
|
|
265
|
+
*
|
|
266
|
+
* - `query` — the original search query.
|
|
267
|
+
* - `chunks` — a list of `PublicRetrieveChunk` objects, each with `text`,
|
|
268
|
+
* `file_name`, `page_number`, `score`, and additional `metadata`.
|
|
269
|
+
* - `total` — the total number of chunks returned.
|
|
270
|
+
*
|
|
271
|
+
* **Error responses:**
|
|
53
272
|
*
|
|
54
|
-
*
|
|
273
|
+
* - `500` — Unexpected internal error during retrieval.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const response = await client.sources.retrieveChunks({
|
|
278
|
+
* query: 'query',
|
|
279
|
+
* });
|
|
280
|
+
* ```
|
|
55
281
|
*/
|
|
56
282
|
retrieveChunks(body, options) {
|
|
57
283
|
return this._client.post('/sources/prebuilt-rag', { body, ...options });
|
|
58
284
|
}
|
|
59
285
|
/**
|
|
60
|
-
* Upload
|
|
286
|
+
* Upload a local file and ingest it as a source into the project's knowledge
|
|
287
|
+
* graph.
|
|
288
|
+
*
|
|
289
|
+
* This endpoint accepts a multipart file upload, validates the file size (max 100
|
|
290
|
+
* MB) and extension against the list of allowed ingestion types, stores the file,
|
|
291
|
+
* and then runs the full data-ingestion pipeline synchronously — including
|
|
292
|
+
* partitioning, chunking, embedding, and graph persistence.
|
|
293
|
+
*
|
|
294
|
+
* **Parameters:**
|
|
295
|
+
*
|
|
296
|
+
* - **file** (multipart): The file to upload. Must include a `Content-Length`
|
|
297
|
+
* header and have a supported extension (e.g. pdf, docx, txt, csv, etc.).
|
|
298
|
+
* - **partition_method** (form, optional): The partitioning strategy to apply to
|
|
299
|
+
* the document. When omitted the system default is used.
|
|
300
|
+
*
|
|
301
|
+
* **Returns** a `PublicSourceResponse` with the resulting source metadata (file
|
|
302
|
+
* ID, name, size, type, source origin, partition method, and processing status).
|
|
303
|
+
*
|
|
304
|
+
* **Error responses:**
|
|
305
|
+
*
|
|
306
|
+
* - `400` — Unsupported file type or missing file name.
|
|
307
|
+
* - `411` — Missing `Content-Length` header (file size cannot be determined).
|
|
308
|
+
* - `413` — File exceeds the 100 MB size limit.
|
|
309
|
+
* - `403` — Permission denied.
|
|
310
|
+
* - `404` — File not found during processing.
|
|
311
|
+
* - `500` — Unexpected internal error.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* const publicSource = await client.sources.upload({
|
|
316
|
+
* file: fs.createReadStream('path/to/file'),
|
|
317
|
+
* });
|
|
318
|
+
* ```
|
|
61
319
|
*/
|
|
62
320
|
upload(body, options) {
|
|
63
321
|
return this._client.post('/sources/upload', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
|
64
322
|
}
|
|
65
323
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
324
|
+
* Ingest a GitHub repository as a source into the project's knowledge graph.
|
|
325
|
+
*
|
|
326
|
+
* The endpoint clones or fetches the repository at the given URL, extracts its
|
|
327
|
+
* text-based files, partitions them using the system default method, generates
|
|
328
|
+
* embeddings, and persists everything in the knowledge graph synchronously.
|
|
329
|
+
*
|
|
330
|
+
* **Parameters (JSON body):**
|
|
331
|
+
*
|
|
332
|
+
* - **url** (str, required): The GitHub repository URL to ingest (e.g.
|
|
333
|
+
* `https://github.com/owner/repo`).
|
|
334
|
+
*
|
|
335
|
+
* **Returns** a `PublicSourceResponse` with the resulting source metadata (file
|
|
336
|
+
* ID, name, size, type, source origin, partition method, and processing status).
|
|
337
|
+
*
|
|
338
|
+
* **Error responses:**
|
|
339
|
+
*
|
|
340
|
+
* - `500` — Unexpected internal error during GitHub source processing.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* ```ts
|
|
344
|
+
* const publicSource = await client.sources.uploadGitHub({
|
|
345
|
+
* url: 'url',
|
|
346
|
+
* });
|
|
347
|
+
* ```
|
|
68
348
|
*/
|
|
69
349
|
uploadGitHub(body, options) {
|
|
70
350
|
return this._client.post('/sources/upload-github-source', { body, ...options });
|
|
71
351
|
}
|
|
72
352
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
353
|
+
* Ingest a web page (or a set of crawled pages) as a source into the project's
|
|
354
|
+
* knowledge graph.
|
|
355
|
+
*
|
|
356
|
+
* The endpoint fetches the content at the given URL, optionally crawls linked
|
|
357
|
+
* pages (when `crawlUrls` is `true`), partitions the resulting HTML/text,
|
|
358
|
+
* generates embeddings, and persists everything in the knowledge graph
|
|
359
|
+
* synchronously.
|
|
360
|
+
*
|
|
361
|
+
* **Parameters (JSON body):**
|
|
362
|
+
*
|
|
363
|
+
* - **url** (str, required): The web page URL to ingest.
|
|
364
|
+
* - **crawlUrls** (bool, optional, default `false`): When `true`, the system will
|
|
365
|
+
* also follow and ingest links found on the page.
|
|
366
|
+
* - **partition_method** (str, optional): The partitioning strategy to use. When
|
|
367
|
+
* omitted the system default is applied.
|
|
368
|
+
*
|
|
369
|
+
* **Returns** a `PublicSourceResponse` with the resulting source metadata (file
|
|
370
|
+
* ID, name, size, type, source origin, partition method, and processing status).
|
|
371
|
+
*
|
|
372
|
+
* **Error responses:**
|
|
373
|
+
*
|
|
374
|
+
* - `500` — Unexpected internal error during URL processing.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* const publicSource = await client.sources.uploadURL({
|
|
379
|
+
* url: 'url',
|
|
380
|
+
* });
|
|
381
|
+
* ```
|
|
75
382
|
*/
|
|
76
383
|
uploadURL(body, options) {
|
|
77
384
|
return this._client.post('/sources/upload-url-source', { body, ...options });
|
|
78
385
|
}
|
|
79
386
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
387
|
+
* Ingest a YouTube video as a source into the project's knowledge graph.
|
|
388
|
+
*
|
|
389
|
+
* The endpoint downloads the transcript/captions of the given YouTube video,
|
|
390
|
+
* partitions the text using the system default method, generates embeddings, and
|
|
391
|
+
* persists everything in the knowledge graph synchronously.
|
|
392
|
+
*
|
|
393
|
+
* **Parameters (JSON body):**
|
|
394
|
+
*
|
|
395
|
+
* - **url** (str, required): The YouTube video URL to ingest (e.g.
|
|
396
|
+
* `https://www.youtube.com/watch?v=...`).
|
|
397
|
+
*
|
|
398
|
+
* **Returns** a `PublicSourceResponse` with the resulting source metadata (file
|
|
399
|
+
* ID, name, size, type, source origin, partition method, and processing status).
|
|
400
|
+
*
|
|
401
|
+
* **Error responses:**
|
|
402
|
+
*
|
|
403
|
+
* - `500` — Unexpected internal error during YouTube source processing.
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* const publicSource = await client.sources.uploadYoutube({
|
|
408
|
+
* url: 'url',
|
|
409
|
+
* });
|
|
410
|
+
* ```
|
|
82
411
|
*/
|
|
83
412
|
uploadYoutube(body, options) {
|
|
84
413
|
return this._client.post('/sources/upload-youtube-source', { body, ...options });
|
package/resources/sources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../src/resources/sources.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAkE;AAElE,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