perplexityai 0.6.0__py3-none-any.whl → 0.7.0__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.
Potentially problematic release.
This version of perplexityai might be problematic. Click here for more details.
- perplexity/_client.py +18 -0
- perplexity/_version.py +1 -1
- perplexity/resources/__init__.py +28 -0
- perplexity/resources/async_/__init__.py +33 -0
- perplexity/resources/async_/async_.py +102 -0
- perplexity/resources/async_/chat/__init__.py +33 -0
- perplexity/resources/async_/chat/chat.py +102 -0
- perplexity/resources/async_/chat/completions.py +347 -0
- perplexity/resources/chat/__init__.py +33 -0
- perplexity/resources/chat/chat.py +102 -0
- perplexity/resources/chat/completions.py +295 -0
- perplexity/resources/content.py +6 -2
- perplexity/resources/search.py +60 -2
- perplexity/types/__init__.py +6 -0
- perplexity/types/async_/__init__.py +3 -0
- perplexity/types/async_/chat/__init__.py +9 -0
- perplexity/types/async_/chat/completion_create_params.py +94 -0
- perplexity/types/async_/chat/completion_create_response.py +54 -0
- perplexity/types/async_/chat/completion_get_response.py +54 -0
- perplexity/types/async_/chat/completion_list_params.py +15 -0
- perplexity/types/async_/chat/completion_list_response.py +31 -0
- perplexity/types/chat/__init__.py +6 -0
- perplexity/types/chat/completion_create_params.py +90 -0
- perplexity/types/chat/completion_create_response.py +30 -0
- perplexity/types/content_create_params.py +1 -0
- perplexity/types/content_create_response.py +6 -0
- perplexity/types/search_create_params.py +24 -0
- perplexity/types/search_create_response.py +7 -0
- perplexity/types/shared/__init__.py +6 -0
- perplexity/types/shared/chat_choice.py +17 -0
- perplexity/types/shared/chat_message.py +31 -0
- perplexity/types/shared/search_result.py +15 -0
- perplexity/types/shared/usage_info.py +23 -0
- perplexity/types/shared_params/__init__.py +3 -0
- perplexity/types/shared_params/chat_message.py +31 -0
- {perplexityai-0.6.0.dist-info → perplexityai-0.7.0.dist-info}/METADATA +90 -22
- perplexityai-0.7.0.dist-info/RECORD +65 -0
- perplexityai-0.6.0.dist-info/RECORD +0 -40
- {perplexityai-0.6.0.dist-info → perplexityai-0.7.0.dist-info}/WHEEL +0 -0
- {perplexityai-0.6.0.dist-info → perplexityai-0.7.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
8
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
9
|
+
from ...._compat import cached_property
|
|
10
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
11
|
+
from ...._response import (
|
|
12
|
+
to_raw_response_wrapper,
|
|
13
|
+
to_streamed_response_wrapper,
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
)
|
|
17
|
+
from ...._base_client import make_request_options
|
|
18
|
+
from ....types.async_.chat import completion_list_params, completion_create_params
|
|
19
|
+
from ....types.async_.chat.completion_get_response import CompletionGetResponse
|
|
20
|
+
from ....types.async_.chat.completion_list_response import CompletionListResponse
|
|
21
|
+
from ....types.async_.chat.completion_create_response import CompletionCreateResponse
|
|
22
|
+
|
|
23
|
+
__all__ = ["CompletionsResource", "AsyncCompletionsResource"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CompletionsResource(SyncAPIResource):
|
|
27
|
+
@cached_property
|
|
28
|
+
def with_raw_response(self) -> CompletionsResourceWithRawResponse:
|
|
29
|
+
"""
|
|
30
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
31
|
+
the raw response object instead of the parsed content.
|
|
32
|
+
|
|
33
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
|
|
34
|
+
"""
|
|
35
|
+
return CompletionsResourceWithRawResponse(self)
|
|
36
|
+
|
|
37
|
+
@cached_property
|
|
38
|
+
def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse:
|
|
39
|
+
"""
|
|
40
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
41
|
+
|
|
42
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
|
|
43
|
+
"""
|
|
44
|
+
return CompletionsResourceWithStreamingResponse(self)
|
|
45
|
+
|
|
46
|
+
def create(
|
|
47
|
+
self,
|
|
48
|
+
*,
|
|
49
|
+
request: completion_create_params.Request,
|
|
50
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
51
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
52
|
+
extra_headers: Headers | None = None,
|
|
53
|
+
extra_query: Query | None = None,
|
|
54
|
+
extra_body: Body | None = None,
|
|
55
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
56
|
+
) -> CompletionCreateResponse:
|
|
57
|
+
"""
|
|
58
|
+
Creates an asynchronous chat completion job
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
extra_headers: Send extra headers
|
|
62
|
+
|
|
63
|
+
extra_query: Add additional query parameters to the request
|
|
64
|
+
|
|
65
|
+
extra_body: Add additional JSON properties to the request
|
|
66
|
+
|
|
67
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
68
|
+
"""
|
|
69
|
+
return self._post(
|
|
70
|
+
"/async/chat/completions",
|
|
71
|
+
body=maybe_transform({"request": request}, completion_create_params.CompletionCreateParams),
|
|
72
|
+
options=make_request_options(
|
|
73
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
74
|
+
),
|
|
75
|
+
cast_to=CompletionCreateResponse,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def list(
|
|
79
|
+
self,
|
|
80
|
+
*,
|
|
81
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
82
|
+
next_token: str | NotGiven = NOT_GIVEN,
|
|
83
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
84
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
85
|
+
extra_headers: Headers | None = None,
|
|
86
|
+
extra_query: Query | None = None,
|
|
87
|
+
extra_body: Body | None = None,
|
|
88
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
89
|
+
) -> CompletionListResponse:
|
|
90
|
+
"""
|
|
91
|
+
Lists all asynchronous chat completion requests for the authenticated user
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
limit: Maximum number of requests to return
|
|
95
|
+
|
|
96
|
+
next_token: Token for fetching the next page of results
|
|
97
|
+
|
|
98
|
+
extra_headers: Send extra headers
|
|
99
|
+
|
|
100
|
+
extra_query: Add additional query parameters to the request
|
|
101
|
+
|
|
102
|
+
extra_body: Add additional JSON properties to the request
|
|
103
|
+
|
|
104
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
105
|
+
"""
|
|
106
|
+
return self._get(
|
|
107
|
+
"/async/chat/completions",
|
|
108
|
+
options=make_request_options(
|
|
109
|
+
extra_headers=extra_headers,
|
|
110
|
+
extra_query=extra_query,
|
|
111
|
+
extra_body=extra_body,
|
|
112
|
+
timeout=timeout,
|
|
113
|
+
query=maybe_transform(
|
|
114
|
+
{
|
|
115
|
+
"limit": limit,
|
|
116
|
+
"next_token": next_token,
|
|
117
|
+
},
|
|
118
|
+
completion_list_params.CompletionListParams,
|
|
119
|
+
),
|
|
120
|
+
),
|
|
121
|
+
cast_to=CompletionListResponse,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def get(
|
|
125
|
+
self,
|
|
126
|
+
request_id: str,
|
|
127
|
+
*,
|
|
128
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
129
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
130
|
+
extra_headers: Headers | None = None,
|
|
131
|
+
extra_query: Query | None = None,
|
|
132
|
+
extra_body: Body | None = None,
|
|
133
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
134
|
+
) -> CompletionGetResponse:
|
|
135
|
+
"""
|
|
136
|
+
Retrieves the status and result of a specific asynchronous chat completion job
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
extra_headers: Send extra headers
|
|
140
|
+
|
|
141
|
+
extra_query: Add additional query parameters to the request
|
|
142
|
+
|
|
143
|
+
extra_body: Add additional JSON properties to the request
|
|
144
|
+
|
|
145
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
146
|
+
"""
|
|
147
|
+
if not request_id:
|
|
148
|
+
raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}")
|
|
149
|
+
return self._get(
|
|
150
|
+
f"/async/chat/completions/{request_id}",
|
|
151
|
+
options=make_request_options(
|
|
152
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
153
|
+
),
|
|
154
|
+
cast_to=CompletionGetResponse,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class AsyncCompletionsResource(AsyncAPIResource):
|
|
159
|
+
@cached_property
|
|
160
|
+
def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse:
|
|
161
|
+
"""
|
|
162
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
163
|
+
the raw response object instead of the parsed content.
|
|
164
|
+
|
|
165
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
|
|
166
|
+
"""
|
|
167
|
+
return AsyncCompletionsResourceWithRawResponse(self)
|
|
168
|
+
|
|
169
|
+
@cached_property
|
|
170
|
+
def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingResponse:
|
|
171
|
+
"""
|
|
172
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
173
|
+
|
|
174
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
|
|
175
|
+
"""
|
|
176
|
+
return AsyncCompletionsResourceWithStreamingResponse(self)
|
|
177
|
+
|
|
178
|
+
async def create(
|
|
179
|
+
self,
|
|
180
|
+
*,
|
|
181
|
+
request: completion_create_params.Request,
|
|
182
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
183
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
184
|
+
extra_headers: Headers | None = None,
|
|
185
|
+
extra_query: Query | None = None,
|
|
186
|
+
extra_body: Body | None = None,
|
|
187
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
188
|
+
) -> CompletionCreateResponse:
|
|
189
|
+
"""
|
|
190
|
+
Creates an asynchronous chat completion job
|
|
191
|
+
|
|
192
|
+
Args:
|
|
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
|
+
return await self._post(
|
|
202
|
+
"/async/chat/completions",
|
|
203
|
+
body=await async_maybe_transform({"request": request}, completion_create_params.CompletionCreateParams),
|
|
204
|
+
options=make_request_options(
|
|
205
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
206
|
+
),
|
|
207
|
+
cast_to=CompletionCreateResponse,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
async def list(
|
|
211
|
+
self,
|
|
212
|
+
*,
|
|
213
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
214
|
+
next_token: str | NotGiven = NOT_GIVEN,
|
|
215
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
216
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
217
|
+
extra_headers: Headers | None = None,
|
|
218
|
+
extra_query: Query | None = None,
|
|
219
|
+
extra_body: Body | None = None,
|
|
220
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
221
|
+
) -> CompletionListResponse:
|
|
222
|
+
"""
|
|
223
|
+
Lists all asynchronous chat completion requests for the authenticated user
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
limit: Maximum number of requests to return
|
|
227
|
+
|
|
228
|
+
next_token: Token for fetching the next page of results
|
|
229
|
+
|
|
230
|
+
extra_headers: Send extra headers
|
|
231
|
+
|
|
232
|
+
extra_query: Add additional query parameters to the request
|
|
233
|
+
|
|
234
|
+
extra_body: Add additional JSON properties to the request
|
|
235
|
+
|
|
236
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
237
|
+
"""
|
|
238
|
+
return await self._get(
|
|
239
|
+
"/async/chat/completions",
|
|
240
|
+
options=make_request_options(
|
|
241
|
+
extra_headers=extra_headers,
|
|
242
|
+
extra_query=extra_query,
|
|
243
|
+
extra_body=extra_body,
|
|
244
|
+
timeout=timeout,
|
|
245
|
+
query=await async_maybe_transform(
|
|
246
|
+
{
|
|
247
|
+
"limit": limit,
|
|
248
|
+
"next_token": next_token,
|
|
249
|
+
},
|
|
250
|
+
completion_list_params.CompletionListParams,
|
|
251
|
+
),
|
|
252
|
+
),
|
|
253
|
+
cast_to=CompletionListResponse,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
async def get(
|
|
257
|
+
self,
|
|
258
|
+
request_id: str,
|
|
259
|
+
*,
|
|
260
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
261
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
262
|
+
extra_headers: Headers | None = None,
|
|
263
|
+
extra_query: Query | None = None,
|
|
264
|
+
extra_body: Body | None = None,
|
|
265
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
266
|
+
) -> CompletionGetResponse:
|
|
267
|
+
"""
|
|
268
|
+
Retrieves the status and result of a specific asynchronous chat completion job
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
extra_headers: Send extra headers
|
|
272
|
+
|
|
273
|
+
extra_query: Add additional query parameters to the request
|
|
274
|
+
|
|
275
|
+
extra_body: Add additional JSON properties to the request
|
|
276
|
+
|
|
277
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
278
|
+
"""
|
|
279
|
+
if not request_id:
|
|
280
|
+
raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}")
|
|
281
|
+
return await self._get(
|
|
282
|
+
f"/async/chat/completions/{request_id}",
|
|
283
|
+
options=make_request_options(
|
|
284
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
285
|
+
),
|
|
286
|
+
cast_to=CompletionGetResponse,
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class CompletionsResourceWithRawResponse:
|
|
291
|
+
def __init__(self, completions: CompletionsResource) -> None:
|
|
292
|
+
self._completions = completions
|
|
293
|
+
|
|
294
|
+
self.create = to_raw_response_wrapper(
|
|
295
|
+
completions.create,
|
|
296
|
+
)
|
|
297
|
+
self.list = to_raw_response_wrapper(
|
|
298
|
+
completions.list,
|
|
299
|
+
)
|
|
300
|
+
self.get = to_raw_response_wrapper(
|
|
301
|
+
completions.get,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class AsyncCompletionsResourceWithRawResponse:
|
|
306
|
+
def __init__(self, completions: AsyncCompletionsResource) -> None:
|
|
307
|
+
self._completions = completions
|
|
308
|
+
|
|
309
|
+
self.create = async_to_raw_response_wrapper(
|
|
310
|
+
completions.create,
|
|
311
|
+
)
|
|
312
|
+
self.list = async_to_raw_response_wrapper(
|
|
313
|
+
completions.list,
|
|
314
|
+
)
|
|
315
|
+
self.get = async_to_raw_response_wrapper(
|
|
316
|
+
completions.get,
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class CompletionsResourceWithStreamingResponse:
|
|
321
|
+
def __init__(self, completions: CompletionsResource) -> None:
|
|
322
|
+
self._completions = completions
|
|
323
|
+
|
|
324
|
+
self.create = to_streamed_response_wrapper(
|
|
325
|
+
completions.create,
|
|
326
|
+
)
|
|
327
|
+
self.list = to_streamed_response_wrapper(
|
|
328
|
+
completions.list,
|
|
329
|
+
)
|
|
330
|
+
self.get = to_streamed_response_wrapper(
|
|
331
|
+
completions.get,
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
class AsyncCompletionsResourceWithStreamingResponse:
|
|
336
|
+
def __init__(self, completions: AsyncCompletionsResource) -> None:
|
|
337
|
+
self._completions = completions
|
|
338
|
+
|
|
339
|
+
self.create = async_to_streamed_response_wrapper(
|
|
340
|
+
completions.create,
|
|
341
|
+
)
|
|
342
|
+
self.list = async_to_streamed_response_wrapper(
|
|
343
|
+
completions.list,
|
|
344
|
+
)
|
|
345
|
+
self.get = async_to_streamed_response_wrapper(
|
|
346
|
+
completions.get,
|
|
347
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .chat import (
|
|
4
|
+
ChatResource,
|
|
5
|
+
AsyncChatResource,
|
|
6
|
+
ChatResourceWithRawResponse,
|
|
7
|
+
AsyncChatResourceWithRawResponse,
|
|
8
|
+
ChatResourceWithStreamingResponse,
|
|
9
|
+
AsyncChatResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .completions import (
|
|
12
|
+
CompletionsResource,
|
|
13
|
+
AsyncCompletionsResource,
|
|
14
|
+
CompletionsResourceWithRawResponse,
|
|
15
|
+
AsyncCompletionsResourceWithRawResponse,
|
|
16
|
+
CompletionsResourceWithStreamingResponse,
|
|
17
|
+
AsyncCompletionsResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"CompletionsResource",
|
|
22
|
+
"AsyncCompletionsResource",
|
|
23
|
+
"CompletionsResourceWithRawResponse",
|
|
24
|
+
"AsyncCompletionsResourceWithRawResponse",
|
|
25
|
+
"CompletionsResourceWithStreamingResponse",
|
|
26
|
+
"AsyncCompletionsResourceWithStreamingResponse",
|
|
27
|
+
"ChatResource",
|
|
28
|
+
"AsyncChatResource",
|
|
29
|
+
"ChatResourceWithRawResponse",
|
|
30
|
+
"AsyncChatResourceWithRawResponse",
|
|
31
|
+
"ChatResourceWithStreamingResponse",
|
|
32
|
+
"AsyncChatResourceWithStreamingResponse",
|
|
33
|
+
]
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ..._compat import cached_property
|
|
6
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
7
|
+
from .completions import (
|
|
8
|
+
CompletionsResource,
|
|
9
|
+
AsyncCompletionsResource,
|
|
10
|
+
CompletionsResourceWithRawResponse,
|
|
11
|
+
AsyncCompletionsResourceWithRawResponse,
|
|
12
|
+
CompletionsResourceWithStreamingResponse,
|
|
13
|
+
AsyncCompletionsResourceWithStreamingResponse,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = ["ChatResource", "AsyncChatResource"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ChatResource(SyncAPIResource):
|
|
20
|
+
@cached_property
|
|
21
|
+
def completions(self) -> CompletionsResource:
|
|
22
|
+
return CompletionsResource(self._client)
|
|
23
|
+
|
|
24
|
+
@cached_property
|
|
25
|
+
def with_raw_response(self) -> ChatResourceWithRawResponse:
|
|
26
|
+
"""
|
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
28
|
+
the raw response object instead of the parsed content.
|
|
29
|
+
|
|
30
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
|
|
31
|
+
"""
|
|
32
|
+
return ChatResourceWithRawResponse(self)
|
|
33
|
+
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
|
|
36
|
+
"""
|
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
38
|
+
|
|
39
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
|
|
40
|
+
"""
|
|
41
|
+
return ChatResourceWithStreamingResponse(self)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class AsyncChatResource(AsyncAPIResource):
|
|
45
|
+
@cached_property
|
|
46
|
+
def completions(self) -> AsyncCompletionsResource:
|
|
47
|
+
return AsyncCompletionsResource(self._client)
|
|
48
|
+
|
|
49
|
+
@cached_property
|
|
50
|
+
def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
|
|
51
|
+
"""
|
|
52
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
53
|
+
the raw response object instead of the parsed content.
|
|
54
|
+
|
|
55
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
|
|
56
|
+
"""
|
|
57
|
+
return AsyncChatResourceWithRawResponse(self)
|
|
58
|
+
|
|
59
|
+
@cached_property
|
|
60
|
+
def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
|
|
61
|
+
"""
|
|
62
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
63
|
+
|
|
64
|
+
For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
|
|
65
|
+
"""
|
|
66
|
+
return AsyncChatResourceWithStreamingResponse(self)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ChatResourceWithRawResponse:
|
|
70
|
+
def __init__(self, chat: ChatResource) -> None:
|
|
71
|
+
self._chat = chat
|
|
72
|
+
|
|
73
|
+
@cached_property
|
|
74
|
+
def completions(self) -> CompletionsResourceWithRawResponse:
|
|
75
|
+
return CompletionsResourceWithRawResponse(self._chat.completions)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class AsyncChatResourceWithRawResponse:
|
|
79
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
|
80
|
+
self._chat = chat
|
|
81
|
+
|
|
82
|
+
@cached_property
|
|
83
|
+
def completions(self) -> AsyncCompletionsResourceWithRawResponse:
|
|
84
|
+
return AsyncCompletionsResourceWithRawResponse(self._chat.completions)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ChatResourceWithStreamingResponse:
|
|
88
|
+
def __init__(self, chat: ChatResource) -> None:
|
|
89
|
+
self._chat = chat
|
|
90
|
+
|
|
91
|
+
@cached_property
|
|
92
|
+
def completions(self) -> CompletionsResourceWithStreamingResponse:
|
|
93
|
+
return CompletionsResourceWithStreamingResponse(self._chat.completions)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class AsyncChatResourceWithStreamingResponse:
|
|
97
|
+
def __init__(self, chat: AsyncChatResource) -> None:
|
|
98
|
+
self._chat = chat
|
|
99
|
+
|
|
100
|
+
@cached_property
|
|
101
|
+
def completions(self) -> AsyncCompletionsResourceWithStreamingResponse:
|
|
102
|
+
return AsyncCompletionsResourceWithStreamingResponse(self._chat.completions)
|