perplexityai 0.5.0__py3-none-any.whl → 0.6.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 CHANGED
@@ -21,7 +21,7 @@ from ._types import (
21
21
  )
22
22
  from ._utils import is_given, get_async_library
23
23
  from ._version import __version__
24
- from .resources import search
24
+ from .resources import search, content
25
25
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
26
26
  from ._exceptions import APIStatusError, PerplexityError
27
27
  from ._base_client import (
@@ -44,6 +44,7 @@ __all__ = [
44
44
 
45
45
  class Perplexity(SyncAPIClient):
46
46
  search: search.SearchResource
47
+ content: content.ContentResource
47
48
  with_raw_response: PerplexityWithRawResponse
48
49
  with_streaming_response: PerplexityWithStreamedResponse
49
50
 
@@ -102,6 +103,7 @@ class Perplexity(SyncAPIClient):
102
103
  )
103
104
 
104
105
  self.search = search.SearchResource(self)
106
+ self.content = content.ContentResource(self)
105
107
  self.with_raw_response = PerplexityWithRawResponse(self)
106
108
  self.with_streaming_response = PerplexityWithStreamedResponse(self)
107
109
 
@@ -212,6 +214,7 @@ class Perplexity(SyncAPIClient):
212
214
 
213
215
  class AsyncPerplexity(AsyncAPIClient):
214
216
  search: search.AsyncSearchResource
217
+ content: content.AsyncContentResource
215
218
  with_raw_response: AsyncPerplexityWithRawResponse
216
219
  with_streaming_response: AsyncPerplexityWithStreamedResponse
217
220
 
@@ -270,6 +273,7 @@ class AsyncPerplexity(AsyncAPIClient):
270
273
  )
271
274
 
272
275
  self.search = search.AsyncSearchResource(self)
276
+ self.content = content.AsyncContentResource(self)
273
277
  self.with_raw_response = AsyncPerplexityWithRawResponse(self)
274
278
  self.with_streaming_response = AsyncPerplexityWithStreamedResponse(self)
275
279
 
@@ -381,21 +385,25 @@ class AsyncPerplexity(AsyncAPIClient):
381
385
  class PerplexityWithRawResponse:
382
386
  def __init__(self, client: Perplexity) -> None:
383
387
  self.search = search.SearchResourceWithRawResponse(client.search)
388
+ self.content = content.ContentResourceWithRawResponse(client.content)
384
389
 
385
390
 
386
391
  class AsyncPerplexityWithRawResponse:
387
392
  def __init__(self, client: AsyncPerplexity) -> None:
388
393
  self.search = search.AsyncSearchResourceWithRawResponse(client.search)
394
+ self.content = content.AsyncContentResourceWithRawResponse(client.content)
389
395
 
390
396
 
391
397
  class PerplexityWithStreamedResponse:
392
398
  def __init__(self, client: Perplexity) -> None:
393
399
  self.search = search.SearchResourceWithStreamingResponse(client.search)
400
+ self.content = content.ContentResourceWithStreamingResponse(client.content)
394
401
 
395
402
 
396
403
  class AsyncPerplexityWithStreamedResponse:
397
404
  def __init__(self, client: AsyncPerplexity) -> None:
398
405
  self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
406
+ self.content = content.AsyncContentResourceWithStreamingResponse(client.content)
399
407
 
400
408
 
401
409
  Client = Perplexity
perplexity/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "perplexity"
4
- __version__ = "0.5.0" # x-release-please-version
4
+ __version__ = "0.6.0" # x-release-please-version
@@ -8,6 +8,14 @@ from .search import (
8
8
  SearchResourceWithStreamingResponse,
9
9
  AsyncSearchResourceWithStreamingResponse,
10
10
  )
11
+ from .content import (
12
+ ContentResource,
13
+ AsyncContentResource,
14
+ ContentResourceWithRawResponse,
15
+ AsyncContentResourceWithRawResponse,
16
+ ContentResourceWithStreamingResponse,
17
+ AsyncContentResourceWithStreamingResponse,
18
+ )
11
19
 
