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
@@ -0,0 +1,582 @@
|
|
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, Iterable
|
6
|
+
|
7
|
+
import httpx
|
8
|
+
|
9
|
+
from .test import (
|
10
|
+
TestResource,
|
11
|
+
AsyncTestResource,
|
12
|
+
TestResourceWithRawResponse,
|
13
|
+
AsyncTestResourceWithRawResponse,
|
14
|
+
TestResourceWithStreamingResponse,
|
15
|
+
AsyncTestResourceWithStreamingResponse,
|
16
|
+
)
|
17
|
+
from .sessions import (
|
18
|
+
SessionsResource,
|
19
|
+
AsyncSessionsResource,
|
20
|
+
SessionsResourceWithRawResponse,
|
21
|
+
AsyncSessionsResourceWithRawResponse,
|
22
|
+
SessionsResourceWithStreamingResponse,
|
23
|
+
AsyncSessionsResourceWithStreamingResponse,
|
24
|
+
)
|
25
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
26
|
+
from ...._utils import maybe_transform, strip_not_given, async_maybe_transform
|
27
|
+
from ...._compat import cached_property
|
28
|
+
from ....types.v1 import (
|
29
|
+
data_analyst_stream_params,
|
30
|
+
data_analyst_send_message_params,
|
31
|
+
data_analyst_retrieve_session_params,
|
32
|
+
)
|
33
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
34
|
+
from ...._response import (
|
35
|
+
to_raw_response_wrapper,
|
36
|
+
to_streamed_response_wrapper,
|
37
|
+
async_to_raw_response_wrapper,
|
38
|
+
async_to_streamed_response_wrapper,
|
39
|
+
)
|
40
|
+
from ...._base_client import make_request_options
|
41
|
+
|
42
|
+
__all__ = ["DataAnalystResource", "AsyncDataAnalystResource"]
|
43
|
+
|
44
|
+
|
45
|
+
class DataAnalystResource(SyncAPIResource):
|
46
|
+
@cached_property
|
47
|
+
def sessions(self) -> SessionsResource:
|
48
|
+
return SessionsResource(self._client)
|
49
|
+
|
50
|
+
@cached_property
|
51
|
+
def test(self) -> TestResource:
|
52
|
+
return TestResource(self._client)
|
53
|
+
|
54
|
+
@cached_property
|
55
|
+
def with_raw_response(self) -> DataAnalystResourceWithRawResponse:
|
56
|
+
"""
|
57
|
+
This property can be used as a prefix for any HTTP method call to return
|
58
|
+
the raw response object instead of the parsed content.
|
59
|
+
|
60
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
61
|
+
"""
|
62
|
+
return DataAnalystResourceWithRawResponse(self)
|
63
|
+
|
64
|
+
@cached_property
|
65
|
+
def with_streaming_response(self) -> DataAnalystResourceWithStreamingResponse:
|
66
|
+
"""
|
67
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
68
|
+
|
69
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
70
|
+
"""
|
71
|
+
return DataAnalystResourceWithStreamingResponse(self)
|
72
|
+
|
73
|
+
def get_history(
|
74
|
+
self,
|
75
|
+
*,
|
76
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
77
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
78
|
+
extra_headers: Headers | None = None,
|
79
|
+
extra_query: Query | None = None,
|
80
|
+
extra_body: Body | None = None,
|
81
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
82
|
+
) -> None:
|
83
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
84
|
+
return self._post(
|
85
|
+
"/api/v1/data-analyst/history",
|
86
|
+
options=make_request_options(
|
87
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
88
|
+
),
|
89
|
+
cast_to=NoneType,
|
90
|
+
)
|
91
|
+
|
92
|
+
def retrieve_session(
|
93
|
+
self,
|
94
|
+
session_id: str,
|
95
|
+
*,
|
96
|
+
user_id: str,
|
97
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
98
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
99
|
+
extra_headers: Headers | None = None,
|
100
|
+
extra_query: Query | None = None,
|
101
|
+
extra_body: Body | None = None,
|
102
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
103
|
+
) -> None:
|
104
|
+
"""
|
105
|
+
Args:
|
106
|
+
extra_headers: Send extra headers
|
107
|
+
|
108
|
+
extra_query: Add additional query parameters to the request
|
109
|
+
|
110
|
+
extra_body: Add additional JSON properties to the request
|
111
|
+
|
112
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
113
|
+
"""
|
114
|
+
if not session_id:
|
115
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
116
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
117
|
+
return self._get(
|
118
|
+
f"/api/v1/data-analyst/session/{session_id}",
|
119
|
+
options=make_request_options(
|
120
|
+
extra_headers=extra_headers,
|
121
|
+
extra_query=extra_query,
|
122
|
+
extra_body=extra_body,
|
123
|
+
timeout=timeout,
|
124
|
+
query=maybe_transform(
|
125
|
+
{"user_id": user_id}, data_analyst_retrieve_session_params.DataAnalystRetrieveSessionParams
|
126
|
+
),
|
127
|
+
),
|
128
|
+
cast_to=NoneType,
|
129
|
+
)
|
130
|
+
|
131
|
+
def send_followups(
|
132
|
+
self,
|
133
|
+
*,
|
134
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
135
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
136
|
+
extra_headers: Headers | None = None,
|
137
|
+
extra_query: Query | None = None,
|
138
|
+
extra_body: Body | None = None,
|
139
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
140
|
+
) -> None:
|
141
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
142
|
+
return self._post(
|
143
|
+
"/api/v1/data-analyst/followups",
|
144
|
+
options=make_request_options(
|
145
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
146
|
+
),
|
147
|
+
cast_to=NoneType,
|
148
|
+
)
|
149
|
+
|
150
|
+
def send_message(
|
151
|
+
self,
|
152
|
+
*,
|
153
|
+
component_id: str,
|
154
|
+
message: data_analyst_send_message_params.Message,
|
155
|
+
x_component_id: str,
|
156
|
+
context: object | NotGiven = NOT_GIVEN,
|
157
|
+
group_ids: List[str] | NotGiven = NOT_GIVEN,
|
158
|
+
session_id: str | NotGiven = NOT_GIVEN,
|
159
|
+
user_id: str | NotGiven = NOT_GIVEN,
|
160
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
161
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
162
|
+
extra_headers: Headers | None = None,
|
163
|
+
extra_query: Query | None = None,
|
164
|
+
extra_body: Body | None = None,
|
165
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
166
|
+
) -> None:
|
167
|
+
"""
|
168
|
+
Args:
|
169
|
+
component_id: Component ID for context
|
170
|
+
|
171
|
+
message: Chat message content
|
172
|
+
|
173
|
+
context: Additional context data
|
174
|
+
|
175
|
+
group_ids: Group IDs for collaboration
|
176
|
+
|
177
|
+
session_id: Session ID for conversation continuity
|
178
|
+
|
179
|
+
user_id: User ID for tracking
|
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.update({"x-component-id": x_component_id})
|
191
|
+
return self._post(
|
192
|
+
"/api/v1/data-analyst/message",
|
193
|
+
body=maybe_transform(
|
194
|
+
{
|
195
|
+
"component_id": component_id,
|
196
|
+
"message": message,
|
197
|
+
"context": context,
|
198
|
+
"group_ids": group_ids,
|
199
|
+
"session_id": session_id,
|
200
|
+
"user_id": user_id,
|
201
|
+
},
|
202
|
+
data_analyst_send_message_params.DataAnalystSendMessageParams,
|
203
|
+
),
|
204
|
+
options=make_request_options(
|
205
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
206
|
+
),
|
207
|
+
cast_to=NoneType,
|
208
|
+
)
|
209
|
+
|
210
|
+
def stream(
|
211
|
+
self,
|
212
|
+
*,
|
213
|
+
context: object | NotGiven = NOT_GIVEN,
|
214
|
+
group_id: str | NotGiven = NOT_GIVEN,
|
215
|
+
messages: Iterable[data_analyst_stream_params.Message] | NotGiven = NOT_GIVEN,
|
216
|
+
user_id: str | NotGiven = NOT_GIVEN,
|
217
|
+
x_component_id: str | NotGiven = NOT_GIVEN,
|
218
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
219
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
220
|
+
extra_headers: Headers | None = None,
|
221
|
+
extra_query: Query | None = None,
|
222
|
+
extra_body: Body | None = None,
|
223
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
224
|
+
) -> None:
|
225
|
+
"""
|
226
|
+
Stream chat responses
|
227
|
+
|
228
|
+
Args:
|
229
|
+
extra_headers: Send extra headers
|
230
|
+
|
231
|
+
extra_query: Add additional query parameters to the request
|
232
|
+
|
233
|
+
extra_body: Add additional JSON properties to the request
|
234
|
+
|
235
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
236
|
+
"""
|
237
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
238
|
+
extra_headers = {**strip_not_given({"x-component-id": x_component_id}), **(extra_headers or {})}
|
239
|
+
return self._post(
|
240
|
+
"/api/v1/data-analyst/stream",
|
241
|
+
body=maybe_transform(
|
242
|
+
{
|
243
|
+
"context": context,
|
244
|
+
"group_id": group_id,
|
245
|
+
"messages": messages,
|
246
|
+
"user_id": user_id,
|
247
|
+
},
|
248
|
+
data_analyst_stream_params.DataAnalystStreamParams,
|
249
|
+
),
|
250
|
+
options=make_request_options(
|
251
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
252
|
+
),
|
253
|
+
cast_to=NoneType,
|
254
|
+
)
|
255
|
+
|
256
|
+
|
257
|
+
class AsyncDataAnalystResource(AsyncAPIResource):
|
258
|
+
@cached_property
|
259
|
+
def sessions(self) -> AsyncSessionsResource:
|
260
|
+
return AsyncSessionsResource(self._client)
|
261
|
+
|
262
|
+
@cached_property
|
263
|
+
def test(self) -> AsyncTestResource:
|
264
|
+
return AsyncTestResource(self._client)
|
265
|
+
|
266
|
+
@cached_property
|
267
|
+
def with_raw_response(self) -> AsyncDataAnalystResourceWithRawResponse:
|
268
|
+
"""
|
269
|
+
This property can be used as a prefix for any HTTP method call to return
|
270
|
+
the raw response object instead of the parsed content.
|
271
|
+
|
272
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#accessing-raw-response-data-eg-headers
|
273
|
+
"""
|
274
|
+
return AsyncDataAnalystResourceWithRawResponse(self)
|
275
|
+
|
276
|
+
@cached_property
|
277
|
+
def with_streaming_response(self) -> AsyncDataAnalystResourceWithStreamingResponse:
|
278
|
+
"""
|
279
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
280
|
+
|
281
|
+
For more information, see https://www.github.com/GoStudyFetchGo/studyfetch-sdk-python#with_streaming_response
|
282
|
+
"""
|
283
|
+
return AsyncDataAnalystResourceWithStreamingResponse(self)
|
284
|
+
|
285
|
+
async def get_history(
|
286
|
+
self,
|
287
|
+
*,
|
288
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
289
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
290
|
+
extra_headers: Headers | None = None,
|
291
|
+
extra_query: Query | None = None,
|
292
|
+
extra_body: Body | None = None,
|
293
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
294
|
+
) -> None:
|
295
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
296
|
+
return await self._post(
|
297
|
+
"/api/v1/data-analyst/history",
|
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
|
+
|
304
|
+
async def retrieve_session(
|
305
|
+
self,
|
306
|
+
session_id: str,
|
307
|
+
*,
|
308
|
+
user_id: str,
|
309
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
310
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
311
|
+
extra_headers: Headers | None = None,
|
312
|
+
extra_query: Query | None = None,
|
313
|
+
extra_body: Body | None = None,
|
314
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
315
|
+
) -> None:
|
316
|
+
"""
|
317
|
+
Args:
|
318
|
+
extra_headers: Send extra headers
|
319
|
+
|
320
|
+
extra_query: Add additional query parameters to the request
|
321
|
+
|
322
|
+
extra_body: Add additional JSON properties to the request
|
323
|
+
|
324
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
325
|
+
"""
|
326
|
+
if not session_id:
|
327
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
328
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
329
|
+
return await self._get(
|
330
|
+
f"/api/v1/data-analyst/session/{session_id}",
|
331
|
+
options=make_request_options(
|
332
|
+
extra_headers=extra_headers,
|
333
|
+
extra_query=extra_query,
|
334
|
+
extra_body=extra_body,
|
335
|
+
timeout=timeout,
|
336
|
+
query=await async_maybe_transform(
|
337
|
+
{"user_id": user_id}, data_analyst_retrieve_session_params.DataAnalystRetrieveSessionParams
|
338
|
+
),
|
339
|
+
),
|
340
|
+
cast_to=NoneType,
|
341
|
+
)
|
342
|
+
|
343
|
+
async def send_followups(
|
344
|
+
self,
|
345
|
+
*,
|
346
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
347
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
348
|
+
extra_headers: Headers | None = None,
|
349
|
+
extra_query: Query | None = None,
|
350
|
+
extra_body: Body | None = None,
|
351
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
352
|
+
) -> None:
|
353
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
354
|
+
return await self._post(
|
355
|
+
"/api/v1/data-analyst/followups",
|
356
|
+
options=make_request_options(
|
357
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
358
|
+
),
|
359
|
+
cast_to=NoneType,
|
360
|
+
)
|
361
|
+
|
362
|
+
async def send_message(
|
363
|
+
self,
|
364
|
+
*,
|
365
|
+
component_id: str,
|
366
|
+
message: data_analyst_send_message_params.Message,
|
367
|
+
x_component_id: str,
|
368
|
+
context: object | NotGiven = NOT_GIVEN,
|
369
|
+
group_ids: List[str] | NotGiven = NOT_GIVEN,
|
370
|
+
session_id: str | NotGiven = NOT_GIVEN,
|
371
|
+
user_id: str | NotGiven = NOT_GIVEN,
|
372
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
373
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
374
|
+
extra_headers: Headers | None = None,
|
375
|
+
extra_query: Query | None = None,
|
376
|
+
extra_body: Body | None = None,
|
377
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
378
|
+
) -> None:
|
379
|
+
"""
|
380
|
+
Args:
|
381
|
+
component_id: Component ID for context
|
382
|
+
|
383
|
+
message: Chat message content
|
384
|
+
|
385
|
+
context: Additional context data
|
386
|
+
|
387
|
+
group_ids: Group IDs for collaboration
|
388
|
+
|
389
|
+
session_id: Session ID for conversation continuity
|
390
|
+
|
391
|
+
user_id: User ID for tracking
|
392
|
+
|
393
|
+
extra_headers: Send extra headers
|
394
|
+
|
395
|
+
extra_query: Add additional query parameters to the request
|
396
|
+
|
397
|
+
extra_body: Add additional JSON properties to the request
|
398
|
+
|
399
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
400
|
+
"""
|
401
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
402
|
+
extra_headers.update({"x-component-id": x_component_id})
|
403
|
+
return await self._post(
|
404
|
+
"/api/v1/data-analyst/message",
|
405
|
+
body=await async_maybe_transform(
|
406
|
+
{
|
407
|
+
"component_id": component_id,
|
408
|
+
"message": message,
|
409
|
+
"context": context,
|
410
|
+
"group_ids": group_ids,
|
411
|
+
"session_id": session_id,
|
412
|
+
"user_id": user_id,
|
413
|
+
},
|
414
|
+
data_analyst_send_message_params.DataAnalystSendMessageParams,
|
415
|
+
),
|
416
|
+
options=make_request_options(
|
417
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
418
|
+
),
|
419
|
+
cast_to=NoneType,
|
420
|
+
)
|
421
|
+
|
422
|
+
async def stream(
|
423
|
+
self,
|
424
|
+
*,
|
425
|
+
context: object | NotGiven = NOT_GIVEN,
|
426
|
+
group_id: str | NotGiven = NOT_GIVEN,
|
427
|
+
messages: Iterable[data_analyst_stream_params.Message] | NotGiven = NOT_GIVEN,
|
428
|
+
user_id: str | NotGiven = NOT_GIVEN,
|
429
|
+
x_component_id: str | NotGiven = NOT_GIVEN,
|
430
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
431
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
432
|
+
extra_headers: Headers | None = None,
|
433
|
+
extra_query: Query | None = None,
|
434
|
+
extra_body: Body | None = None,
|
435
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
436
|
+
) -> None:
|
437
|
+
"""
|
438
|
+
Stream chat responses
|
439
|
+
|
440
|
+
Args:
|
441
|
+
extra_headers: Send extra headers
|
442
|
+
|
443
|
+
extra_query: Add additional query parameters to the request
|
444
|
+
|
445
|
+
extra_body: Add additional JSON properties to the request
|
446
|
+
|
447
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
448
|
+
"""
|
449
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
450
|
+
extra_headers = {**strip_not_given({"x-component-id": x_component_id}), **(extra_headers or {})}
|
451
|
+
return await self._post(
|
452
|
+
"/api/v1/data-analyst/stream",
|
453
|
+
body=await async_maybe_transform(
|
454
|
+
{
|
455
|
+
"context": context,
|
456
|
+
"group_id": group_id,
|
457
|
+
"messages": messages,
|
458
|
+
"user_id": user_id,
|
459
|
+
},
|
460
|
+
data_analyst_stream_params.DataAnalystStreamParams,
|
461
|
+
),
|
462
|
+
options=make_request_options(
|
463
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
464
|
+
),
|
465
|
+
cast_to=NoneType,
|
466
|
+
)
|
467
|
+
|
468
|
+
|
469
|
+
class DataAnalystResourceWithRawResponse:
|
470
|
+
def __init__(self, data_analyst: DataAnalystResource) -> None:
|
471
|
+
self._data_analyst = data_analyst
|
472
|
+
|
473
|
+
self.get_history = to_raw_response_wrapper(
|
474
|
+
data_analyst.get_history,
|
475
|
+
)
|
476
|
+
self.retrieve_session = to_raw_response_wrapper(
|
477
|
+
data_analyst.retrieve_session,
|
478
|
+
)
|
479
|
+
self.send_followups = to_raw_response_wrapper(
|
480
|
+
data_analyst.send_followups,
|
481
|
+
)
|
482
|
+
self.send_message = to_raw_response_wrapper(
|
483
|
+
data_analyst.send_message,
|
484
|
+
)
|
485
|
+
self.stream = to_raw_response_wrapper(
|
486
|
+
data_analyst.stream,
|
487
|
+
)
|
488
|
+
|
489
|
+
@cached_property
|
490
|
+
def sessions(self) -> SessionsResourceWithRawResponse:
|
491
|
+
return SessionsResourceWithRawResponse(self._data_analyst.sessions)
|
492
|
+
|
493
|
+
@cached_property
|
494
|
+
def test(self) -> TestResourceWithRawResponse:
|
495
|
+
return TestResourceWithRawResponse(self._data_analyst.test)
|
496
|
+
|
497
|
+
|
498
|
+
class AsyncDataAnalystResourceWithRawResponse:
|
499
|
+
def __init__(self, data_analyst: AsyncDataAnalystResource) -> None:
|
500
|
+
self._data_analyst = data_analyst
|
501
|
+
|
502
|
+
self.get_history = async_to_raw_response_wrapper(
|
503
|
+
data_analyst.get_history,
|
504
|
+
)
|
505
|
+
self.retrieve_session = async_to_raw_response_wrapper(
|
506
|
+
data_analyst.retrieve_session,
|
507
|
+
)
|
508
|
+
self.send_followups = async_to_raw_response_wrapper(
|
509
|
+
data_analyst.send_followups,
|
510
|
+
)
|
511
|
+
self.send_message = async_to_raw_response_wrapper(
|
512
|
+
data_analyst.send_message,
|
513
|
+
)
|
514
|
+
self.stream = async_to_raw_response_wrapper(
|
515
|
+
data_analyst.stream,
|
516
|
+
)
|
517
|
+
|
518
|
+
@cached_property
|
519
|
+
def sessions(self) -> AsyncSessionsResourceWithRawResponse:
|
520
|
+
return AsyncSessionsResourceWithRawResponse(self._data_analyst.sessions)
|
521
|
+
|
522
|
+
@cached_property
|
523
|
+
def test(self) -> AsyncTestResourceWithRawResponse:
|
524
|
+
return AsyncTestResourceWithRawResponse(self._data_analyst.test)
|
525
|
+
|
526
|
+
|
527
|
+
class DataAnalystResourceWithStreamingResponse:
|
528
|
+
def __init__(self, data_analyst: DataAnalystResource) -> None:
|
529
|
+
self._data_analyst = data_analyst
|
530
|
+
|
531
|
+
self.get_history = to_streamed_response_wrapper(
|
532
|
+
data_analyst.get_history,
|
533
|
+
)
|
534
|
+
self.retrieve_session = to_streamed_response_wrapper(
|
535
|
+
data_analyst.retrieve_session,
|
536
|
+
)
|
537
|
+
self.send_followups = to_streamed_response_wrapper(
|
538
|
+
data_analyst.send_followups,
|
539
|
+
)
|
540
|
+
self.send_message = to_streamed_response_wrapper(
|
541
|
+
data_analyst.send_message,
|
542
|
+
)
|
543
|
+
self.stream = to_streamed_response_wrapper(
|
544
|
+
data_analyst.stream,
|
545
|
+
)
|
546
|
+
|
547
|
+
@cached_property
|
548
|
+
def sessions(self) -> SessionsResourceWithStreamingResponse:
|
549
|
+
return SessionsResourceWithStreamingResponse(self._data_analyst.sessions)
|
550
|
+
|
551
|
+
@cached_property
|
552
|
+
def test(self) -> TestResourceWithStreamingResponse:
|
553
|
+
return TestResourceWithStreamingResponse(self._data_analyst.test)
|
554
|
+
|
555
|
+
|
556
|
+
class AsyncDataAnalystResourceWithStreamingResponse:
|
557
|
+
def __init__(self, data_analyst: AsyncDataAnalystResource) -> None:
|
558
|
+
self._data_analyst = data_analyst
|
559
|
+
|
560
|
+
self.get_history = async_to_streamed_response_wrapper(
|
561
|
+
data_analyst.get_history,
|
562
|
+
)
|
563
|
+
self.retrieve_session = async_to_streamed_response_wrapper(
|
564
|
+
data_analyst.retrieve_session,
|
565
|
+
)
|
566
|
+
self.send_followups = async_to_streamed_response_wrapper(
|
567
|
+
data_analyst.send_followups,
|
568
|
+
)
|
569
|
+
self.send_message = async_to_streamed_response_wrapper(
|
570
|
+
data_analyst.send_message,
|
571
|
+
)
|
572
|
+
self.stream = async_to_streamed_response_wrapper(
|
573
|
+
data_analyst.stream,
|
574
|
+
)
|
575
|
+
|
576
|
+
@cached_property
|
577
|
+
def sessions(self) -> AsyncSessionsResourceWithStreamingResponse:
|
578
|
+
return AsyncSessionsResourceWithStreamingResponse(self._data_analyst.sessions)
|
579
|
+
|
580
|
+
@cached_property
|
581
|
+
def test(self) -> AsyncTestResourceWithStreamingResponse:
|
582
|
+
return AsyncTestResourceWithStreamingResponse(self._data_analyst.test)
|