studyfetch-sdk 0.1.0a20__py3-none-any.whl → 0.1.0a21__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/_version.py +1 -1
- studyfetch_sdk/resources/v1/__init__.py +14 -14
- studyfetch_sdk/resources/v1/chat.py +246 -0
- studyfetch_sdk/resources/v1/materials/materials.py +304 -0
- studyfetch_sdk/resources/v1/materials/upload.py +6 -14
- studyfetch_sdk/resources/v1/v1.py +32 -32
- studyfetch_sdk/types/v1/__init__.py +4 -0
- studyfetch_sdk/types/v1/chat_stream_params.py +60 -0
- studyfetch_sdk/types/v1/generated_material.py +65 -0
- studyfetch_sdk/types/v1/material_generate_and_process_params.py +38 -0
- studyfetch_sdk/types/v1/material_generate_params.py +32 -0
- studyfetch_sdk/types/v1/materials/upload_complete_upload_params.py +2 -5
- studyfetch_sdk/types/v1/materials/upload_upload_file_and_process_params.py +1 -1
- {studyfetch_sdk-0.1.0a20.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/METADATA +1 -1
- {studyfetch_sdk-0.1.0a20.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/RECORD +17 -23
- studyfetch_sdk/resources/v1/upload/__init__.py +0 -33
- studyfetch_sdk/resources/v1/upload/component.py +0 -572
- studyfetch_sdk/resources/v1/upload/upload.py +0 -102
- studyfetch_sdk/types/v1/upload/__init__.py +0 -11
- studyfetch_sdk/types/v1/upload/component_complete_upload_params.py +0 -20
- studyfetch_sdk/types/v1/upload/component_complete_upload_response.py +0 -16
- studyfetch_sdk/types/v1/upload/component_get_presigned_url_params.py +0 -23
- studyfetch_sdk/types/v1/upload/component_get_presigned_url_response.py +0 -15
- studyfetch_sdk/types/v1/upload/component_upload_file_params.py +0 -21
- studyfetch_sdk/types/v1/upload/component_upload_url_params.py +0 -23
- studyfetch_sdk/types/v1/upload/file_upload_response.py +0 -24
- {studyfetch_sdk-0.1.0a20.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/WHEEL +0 -0
- {studyfetch_sdk-0.1.0a20.dist-info → studyfetch_sdk-0.1.0a21.dist-info}/licenses/LICENSE +0 -0
studyfetch_sdk/_version.py
CHANGED
@@ -8,6 +8,14 @@ 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
|
+
)
|
11
19
|
from .embed import (
|
12
20
|
EmbedResource,
|
13
21
|
AsyncEmbedResource,
|
@@ -24,14 +32,6 @@ from .usage import (
|
|
24
32
|
UsageResourceWithStreamingResponse,
|
25
33
|
AsyncUsageResourceWithStreamingResponse,
|
26
34
|
)
|
27
|
-
from .upload import (
|
28
|
-
UploadResource,
|
29
|
-
AsyncUploadResource,
|
30
|
-
UploadResourceWithRawResponse,
|
31
|
-
AsyncUploadResourceWithRawResponse,
|
32
|
-
UploadResourceWithStreamingResponse,
|
33
|
-
AsyncUploadResourceWithStreamingResponse,
|
34
|
-
)
|
35
35
|
from .folders import (
|
36
36
|
FoldersResource,
|
37
37
|
AsyncFoldersResource,
|
@@ -96,18 +96,18 @@ __all__ = [
|
|
96
96
|
"AsyncEmbedResourceWithRawResponse",
|
97
97
|
"EmbedResourceWithStreamingResponse",
|
98
98
|
"AsyncEmbedResourceWithStreamingResponse",
|
99
|
-
"UploadResource",
|
100
|
-
"AsyncUploadResource",
|
101
|
-
"UploadResourceWithRawResponse",
|
102
|
-
"AsyncUploadResourceWithRawResponse",
|
103
|
-
"UploadResourceWithStreamingResponse",
|
104
|
-
"AsyncUploadResourceWithStreamingResponse",
|
105
99
|
"AssignmentGraderResource",
|
106
100
|
"AsyncAssignmentGraderResource",
|
107
101
|
"AssignmentGraderResourceWithRawResponse",
|
108
102
|
"AsyncAssignmentGraderResourceWithRawResponse",
|
109
103
|
"AssignmentGraderResourceWithStreamingResponse",
|
110
104
|
"AsyncAssignmentGraderResourceWithStreamingResponse",
|
105
|
+
"ChatResource",
|
106
|
+
"AsyncChatResource",
|
107
|
+
"ChatResourceWithRawResponse",
|
108
|
+
"AsyncChatResourceWithRawResponse",
|
109
|
+
"ChatResourceWithStreamingResponse",
|
110
|
+
"AsyncChatResourceWithStreamingResponse",
|
111
111
|
"V1Resource",
|
112
112
|
"AsyncV1Resource",
|
113
113
|
"V1ResourceWithRawResponse",
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import List
|
6
|
+
|
7
|
+
import httpx
|
8
|
+
|
9
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
10
|
+
from ..._utils import maybe_transform, strip_not_given, async_maybe_transform
|
11
|
+
from ..._compat import cached_property
|
12
|
+
from ...types.v1 import chat_stream_params
|
13
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
14
|
+
from ..._response import (
|
15
|
+
to_raw_response_wrapper,
|
16
|
+
to_streamed_response_wrapper,
|
17
|
+
async_to_raw_response_wrapper,
|
18
|
+
async_to_streamed_response_wrapper,
|
19
|
+
)
|
20
|
+
from ..._base_client import make_request_options
|
21
|
+
|
22
|
+
__all__ = ["ChatResource", "AsyncChatResource"]
|
23
|
+
|
24
|
+
|
25
|
+
class ChatResource(SyncAPIResource):
|
26
|
+
@cached_property
|
27
|
+
def with_raw_response(self) -> ChatResourceWithRawResponse:
|
28
|
+
"""
|
29
|
+
This property can be used as a prefix for any HTTP method call to return
|
30
|
+
the raw response object instead of the parsed content.
|
31
|
+
|
32
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
33
|
+
"""
|
34
|
+
return ChatResourceWithRawResponse(self)
|
35
|
+
|
36
|
+
@cached_property
|
37
|
+
def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
|
38
|
+
"""
|
39
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
40
|
+
|
41
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
42
|
+
"""
|
43
|
+
return ChatResourceWithStreamingResponse(self)
|
44
|
+
|
45
|
+
def stream(
|
46
|
+
self,
|
47
|
+
*,
|
48
|
+
id: str | NotGiven = NOT_GIVEN,
|
49
|
+
component_id: str | NotGiven = NOT_GIVEN,
|
50
|
+
context: object | NotGiven = NOT_GIVEN,
|
51
|
+
group_ids: List[str] | NotGiven = NOT_GIVEN,
|
52
|
+
message: chat_stream_params.Message | NotGiven = NOT_GIVEN,
|
53
|
+
messages: List[str] | NotGiven = NOT_GIVEN,
|
54
|
+
session_id: str | NotGiven = NOT_GIVEN,
|
55
|
+
user_id: str | NotGiven = NOT_GIVEN,
|
56
|
+
x_component_id: str | NotGiven = NOT_GIVEN,
|
57
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
58
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
59
|
+
extra_headers: Headers | None = None,
|
60
|
+
extra_query: Query | None = None,
|
61
|
+
extra_body: Body | None = None,
|
62
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
63
|
+
) -> None:
|
64
|
+
"""Streams a chat response in real-time using server-sent events (SSE).
|
65
|
+
|
66
|
+
Supports
|
67
|
+
both AI SDK format (with messages array) and custom format (with message
|
68
|
+
object).
|
69
|
+
|
70
|
+
Args:
|
71
|
+
id: Session ID (AI SDK uses "id")
|
72
|
+
|
73
|
+
component_id: Component ID
|
74
|
+
|
75
|
+
context: Additional context
|
76
|
+
|
77
|
+
group_ids: Group IDs for access control
|
78
|
+
|
79
|
+
message: Single message for custom format - contains text and optional images
|
80
|
+
|
81
|
+
messages: Messages array for AI SDK format - list of conversation messages with roles
|
82
|
+
|
83
|
+
session_id: Session ID
|
84
|
+
|
85
|
+
user_id: User ID
|
86
|
+
|
87
|
+
extra_headers: Send extra headers
|
88
|
+
|
89
|
+
extra_query: Add additional query parameters to the request
|
90
|
+
|
91
|
+
extra_body: Add additional JSON properties to the request
|
92
|
+
|
93
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
94
|
+
"""
|
95
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
96
|
+
extra_headers = {**strip_not_given({"x-component-id": x_component_id}), **(extra_headers or {})}
|
97
|
+
return self._post(
|
98
|
+
"/api/v1/chat/stream",
|
99
|
+
body=maybe_transform(
|
100
|
+
{
|
101
|
+
"id": id,
|
102
|
+
"component_id": component_id,
|
103
|
+
"context": context,
|
104
|
+
"group_ids": group_ids,
|
105
|
+
"message": message,
|
106
|
+
"messages": messages,
|
107
|
+
"session_id": session_id,
|
108
|
+
"user_id": user_id,
|
109
|
+
},
|
110
|
+
chat_stream_params.ChatStreamParams,
|
111
|
+
),
|
112
|
+
options=make_request_options(
|
113
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
114
|
+
),
|
115
|
+
cast_to=NoneType,
|
116
|
+
)
|
117
|
+
|
118
|
+
|
119
|
+
class AsyncChatResource(AsyncAPIResource):
|
120
|
+
@cached_property
|
121
|
+
def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
|
122
|
+
"""
|
123
|
+
This property can be used as a prefix for any HTTP method call to return
|
124
|
+
the raw response object instead of the parsed content.
|
125
|
+
|
126
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
127
|
+
"""
|
128
|
+
return AsyncChatResourceWithRawResponse(self)
|
129
|
+
|
130
|
+
@cached_property
|
131
|
+
def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
|
132
|
+
"""
|
133
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
134
|
+
|
135
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
136
|
+
"""
|
137
|
+
return AsyncChatResourceWithStreamingResponse(self)
|
138
|
+
|
139
|
+
async def stream(
|
140
|
+
self,
|
141
|
+
*,
|
142
|
+
id: str | NotGiven = NOT_GIVEN,
|
143
|
+
component_id: str | NotGiven = NOT_GIVEN,
|
144
|
+
context: object | NotGiven = NOT_GIVEN,
|
145
|
+
group_ids: List[str] | NotGiven = NOT_GIVEN,
|
146
|
+
message: chat_stream_params.Message | NotGiven = NOT_GIVEN,
|
147
|
+
messages: List[str] | NotGiven = NOT_GIVEN,
|
148
|
+
session_id: str | NotGiven = NOT_GIVEN,
|
149
|
+
user_id: str | NotGiven = NOT_GIVEN,
|
150
|
+
x_component_id: str | NotGiven = NOT_GIVEN,
|
151
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
152
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
153
|
+
extra_headers: Headers | None = None,
|
154
|
+
extra_query: Query | None = None,
|
155
|
+
extra_body: Body | None = None,
|
156
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
157
|
+
) -> None:
|
158
|
+
"""Streams a chat response in real-time using server-sent events (SSE).
|
159
|
+
|
160
|
+
Supports
|
161
|
+
both AI SDK format (with messages array) and custom format (with message
|
162
|
+
object).
|
163
|
+
|
164
|
+
Args:
|
165
|
+
id: Session ID (AI SDK uses "id")
|
166
|
+
|
167
|
+
component_id: Component ID
|
168
|
+
|
169
|
+
context: Additional context
|
170
|
+
|
171
|
+
group_ids: Group IDs for access control
|
172
|
+
|
173
|
+
message: Single message for custom format - contains text and optional images
|
174
|
+
|
175
|
+
messages: Messages array for AI SDK format - list of conversation messages with roles
|
176
|
+
|
177
|
+
session_id: Session ID
|
178
|
+
|
179
|
+
user_id: User ID
|
180
|
+
|
181
|
+
extra_headers: Send extra headers
|
182
|
+
|
183
|
+
extra_query: Add additional query parameters to the request
|
184
|
+
|
185
|
+
extra_body: Add additional JSON properties to the request
|
186
|
+
|
187
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
188
|
+
"""
|
189
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
190
|
+
extra_headers = {**strip_not_given({"x-component-id": x_component_id}), **(extra_headers or {})}
|
191
|
+
return await self._post(
|
192
|
+
"/api/v1/chat/stream",
|
193
|
+
body=await async_maybe_transform(
|
194
|
+
{
|
195
|
+
"id": id,
|
196
|
+
"component_id": component_id,
|
197
|
+
"context": context,
|
198
|
+
"group_ids": group_ids,
|
199
|
+
"message": message,
|
200
|
+
"messages": messages,
|
201
|
+
"session_id": session_id,
|
202
|
+
"user_id": user_id,
|
203
|
+
},
|
204
|
+
chat_stream_params.ChatStreamParams,
|
205
|
+
),
|
206
|
+
options=make_request_options(
|
207
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
208
|
+
),
|
209
|
+
cast_to=NoneType,
|
210
|
+
)
|
211
|
+
|
212
|
+
|
213
|
+
class ChatResourceWithRawResponse:
|
214
|
+
def __init__(self, chat: ChatResource) -> None:
|
215
|
+
self._chat = chat
|
216
|
+
|
217
|
+
self.stream = to_raw_response_wrapper(
|
218
|
+
chat.stream,
|
219
|
+
)
|
220
|
+
|
221
|
+
|
222
|
+
class AsyncChatResourceWithRawResponse:
|
223
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
224
|
+
self._chat = chat
|
225
|
+
|
226
|
+
self.stream = async_to_raw_response_wrapper(
|
227
|
+
chat.stream,
|
228
|
+
)
|
229
|
+
|
230
|
+
|
231
|
+
class ChatResourceWithStreamingResponse:
|
232
|
+
def __init__(self, chat: ChatResource) -> None:
|
233
|
+
self._chat = chat
|
234
|
+
|
235
|
+
self.stream = to_streamed_response_wrapper(
|
236
|
+
chat.stream,
|
237
|
+
)
|
238
|
+
|
239
|
+
|
240
|
+
class AsyncChatResourceWithStreamingResponse:
|
241
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
242
|
+
self._chat = chat
|
243
|
+
|
244
|
+
self.stream = async_to_streamed_response_wrapper(
|
245
|
+
chat.stream,
|
246
|
+
)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
5
|
from typing import List, Iterable, Optional
|
6
|
+
from typing_extensions import Literal
|
6
7
|
|
7
8
|
import httpx
|
8
9
|
|
@@ -39,9 +40,11 @@ from ....types.v1 import (
|
|
39
40
|
material_create_params,
|
40
41
|
material_rename_params,
|
41
42
|
material_search_params,
|
43
|
+
material_generate_params,
|
42
44
|
material_batch_create_params,
|
43
45
|
material_get_download_url_params,
|
44
46
|
material_create_and_process_params,
|
47
|
+
material_generate_and_process_params,
|
45
48
|
)
|
46
49
|
from ...._resource import SyncAPIResource, AsyncAPIResource
|
47
50
|
from ...._response import (
|
@@ -53,6 +56,7 @@ from ...._response import (
|
|
53
56
|
from ...._base_client import make_request_options
|
54
57
|
from ....types.v1.material import Material
|
55
58
|
from ....types.v1.content_param import ContentParam
|
59
|
+
from ....types.v1.generated_material import GeneratedMaterial
|
56
60
|
from ....types.v1.material_list_response import MaterialListResponse
|
57
61
|
from ....types.v1.material_debug_response import MaterialDebugResponse
|
58
62
|
from ....types.v1.material_search_response import MaterialSearchResponse
|
@@ -369,6 +373,144 @@ class MaterialsResource(SyncAPIResource):
|
|
369
373
|
cast_to=MaterialDebugResponse,
|
370
374
|
)
|
371
375
|
|
376
|
+
def generate(
|
377
|
+
self,
|
378
|
+
*,
|
379
|
+
name: str,
|
380
|
+
topic: str,
|
381
|
+
type: Literal["outline", "overview", "notes", "summary"],
|
382
|
+
context: str | NotGiven = NOT_GIVEN,
|
383
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
384
|
+
length: Literal["short", "medium", "long"] | NotGiven = NOT_GIVEN,
|
385
|
+
level: Literal["high_school", "college", "professional"] | NotGiven = NOT_GIVEN,
|
386
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
387
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
388
|
+
extra_headers: Headers | None = None,
|
389
|
+
extra_query: Query | None = None,
|
390
|
+
extra_body: Body | None = None,
|
391
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
392
|
+
) -> GeneratedMaterial:
|
393
|
+
"""Uses AI to generate study materials like outlines, notes, summaries, etc.
|
394
|
+
|
395
|
+
from a
|
396
|
+
given topic. Returns immediately without waiting for processing.
|
397
|
+
|
398
|
+
Args:
|
399
|
+
name: Name for the generated material
|
400
|
+
|
401
|
+
topic: Topic or context to generate material from
|
402
|
+
|
403
|
+
type: Type of material to generate
|
404
|
+
|
405
|
+
context: Additional context or details about the topic
|
406
|
+
|
407
|
+
folder_id: Target folder ID
|
408
|
+
|
409
|
+
length: Length of the generated content
|
410
|
+
|
411
|
+
level: Target education level
|
412
|
+
|
413
|
+
extra_headers: Send extra headers
|
414
|
+
|
415
|
+
extra_query: Add additional query parameters to the request
|
416
|
+
|
417
|
+
extra_body: Add additional JSON properties to the request
|
418
|
+
|
419
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
420
|
+
"""
|
421
|
+
return self._post(
|
422
|
+
"/api/v1/materials/generate",
|
423
|
+
body=maybe_transform(
|
424
|
+
{
|
425
|
+
"name": name,
|
426
|
+
"topic": topic,
|
427
|
+
"type": type,
|
428
|
+
"context": context,
|
429
|
+
"folder_id": folder_id,
|
430
|
+
"length": length,
|
431
|
+
"level": level,
|
432
|
+
},
|
433
|
+
material_generate_params.MaterialGenerateParams,
|
434
|
+
),
|
435
|
+
options=make_request_options(
|
436
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
437
|
+
),
|
438
|
+
cast_to=GeneratedMaterial,
|
439
|
+
)
|
440
|
+
|
441
|
+
def generate_and_process(
|
442
|
+
self,
|
443
|
+
*,
|
444
|
+
name: str,
|
445
|
+
topic: str,
|
446
|
+
type: Literal["outline", "overview", "notes", "summary"],
|
447
|
+
context: str | NotGiven = NOT_GIVEN,
|
448
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
449
|
+
length: Literal["short", "medium", "long"] | NotGiven = NOT_GIVEN,
|
450
|
+
level: Literal["high_school", "college", "professional"] | NotGiven = NOT_GIVEN,
|
451
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
452
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
453
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
454
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
455
|
+
extra_headers: Headers | None = None,
|
456
|
+
extra_query: Query | None = None,
|
457
|
+
extra_body: Body | None = None,
|
458
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
459
|
+
) -> GeneratedMaterial:
|
460
|
+
"""Uses AI to generate study materials like outlines, notes, summaries, etc.
|
461
|
+
|
462
|
+
from a
|
463
|
+
given topic and waits for processing to complete
|
464
|
+
|
465
|
+
Args:
|
466
|
+
name: Name for the generated material
|
467
|
+
|
468
|
+
topic: Topic or context to generate material from
|
469
|
+
|
470
|
+
type: Type of material to generate
|
471
|
+
|
472
|
+
context: Additional context or details about the topic
|
473
|
+
|
474
|
+
folder_id: Target folder ID
|
475
|
+
|
476
|
+
length: Length of the generated content
|
477
|
+
|
478
|
+
level: Target education level
|
479
|
+
|
480
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
481
|
+
|
482
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
483
|
+
|
484
|
+
extra_headers: Send extra headers
|
485
|
+
|
486
|
+
extra_query: Add additional query parameters to the request
|
487
|
+
|
488
|
+
extra_body: Add additional JSON properties to the request
|
489
|
+
|
490
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
491
|
+
"""
|
492
|
+
return self._post(
|
493
|
+
"/api/v1/materials/generate-and-process",
|
494
|
+
body=maybe_transform(
|
495
|
+
{
|
496
|
+
"name": name,
|
497
|
+
"topic": topic,
|
498
|
+
"type": type,
|
499
|
+
"context": context,
|
500
|
+
"folder_id": folder_id,
|
501
|
+
"length": length,
|
502
|
+
"level": level,
|
503
|
+
"poll_interval_ms": poll_interval_ms,
|
504
|
+
"timeout_ms": timeout_ms,
|
505
|
+
},
|
506
|
+
material_generate_and_process_params.MaterialGenerateAndProcessParams,
|
507
|
+
),
|
508
|
+
options=make_request_options(
|
509
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
510
|
+
),
|
511
|
+
cast_to=GeneratedMaterial,
|
512
|
+
)
|
513
|
+
|
372
514
|
def get_download_url(
|
373
515
|
self,
|
374
516
|
id: str,
|
@@ -879,6 +1021,144 @@ class AsyncMaterialsResource(AsyncAPIResource):
|
|
879
1021
|
cast_to=MaterialDebugResponse,
|
880
1022
|
)
|
881
1023
|
|
1024
|
+
async def generate(
|
1025
|
+
self,
|
1026
|
+
*,
|
1027
|
+
name: str,
|
1028
|
+
topic: str,
|
1029
|
+
type: Literal["outline", "overview", "notes", "summary"],
|
1030
|
+
context: str | NotGiven = NOT_GIVEN,
|
1031
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
1032
|
+
length: Literal["short", "medium", "long"] | NotGiven = NOT_GIVEN,
|
1033
|
+
level: Literal["high_school", "college", "professional"] | NotGiven = NOT_GIVEN,
|
1034
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
1035
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
1036
|
+
extra_headers: Headers | None = None,
|
1037
|
+
extra_query: Query | None = None,
|
1038
|
+
extra_body: Body | None = None,
|
1039
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
1040
|
+
) -> GeneratedMaterial:
|
1041
|
+
"""Uses AI to generate study materials like outlines, notes, summaries, etc.
|
1042
|
+
|
1043
|
+
from a
|
1044
|
+
given topic. Returns immediately without waiting for processing.
|
1045
|
+
|
1046
|
+
Args:
|
1047
|
+
name: Name for the generated material
|
1048
|
+
|
1049
|
+
topic: Topic or context to generate material from
|
1050
|
+
|
1051
|
+
type: Type of material to generate
|
1052
|
+
|
1053
|
+
context: Additional context or details about the topic
|
1054
|
+
|
1055
|
+
folder_id: Target folder ID
|
1056
|
+
|
1057
|
+
length: Length of the generated content
|
1058
|
+
|
1059
|
+
level: Target education level
|
1060
|
+
|
1061
|
+
extra_headers: Send extra headers
|
1062
|
+
|
1063
|
+
extra_query: Add additional query parameters to the request
|
1064
|
+
|
1065
|
+
extra_body: Add additional JSON properties to the request
|
1066
|
+
|
1067
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
1068
|
+
"""
|
1069
|
+
return await self._post(
|
1070
|
+
"/api/v1/materials/generate",
|
1071
|
+
body=await async_maybe_transform(
|
1072
|
+
{
|
1073
|
+
"name": name,
|
1074
|
+
"topic": topic,
|
1075
|
+
"type": type,
|
1076
|
+
"context": context,
|
1077
|
+
"folder_id": folder_id,
|
1078
|
+
"length": length,
|
1079
|
+
"level": level,
|
1080
|
+
},
|
1081
|
+
material_generate_params.MaterialGenerateParams,
|
1082
|
+
),
|
1083
|
+
options=make_request_options(
|
1084
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
1085
|
+
),
|
1086
|
+
cast_to=GeneratedMaterial,
|
1087
|
+
)
|
1088
|
+
|
1089
|
+
async def generate_and_process(
|
1090
|
+
self,
|
1091
|
+
*,
|
1092
|
+
name: str,
|
1093
|
+
topic: str,
|
1094
|
+
type: Literal["outline", "overview", "notes", "summary"],
|
1095
|
+
context: str | NotGiven = NOT_GIVEN,
|
1096
|
+
folder_id: str | NotGiven = NOT_GIVEN,
|
1097
|
+
length: Literal["short", "medium", "long"] | NotGiven = NOT_GIVEN,
|
1098
|
+
level: Literal["high_school", "college", "professional"] | NotGiven = NOT_GIVEN,
|
1099
|
+
poll_interval_ms: float | NotGiven = NOT_GIVEN,
|
1100
|
+
timeout_ms: float | NotGiven = NOT_GIVEN,
|
1101
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
1102
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
1103
|
+
extra_headers: Headers | None = None,
|
1104
|
+
extra_query: Query | None = None,
|
1105
|
+
extra_body: Body | None = None,
|
1106
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
1107
|
+
) -> GeneratedMaterial:
|
1108
|
+
"""Uses AI to generate study materials like outlines, notes, summaries, etc.
|
1109
|
+
|
1110
|
+
from a
|
1111
|
+
given topic and waits for processing to complete
|
1112
|
+
|
1113
|
+
Args:
|
1114
|
+
name: Name for the generated material
|
1115
|
+
|
1116
|
+
topic: Topic or context to generate material from
|
1117
|
+
|
1118
|
+
type: Type of material to generate
|
1119
|
+
|
1120
|
+
context: Additional context or details about the topic
|
1121
|
+
|
1122
|
+
folder_id: Target folder ID
|
1123
|
+
|
1124
|
+
length: Length of the generated content
|
1125
|
+
|
1126
|
+
level: Target education level
|
1127
|
+
|
1128
|
+
poll_interval_ms: Polling interval in milliseconds (default: 2 seconds)
|
1129
|
+
|
1130
|
+
timeout_ms: Maximum time to wait for processing in milliseconds (default: 5 minutes)
|
1131
|
+
|
1132
|
+
extra_headers: Send extra headers
|
1133
|
+
|
1134
|
+
extra_query: Add additional query parameters to the request
|
1135
|
+
|
1136
|
+
extra_body: Add additional JSON properties to the request
|
1137
|
+
|
1138
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
1139
|
+
"""
|
1140
|
+
return await self._post(
|
1141
|
+
"/api/v1/materials/generate-and-process",
|
1142
|
+
body=await async_maybe_transform(
|
1143
|
+
{
|
1144
|
+
"name": name,
|
1145
|
+
"topic": topic,
|
1146
|
+
"type": type,
|
1147
|
+
"context": context,
|
1148
|
+
"folder_id": folder_id,
|
1149
|
+
"length": length,
|
1150
|
+
"level": level,
|
1151
|
+
"poll_interval_ms": poll_interval_ms,
|
1152
|
+
"timeout_ms": timeout_ms,
|
1153
|
+
},
|
1154
|
+
material_generate_and_process_params.MaterialGenerateAndProcessParams,
|
1155
|
+
),
|
1156
|
+
options=make_request_options(
|
1157
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
1158
|
+
),
|
1159
|
+
cast_to=GeneratedMaterial,
|
1160
|
+
)
|
1161
|
+
|
882
1162
|
async def get_download_url(
|
883
1163
|
self,
|
884
1164
|
id: str,
|
@@ -1105,6 +1385,12 @@ class MaterialsResourceWithRawResponse:
|
|
1105
1385
|
self.debug = to_raw_response_wrapper(
|
1106
1386
|
materials.debug,
|
1107
1387
|
)
|
1388
|
+
self.generate = to_raw_response_wrapper(
|
1389
|
+
materials.generate,
|
1390
|
+
)
|
1391
|
+
self.generate_and_process = to_raw_response_wrapper(
|
1392
|
+
materials.generate_and_process,
|
1393
|
+
)
|
1108
1394
|
self.get_download_url = to_raw_response_wrapper(
|
1109
1395
|
materials.get_download_url,
|
1110
1396
|
)
|
@@ -1159,6 +1445,12 @@ class AsyncMaterialsResourceWithRawResponse:
|
|
1159
1445
|
self.debug = async_to_raw_response_wrapper(
|
1160
1446
|
materials.debug,
|
1161
1447
|
)
|
1448
|
+
self.generate = async_to_raw_response_wrapper(
|
1449
|
+
materials.generate,
|
1450
|
+
)
|
1451
|
+
self.generate_and_process = async_to_raw_response_wrapper(
|
1452
|
+
materials.generate_and_process,
|
1453
|
+
)
|
1162
1454
|
self.get_download_url = async_to_raw_response_wrapper(
|
1163
1455
|
materials.get_download_url,
|
1164
1456
|
)
|
@@ -1213,6 +1505,12 @@ class MaterialsResourceWithStreamingResponse:
|
|
1213
1505
|
self.debug = to_streamed_response_wrapper(
|
1214
1506
|
materials.debug,
|
1215
1507
|
)
|
1508
|
+
self.generate = to_streamed_response_wrapper(
|
1509
|
+
materials.generate,
|
1510
|
+
)
|
1511
|
+
self.generate_and_process = to_streamed_response_wrapper(
|
1512
|
+
materials.generate_and_process,
|
1513
|
+
)
|
1216
1514
|
self.get_download_url = to_streamed_response_wrapper(
|
1217
1515
|
materials.get_download_url,
|
1218
1516
|
)
|
@@ -1267,6 +1565,12 @@ class AsyncMaterialsResourceWithStreamingResponse:
|
|
1267
1565
|
self.debug = async_to_streamed_response_wrapper(
|
1268
1566
|
materials.debug,
|
1269
1567
|
)
|
1568
|
+
self.generate = async_to_streamed_response_wrapper(
|
1569
|
+
materials.generate,
|
1570
|
+
)
|
1571
|
+
self.generate_and_process = async_to_streamed_response_wrapper(
|
1572
|
+
materials.generate_and_process,
|
1573
|
+
)
|
1270
1574
|
self.get_download_url = async_to_streamed_response_wrapper(
|
1271
1575
|
materials.get_download_url,
|
1272
1576
|
)
|