12
20
  __all__ = [
13
21
  "SearchResource",
@@ -16,4 +24,10 @@ __all__ = [
16
24
  "AsyncSearchResourceWithRawResponse",
17
25
  "SearchResourceWithStreamingResponse",
18
26
  "AsyncSearchResourceWithStreamingResponse",
27
+ "ContentResource",
28
+ "AsyncContentResource",
29
+ "ContentResourceWithRawResponse",
30
+ "AsyncContentResourceWithRawResponse",
31
+ "ContentResourceWithStreamingResponse",
32
+ "AsyncContentResourceWithStreamingResponse",
19
33
  ]
@@ -0,0 +1,163 @@
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 content_create_params
8
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
9
+ from .._utils import maybe_transform, async_maybe_transform
10
+ from .._compat import cached_property
11
+ from .._resource import SyncAPIResource, AsyncAPIResource
12
+ from .._response import (
13
+ to_raw_response_wrapper,
14
+ to_streamed_response_wrapper,
15
+ async_to_raw_response_wrapper,
16
+ async_to_streamed_response_wrapper,
17
+ )
18
+ from .._base_client import make_request_options
19
+ from ..types.content_create_response import ContentCreateResponse
20
+
21
+ __all__ = ["ContentResource", "AsyncContentResource"]
22
+
23
+
24
+ class ContentResource(SyncAPIResource):
25
+ @cached_property
26
+ def with_raw_response(self) -> ContentResourceWithRawResponse:
27
+ """
28
+ This property can be used as a prefix for any HTTP method call to return
29
+ the raw response object instead of the parsed content.
30
+
31
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
32
+ """
33
+ return ContentResourceWithRawResponse(self)
34
+
35
+ @cached_property
36
+ def with_streaming_response(self) -> ContentResourceWithStreamingResponse:
37
+ """
38
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
39
+
40
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
41
+ """
42
+ return ContentResourceWithStreamingResponse(self)
43
+
44
+ def create(
45
+ self,
46
+ *,
47
+ urls: SequenceNotStr[str],
48
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
49
+ # The extra values given here take precedence over values defined on the client or passed to this method.
50
+ extra_headers: Headers | None = None,
51
+ extra_query: Query | None = None,
52
+ extra_body: Body | None = None,
53
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
54
+ ) -> ContentCreateResponse:
55
+ """
56
+ Get Urls Content
57
+
58
+ Args:
59
+ extra_headers: Send extra headers
60
+
61
+ extra_query: Add additional query parameters to the request
62
+
63
+ extra_body: Add additional JSON properties to the request
64
+
65
+ timeout: Override the client-level default timeout for this request, in seconds
66
+ """
67
+ return self._post(
68
+ "/content",
69
+ body=maybe_transform({"urls": urls}, content_create_params.ContentCreateParams),
70
+ options=make_request_options(
71
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
72
+ ),
73
+ cast_to=ContentCreateResponse,
74
+ )
75
+
76
+
77
+ class AsyncContentResource(AsyncAPIResource):
78
+ @cached_property
79
+ def with_raw_response(self) -> AsyncContentResourceWithRawResponse:
80
+ """
81
+ This property can be used as a prefix for any HTTP method call to return
82
+ the raw response object instead of the parsed content.
83
+
84
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
85
+ """
86
+ return AsyncContentResourceWithRawResponse(self)
87
+
88
+ @cached_property
89
+ def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse:
90
+ """
91
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
92
+
93
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
94
+ """
95
+ return AsyncContentResourceWithStreamingResponse(self)
96
+
97
+ async def create(
98
+ self,
99
+ *,
100
+ urls: SequenceNotStr[str],
101
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
102
+ # The extra values given here take precedence over values defined on the client or passed to this method.
103
+ extra_headers: Headers | None = None,
104
+ extra_query: Query | None = None,
105
+ extra_body: Body | None = None,
106
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
107
+ ) -> ContentCreateResponse:
108
+ """
109
+ Get Urls Content
110
+
111
+ Args:
112
+ extra_headers: Send extra headers
113
+
114
+ extra_query: Add additional query parameters to the request
115
+
116
+ extra_body: Add additional JSON properties to the request
117
+
118
+ timeout: Override the client-level default timeout for this request, in seconds
119
+ """
120
+ return await self._post(
121
+ "/content",
122
+ body=await async_maybe_transform({"urls": urls}, content_create_params.ContentCreateParams),
123
+ options=make_request_options(
124
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
125
+ ),
126
+ cast_to=ContentCreateResponse,
127
+ )
128
+
129
+
130
+ class ContentResourceWithRawResponse:
131
+ def __init__(self, content: ContentResource) -> None:
132
+ self._content = content
133
+
134
+ self.create = to_raw_response_wrapper(
135
+ content.create,
136
+ )
137
+
138
+
139
+ class AsyncContentResourceWithRawResponse:
140
+ def __init__(self, content: AsyncContentResource) -> None:
141
+ self._content = content
142
+
143
+ self.create = async_to_raw_response_wrapper(
144
+ content.create,
145
+ )
146
+
147
+
148
+ class ContentResourceWithStreamingResponse:
149
+ def __init__(self, content: ContentResource) -> None:
150
+ self._content = content
151
+
152
+ self.create = to_streamed_response_wrapper(
153
+ content.create,
154
+ )
155
+
156
+
157
+ class AsyncContentResourceWithStreamingResponse:
158
+ def __init__(self, content: AsyncContentResource) -> None:
159
+ self._content = content
160
+
161
+ self.create = async_to_streamed_response_wrapper(
162
+ content.create,
163
+ )
@@ -53,6 +53,7 @@ class SearchResource(SyncAPIResource):
53
53
  last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
54
54
  max_results: int | NotGiven = NOT_GIVEN,
55
55
  max_tokens: int | NotGiven = NOT_GIVEN,
56
+ max_tokens_per_page: int | NotGiven = NOT_GIVEN,
56
57
  safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
57
58
  search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
58
59
  search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
@@ -88,6 +89,7 @@ class SearchResource(SyncAPIResource):
88
89
  "last_updated_before_filter": last_updated_before_filter,
89
90
  "max_results": max_results,
90
91
  "max_tokens": max_tokens,
92
+ "max_tokens_per_page": max_tokens_per_page,
91
93
  "safe_search": safe_search,
92
94
  "search_after_date_filter": search_after_date_filter,
93
95
  "search_before_date_filter": search_before_date_filter,
@@ -133,6 +135,7 @@ class AsyncSearchResource(AsyncAPIResource):
133
135
  last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
134
136
  max_results: int | NotGiven = NOT_GIVEN,
135
137
  max_tokens: int | NotGiven = NOT_GIVEN,
138
+ max_tokens_per_page: int | NotGiven = NOT_GIVEN,
136
139
  safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
137
140
  search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
138
141
  search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
@@ -168,6 +171,7 @@ class AsyncSearchResource(AsyncAPIResource):
168
171
  "last_updated_before_filter": last_updated_before_filter,
169
172
  "max_results": max_results,
170
173
  "max_tokens": max_tokens,
174
+ "max_tokens_per_page": max_tokens_per_page,
171
175
  "safe_search": safe_search,
172
176
  "search_after_date_filter": search_after_date_filter,
173
177
  "search_before_date_filter": search_before_date_filter,
@@ -3,4 +3,6 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from .search_create_params import SearchCreateParams as SearchCreateParams
6
+ from .content_create_params import ContentCreateParams as ContentCreateParams
6
7
  from .search_create_response import SearchCreateResponse as SearchCreateResponse
8
+ from .content_create_response import ContentCreateResponse as ContentCreateResponse
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Required, TypedDict
6
+
7
+ from .._types import SequenceNotStr
8
+
9
+ __all__ = ["ContentCreateParams"]
10
+
11
+
12
+ class ContentCreateParams(TypedDict, total=False):
13
+ urls: Required[SequenceNotStr[str]]
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+
5
+ from .._models import BaseModel
6
+
7
+ __all__ = ["ContentCreateResponse", "Result"]
8
+
9
+
10
+ class Result(BaseModel):
11
+ content: str
12
+
13
+ title: str
14
+
15
+ url: str
16
+
17
+ date: Optional[str] = None
18
+
19
+
20
+ class ContentCreateResponse(BaseModel):
21
+ id: str
22
+
23
+ results: List[Result]
@@ -23,6 +23,8 @@ class SearchCreateParams(TypedDict, total=False):
23
23
 
24
24
  max_tokens: int
25
25
 
26
+ max_tokens_per_page: int
27
+
26
28
  safe_search: Optional[bool]
27
29
 
28
30
  search_after_date_filter: Optional[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: perplexityai
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: The official Python library for the perplexity API
5
5
  Project-URL: Homepage, https://github.com/ppl-ai/perplexity-py
6
6
  Project-URL: Repository, https://github.com/ppl-ai/perplexity-py
@@ -1,6 +1,6 @@
1
1
  perplexity/__init__.py,sha256=5epbvK3UiJEgvsBW9Ds6RFB6zObkUxYkA9fIQlgUaXA,2655
2
2
  perplexity/_base_client.py,sha256=DSeMteXutziRGJA9HqJaoLpG7ktzpU2GPcaIgQT1oZQ,67051
3
- perplexity/_client.py,sha256=9vsUrMdMmEO8Hz7yAEQJbTd3jszVlJERm0TMLyCQuBY,15080
3
+ perplexity/_client.py,sha256=dMkVFaHlpMtICqxeJOxwhIj1PKBgn7DPdoMmOKfvQ0s,15613
4
4
  perplexity/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
5
5
  perplexity/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  perplexity/_exceptions.py,sha256=v-hOXWSDTEtXcn_By7pPml3HjEmG5HXpbE-RK_A6_0Q,3228
@@ -11,7 +11,7 @@ perplexity/_resource.py,sha256=Pgc8KNBsIc1ltJn94uhDcDl0-3n5RLbe3iC2AiiNRnE,1124
11
11
  perplexity/_response.py,sha256=bpqzmVGq6jnivoMkUgt3OI0Rh6xHd6BMcp5PHgSFPb0,28842
12
12
  perplexity/_streaming.py,sha256=SQ61v42gFmNiO57uMFUZMAuDlGE0n_EulkZcPgJXt4U,10116
13
13
  perplexity/_types.py,sha256=XZYv2_G7oQGhQkjI28-TFIMP_yZZV590TRuKAoLJ3wM,7300
14
- perplexity/_version.py,sha256=r7xvBu1r6SCzn2w8FnNCT0y6vSjIPhARbGd3iWRTuDU,162
14
+ perplexity/_version.py,sha256=jJUPrkIRgFBl89WVXU3mGpPT6gT2nbhE_hrTKXiRDtk,162
15
15
  perplexity/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  perplexity/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
17
17
  perplexity/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
@@ -26,12 +26,15 @@ perplexity/_utils/_transform.py,sha256=i_U4R82RtQJtKKCriwFqmfcWjtwmmsiiF1AEXKQ_O
26
26
  perplexity/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
27
27
  perplexity/_utils/_utils.py,sha256=D2QE7mVPNEJzaB50u8rvDQAUDS5jx7JoeFD7zdj-TeI,12231
28
28
  perplexity/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
29
- perplexity/resources/__init__.py,sha256=e0o4Fhm2rFANVaRFoUJUmfCjJunhyhiJHWWRRnwv_yg,552
30
- perplexity/resources/search.py,sha256=8wlC-XJbprA1q6Ba_MZQ4aABUKvPnpBuFoY__YWaZOY,9028
31
- perplexity/types/__init__.py,sha256=yc0WYtyPE_vei_eT8gwY9-g7otC7EJjQpKSdeBcte4Y,279
32
- perplexity/types/search_create_params.py,sha256=RR5716GptBeuX99P0VHICzd5fEYsiwKdz1bW8nAlujI,886
29
+ perplexity/resources/__init__.py,sha256=4gcgh_cZ4sqi0z898C_SeFbHx_RpXtkd3coApMVPiPs,1015
30
+ perplexity/resources/content.py,sha256=4BbRmRPY3qeYtP-b8toraEbRnBMAPYRZkyuri17SH-0,5905
31
+ perplexity/resources/search.py,sha256=3EqjYtS5EK457YAO0QXY5QutoqscbSqKKxkwM65sRqU,9270
32
+ perplexity/types/__init__.py,sha256=gD41Ien1RrCYCdig8ygalnShM5uT8k_l0-dx1u38I8I,441
33
+ perplexity/types/content_create_params.py,sha256=NHj29NXYWhvY9CpcE2RuqHQ-H2_dP7yRRa3fFUbB2AM,338
34
+ perplexity/types/content_create_response.py,sha256=Wr2TbU5lbEb5tHhw68erei5AGtX6hfQHmc-y8DcatLc,388
35
+ perplexity/types/search_create_params.py,sha256=RHKT4toTErSF4T5g0DYD9DTDFDOvjKF0BIa0t5Pv7bk,916
33
36
  perplexity/types/search_create_response.py,sha256=lOteaJs4qpULkx5GLtEs6HhetqIBhM0I1AC1moWTeI8,426
34
- perplexityai-0.5.0.dist-info/METADATA,sha256=WoYAXSvZB8oFZKmFekj5FLK8z4vzq7mv9CXNEY4ijto,13621
35
- perplexityai-0.5.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
36
- perplexityai-0.5.0.dist-info/licenses/LICENSE,sha256=hkCriG3MT4vBhhc0roAOsrCE7IEDr1ywVEMonVHGmAQ,11340
37
- perplexityai-0.5.0.dist-info/RECORD,,
37
+ perplexityai-0.6.0.dist-info/METADATA,sha256=_RTfMkrLjrfNgCxgD2YASfbevut51kA7ePgRI9E_17Q,13621
38
+ perplexityai-0.6.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
39
+ perplexityai-0.6.0.dist-info/licenses/LICENSE,sha256=hkCriG3MT4vBhhc0roAOsrCE7IEDr1ywVEMonVHGmAQ,11340
40
+ perplexityai-0.6.0.dist-info/RECORD,,