studyfetch-sdk 0.1.0a18__py3-none-any.whl → 0.1.0a20__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.
Files changed (78) hide show
  1. studyfetch_sdk/_models.py +24 -3
  2. studyfetch_sdk/_version.py +1 -1
  3. studyfetch_sdk/resources/v1/__init__.py +0 -84
  4. studyfetch_sdk/resources/v1/assignment_grader.py +81 -1
  5. studyfetch_sdk/resources/v1/components.py +36 -4
  6. studyfetch_sdk/resources/v1/materials/materials.py +130 -2
  7. studyfetch_sdk/resources/v1/materials/upload.py +286 -0
  8. studyfetch_sdk/resources/v1/usage/analyst.py +143 -15
  9. studyfetch_sdk/resources/v1/v1.py +66 -192
  10. studyfetch_sdk/types/v1/__init__.py +2 -20
  11. studyfetch_sdk/types/v1/assignment_grader_response.py +20 -1
  12. studyfetch_sdk/types/v1/component.py +9 -1
  13. studyfetch_sdk/types/v1/component_create_params.py +81 -1
  14. studyfetch_sdk/types/v1/component_generate_embed_params.py +7 -1
  15. studyfetch_sdk/types/v1/component_list_params.py +9 -1
  16. studyfetch_sdk/types/v1/content_param.py +23 -0
  17. studyfetch_sdk/types/v1/material_create_and_process_params.py +27 -0
  18. studyfetch_sdk/types/v1/material_create_params.py +4 -17
  19. studyfetch_sdk/types/v1/materials/__init__.py +2 -0
  20. studyfetch_sdk/types/v1/materials/upload_create_presigned_url_params.py +3 -0
  21. studyfetch_sdk/types/v1/materials/upload_upload_file_and_process_params.py +29 -0
  22. studyfetch_sdk/types/v1/materials/upload_upload_file_params.py +3 -0
  23. studyfetch_sdk/types/v1/materials/upload_upload_url_and_process_params.py +26 -0
  24. studyfetch_sdk/types/v1/usage/__init__.py +3 -0
  25. studyfetch_sdk/types/v1/usage/analyst_get_test_questions_params.py +18 -0
  26. studyfetch_sdk/types/v1/usage/analyst_list_chat_messages_params.py +18 -0
  27. studyfetch_sdk/types/v1/usage/analyst_list_chat_messages_response.py +35 -0
  28. studyfetch_sdk/types/v1/usage/analyst_list_events_params.py +7 -0
  29. {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a20.dist-info}/METADATA +1 -1
  30. {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a20.dist-info}/RECORD +32 -71
  31. studyfetch_sdk/resources/v1/audio_recaps/__init__.py +0 -33
  32. studyfetch_sdk/resources/v1/audio_recaps/audio_recaps.py +0 -328
  33. studyfetch_sdk/resources/v1/audio_recaps/sections.py +0 -250
  34. studyfetch_sdk/resources/v1/chat/__init__.py +0 -47
  35. studyfetch_sdk/resources/v1/chat/chat.py +0 -574
  36. studyfetch_sdk/resources/v1/chat/sessions.py +0 -222
  37. studyfetch_sdk/resources/v1/chat/test.py +0 -190
  38. studyfetch_sdk/resources/v1/explainers.py +0 -441
  39. studyfetch_sdk/resources/v1/flashcards.py +0 -783
  40. studyfetch_sdk/resources/v1/scenarios/__init__.py +0 -61
  41. studyfetch_sdk/resources/v1/scenarios/component.py +0 -426
  42. studyfetch_sdk/resources/v1/scenarios/scenarios.py +0 -936
  43. studyfetch_sdk/resources/v1/scenarios/sessions.py +0 -236
  44. studyfetch_sdk/resources/v1/scenarios/submissions/__init__.py +0 -33
  45. studyfetch_sdk/resources/v1/scenarios/submissions/submissions.py +0 -102
  46. studyfetch_sdk/resources/v1/scenarios/submissions/user.py +0 -210
  47. studyfetch_sdk/resources/v1/tests/__init__.py +0 -33
  48. studyfetch_sdk/resources/v1/tests/component.py +0 -160
  49. studyfetch_sdk/resources/v1/tests/tests.py +0 -682
  50. studyfetch_sdk/types/v1/audio_recaps/__init__.py +0 -3
  51. studyfetch_sdk/types/v1/chat/__init__.py +0 -5
  52. studyfetch_sdk/types/v1/chat/session_retrieve_params.py +0 -11
  53. studyfetch_sdk/types/v1/chat_get_session_params.py +0 -13
  54. studyfetch_sdk/types/v1/chat_send_message_params.py +0 -54
  55. studyfetch_sdk/types/v1/chat_stream_params.py +0 -28
  56. studyfetch_sdk/types/v1/explainer_create_params.py +0 -45
  57. studyfetch_sdk/types/v1/explainer_handle_webhook_params.py +0 -53
  58. studyfetch_sdk/types/v1/flashcard_batch_process_params.py +0 -36
  59. studyfetch_sdk/types/v1/flashcard_batch_process_response.py +0 -39
  60. studyfetch_sdk/types/v1/flashcard_get_algorithm_response.py +0 -37
  61. studyfetch_sdk/types/v1/flashcard_get_all_params.py +0 -23
  62. studyfetch_sdk/types/v1/flashcard_get_due_params.py +0 -19
  63. studyfetch_sdk/types/v1/flashcard_get_stats_params.py +0 -17
  64. studyfetch_sdk/types/v1/flashcard_get_types_response.py +0 -14
  65. studyfetch_sdk/types/v1/flashcard_rate_params.py +0 -23
  66. studyfetch_sdk/types/v1/scenario_create_params.py +0 -48
  67. studyfetch_sdk/types/v1/scenario_submit_answer_params.py +0 -18
  68. studyfetch_sdk/types/v1/scenario_update_params.py +0 -45
  69. studyfetch_sdk/types/v1/scenarios/__init__.py +0 -5
  70. studyfetch_sdk/types/v1/scenarios/component_update_params.py +0 -45
  71. studyfetch_sdk/types/v1/scenarios/submissions/__init__.py +0 -3
  72. studyfetch_sdk/types/v1/test_create_params.py +0 -20
  73. studyfetch_sdk/types/v1/test_retake_params.py +0 -14
  74. studyfetch_sdk/types/v1/test_submit_answer_params.py +0 -20
  75. studyfetch_sdk/types/v1/test_submit_params.py +0 -14
  76. studyfetch_sdk/types/v1/tests/__init__.py +0 -3
  77. {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a20.dist-info}/WHEEL +0 -0
  78. {studyfetch_sdk-0.1.0a18.dist-info → studyfetch_sdk-0.1.0a20.dist-info}/licenses/LICENSE +0 -0
