studyfetch-sdk 0.1.0a17__py3-none-any.whl → 0.1.0a19__py3-none-any.whl
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.
- studyfetch_sdk/_models.py +1 -1
- studyfetch_sdk/_version.py +1 -1
- studyfetch_sdk/resources/v1/__init__.py +14 -0
- studyfetch_sdk/resources/v1/assignment_grader.py +81 -1
- studyfetch_sdk/resources/v1/components.py +36 -4
- studyfetch_sdk/resources/v1/data_analyst/__init__.py +47 -0
- studyfetch_sdk/resources/v1/data_analyst/data_analyst.py +582 -0
- studyfetch_sdk/resources/v1/data_analyst/sessions.py +222 -0
- studyfetch_sdk/resources/v1/data_analyst/test.py +190 -0
- studyfetch_sdk/resources/v1/materials/bulk.py +60 -7
- studyfetch_sdk/resources/v1/materials/materials.py +250 -57
- studyfetch_sdk/resources/v1/materials/test.py +29 -25
- studyfetch_sdk/resources/v1/materials/upload.py +402 -14
- studyfetch_sdk/resources/v1/usage/analyst.py +143 -15
- studyfetch_sdk/resources/v1/v1.py +98 -0
- studyfetch_sdk/types/v1/__init__.py +12 -0
- studyfetch_sdk/types/v1/assignment_grader_response.py +20 -1
- studyfetch_sdk/types/v1/component.py +9 -1
- studyfetch_sdk/types/v1/component_create_params.py +57 -1
- studyfetch_sdk/types/v1/component_list_params.py +9 -1
- studyfetch_sdk/types/v1/content_param.py +23 -0
- studyfetch_sdk/types/v1/data_analyst/__init__.py +5 -0
- studyfetch_sdk/types/v1/data_analyst/session_retrieve_params.py +11 -0
- studyfetch_sdk/types/v1/data_analyst_retrieve_session_params.py +13 -0
- studyfetch_sdk/types/v1/data_analyst_send_message_params.py +54 -0
- studyfetch_sdk/types/v1/data_analyst_stream_params.py +28 -0
- studyfetch_sdk/types/v1/material_batch_create_params.py +29 -0
- studyfetch_sdk/types/v1/material_batch_create_response.py +27 -0
- studyfetch_sdk/types/v1/material_create_and_process_params.py +27 -0
- studyfetch_sdk/types/v1/material_create_params.py +4 -17
- studyfetch_sdk/types/v1/material_debug_response.py +47 -0
- studyfetch_sdk/types/v1/material_get_download_url_params.py +3 -2
- studyfetch_sdk/types/v1/material_get_download_url_response.py +12 -0
- studyfetch_sdk/types/v1/material_move_params.py +15 -0
- studyfetch_sdk/types/v1/material_rename_params.py +12 -0
- studyfetch_sdk/types/v1/material_search_params.py +3 -6
- studyfetch_sdk/types/v1/material_search_response.py +54 -0
- studyfetch_sdk/types/v1/materials/__init__.py +11 -0
- studyfetch_sdk/types/v1/materials/bulk_move_params.py +18 -0
- studyfetch_sdk/types/v1/materials/bulk_move_response.py +15 -0
- studyfetch_sdk/types/v1/materials/test_perform_ocr_response.py +19 -0
- studyfetch_sdk/types/v1/materials/test_process_epub_response.py +30 -0
- studyfetch_sdk/types/v1/materials/test_process_image_response.py +30 -0
- studyfetch_sdk/types/v1/materials/test_process_video_response.py +25 -0
- studyfetch_sdk/types/v1/materials/upload_complete_upload_params.py +20 -0
- studyfetch_sdk/types/v1/materials/upload_create_presigned_url_params.py +23 -0
- studyfetch_sdk/types/v1/materials/upload_create_presigned_url_response.py +18 -0
- studyfetch_sdk/types/v1/materials/upload_upload_file_and_process_params.py +26 -0
- studyfetch_sdk/types/v1/materials/upload_upload_url_and_process_params.py +26 -0
- studyfetch_sdk/types/v1/usage/__init__.py +3 -0
- studyfetch_sdk/types/v1/usage/analyst_get_test_questions_params.py +18 -0
- studyfetch_sdk/types/v1/usage/analyst_list_chat_messages_params.py +18 -0
- studyfetch_sdk/types/v1/usage/analyst_list_chat_messages_response.py +35 -0
- studyfetch_sdk/types/v1/usage/analyst_list_events_params.py +7 -0
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/METADATA +1 -1
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/RECORD +58 -26
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/WHEEL +0 -0
- {studyfetch_sdk-0.1.0a17.dist-info → studyfetch_sdk-0.1.0a19.dist-info}/licenses/LICENSE +0 -0
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
-
from typing import List
|
5
|
+
from typing import List, Iterable, Optional
|
6
6
|
|
7
7
|
import httpx
|
8
8
|
|
@@ -35,9 +35,13 @@ from ...._utils import maybe_transform, async_maybe_transform
|
|
35
35
|
from ...._compat import cached_property
|
36
36
|
from ....types.v1 import (
|
37
37
|
material_list_params,
|
38
|
+
material_move_params,
|
38
39
|
material_create_params,
|
40
|
+
material_rename_params,
|
39
41
|
material_search_params,
|
42
|
+
material_batch_create_params,
|
40
43
|
material_get_download_url_params,
|
44
|
+
material_create_and_process_params,
|
41
45
|
)
|
42
46
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
43
47
|
from ...._response import (
|
@@ -48,7 +52,12 @@ from ...._response import (
|
|
48
52
|
)
|
49
53
|
from ...._base_client import make_request_options
|
50
54
|
from ....types.v1.material import Material
|
55
|
+
from ....types.v1.content_param import ContentParam
|
51
56
|
from ....types.v1.material_list_response import MaterialListResponse
|
57
|
+
from ....types.v1.material_debug_response import MaterialDebugResponse
|
58
|
+
from ....types.v1.material_search_response import MaterialSearchResponse
|
59
|
+
from ....types.v1.material_batch_create_response import MaterialBatchCreateResponse
|
60
|
+
from ....types.v1.material_get_download_url_response import MaterialGetDownloadURLResponse
|
52
61
|
|
53
62
|
__all__ = ["MaterialsResource", "AsyncMaterialsResource"]
|
54
63
|
|
@@ -88,7 +97,7 @@ class MaterialsResource(SyncAPIResource):
|
|
88
97
|
def create(
|
89
98
|
self,
|
90
99
|
*,
|
91
|
-
content:
|
100
|
+
content: ContentParam,
|
92
101
|
name: str,
|
93
102
|
folder_id: str | NotGiven = NOT_GIVEN,
|
94
103
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
@@ -239,20 +248,92 @@ class MaterialsResource(SyncAPIResource):
|
|
239
248
|
def batch_create(
|
240
249
|
self,
|
241
250
|
*,
|
251
|
+
materials: Iterable[material_batch_create_params.Material],
|
242
252
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
243
253
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
244
254
|
extra_headers: Headers | None = None,
|
245
255
|
extra_query: Query | None = None,
|
246
256
|
extra_body: Body | None = None,
|
247
257
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
248
|
-
) ->
|
249
|
-
|
258
|
+
) -> MaterialBatchCreateResponse:
|
259
|
+
"""
|
260
|
+
Create batch upload URLs for multiple materials
|
261
|
+
|
262
|
+
Args:
|
263
|
+
materials: Array of materials to create
|
264
|
+
|
265
|
+
extra_headers: Send extra headers
|
266
|
+
|
267
|
+
extra_query: Add additional query parameters to the request
|
268
|
+
|
269
|
+
extra_body: Add additional JSON properties to the request
|
270
|
+
|
271
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
272
|
+
"""
|
250
273
|
return self._post(
|
251
274
|
"/api/v1/materials/batch",
|
275
|
+
body=maybe_transform({"materials": materials}, material_batch_create_params.MaterialBatchCreateParams),
|
252
276
|
options=make_request_options(
|
253
277
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
254
278
|
),
|
255
|
-
cast_to=
|
279
|
+
cast_to=MaterialBatchCreateResponse,
|
280
|
+
)
|
281
|
+
|
282
|
+
def create_and_process(
|
283
|
+
self,
|
284
|
+
*,
|
285
|
+
content: ContentParam,
|
286
|
+
name: str,
|
287
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
288
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
289
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
290
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
291
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
292
|
+
extra_headers: Headers | None = None,
|
293
|
+
extra_query: Query | None = None,
|
294
|
+
extra_body: Body | None = None,
|
295
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
296
|
+
) -> Material:
|
297
|
+
"""Creates a material and waits for processing to finish before returning.
|
298
|
+
|
299
|
+
Useful
|
300
|
+
for synchronous API usage.
|
301
|
+
|
302
|
+
Args:
|
303
|
+
content: Content details
|
304
|
+
|
305
|
+
name: Name of the material
|
306
|
+
|
307
|
+
folder_id: Folder ID to place the material in
|
308
|
+
|
309
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
310
|
+
|
311
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
312
|
+
|
313
|
+
extra_headers: Send extra headers
|
314
|
+
|
315
|
+
extra_query: Add additional query parameters to the request
|
316
|
+
|
317
|
+
extra_body: Add additional JSON properties to the request
|
318
|
+
|
319
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
320
|
+
"""
|
321
|
+
return self._post(
|
322
|
+
"/api/v1/materials/upload-and-process",
|
323
|
+
body=maybe_transform(
|
324
|
+
{
|
325
|
+
"content": content,
|
326
|
+
"name": name,
|
327
|
+
"folder_id": folder_id,
|
328
|
+
"poll_interval_ms": poll_interval_ms,
|
329
|
+
"timeout_ms": timeout_ms,
|
330
|
+
},
|
331
|
+
material_create_and_process_params.MaterialCreateAndProcessParams,
|
332
|
+
),
|
333
|
+
options=make_request_options(
|
334
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
335
|
+
),
|
336
|
+
cast_to=Material,
|
256
337
|
)
|
257
338
|
|
258
339
|
def debug(
|
@@ -265,8 +346,10 @@ class MaterialsResource(SyncAPIResource):
|
|
265
346
|
extra_query: Query | None = None,
|
266
347
|
extra_body: Body | None = None,
|
267
348
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
268
|
-
) ->
|
349
|
+
) -> MaterialDebugResponse:
|
269
350
|
"""
|
351
|
+
Get debug information for a material including extracted content
|
352
|
+
|
270
353
|
Args:
|
271
354
|
extra_headers: Send extra headers
|
272
355
|
|
@@ -278,29 +361,32 @@ class MaterialsResource(SyncAPIResource):
|
|
278
361
|
"""
|
279
362
|
if not id:
|
280
363
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
281
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
282
364
|
return self._get(
|
283
365
|
f"/api/v1/materials/{id}/debug",
|
284
366
|
options=make_request_options(
|
285
367
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
286
368
|
),
|
287
|
-
cast_to=
|
369
|
+
cast_to=MaterialDebugResponse,
|
288
370
|
)
|
289
371
|
|
290
372
|
def get_download_url(
|
291
373
|
self,
|
292
374
|
id: str,
|
293
375
|
*,
|
294
|
-
expires_in:
|
376
|
+
expires_in: float | NotGiven = NOT_GIVEN,
|
295
377
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
296
378
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
297
379
|
extra_headers: Headers | None = None,
|
298
380
|
extra_query: Query | None = None,
|
299
381
|
extra_body: Body | None = None,
|
300
382
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
301
|
-
) ->
|
383
|
+
) -> MaterialGetDownloadURLResponse:
|
302
384
|
"""
|
385
|
+
Get temporary download URL for material
|
386
|
+
|
303
387
|
Args:
|
388
|
+
expires_in: URL expiration time in seconds (default: 3600)
|
389
|
+
|
304
390
|
extra_headers: Send extra headers
|
305
391
|
|
306
392
|
extra_query: Add additional query parameters to the request
|
@@ -311,7 +397,6 @@ class MaterialsResource(SyncAPIResource):
|
|
311
397
|
"""
|
312
398
|
if not id:
|
313
399
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
314
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
315
400
|
return self._get(
|
316
401
|
f"/api/v1/materials/{id}/download-url",
|
317
402
|
options=make_request_options(
|
@@ -323,22 +408,27 @@ class MaterialsResource(SyncAPIResource):
|
|
323
408
|
{"expires_in": expires_in}, material_get_download_url_params.MaterialGetDownloadURLParams
|
324
409
|
),
|
325
410
|
),
|
326
|
-
cast_to=
|
411
|
+
cast_to=MaterialGetDownloadURLResponse,
|
327
412
|
)
|
328
413
|
|
329
414
|
def move(
|
330
415
|
self,
|
331
416
|
id: str,
|
332
417
|
*,
|
418
|
+
folder_id: Optional[str],
|
333
419
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
334
420
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
335
421
|
extra_headers: Headers | None = None,
|
336
422
|
extra_query: Query | None = None,
|
337
423
|
extra_body: Body | None = None,
|
338
424
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
339
|
-
) ->
|
425
|
+
) -> Material:
|
340
426
|
"""
|
427
|
+
Move material to a different folder
|
428
|
+
|
341
429
|
Args:
|
430
|
+
folder_id: Target folder ID (null for root)
|
431
|
+
|
342
432
|
extra_headers: Send extra headers
|
343
433
|
|
344
434
|
extra_query: Add additional query parameters to the request
|
@@ -349,28 +439,33 @@ class MaterialsResource(SyncAPIResource):
|
|
349
439
|
"""
|
350
440
|
if not id:
|
351
441
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
352
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
353
442
|
return self._post(
|
354
443
|
f"/api/v1/materials/{id}/move",
|
444
|
+
body=maybe_transform({"folder_id": folder_id}, material_move_params.MaterialMoveParams),
|
355
445
|
options=make_request_options(
|
356
446
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
357
447
|
),
|
358
|
-
cast_to=
|
448
|
+
cast_to=Material,
|
359
449
|
)
|
360
450
|
|
361
451
|
def rename(
|
362
452
|
self,
|
363
453
|
id: str,
|
364
454
|
*,
|
455
|
+
name: str,
|
365
456
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
366
457
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
367
458
|
extra_headers: Headers | None = None,
|
368
459
|
extra_query: Query | None = None,
|
369
460
|
extra_body: Body | None = None,
|
370
461
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
371
|
-
) ->
|
462
|
+
) -> Material:
|
372
463
|
"""
|
464
|
+
Rename a material
|
465
|
+
|
373
466
|
Args:
|
467
|
+
name: New name for the material
|
468
|
+
|
374
469
|
extra_headers: Send extra headers
|
375
470
|
|
376
471
|
extra_query: Add additional query parameters to the request
|
@@ -381,13 +476,13 @@ class MaterialsResource(SyncAPIResource):
|
|
381
476
|
"""
|
382
477
|
if not id:
|
383
478
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
384
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
385
479
|
return self._post(
|
386
480
|
f"/api/v1/materials/{id}/rename",
|
481
|
+
body=maybe_transform({"name": name}, material_rename_params.MaterialRenameParams),
|
387
482
|
options=make_request_options(
|
388
483
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
389
484
|
),
|
390
|
-
cast_to=
|
485
|
+
cast_to=Material,
|
391
486
|
)
|
392
487
|
|
393
488
|
def reprocess(
|
@@ -400,8 +495,10 @@ class MaterialsResource(SyncAPIResource):
|
|
400
495
|
extra_query: Query | None = None,
|
401
496
|
extra_body: Body | None = None,
|
402
497
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
403
|
-
) ->
|
498
|
+
) -> Material:
|
404
499
|
"""
|
500
|
+
Reprocess material to regenerate embeddings and extract content
|
501
|
+
|
405
502
|
Args:
|
406
503
|
extra_headers: Send extra headers
|
407
504
|
|
@@ -413,13 +510,12 @@ class MaterialsResource(SyncAPIResource):
|
|
413
510
|
"""
|
414
511
|
if not id:
|
415
512
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
416
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
417
513
|
return self._post(
|
418
514
|
f"/api/v1/materials/{id}/reprocess",
|
419
515
|
options=make_request_options(
|
420
516
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
421
517
|
),
|
422
|
-
cast_to=
|
518
|
+
cast_to=Material,
|
423
519
|
)
|
424
520
|
|
425
521
|
def search(
|
@@ -435,19 +531,18 @@ class MaterialsResource(SyncAPIResource):
|
|
435
531
|
extra_query: Query | None = None,
|
436
532
|
extra_body: Body | None = None,
|
437
533
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
438
|
-
) ->
|
534
|
+
) -> MaterialSearchResponse:
|
439
535
|
"""
|
440
|
-
Search materials using RAG
|
536
|
+
Search materials using RAG (Retrieval-Augmented Generation)
|
441
537
|
|
442
538
|
Args:
|
443
539
|
query: Search query
|
444
540
|
|
445
|
-
folder_ids:
|
446
|
-
subfolders)
|
541
|
+
folder_ids: Limit search to materials within specific folders (includes subfolders)
|
447
542
|
|
448
|
-
material_ids:
|
543
|
+
material_ids: Limit search to specific material IDs
|
449
544
|
|
450
|
-
top_k: Number of results to return
|
545
|
+
top_k: Number of results to return
|
451
546
|
|
452
547
|
extra_headers: Send extra headers
|
453
548
|
|
@@ -457,7 +552,6 @@ class MaterialsResource(SyncAPIResource):
|
|
457
552
|
|
458
553
|
timeout: Override the client-level default timeout for this request, in seconds
|
459
554
|
"""
|
460
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
461
555
|
return self._post(
|
462
556
|
"/api/v1/materials/search",
|
463
557
|
body=maybe_transform(
|
@@ -472,7 +566,7 @@ class MaterialsResource(SyncAPIResource):
|
|
472
566
|
options=make_request_options(
|
473
567
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
474
568
|
),
|
475
|
-
cast_to=
|
569
|
+
cast_to=MaterialSearchResponse,
|
476
570
|
)
|
477
571
|
|
478
572
|
|
@@ -511,7 +605,7 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
511
605
|
async def create(
|
512
606
|
self,
|
513
607
|
*,
|
514
|
-
content:
|
608
|
+
content: ContentParam,
|
515
609
|
name: str,
|
516
610
|
folder_id: str | NotGiven = NOT_GIVEN,
|
517
611
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
@@ -662,20 +756,94 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
662
756
|
async def batch_create(
|
663
757
|
self,
|
664
758
|
*,
|
759
|
+
materials: Iterable[material_batch_create_params.Material],
|
665
760
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
666
761
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
667
762
|
extra_headers: Headers | None = None,
|
668
763
|
extra_query: Query | None = None,
|
669
764
|
extra_body: Body | None = None,
|
670
765
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
671
|
-
) ->
|
672
|
-
|
766
|
+
) -> MaterialBatchCreateResponse:
|
767
|
+
"""
|
768
|
+
Create batch upload URLs for multiple materials
|
769
|
+
|
770
|
+
Args:
|
771
|
+
materials: Array of materials to create
|
772
|
+
|
773
|
+
extra_headers: Send extra headers
|
774
|
+
|
775
|
+
extra_query: Add additional query parameters to the request
|
776
|
+
|
777
|
+
extra_body: Add additional JSON properties to the request
|
778
|
+
|
779
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
780
|
+
"""
|
673
781
|
return await self._post(
|
674
782
|
"/api/v1/materials/batch",
|
783
|
+
body=await async_maybe_transform(
|
784
|
+
{"materials": materials}, material_batch_create_params.MaterialBatchCreateParams
|
785
|
+
),
|
675
786
|
options=make_request_options(
|
676
787
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
677
788
|
),
|
678
|
-
cast_to=
|
789
|
+
cast_to=MaterialBatchCreateResponse,
|
790
|
+
)
|
791
|
+
|
792
|
+
async def create_and_process(
|
793
|
+
self,
|
794
|
+
*,
|
795
|
+
content: ContentParam,
|
796
|
+
name: str,
|
797
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
798
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
799
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
800
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
801
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
802
|
+
extra_headers: Headers | None = None,
|
803
|
+
extra_query: Query | None = None,
|
804
|
+
extra_body: Body | None = None,
|
805
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
806
|
+
) -> Material:
|
807
|
+
"""Creates a material and waits for processing to finish before returning.
|
808
|
+
|
809
|
+
Useful
|
810
|
+
for synchronous API usage.
|
811
|
+
|
812
|
+
Args:
|
813
|
+
content: Content details
|
814
|
+
|
815
|
+
name: Name of the material
|
816
|
+
|
817
|
+
folder_id: Folder ID to place the material in
|
818
|
+
|
819
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
820
|
+
|
821
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
822
|
+
|
823
|
+
extra_headers: Send extra headers
|
824
|
+
|
825
|
+
extra_query: Add additional query parameters to the request
|
826
|
+
|
827
|
+
extra_body: Add additional JSON properties to the request
|
828
|
+
|
829
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
830
|
+
"""
|
831
|
+
return await self._post(
|
832
|
+
"/api/v1/materials/upload-and-process",
|
833
|
+
body=await async_maybe_transform(
|
834
|
+
{
|
835
|
+
"content": content,
|
836
|
+
"name": name,
|
837
|
+
"folder_id": folder_id,
|
838
|
+
"poll_interval_ms": poll_interval_ms,
|
839
|
+
"timeout_ms": timeout_ms,
|
840
|
+
},
|
841
|
+
material_create_and_process_params.MaterialCreateAndProcessParams,
|
842
|
+
),
|
843
|
+
options=make_request_options(
|
844
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
845
|
+
),
|
846
|
+
cast_to=Material,
|
679
847
|
)
|
680
848
|
|
681
849
|
async def debug(
|
@@ -688,8 +856,10 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
688
856
|
extra_query: Query | None = None,
|
689
857
|
extra_body: Body | None = None,
|
690
858
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
691
|
-
) ->
|
859
|
+
) -> MaterialDebugResponse:
|
692
860
|
"""
|
861
|
+
Get debug information for a material including extracted content
|
862
|
+
|
693
863
|
Args:
|
694
864
|
extra_headers: Send extra headers
|
695
865
|
|
@@ -701,29 +871,32 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
701
871
|
"""
|
702
872
|
if not id:
|
703
873
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
704
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
705
874
|
return await self._get(
|
706
875
|
f"/api/v1/materials/{id}/debug",
|
707
876
|
options=make_request_options(
|
708
877
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
709
878
|
),
|
710
|
-
cast_to=
|
879
|
+
cast_to=MaterialDebugResponse,
|
711
880
|
)
|
712
881
|
|
713
882
|
async def get_download_url(
|
714
883
|
self,
|
715
884
|
id: str,
|
716
885
|
*,
|
717
|
-
expires_in:
|
886
|
+
expires_in: float | NotGiven = NOT_GIVEN,
|
718
887
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
719
888
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
720
889
|
extra_headers: Headers | None = None,
|
721
890
|
extra_query: Query | None = None,
|
722
891
|
extra_body: Body | None = None,
|
723
892
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
724
|
-
) ->
|
893
|
+
) -> MaterialGetDownloadURLResponse:
|
725
894
|
"""
|
895
|
+
Get temporary download URL for material
|
896
|
+
|
726
897
|
Args:
|
898
|
+
expires_in: URL expiration time in seconds (default: 3600)
|
899
|
+
|
727
900
|
extra_headers: Send extra headers
|
728
901
|
|
729
902
|
extra_query: Add additional query parameters to the request
|
@@ -734,7 +907,6 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
734
907
|
"""
|
735
908
|
if not id:
|
736
909
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
737
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
738
910
|
return await self._get(
|
739
911
|
f"/api/v1/materials/{id}/download-url",
|
740
912
|
options=make_request_options(
|
@@ -746,22 +918,27 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
746
918
|
{"expires_in": expires_in}, material_get_download_url_params.MaterialGetDownloadURLParams
|
747
919
|
),
|
748
920
|
),
|
749
|
-
cast_to=
|
921
|
+
cast_to=MaterialGetDownloadURLResponse,
|
750
922
|
)
|
751
923
|
|
752
924
|
async def move(
|
753
925
|
self,
|
754
926
|
id: str,
|
755
927
|
*,
|
928
|
+
folder_id: Optional[str],
|
756
929
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
757
930
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
758
931
|
extra_headers: Headers | None = None,
|
759
932
|
extra_query: Query | None = None,
|
760
933
|
extra_body: Body | None = None,
|
761
934
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
762
|
-
) ->
|
935
|
+
) -> Material:
|
763
936
|
"""
|
937
|
+
Move material to a different folder
|
938
|
+
|
764
939
|
Args:
|
940
|
+
folder_id: Target folder ID (null for root)
|
941
|
+
|
765
942
|
extra_headers: Send extra headers
|
766
943
|
|
767
944
|
extra_query: Add additional query parameters to the request
|
@@ -772,28 +949,33 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
772
949
|
"""
|
773
950
|
if not id:
|
774
951
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
775
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
776
952
|
return await self._post(
|
777
953
|
f"/api/v1/materials/{id}/move",
|
954
|
+
body=await async_maybe_transform({"folder_id": folder_id}, material_move_params.MaterialMoveParams),
|
778
955
|
options=make_request_options(
|
779
956
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
780
957
|
),
|
781
|
-
cast_to=
|
958
|
+
cast_to=Material,
|
782
959
|
)
|
783
960
|
|
784
961
|
async def rename(
|
785
962
|
self,
|
786
963
|
id: str,
|
787
964
|
*,
|
965
|
+
name: str,
|
788
966
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
789
967
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
790
968
|
extra_headers: Headers | None = None,
|
791
969
|
extra_query: Query | None = None,
|
792
970
|
extra_body: Body | None = None,
|
793
971
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
794
|
-
) ->
|
972
|
+
) -> Material:
|
795
973
|
"""
|
974
|
+
Rename a material
|
975
|
+
|
796
976
|
Args:
|
977
|
+
name: New name for the material
|
978
|
+
|
797
979
|
extra_headers: Send extra headers
|
798
980
|
|
799
981
|
extra_query: Add additional query parameters to the request
|
@@ -804,13 +986,13 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
804
986
|
"""
|
805
987
|
if not id:
|
806
988
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
807
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
808
989
|
return await self._post(
|
809
990
|
f"/api/v1/materials/{id}/rename",
|
991
|
+
body=await async_maybe_transform({"name": name}, material_rename_params.MaterialRenameParams),
|
810
992
|
options=make_request_options(
|
811
993
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
812
994
|
),
|
813
|
-
cast_to=
|
995
|
+
cast_to=Material,
|
814
996
|
)
|
815
997
|
|
816
998
|
async def reprocess(
|
@@ -823,8 +1005,10 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
823
1005
|
extra_query: Query | None = None,
|
824
1006
|
extra_body: Body | None = None,
|
825
1007
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
826
|
-
) ->
|
1008
|
+
) -> Material:
|
827
1009
|
"""
|
1010
|
+
Reprocess material to regenerate embeddings and extract content
|
1011
|
+
|
828
1012
|
Args:
|
829
1013
|
extra_headers: Send extra headers
|
830
1014
|
|
@@ -836,13 +1020,12 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
836
1020
|
"""
|
837
1021
|
if not id:
|
838
1022
|
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
839
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
840
1023
|
return await self._post(
|
841
1024
|
f"/api/v1/materials/{id}/reprocess",
|
842
1025
|
options=make_request_options(
|
843
1026
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
844
1027
|
),
|
845
|
-
cast_to=
|
1028
|
+
cast_to=Material,
|
846
1029
|
)
|
847
1030
|
|
848
1031
|
async def search(
|
@@ -858,19 +1041,18 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
858
1041
|
extra_query: Query | None = None,
|
859
1042
|
extra_body: Body | None = None,
|
860
1043
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
861
|
-
) ->
|
1044
|
+
) -> MaterialSearchResponse:
|
862
1045
|
"""
|
863
|
-
Search materials using RAG
|
1046
|
+
Search materials using RAG (Retrieval-Augmented Generation)
|
864
1047
|
|
865
1048
|
Args:
|
866
1049
|
query: Search query
|
867
1050
|
|
868
|
-
folder_ids:
|
869
|
-
subfolders)
|
1051
|
+
folder_ids: Limit search to materials within specific folders (includes subfolders)
|
870
1052
|
|
871
|
-
material_ids:
|
1053
|
+
material_ids: Limit search to specific material IDs
|
872
1054
|
|
873
|
-
top_k: Number of results to return
|
1055
|
+
top_k: Number of results to return
|
874
1056
|
|
875
1057
|
extra_headers: Send extra headers
|
876
1058
|
|
@@ -880,7 +1062,6 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
880
1062
|
|
881
1063
|
timeout: Override the client-level default timeout for this request, in seconds
|
882
1064
|
"""
|
883
|
-
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
884
1065
|
return await self._post(
|
885
1066
|
"/api/v1/materials/search",
|
886
1067
|
body=await async_maybe_transform(
|
@@ -895,7 +1076,7 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
895
1076
|
options=make_request_options(
|
896
1077
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
897
1078
|
),
|
898
|
-
cast_to=
|
1079
|
+
cast_to=MaterialSearchResponse,
|
899
1080
|
)
|
900
1081
|
|
901
1082
|
|
@@ -918,6 +1099,9 @@ class MaterialsResourceWithRawResponse:
|
|
918
1099
|
self.batch_create = to_raw_response_wrapper(
|
919
1100
|
materials.batch_create,
|
920
1101
|
)
|
1102
|
+
self.create_and_process = to_raw_response_wrapper(
|
1103
|
+
materials.create_and_process,
|
1104
|
+
)
|
921
1105
|
self.debug = to_raw_response_wrapper(
|
922
1106
|
materials.debug,
|
923
1107
|
)
|
@@ -969,6 +1153,9 @@ class AsyncMaterialsResourceWithRawResponse:
|
|
969
1153
|
self.batch_create = async_to_raw_response_wrapper(
|
970
1154
|
materials.batch_create,
|
971
1155
|
)
|
1156
|
+
self.create_and_process = async_to_raw_response_wrapper(
|
1157
|
+
materials.create_and_process,
|
1158
|
+
)
|
972
1159
|
self.debug = async_to_raw_response_wrapper(
|
973
1160
|
materials.debug,
|
974
1161
|
)
|
@@ -1020,6 +1207,9 @@ class MaterialsResourceWithStreamingResponse:
|
|
1020
1207
|
self.batch_create = to_streamed_response_wrapper(
|
1021
1208
|
materials.batch_create,
|
1022
1209
|
)
|
1210
|
+
self.create_and_process = to_streamed_response_wrapper(
|
1211
|
+
materials.create_and_process,
|
1212
|
+
)
|
1023
1213
|
self.debug = to_streamed_response_wrapper(
|
1024
1214
|
materials.debug,
|
1025
1215
|
)
|
@@ -1071,6 +1261,9 @@ class AsyncMaterialsResourceWithStreamingResponse:
|
|
1071
1261
|
self.batch_create = async_to_streamed_response_wrapper(
|
1072
1262
|
materials.batch_create,
|
1073
1263
|
)
|
1264
|
+
self.create_and_process = async_to_streamed_response_wrapper(
|
1265
|
+
materials.create_and_process,
|
1266
|
+
)
|
1074
1267
|
self.debug = async_to_streamed_response_wrapper(
|
1075
1268
|
materials.debug,
|
1076
1269
|
)
|