scale-gp-beta 0.1.0a24__py3-none-any.whl → 0.1.0a25__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.
- scale_gp_beta/__init__.py +2 -1
- scale_gp_beta/_base_client.py +22 -0
- scale_gp_beta/_client.py +19 -1
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/lib/tracing/types.py +1 -3
- scale_gp_beta/resources/__init__.py +14 -0
- scale_gp_beta/resources/chat/completions.py +4 -2
- scale_gp_beta/resources/models.py +2 -0
- scale_gp_beta/resources/questions.py +693 -0
- scale_gp_beta/resources/spans.py +124 -92
- scale_gp_beta/types/__init__.py +4 -1
- scale_gp_beta/types/chat/chat_completion.py +1 -1
- scale_gp_beta/types/chat/chat_completion_chunk.py +1 -1
- scale_gp_beta/types/chat/completion_models_params.py +1 -0
- scale_gp_beta/types/chat/model_definition.py +1 -0
- scale_gp_beta/types/inference_model.py +1 -0
- scale_gp_beta/types/model_list_params.py +1 -0
- scale_gp_beta/types/question.py +175 -0
- scale_gp_beta/types/question_create_params.py +121 -0
- scale_gp_beta/types/{span_search_response.py → question_list.py} +4 -4
- scale_gp_beta/types/question_list_params.py +17 -0
- scale_gp_beta/types/span.py +1 -3
- scale_gp_beta/types/span_batch_params.py +1 -3
- scale_gp_beta/types/span_create_params.py +1 -3
- scale_gp_beta/types/span_search_params.py +45 -33
- scale_gp_beta/types/span_update_params.py +1 -1
- scale_gp_beta/types/span_upsert_batch_params.py +1 -3
- {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a25.dist-info}/METADATA +41 -1
- {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a25.dist-info}/RECORD +31 -27
- {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a25.dist-info}/WHEEL +0 -0
- {scale_gp_beta-0.1.0a24.dist-info → scale_gp_beta-0.1.0a25.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,693 @@
|
|
|
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 Any, cast
|
|
6
|
+
from typing_extensions import Literal, overload
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import question_list_params, question_create_params
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
+
from .._utils import required_args, maybe_transform, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
22
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
23
|
+
from ..types.question import Question
|
|
24
|
+
|
|
25
|
+
__all__ = ["QuestionsResource", "AsyncQuestionsResource"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class QuestionsResource(SyncAPIResource):
|
|
29
|
+
@cached_property
|
|
30
|
+
def with_raw_response(self) -> QuestionsResourceWithRawResponse:
|
|
31
|
+
"""
|
|
32
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
33
|
+
the raw response object instead of the parsed content.
|
|
34
|
+
|
|
35
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
36
|
+
"""
|
|
37
|
+
return QuestionsResourceWithRawResponse(self)
|
|
38
|
+
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_streaming_response(self) -> QuestionsResourceWithStreamingResponse:
|
|
41
|
+
"""
|
|
42
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
45
|
+
"""
|
|
46
|
+
return QuestionsResourceWithStreamingResponse(self)
|
|
47
|
+
|
|
48
|
+
@overload
|
|
49
|
+
def create(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
configuration: question_create_params.CategoricalQuestionRequestConfiguration,
|
|
53
|
+
name: str,
|
|
54
|
+
prompt: str,
|
|
55
|
+
question_type: Literal["categorical"] | NotGiven = NOT_GIVEN,
|
|
56
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
58
|
+
extra_headers: Headers | None = None,
|
|
59
|
+
extra_query: Query | None = None,
|
|
60
|
+
extra_body: Body | None = None,
|
|
61
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
62
|
+
) -> Question:
|
|
63
|
+
"""
|
|
64
|
+
Create Question
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
prompt: user-facing question prompt
|
|
68
|
+
|
|
69
|
+
extra_headers: Send extra headers
|
|
70
|
+
|
|
71
|
+
extra_query: Add additional query parameters to the request
|
|
72
|
+
|
|
73
|
+
extra_body: Add additional JSON properties to the request
|
|
74
|
+
|
|
75
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
76
|
+
"""
|
|
77
|
+
...
|
|
78
|
+
|
|
79
|
+
@overload
|
|
80
|
+
def create(
|
|
81
|
+
self,
|
|
82
|
+
*,
|
|
83
|
+
configuration: question_create_params.RatingQuestionRequestConfiguration,
|
|
84
|
+
name: str,
|
|
85
|
+
prompt: str,
|
|
86
|
+
question_type: Literal["rating"] | NotGiven = NOT_GIVEN,
|
|
87
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
88
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
89
|
+
extra_headers: Headers | None = None,
|
|
90
|
+
extra_query: Query | None = None,
|
|
91
|
+
extra_body: Body | None = None,
|
|
92
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
93
|
+
) -> Question:
|
|
94
|
+
"""
|
|
95
|
+
Create Question
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
prompt: user-facing question prompt
|
|
99
|
+
|
|
100
|
+
extra_headers: Send extra headers
|
|
101
|
+
|
|
102
|
+
extra_query: Add additional query parameters to the request
|
|
103
|
+
|
|
104
|
+
extra_body: Add additional JSON properties to the request
|
|
105
|
+
|
|
106
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
107
|
+
"""
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
@overload
|
|
111
|
+
def create(
|
|
112
|
+
self,
|
|
113
|
+
*,
|
|
114
|
+
name: str,
|
|
115
|
+
prompt: str,
|
|
116
|
+
configuration: question_create_params.NumberQuestionRequestConfiguration | NotGiven = NOT_GIVEN,
|
|
117
|
+
question_type: Literal["number"] | NotGiven = NOT_GIVEN,
|
|
118
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
119
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
120
|
+
extra_headers: Headers | None = None,
|
|
121
|
+
extra_query: Query | None = None,
|
|
122
|
+
extra_body: Body | None = None,
|
|
123
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
124
|
+
) -> Question:
|
|
125
|
+
"""
|
|
126
|
+
Create Question
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
prompt: user-facing question prompt
|
|
130
|
+
|
|
131
|
+
extra_headers: Send extra headers
|
|
132
|
+
|
|
133
|
+
extra_query: Add additional query parameters to the request
|
|
134
|
+
|
|
135
|
+
extra_body: Add additional JSON properties to the request
|
|
136
|
+
|
|
137
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
138
|
+
"""
|
|
139
|
+
...
|
|
140
|
+
|
|
141
|
+
@overload
|
|
142
|
+
def create(
|
|
143
|
+
self,
|
|
144
|
+
*,
|
|
145
|
+
name: str,
|
|
146
|
+
prompt: str,
|
|
147
|
+
configuration: question_create_params.FreeTextQuestionRequestConfiguration | NotGiven = NOT_GIVEN,
|
|
148
|
+
question_type: Literal["free_text"] | NotGiven = NOT_GIVEN,
|
|
149
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
150
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
151
|
+
extra_headers: Headers | None = None,
|
|
152
|
+
extra_query: Query | None = None,
|
|
153
|
+
extra_body: Body | None = None,
|
|
154
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
155
|
+
) -> Question:
|
|
156
|
+
"""
|
|
157
|
+
Create Question
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
prompt: user-facing question prompt
|
|
161
|
+
|
|
162
|
+
extra_headers: Send extra headers
|
|
163
|
+
|
|
164
|
+
extra_query: Add additional query parameters to the request
|
|
165
|
+
|
|
166
|
+
extra_body: Add additional JSON properties to the request
|
|
167
|
+
|
|
168
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
169
|
+
"""
|
|
170
|
+
...
|
|
171
|
+
|
|
172
|
+
@overload
|
|
173
|
+
def create(
|
|
174
|
+
self,
|
|
175
|
+
*,
|
|
176
|
+
configuration: question_create_params.FormQuestionRequestConfiguration,
|
|
177
|
+
name: str,
|
|
178
|
+
prompt: str,
|
|
179
|
+
question_type: Literal["form"] | NotGiven = NOT_GIVEN,
|
|
180
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
181
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
182
|
+
extra_headers: Headers | None = None,
|
|
183
|
+
extra_query: Query | None = None,
|
|
184
|
+
extra_body: Body | None = None,
|
|
185
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
186
|
+
) -> Question:
|
|
187
|
+
"""
|
|
188
|
+
Create Question
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
prompt: user-facing question prompt
|
|
192
|
+
|
|
193
|
+
extra_headers: Send extra headers
|
|
194
|
+
|
|
195
|
+
extra_query: Add additional query parameters to the request
|
|
196
|
+
|
|
197
|
+
extra_body: Add additional JSON properties to the request
|
|
198
|
+
|
|
199
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
200
|
+
"""
|
|
201
|
+
...
|
|
202
|
+
|
|
203
|
+
@required_args(["configuration", "name", "prompt"], ["name", "prompt"])
|
|
204
|
+
def create(
|
|
205
|
+
self,
|
|
206
|
+
*,
|
|
207
|
+
configuration: question_create_params.CategoricalQuestionRequestConfiguration
|
|
208
|
+
| question_create_params.RatingQuestionRequestConfiguration
|
|
209
|
+
| question_create_params.NumberQuestionRequestConfiguration
|
|
210
|
+
| question_create_params.FreeTextQuestionRequestConfiguration
|
|
211
|
+
| question_create_params.FormQuestionRequestConfiguration
|
|
212
|
+
| NotGiven = NOT_GIVEN,
|
|
213
|
+
name: str,
|
|
214
|
+
prompt: str,
|
|
215
|
+
question_type: Literal["categorical"]
|
|
216
|
+
| Literal["rating"]
|
|
217
|
+
| Literal["number"]
|
|
218
|
+
| Literal["free_text"]
|
|
219
|
+
| Literal["form"]
|
|
220
|
+
| NotGiven = NOT_GIVEN,
|
|
221
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
222
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
223
|
+
extra_headers: Headers | None = None,
|
|
224
|
+
extra_query: Query | None = None,
|
|
225
|
+
extra_body: Body | None = None,
|
|
226
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
227
|
+
) -> Question:
|
|
228
|
+
return cast(
|
|
229
|
+
Question,
|
|
230
|
+
self._post(
|
|
231
|
+
"/v5/questions",
|
|
232
|
+
body=maybe_transform(
|
|
233
|
+
{
|
|
234
|
+
"configuration": configuration,
|
|
235
|
+
"name": name,
|
|
236
|
+
"prompt": prompt,
|
|
237
|
+
"question_type": question_type,
|
|
238
|
+
},
|
|
239
|
+
question_create_params.QuestionCreateParams,
|
|
240
|
+
),
|
|
241
|
+
options=make_request_options(
|
|
242
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
243
|
+
),
|
|
244
|
+
cast_to=cast(Any, Question), # Union types cannot be passed in as arguments in the type system
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
def retrieve(
|
|
249
|
+
self,
|
|
250
|
+
question_id: str,
|
|
251
|
+
*,
|
|
252
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
253
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
254
|
+
extra_headers: Headers | None = None,
|
|
255
|
+
extra_query: Query | None = None,
|
|
256
|
+
extra_body: Body | None = None,
|
|
257
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
258
|
+
) -> Question:
|
|
259
|
+
"""
|
|
260
|
+
Get Question
|
|
261
|
+
|
|
262
|
+
Args:
|
|
263
|
+
extra_headers: Send extra headers
|
|
264
|
+
|
|
265
|
+
extra_query: Add additional query parameters to the request
|
|
266
|
+
|
|
267
|
+
extra_body: Add additional JSON properties to the request
|
|
268
|
+
|
|
269
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
270
|
+
"""
|
|
271
|
+
if not question_id:
|
|
272
|
+
raise ValueError(f"Expected a non-empty value for `question_id` but received {question_id!r}")
|
|
273
|
+
return cast(
|
|
274
|
+
Question,
|
|
275
|
+
self._get(
|
|
276
|
+
f"/v5/questions/{question_id}",
|
|
277
|
+
options=make_request_options(
|
|
278
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
279
|
+
),
|
|
280
|
+
cast_to=cast(Any, Question), # Union types cannot be passed in as arguments in the type system
|
|
281
|
+
),
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
def list(
|
|
285
|
+
self,
|
|
286
|
+
*,
|
|
287
|
+
ending_before: str | NotGiven = NOT_GIVEN,
|
|
288
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
289
|
+
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
290
|
+
starting_after: str | NotGiven = NOT_GIVEN,
|
|
291
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
292
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
293
|
+
extra_headers: Headers | None = None,
|
|
294
|
+
extra_query: Query | None = None,
|
|
295
|
+
extra_body: Body | None = None,
|
|
296
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
297
|
+
) -> SyncCursorPage[Question]:
|
|
298
|
+
"""
|
|
299
|
+
List Questions
|
|
300
|
+
|
|
301
|
+
Args:
|
|
302
|
+
extra_headers: Send extra headers
|
|
303
|
+
|
|
304
|
+
extra_query: Add additional query parameters to the request
|
|
305
|
+
|
|
306
|
+
extra_body: Add additional JSON properties to the request
|
|
307
|
+
|
|
308
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
309
|
+
"""
|
|
310
|
+
return self._get_api_list(
|
|
311
|
+
"/v5/questions",
|
|
312
|
+
page=SyncCursorPage[Question],
|
|
313
|
+
options=make_request_options(
|
|
314
|
+
extra_headers=extra_headers,
|
|
315
|
+
extra_query=extra_query,
|
|
316
|
+
extra_body=extra_body,
|
|
317
|
+
timeout=timeout,
|
|
318
|
+
query=maybe_transform(
|
|
319
|
+
{
|
|
320
|
+
"ending_before": ending_before,
|
|
321
|
+
"limit": limit,
|
|
322
|
+
"sort_order": sort_order,
|
|
323
|
+
"starting_after": starting_after,
|
|
324
|
+
},
|
|
325
|
+
question_list_params.QuestionListParams,
|
|
326
|
+
),
|
|
327
|
+
),
|
|
328
|
+
model=cast(Any, Question), # Union types cannot be passed in as arguments in the type system
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class AsyncQuestionsResource(AsyncAPIResource):
|
|
333
|
+
@cached_property
|
|
334
|
+
def with_raw_response(self) -> AsyncQuestionsResourceWithRawResponse:
|
|
335
|
+
"""
|
|
336
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
337
|
+
the raw response object instead of the parsed content.
|
|
338
|
+
|
|
339
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
340
|
+
"""
|
|
341
|
+
return AsyncQuestionsResourceWithRawResponse(self)
|
|
342
|
+
|
|
343
|
+
@cached_property
|
|
344
|
+
def with_streaming_response(self) -> AsyncQuestionsResourceWithStreamingResponse:
|
|
345
|
+
"""
|
|
346
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
347
|
+
|
|
348
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
349
|
+
"""
|
|
350
|
+
return AsyncQuestionsResourceWithStreamingResponse(self)
|
|
351
|
+
|
|
352
|
+
@overload
|
|
353
|
+
async def create(
|
|
354
|
+
self,
|
|
355
|
+
*,
|
|
356
|
+
configuration: question_create_params.CategoricalQuestionRequestConfiguration,
|
|
357
|
+
name: str,
|
|
358
|
+
prompt: str,
|
|
359
|
+
question_type: Literal["categorical"] | NotGiven = NOT_GIVEN,
|
|
360
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
361
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
362
|
+
extra_headers: Headers | None = None,
|
|
363
|
+
extra_query: Query | None = None,
|
|
364
|
+
extra_body: Body | None = None,
|
|
365
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
366
|
+
) -> Question:
|
|
367
|
+
"""
|
|
368
|
+
Create Question
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
prompt: user-facing question prompt
|
|
372
|
+
|
|
373
|
+
extra_headers: Send extra headers
|
|
374
|
+
|
|
375
|
+
extra_query: Add additional query parameters to the request
|
|
376
|
+
|
|
377
|
+
extra_body: Add additional JSON properties to the request
|
|
378
|
+
|
|
379
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
380
|
+
"""
|
|
381
|
+
...
|
|
382
|
+
|
|
383
|
+
@overload
|
|
384
|
+
async def create(
|
|
385
|
+
self,
|
|
386
|
+
*,
|
|
387
|
+
configuration: question_create_params.RatingQuestionRequestConfiguration,
|
|
388
|
+
name: str,
|
|
389
|
+
prompt: str,
|
|
390
|
+
question_type: Literal["rating"] | NotGiven = NOT_GIVEN,
|
|
391
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
392
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
393
|
+
extra_headers: Headers | None = None,
|
|
394
|
+
extra_query: Query | None = None,
|
|
395
|
+
extra_body: Body | None = None,
|
|
396
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
397
|
+
) -> Question:
|
|
398
|
+
"""
|
|
399
|
+
Create Question
|
|
400
|
+
|
|
401
|
+
Args:
|
|
402
|
+
prompt: user-facing question prompt
|
|
403
|
+
|
|
404
|
+
extra_headers: Send extra headers
|
|
405
|
+
|
|
406
|
+
extra_query: Add additional query parameters to the request
|
|
407
|
+
|
|
408
|
+
extra_body: Add additional JSON properties to the request
|
|
409
|
+
|
|
410
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
411
|
+
"""
|
|
412
|
+
...
|
|
413
|
+
|
|
414
|
+
@overload
|
|
415
|
+
async def create(
|
|
416
|
+
self,
|
|
417
|
+
*,
|
|
418
|
+
name: str,
|
|
419
|
+
prompt: str,
|
|
420
|
+
configuration: question_create_params.NumberQuestionRequestConfiguration | NotGiven = NOT_GIVEN,
|
|
421
|
+
question_type: Literal["number"] | NotGiven = NOT_GIVEN,
|
|
422
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
423
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
424
|
+
extra_headers: Headers | None = None,
|
|
425
|
+
extra_query: Query | None = None,
|
|
426
|
+
extra_body: Body | None = None,
|
|
427
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
428
|
+
) -> Question:
|
|
429
|
+
"""
|
|
430
|
+
Create Question
|
|
431
|
+
|
|
432
|
+
Args:
|
|
433
|
+
prompt: user-facing question prompt
|
|
434
|
+
|
|
435
|
+
extra_headers: Send extra headers
|
|
436
|
+
|
|
437
|
+
extra_query: Add additional query parameters to the request
|
|
438
|
+
|
|
439
|
+
extra_body: Add additional JSON properties to the request
|
|
440
|
+
|
|
441
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
442
|
+
"""
|
|
443
|
+
...
|
|
444
|
+
|
|
445
|
+
@overload
|
|
446
|
+
async def create(
|
|
447
|
+
self,
|
|
448
|
+
*,
|
|
449
|
+
name: str,
|
|
450
|
+
prompt: str,
|
|
451
|
+
configuration: question_create_params.FreeTextQuestionRequestConfiguration | NotGiven = NOT_GIVEN,
|
|
452
|
+
question_type: Literal["free_text"] | 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
|
+
) -> Question:
|
|
460
|
+
"""
|
|
461
|
+
Create Question
|
|
462
|
+
|
|
463
|
+
Args:
|
|
464
|
+
prompt: user-facing question prompt
|
|
465
|
+
|
|
466
|
+
extra_headers: Send extra headers
|
|
467
|
+
|
|
468
|
+
extra_query: Add additional query parameters to the request
|
|
469
|
+
|
|
470
|
+
extra_body: Add additional JSON properties to the request
|
|
471
|
+
|
|
472
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
473
|
+
"""
|
|
474
|
+
...
|
|
475
|
+
|
|
476
|
+
@overload
|
|
477
|
+
async def create(
|
|
478
|
+
self,
|
|
479
|
+
*,
|
|
480
|
+
configuration: question_create_params.FormQuestionRequestConfiguration,
|
|
481
|
+
name: str,
|
|
482
|
+
prompt: str,
|
|
483
|
+
question_type: Literal["form"] | NotGiven = NOT_GIVEN,
|
|
484
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
485
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
486
|
+
extra_headers: Headers | None = None,
|
|
487
|
+
extra_query: Query | None = None,
|
|
488
|
+
extra_body: Body | None = None,
|
|
489
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
490
|
+
) -> Question:
|
|
491
|
+
"""
|
|
492
|
+
Create Question
|
|
493
|
+
|
|
494
|
+
Args:
|
|
495
|
+
prompt: user-facing question prompt
|
|
496
|
+
|
|
497
|
+
extra_headers: Send extra headers
|
|
498
|
+
|
|
499
|
+
extra_query: Add additional query parameters to the request
|
|
500
|
+
|
|
501
|
+
extra_body: Add additional JSON properties to the request
|
|
502
|
+
|
|
503
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
504
|
+
"""
|
|
505
|
+
...
|
|
506
|
+
|
|
507
|
+
@required_args(["configuration", "name", "prompt"], ["name", "prompt"])
|
|
508
|
+
async def create(
|
|
509
|
+
self,
|
|
510
|
+
*,
|
|
511
|
+
configuration: question_create_params.CategoricalQuestionRequestConfiguration
|
|
512
|
+
| question_create_params.RatingQuestionRequestConfiguration
|
|
513
|
+
| question_create_params.NumberQuestionRequestConfiguration
|
|
514
|
+
| question_create_params.FreeTextQuestionRequestConfiguration
|
|
515
|
+
| question_create_params.FormQuestionRequestConfiguration
|
|
516
|
+
| NotGiven = NOT_GIVEN,
|
|
517
|
+
name: str,
|
|
518
|
+
prompt: str,
|
|
519
|
+
question_type: Literal["categorical"]
|
|
520
|
+
| Literal["rating"]
|
|
521
|
+
| Literal["number"]
|
|
522
|
+
| Literal["free_text"]
|
|
523
|
+
| Literal["form"]
|
|
524
|
+
| NotGiven = NOT_GIVEN,
|
|
525
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
526
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
527
|
+
extra_headers: Headers | None = None,
|
|
528
|
+
extra_query: Query | None = None,
|
|
529
|
+
extra_body: Body | None = None,
|
|
530
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
531
|
+
) -> Question:
|
|
532
|
+
return cast(
|
|
533
|
+
Question,
|
|
534
|
+
await self._post(
|
|
535
|
+
"/v5/questions",
|
|
536
|
+
body=await async_maybe_transform(
|
|
537
|
+
{
|
|
538
|
+
"configuration": configuration,
|
|
539
|
+
"name": name,
|
|
540
|
+
"prompt": prompt,
|
|
541
|
+
"question_type": question_type,
|
|
542
|
+
},
|
|
543
|
+
question_create_params.QuestionCreateParams,
|
|
544
|
+
),
|
|
545
|
+
options=make_request_options(
|
|
546
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
547
|
+
),
|
|
548
|
+
cast_to=cast(Any, Question), # Union types cannot be passed in as arguments in the type system
|
|
549
|
+
),
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
async def retrieve(
|
|
553
|
+
self,
|
|
554
|
+
question_id: str,
|
|
555
|
+
*,
|
|
556
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
557
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
558
|
+
extra_headers: Headers | None = None,
|
|
559
|
+
extra_query: Query | None = None,
|
|
560
|
+
extra_body: Body | None = None,
|
|
561
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
562
|
+
) -> Question:
|
|
563
|
+
"""
|
|
564
|
+
Get Question
|
|
565
|
+
|
|
566
|
+
Args:
|
|
567
|
+
extra_headers: Send extra headers
|
|
568
|
+
|
|
569
|
+
extra_query: Add additional query parameters to the request
|
|
570
|
+
|
|
571
|
+
extra_body: Add additional JSON properties to the request
|
|
572
|
+
|
|
573
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
574
|
+
"""
|
|
575
|
+
if not question_id:
|
|
576
|
+
raise ValueError(f"Expected a non-empty value for `question_id` but received {question_id!r}")
|
|
577
|
+
return cast(
|
|
578
|
+
Question,
|
|
579
|
+
await self._get(
|
|
580
|
+
f"/v5/questions/{question_id}",
|
|
581
|
+
options=make_request_options(
|
|
582
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
583
|
+
),
|
|
584
|
+
cast_to=cast(Any, Question), # Union types cannot be passed in as arguments in the type system
|
|
585
|
+
),
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
def list(
|
|
589
|
+
self,
|
|
590
|
+
*,
|
|
591
|
+
ending_before: str | NotGiven = NOT_GIVEN,
|
|
592
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
593
|
+
sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
|
|
594
|
+
starting_after: str | NotGiven = NOT_GIVEN,
|
|
595
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
596
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
597
|
+
extra_headers: Headers | None = None,
|
|
598
|
+
extra_query: Query | None = None,
|
|
599
|
+
extra_body: Body | None = None,
|
|
600
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
601
|
+
) -> AsyncPaginator[Question, AsyncCursorPage[Question]]:
|
|
602
|
+
"""
|
|
603
|
+
List Questions
|
|
604
|
+
|
|
605
|
+
Args:
|
|
606
|
+
extra_headers: Send extra headers
|
|
607
|
+
|
|
608
|
+
extra_query: Add additional query parameters to the request
|
|
609
|
+
|
|
610
|
+
extra_body: Add additional JSON properties to the request
|
|
611
|
+
|
|
612
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
613
|
+
"""
|
|
614
|
+
return self._get_api_list(
|
|
615
|
+
"/v5/questions",
|
|
616
|
+
page=AsyncCursorPage[Question],
|
|
617
|
+
options=make_request_options(
|
|
618
|
+
extra_headers=extra_headers,
|
|
619
|
+
extra_query=extra_query,
|
|
620
|
+
extra_body=extra_body,
|
|
621
|
+
timeout=timeout,
|
|
622
|
+
query=maybe_transform(
|
|
623
|
+
{
|
|
624
|
+
"ending_before": ending_before,
|
|
625
|
+
"limit": limit,
|
|
626
|
+
"sort_order": sort_order,
|
|
627
|
+
"starting_after": starting_after,
|
|
628
|
+
},
|
|
629
|
+
question_list_params.QuestionListParams,
|
|
630
|
+
),
|
|
631
|
+
),
|
|
632
|
+
model=cast(Any, Question), # Union types cannot be passed in as arguments in the type system
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
class QuestionsResourceWithRawResponse:
|
|
637
|
+
def __init__(self, questions: QuestionsResource) -> None:
|
|
638
|
+
self._questions = questions
|
|
639
|
+
|
|
640
|
+
self.create = to_raw_response_wrapper(
|
|
641
|
+
questions.create,
|
|
642
|
+
)
|
|
643
|
+
self.retrieve = to_raw_response_wrapper(
|
|
644
|
+
questions.retrieve,
|
|
645
|
+
)
|
|
646
|
+
self.list = to_raw_response_wrapper(
|
|
647
|
+
questions.list,
|
|
648
|
+
)
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
class AsyncQuestionsResourceWithRawResponse:
|
|
652
|
+
def __init__(self, questions: AsyncQuestionsResource) -> None:
|
|
653
|
+
self._questions = questions
|
|
654
|
+
|
|
655
|
+
self.create = async_to_raw_response_wrapper(
|
|
656
|
+
questions.create,
|
|
657
|
+
)
|
|
658
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
659
|
+
questions.retrieve,
|
|
660
|
+
)
|
|
661
|
+
self.list = async_to_raw_response_wrapper(
|
|
662
|
+
questions.list,
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
class QuestionsResourceWithStreamingResponse:
|
|
667
|
+
def __init__(self, questions: QuestionsResource) -> None:
|
|
668
|
+
self._questions = questions
|
|
669
|
+
|
|
670
|
+
self.create = to_streamed_response_wrapper(
|
|
671
|
+
questions.create,
|
|
672
|
+
)
|
|
673
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
674
|
+
questions.retrieve,
|
|
675
|
+
)
|
|
676
|
+
self.list = to_streamed_response_wrapper(
|
|
677
|
+
questions.list,
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
class AsyncQuestionsResourceWithStreamingResponse:
|
|
682
|
+
def __init__(self, questions: AsyncQuestionsResource) -> None:
|
|
683
|
+
self._questions = questions
|
|
684
|
+
|
|
685
|
+
self.create = async_to_streamed_response_wrapper(
|
|
686
|
+
questions.create,
|
|
687
|
+
)
|
|
688
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
689
|
+
questions.retrieve,
|
|
690
|
+
)
|
|
691
|
+
self.list = async_to_streamed_response_wrapper(
|
|
692
|
+
questions.list,
|
|
693
|
+
)
|