studyfetch_sdk/_models.py CHANGED
@@ -208,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
208
208
  else:
209
209
  fields_values[name] = field_get_default(field)
210
210
 
211
+ extra_field_type = _get_extra_fields_type(__cls)
212
+
211
213
  _extra = {}
212
214
  for key, value in values.items():
213
215
  if key not in model_fields:
216
+ parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
217
+
214
218
  if PYDANTIC_V2:
215
- _extra[key] = value
219
+ _extra[key] = parsed
216
220
  else:
217
221
  _fields_set.add(key)
218
- fields_values[key] = value
222
+ fields_values[key] = parsed
219
223
 
220
224
  object.__setattr__(m, "__dict__", fields_values)
221
225
 
@@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
370
374
  return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
371
375
 
372
376
 
377
+ def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
378
+ if not PYDANTIC_V2:
379
+ # TODO
380
+ return None
381
+
382
+ schema = cls.__pydantic_core_schema__
383
+ if schema["type"] == "model":
384
+ fields = schema["schema"]
385
+ if fields["type"] == "model-fields":
386
+ extras = fields.get("extras_schema")
387
+ if extras and "cls" in extras:
388
+ # mypy can't narrow the type
389
+ return extras["cls"] # type: ignore[no-any-return]
390
+
391
+ return None
392
+
393
+
373
394
  def is_basemodel(type_: type) -> bool:
374
395
  """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`"""
375
396
  if is_union(type_):
@@ -439,7 +460,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]
439
460
  type_ = type_.__value__ # type: ignore[unreachable]
440
461
 
441
462
  # unwrap `Annotated[T, ...]` -> `T`
442
- if metadata is not None:
463
+ if metadata is not None and len(metadata) > 0:
443
464
  meta: tuple[Any, ...] = tuple(metadata)
444
465
  elif is_annotated_type(type_):
445
466
  meta = get_args(type_)[1:]
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "studyfetch_sdk"
4
- __version__ = "0.1.0-alpha.18" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.20" # x-release-please-version
@@ -8,14 +8,6 @@ from .v1 import (
8
8
  V1ResourceWithStreamingResponse,
9
9
  AsyncV1ResourceWithStreamingResponse,
10
10
  )
11
- from .chat import (
12
- ChatResource,
13
- AsyncChatResource,
14
- ChatResourceWithRawResponse,
15
- AsyncChatResourceWithRawResponse,
16
- ChatResourceWithStreamingResponse,
17
- AsyncChatResourceWithStreamingResponse,
18
- )
19
11
  from .embed import (
20
12
  EmbedResource,
21
13
  AsyncEmbedResource,
@@ -24,14 +16,6 @@ from .embed import (
24
16
  EmbedResourceWithStreamingResponse,
25
17
  AsyncEmbedResourceWithStreamingResponse,
26
18
  )
27
- from .tests import (
28
- TestsResource,
29
- AsyncTestsResource,
30
- TestsResourceWithRawResponse,
31
- AsyncTestsResourceWithRawResponse,
32
- TestsResourceWithStreamingResponse,
33
- AsyncTestsResourceWithStreamingResponse,
34
- )
35
19
  from .usage import (
36
20
  UsageResource,
37
21
  AsyncUsageResource,
@@ -64,14 +48,6 @@ from .materials import (
64
48
  MaterialsResourceWithStreamingResponse,
65
49
  AsyncMaterialsResourceWithStreamingResponse,
66
50
  )
67
- from .scenarios import (
68
- ScenariosResource,
69
- AsyncScenariosResource,
70
- ScenariosResourceWithRawResponse,
71
- AsyncScenariosResourceWithRawResponse,
72
- ScenariosResourceWithStreamingResponse,
73
- AsyncScenariosResourceWithStreamingResponse,
74
- )
75
51
  from .components import (
76
52
  ComponentsResource,
77
53
  AsyncComponentsResource,
@@ -80,30 +56,6 @@ from .components import (
80
56
  ComponentsResourceWithStreamingResponse,
81
57
  AsyncComponentsResourceWithStreamingResponse,
82
58
  )
83
- from .explainers import (
84
- ExplainersResource,
85
- AsyncExplainersResource,
86
- ExplainersResourceWithRawResponse,
87
- AsyncExplainersResourceWithRawResponse,
88
- ExplainersResourceWithStreamingResponse,
89
- AsyncExplainersResourceWithStreamingResponse,
90
- )
91
- from .flashcards import (
92
- FlashcardsResource,
93
- AsyncFlashcardsResource,
94
- FlashcardsResourceWithRawResponse,
95
- AsyncFlashcardsResourceWithRawResponse,
96
- FlashcardsResourceWithStreamingResponse,
97
- AsyncFlashcardsResourceWithStreamingResponse,
98
- )
99
- from .audio_recaps import (
100
- AudioRecapsResource,
101
- AsyncAudioRecapsResource,
102
- AudioRecapsResourceWithRawResponse,
103
- AsyncAudioRecapsResourceWithRawResponse,
104
- AudioRecapsResourceWithStreamingResponse,
105
- AsyncAudioRecapsResourceWithStreamingResponse,
106
- )
107
59
  from .assignment_grader import (
108
60
  AssignmentGraderResource,
109
61
  AsyncAssignmentGraderResource,
@@ -144,42 +96,6 @@ __all__ = [
144
96
  "AsyncEmbedResourceWithRawResponse",
145
97
  "EmbedResourceWithStreamingResponse",
146
98
  "AsyncEmbedResourceWithStreamingResponse",
147
- "ChatResource",
148
- "AsyncChatResource",
149
- "ChatResourceWithRawResponse",
150
- "AsyncChatResourceWithRawResponse",
151
- "ChatResourceWithStreamingResponse",
152
- "AsyncChatResourceWithStreamingResponse",
153
- "TestsResource",
154
- "AsyncTestsResource",
155
- "TestsResourceWithRawResponse",
156
- "AsyncTestsResourceWithRawResponse",
157
- "TestsResourceWithStreamingResponse",
158
- "AsyncTestsResourceWithStreamingResponse",
159
- "AudioRecapsResource",
160
- "AsyncAudioRecapsResource",
161
- "AudioRecapsResourceWithRawResponse",
162
- "AsyncAudioRecapsResourceWithRawResponse",
163
- "AudioRecapsResourceWithStreamingResponse",
164
- "AsyncAudioRecapsResourceWithStreamingResponse",
165
- "FlashcardsResource",
166
- "AsyncFlashcardsResource",
167
- "FlashcardsResourceWithRawResponse",
168
- "AsyncFlashcardsResourceWithRawResponse",
169
- "FlashcardsResourceWithStreamingResponse",
170
- "AsyncFlashcardsResourceWithStreamingResponse",
171
- "ScenariosResource",
172
- "AsyncScenariosResource",
173
- "ScenariosResourceWithRawResponse",
174
- "AsyncScenariosResourceWithRawResponse",
175
- "ScenariosResourceWithStreamingResponse",
176
- "AsyncScenariosResourceWithStreamingResponse",
177
- "ExplainersResource",
178
- "AsyncExplainersResource",
179
- "ExplainersResourceWithRawResponse",
180
- "AsyncExplainersResourceWithRawResponse",
181
- "ExplainersResourceWithStreamingResponse",
182
- "AsyncExplainersResourceWithStreamingResponse",
183
99
  "UploadResource",
184
100
  "AsyncUploadResource",
185
101
  "UploadResourceWithRawResponse",
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import httpx
6
6
 
7
- from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
7
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
8
8
  from ..._utils import maybe_transform, async_maybe_transform
9
9
  from ..._compat import cached_property
10
10
  from ...types.v1 import assignment_grader_create_params
@@ -101,6 +101,40 @@ class AssignmentGraderResource(SyncAPIResource):
101
101
  cast_to=AssignmentGraderResponse,
102
102
  )
103
103
 
104
+ def delete(
105
+ self,
106
+ id: str,
107
+ *,
108
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
109
+ # The extra values given here take precedence over values defined on the client or passed to this method.
110
+ extra_headers: Headers | None = None,
111
+ extra_query: Query | None = None,
112
+ extra_body: Body | None = None,
113
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
114
+ ) -> None:
115
+ """
116
+ Delete an assignment grader by ID
117
+
118
+ Args:
119
+ extra_headers: Send extra headers
120
+
121
+ extra_query: Add additional query parameters to the request
122
+
123
+ extra_body: Add additional JSON properties to the request
124
+
125
+ timeout: Override the client-level default timeout for this request, in seconds
126
+ """
127
+ if not id:
128
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
129
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
130
+ return self._delete(
131
+ f"/api/v1/assignment-grader/delete/{id}",
132
+ options=make_request_options(
133
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
134
+ ),
135
+ cast_to=NoneType,
136
+ )
137
+
104
138
  def get_all(
105
139
  self,
106
140
  *,
@@ -233,6 +267,40 @@ class AsyncAssignmentGraderResource(AsyncAPIResource):
233
267
  cast_to=AssignmentGraderResponse,
234
268
  )
235
269
 
270
+ async def delete(
271
+ self,
272
+ id: str,
273
+ *,
274
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
275
+ # The extra values given here take precedence over values defined on the client or passed to this method.
276
+ extra_headers: Headers | None = None,
277
+ extra_query: Query | None = None,
278
+ extra_body: Body | None = None,
279
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
280
+ ) -> None:
281
+ """
282
+ Delete an assignment grader by ID
283
+
284
+ Args:
285
+ extra_headers: Send extra headers
286
+
287
+ extra_query: Add additional query parameters to the request
288
+
289
+ extra_body: Add additional JSON properties to the request
290
+
291
+ timeout: Override the client-level default timeout for this request, in seconds
292
+ """
293
+ if not id:
294
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
295
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
296
+ return await self._delete(
297
+ f"/api/v1/assignment-grader/delete/{id}",
298
+ options=make_request_options(
299
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
300
+ ),
301
+ cast_to=NoneType,
302
+ )
303
+
236
304
  async def get_all(
237
305
  self,
238
306
  *,
@@ -293,6 +361,9 @@ class AssignmentGraderResourceWithRawResponse:
293
361
  self.create = to_raw_response_wrapper(
294
362
  assignment_grader.create,
295
363
  )
364
+ self.delete = to_raw_response_wrapper(
365
+ assignment_grader.delete,
366
+ )
296
367
  self.get_all = to_raw_response_wrapper(
297
368
  assignment_grader.get_all,
298
369
  )
@@ -308,6 +379,9 @@ class AsyncAssignmentGraderResourceWithRawResponse:
308
379
  self.create = async_to_raw_response_wrapper(
309
380
  assignment_grader.create,
310
381
  )
382
+ self.delete = async_to_raw_response_wrapper(
383
+ assignment_grader.delete,
384
+ )
311
385
  self.get_all = async_to_raw_response_wrapper(
312
386
  assignment_grader.get_all,
313
387
  )
@@ -323,6 +397,9 @@ class AssignmentGraderResourceWithStreamingResponse:
323
397
  self.create = to_streamed_response_wrapper(
324
398
  assignment_grader.create,
325
399
  )
400
+ self.delete = to_streamed_response_wrapper(
401
+ assignment_grader.delete,
402
+ )
326
403
  self.get_all = to_streamed_response_wrapper(
327
404
  assignment_grader.get_all,
328
405
  )
@@ -338,6 +415,9 @@ class AsyncAssignmentGraderResourceWithStreamingResponse:
338
415
  self.create = async_to_streamed_response_wrapper(
339
416
  assignment_grader.create,
340
417
  )
418
+ self.delete = async_to_streamed_response_wrapper(
419
+ assignment_grader.delete,
420
+ )
341
421
  self.get_all = async_to_streamed_response_wrapper(
342
422
  assignment_grader.get_all,
343
423
  )
@@ -57,7 +57,15 @@ class ComponentsResource(SyncAPIResource):
57
57
  config: component_create_params.Config,
58
58
  name: str,
59
59
  type: Literal[
60
- "chat", "flashcards", "scenarios", "practice_test", "audio_recap", "tutor_me", "explainers", "uploads"
60
+ "chat",
61
+ "data_analyst",
62
+ "flashcards",
63
+ "scenarios",
64
+ "practice_test",
65
+ "audio_recap",
66
+ "tutor_me",
67
+ "explainers",
68
+ "uploads",
61
69
  ],
62
70
  description: str | NotGiven = NOT_GIVEN,
63
71
  metadata: object | NotGiven = NOT_GIVEN,
@@ -182,7 +190,15 @@ class ComponentsResource(SyncAPIResource):
182
190
  self,
183
191
  *,
184
192
  type: Literal[
185
- "chat", "flashcards", "scenarios", "practice_test", "audio_recap", "tutor_me", "explainers", "uploads"
193
+ "chat",
194
+ "data_analyst",
195
+ "flashcards",
196
+ "scenarios",
197
+ "practice_test",
198
+ "audio_recap",
199
+ "tutor_me",
200
+ "explainers",
201
+ "uploads",
186
202
  ]
187
203
  | NotGiven = NOT_GIVEN,
188
204
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -445,7 +461,15 @@ class AsyncComponentsResource(AsyncAPIResource):
445
461
  config: component_create_params.Config,
446
462
  name: str,
447
463
  type: Literal[
448
- "chat", "flashcards", "scenarios", "practice_test", "audio_recap", "tutor_me", "explainers", "uploads"
464
+ "chat",
465
+ "data_analyst",
466
+ "flashcards",
467
+ "scenarios",
468
+ "practice_test",
469
+ "audio_recap",
470
+ "tutor_me",
471
+ "explainers",
472
+ "uploads",
449
473
  ],
450
474
  description: str | NotGiven = NOT_GIVEN,
451
475
  metadata: object | NotGiven = NOT_GIVEN,
@@ -570,7 +594,15 @@ class AsyncComponentsResource(AsyncAPIResource):
570
594
  self,
571
595
  *,
572
596
  type: Literal[
573
- "chat", "flashcards", "scenarios", "practice_test", "audio_recap", "tutor_me", "explainers", "uploads"
597
+ "chat",
598
+ "data_analyst",
599
+ "flashcards",
600
+ "scenarios",
601
+ "practice_test",
602
+ "audio_recap",
603
+ "tutor_me",
604
+ "explainers",
605
+ "uploads",
574
606
  ]
575
607
  | NotGiven = NOT_GIVEN,
576
608
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -41,6 +41,7 @@ from ....types.v1 import (
41
41
  material_search_params,
42
42
  material_batch_create_params,
43
43
  material_get_download_url_params,
44
+ material_create_and_process_params,
44
45
  )
45
46
  from ...._resource import SyncAPIResource, AsyncAPIResource
46
47
  from ...._response import (
@@ -51,6 +52,7 @@ from ...._response import (
51
52
  )
52
53
  from ...._base_client import make_request_options
53
54
  from ....types.v1.material import Material
55
+ from ....types.v1.content_param import ContentParam
54
56
  from ....types.v1.material_list_response import MaterialListResponse
55
57
  from ....types.v1.material_debug_response import MaterialDebugResponse
56
58
  from ....types.v1.material_search_response import MaterialSearchResponse
@@ -95,7 +97,7 @@ class MaterialsResource(SyncAPIResource):
95
97
  def create(
96
98
  self,
97
99
  *,
98
- content: material_create_params.Content,
100
+ content: ContentParam,
99
101
  name: str,
100
102
  folder_id: str | NotGiven = NOT_GIVEN,
101
103
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -277,6 +279,63 @@ class MaterialsResource(SyncAPIResource):
277
279
  cast_to=MaterialBatchCreateResponse,
278
280
  )
279
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,
337
+ )
338
+
280
339
  def debug(
281
340
  self,
282
341
  id: str,
@@ -546,7 +605,7 @@ class AsyncMaterialsResource(AsyncAPIResource):
546
605
  async def create(
547
606
  self,
548
607
  *,
549
- content: material_create_params.Content,
608
+ content: ContentParam,
550
609
  name: str,
551
610
  folder_id: str | NotGiven = NOT_GIVEN,
552
611
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -730,6 +789,63 @@ class AsyncMaterialsResource(AsyncAPIResource):
730
789
  cast_to=MaterialBatchCreateResponse,
731
790
  )
732
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,
847
+ )
848
+
733
849
  async def debug(
734
850
  self,
735
851
  id: str,
@@ -983,6 +1099,9 @@ class MaterialsResourceWithRawResponse:
983
1099
  self.batch_create = to_raw_response_wrapper(
984
1100
  materials.batch_create,
985
1101
  )
1102
+ self.create_and_process = to_raw_response_wrapper(
1103
+ materials.create_and_process,
1104
+ )
986
1105
  self.debug = to_raw_response_wrapper(
987
1106
  materials.debug,
988
1107
  )
@@ -1034,6 +1153,9 @@ class AsyncMaterialsResourceWithRawResponse:
1034
1153
  self.batch_create = async_to_raw_response_wrapper(
1035
1154
  materials.batch_create,
1036
1155
  )
1156
+ self.create_and_process = async_to_raw_response_wrapper(
1157
+ materials.create_and_process,
1158
+ )
1037
1159
  self.debug = async_to_raw_response_wrapper(
1038
1160
  materials.debug,
1039
1161
  )
@@ -1085,6 +1207,9 @@ class MaterialsResourceWithStreamingResponse:
1085
1207
  self.batch_create = to_streamed_response_wrapper(
1086
1208
  materials.batch_create,
1087
1209
  )
1210
+ self.create_and_process = to_streamed_response_wrapper(
1211
+ materials.create_and_process,
1212
+ )
1088
1213
  self.debug = to_streamed_response_wrapper(
1089
1214
  materials.debug,
1090
1215
  )
@@ -1136,6 +1261,9 @@ class AsyncMaterialsResourceWithStreamingResponse:
1136
1261
  self.batch_create = async_to_streamed_response_wrapper(
1137
1262
  materials.batch_create,
1138
1263
  )
1264
+ self.create_and_process = async_to_streamed_response_wrapper(
1265
+ materials.create_and_process,
1266
+ )
1139
1267
  self.debug = async_to_streamed_response_wrapper(
1140
1268
  materials.debug,
1141
1269
  )