perplexityai 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- perplexityai-0.4.0/.release-please-manifest.json +3 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/CHANGELOG.md +13 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/PKG-INFO +13 -13
- {perplexityai-0.3.0 → perplexityai-0.4.0}/README.md +12 -12
- perplexityai-0.4.0/api.md +11 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/pyproject.toml +1 -1
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_version.py +1 -1
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/resources/search.py +18 -18
- perplexityai-0.4.0/src/perplexity/types/__init__.py +6 -0
- perplexityai-0.3.0/src/perplexity/types/search_perform_params.py → perplexityai-0.4.0/src/perplexity/types/search_create_params.py +2 -2
- perplexityai-0.3.0/src/perplexity/types/search_perform_response.py → perplexityai-0.4.0/src/perplexity/types/search_create_response.py +2 -2
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/api_resources/test_search.py +25 -25
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_client.py +10 -10
- perplexityai-0.3.0/.release-please-manifest.json +0 -3
- perplexityai-0.3.0/api.md +0 -11
- perplexityai-0.3.0/src/perplexity/types/__init__.py +0 -6
- {perplexityai-0.3.0 → perplexityai-0.4.0}/.gitignore +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/CONTRIBUTING.md +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/LICENSE +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/SECURITY.md +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/bin/check-release-environment +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/bin/publish-pypi +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/examples/.keep +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/noxfile.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/release-please-config.json +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/requirements-dev.lock +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/requirements.lock +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/__init__.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_base_client.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_client.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_compat.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_constants.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_exceptions.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_files.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_models.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_qs.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_resource.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_response.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_streaming.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_types.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/__init__.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_compat.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_datetime_parse.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_logs.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_proxy.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_reflection.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_resources_proxy.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_streams.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_sync.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_transform.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_typing.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/_utils/_utils.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/lib/.keep +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/py.typed +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/src/perplexity/resources/__init__.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/__init__.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/api_resources/__init__.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/conftest.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/sample_file.txt +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_deepcopy.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_extract_files.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_files.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_models.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_qs.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_required_args.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_response.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_streaming.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_transform.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_utils/test_proxy.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/test_utils/test_typing.py +0 -0
- {perplexityai-0.3.0 → perplexityai-0.4.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 (2025-09-07)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.3.0...v0.4.0](https://github.com/ppl-ai/perplexity-py/compare/v0.3.0...v0.4.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update from perform -> create ([35d2c42](https://github.com/ppl-ai/perplexity-py/commit/35d2c42567e59d53b37be7d4699f80755c09ca30))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
|
|
14
|
+
* update SDK settings ([a5a9d00](https://github.com/ppl-ai/perplexity-py/commit/a5a9d0009d07b48cf9b5f4521705acdb6878c904))
|
|
15
|
+
|
|
3
16
|
## 0.3.0 (2025-09-07)
|
|
4
17
|
|
|
5
18
|
Full Changelog: [v0.2.1...v0.3.0](https://github.com/ppl-ai/perplexity-py/compare/v0.2.1...v0.3.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: perplexityai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.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
|
|
@@ -67,10 +67,10 @@ client = Perplexity(
|
|
|
67
67
|
bearer_token=os.environ.get("PERPLEXITY_API_KEY"), # This is the default and can be omitted
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
search = client.search.create(
|
|
71
71
|
query="string",
|
|
72
72
|
)
|
|
73
|
-
print(
|
|
73
|
+
print(search.id)
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
While you can provide a `bearer_token` keyword argument,
|
|
@@ -93,10 +93,10 @@ client = AsyncPerplexity(
|
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
async def main() -> None:
|
|
96
|
-
|
|
96
|
+
search = await client.search.create(
|
|
97
97
|
query="string",
|
|
98
98
|
)
|
|
99
|
-
print(
|
|
99
|
+
print(search.id)
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
asyncio.run(main())
|
|
@@ -128,10 +128,10 @@ async def main() -> None:
|
|
|
128
128
|
bearer_token="My Bearer Token",
|
|
129
129
|
http_client=DefaultAioHttpClient(),
|
|
130
130
|
) as client:
|
|
131
|
-
|
|
131
|
+
search = await client.search.create(
|
|
132
132
|
query="string",
|
|
133
133
|
)
|
|
134
|
-
print(
|
|
134
|
+
print(search.id)
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
asyncio.run(main())
|
|
@@ -162,7 +162,7 @@ from perplexity import Perplexity
|
|
|
162
162
|
client = Perplexity()
|
|
163
163
|
|
|
164
164
|
try:
|
|
165
|
-
client.search.
|
|
165
|
+
client.search.create(
|
|
166
166
|
query="string",
|
|
167
167
|
)
|
|
168
168
|
except perplexity.APIConnectionError as e:
|
|
@@ -207,7 +207,7 @@ client = Perplexity(
|
|
|
207
207
|
)
|
|
208
208
|
|
|
209
209
|
# Or, configure per-request:
|
|
210
|
-
client.with_options(max_retries=5).search.
|
|
210
|
+
client.with_options(max_retries=5).search.create(
|
|
211
211
|
query="string",
|
|
212
212
|
)
|
|
213
213
|
```
|
|
@@ -232,7 +232,7 @@ client = Perplexity(
|
|
|
232
232
|
)
|
|
233
233
|
|
|
234
234
|
# Override per-request:
|
|
235
|
-
client.with_options(timeout=5.0).search.
|
|
235
|
+
client.with_options(timeout=5.0).search.create(
|
|
236
236
|
query="string",
|
|
237
237
|
)
|
|
238
238
|
```
|
|
@@ -275,12 +275,12 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
275
275
|
from perplexity import Perplexity
|
|
276
276
|
|
|
277
277
|
client = Perplexity()
|
|
278
|
-
response = client.search.with_raw_response.
|
|
278
|
+
response = client.search.with_raw_response.create(
|
|
279
279
|
query="string",
|
|
280
280
|
)
|
|
281
281
|
print(response.headers.get('X-My-Header'))
|
|
282
282
|
|
|
283
|
-
search = response.parse() # get the object that `search.
|
|
283
|
+
search = response.parse() # get the object that `search.create()` would have returned
|
|
284
284
|
print(search.id)
|
|
285
285
|
```
|
|
286
286
|
|
|
@@ -295,7 +295,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
295
295
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
296
296
|
|
|
297
297
|
```python
|
|
298
|
-
with client.search.with_streaming_response.
|
|
298
|
+
with client.search.with_streaming_response.create(
|
|
299
299
|
query="string",
|
|
300
300
|
) as response:
|
|
301
301
|
print(response.headers.get("X-My-Header"))
|
|
@@ -32,10 +32,10 @@ client = Perplexity(
|
|
|
32
32
|
bearer_token=os.environ.get("PERPLEXITY_API_KEY"), # This is the default and can be omitted
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
search = client.search.create(
|
|
36
36
|
query="string",
|
|
37
37
|
)
|
|
38
|
-
print(
|
|
38
|
+
print(search.id)
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
While you can provide a `bearer_token` keyword argument,
|
|
@@ -58,10 +58,10 @@ client = AsyncPerplexity(
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
async def main() -> None:
|
|
61
|
-
|
|
61
|
+
search = await client.search.create(
|
|
62
62
|
query="string",
|
|
63
63
|
)
|
|
64
|
-
print(
|
|
64
|
+
print(search.id)
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
asyncio.run(main())
|
|
@@ -93,10 +93,10 @@ async def main() -> None:
|
|
|
93
93
|
bearer_token="My Bearer Token",
|
|
94
94
|
http_client=DefaultAioHttpClient(),
|
|
95
95
|
) as client:
|
|
96
|
-
|
|
96
|
+
search = await client.search.create(
|
|
97
97
|
query="string",
|
|
98
98
|
)
|
|
99
|
-
print(
|
|
99
|
+
print(search.id)
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
asyncio.run(main())
|
|
@@ -127,7 +127,7 @@ from perplexity import Perplexity
|
|
|
127
127
|
client = Perplexity()
|
|
128
128
|
|
|
129
129
|
try:
|
|
130
|
-
client.search.
|
|
130
|
+
client.search.create(
|
|
131
131
|
query="string",
|
|
132
132
|
)
|
|
133
133
|
except perplexity.APIConnectionError as e:
|
|
@@ -172,7 +172,7 @@ client = Perplexity(
|
|
|
172
172
|
)
|
|
173
173
|
|
|
174
174
|
# Or, configure per-request:
|
|
175
|
-
client.with_options(max_retries=5).search.
|
|
175
|
+
client.with_options(max_retries=5).search.create(
|
|
176
176
|
query="string",
|
|
177
177
|
)
|
|
178
178
|
```
|
|
@@ -197,7 +197,7 @@ client = Perplexity(
|
|
|
197
197
|
)
|
|
198
198
|
|
|
199
199
|
# Override per-request:
|
|
200
|
-
client.with_options(timeout=5.0).search.
|
|
200
|
+
client.with_options(timeout=5.0).search.create(
|
|
201
201
|
query="string",
|
|
202
202
|
)
|
|
203
203
|
```
|
|
@@ -240,12 +240,12 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
240
240
|
from perplexity import Perplexity
|
|
241
241
|
|
|
242
242
|
client = Perplexity()
|
|
243
|
-
response = client.search.with_raw_response.
|
|
243
|
+
response = client.search.with_raw_response.create(
|
|
244
244
|
query="string",
|
|
245
245
|
)
|
|
246
246
|
print(response.headers.get('X-My-Header'))
|
|
247
247
|
|
|
248
|
-
search = response.parse() # get the object that `search.
|
|
248
|
+
search = response.parse() # get the object that `search.create()` would have returned
|
|
249
249
|
print(search.id)
|
|
250
250
|
```
|
|
251
251
|
|
|
@@ -260,7 +260,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
260
260
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
261
261
|
|
|
262
262
|
```python
|
|
263
|
-
with client.search.with_streaming_response.
|
|
263
|
+
with client.search.with_streaming_response.create(
|
|
264
264
|
query="string",
|
|
265
265
|
) as response:
|
|
266
266
|
print(response.headers.get("X-My-Header"))
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Search
|
|
2
|
+
|
|
3
|
+
Types:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from perplexity.types import SearchCreateResponse
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Methods:
|
|
10
|
+
|
|
11
|
+
- <code title="post /search">client.search.<a href="./src/perplexity/resources/search.py">create</a>(\*\*<a href="src/perplexity/types/search_create_params.py">params</a>) -> <a href="./src/perplexity/types/search_create_response.py">SearchCreateResponse</a></code>
|
|
@@ -7,7 +7,7 @@ from typing_extensions import Literal
|
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from ..types import
|
|
10
|
+
from ..types import search_create_params
|
|
11
11
|
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
|
|
12
12
|
from .._utils import maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
@@ -19,7 +19,7 @@ from .._response import (
|
|
|
19
19
|
async_to_streamed_response_wrapper,
|
|
20
20
|
)
|
|
21
21
|
from .._base_client import make_request_options
|
|
22
|
-
from ..types.
|
|
22
|
+
from ..types.search_create_response import SearchCreateResponse
|
|
23
23
|
|
|
24
24
|
__all__ = ["SearchResource", "AsyncSearchResource"]
|
|
25
25
|
|
|
@@ -44,7 +44,7 @@ class SearchResource(SyncAPIResource):
|
|
|
44
44
|
"""
|
|
45
45
|
return SearchResourceWithStreamingResponse(self)
|
|
46
46
|
|
|
47
|
-
def
|
|
47
|
+
def create(
|
|
48
48
|
self,
|
|
49
49
|
*,
|
|
50
50
|
query: Union[str, SequenceNotStr[str]],
|
|
@@ -65,7 +65,7 @@ class SearchResource(SyncAPIResource):
|
|
|
65
65
|
extra_query: Query | None = None,
|
|
66
66
|
extra_body: Body | None = None,
|
|
67
67
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
68
|
-
) ->
|
|
68
|
+
) -> SearchCreateResponse:
|
|
69
69
|
"""
|
|
70
70
|
Search
|
|
71
71
|
|
|
@@ -95,12 +95,12 @@ class SearchResource(SyncAPIResource):
|
|
|
95
95
|
"search_mode": search_mode,
|
|
96
96
|
"search_recency_filter": search_recency_filter,
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
search_create_params.SearchCreateParams,
|
|
99
99
|
),
|
|
100
100
|
options=make_request_options(
|
|
101
101
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
102
102
|
),
|
|
103
|
-
cast_to=
|
|
103
|
+
cast_to=SearchCreateResponse,
|
|
104
104
|
)
|
|
105
105
|
|
|
106
106
|
|
|
@@ -124,7 +124,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
124
124
|
"""
|
|
125
125
|
return AsyncSearchResourceWithStreamingResponse(self)
|
|
126
126
|
|
|
127
|
-
async def
|
|
127
|
+
async def create(
|
|
128
128
|
self,
|
|
129
129
|
*,
|
|
130
130
|
query: Union[str, SequenceNotStr[str]],
|
|
@@ -145,7 +145,7 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
145
145
|
extra_query: Query | None = None,
|
|
146
146
|
extra_body: Body | None = None,
|
|
147
147
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
148
|
-
) ->
|
|
148
|
+
) -> SearchCreateResponse:
|
|
149
149
|
"""
|
|
150
150
|
Search
|
|
151
151
|
|
|
@@ -175,12 +175,12 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
175
175
|
"search_mode": search_mode,
|
|
176
176
|
"search_recency_filter": search_recency_filter,
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
search_create_params.SearchCreateParams,
|
|
179
179
|
),
|
|
180
180
|
options=make_request_options(
|
|
181
181
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
182
182
|
),
|
|
183
|
-
cast_to=
|
|
183
|
+
cast_to=SearchCreateResponse,
|
|
184
184
|
)
|
|
185
185
|
|
|
186
186
|
|
|
@@ -188,8 +188,8 @@ class SearchResourceWithRawResponse:
|
|
|
188
188
|
def __init__(self, search: SearchResource) -> None:
|
|
189
189
|
self._search = search
|
|
190
190
|
|
|
191
|
-
self.
|
|
192
|
-
search.
|
|
191
|
+
self.create = to_raw_response_wrapper(
|
|
192
|
+
search.create,
|
|
193
193
|
)
|
|
194
194
|
|
|
195
195
|
|
|
@@ -197,8 +197,8 @@ class AsyncSearchResourceWithRawResponse:
|
|
|
197
197
|
def __init__(self, search: AsyncSearchResource) -> None:
|
|
198
198
|
self._search = search
|
|
199
199
|
|
|
200
|
-
self.
|
|
201
|
-
search.
|
|
200
|
+
self.create = async_to_raw_response_wrapper(
|
|
201
|
+
search.create,
|
|
202
202
|
)
|
|
203
203
|
|
|
204
204
|
|
|
@@ -206,8 +206,8 @@ class SearchResourceWithStreamingResponse:
|
|
|
206
206
|
def __init__(self, search: SearchResource) -> None:
|
|
207
207
|
self._search = search
|
|
208
208
|
|
|
209
|
-
self.
|
|
210
|
-
search.
|
|
209
|
+
self.create = to_streamed_response_wrapper(
|
|
210
|
+
search.create,
|
|
211
211
|
)
|
|
212
212
|
|
|
213
213
|
|
|
@@ -215,6 +215,6 @@ class AsyncSearchResourceWithStreamingResponse:
|
|
|
215
215
|
def __init__(self, search: AsyncSearchResource) -> None:
|
|
216
216
|
self._search = search
|
|
217
217
|
|
|
218
|
-
self.
|
|
219
|
-
search.
|
|
218
|
+
self.create = async_to_streamed_response_wrapper(
|
|
219
|
+
search.create,
|
|
220
220
|
)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .search_create_params import SearchCreateParams as SearchCreateParams
|
|
6
|
+
from .search_create_response import SearchCreateResponse as SearchCreateResponse
|
|
@@ -7,10 +7,10 @@ from typing_extensions import Literal, Required, TypedDict
|
|
|
7
7
|
|
|
8
8
|
from .._types import SequenceNotStr
|
|
9
9
|
|
|
10
|
-
__all__ = ["
|
|
10
|
+
__all__ = ["SearchCreateParams"]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class
|
|
13
|
+
class SearchCreateParams(TypedDict, total=False):
|
|
14
14
|
query: Required[Union[str, SequenceNotStr[str]]]
|
|
15
15
|
|
|
16
16
|
country: Optional[str]
|
|
@@ -4,7 +4,7 @@ from typing import List, Optional
|
|
|
4
4
|
|
|
5
5
|
from .._models import BaseModel
|
|
6
6
|
|
|
7
|
-
__all__ = ["
|
|
7
|
+
__all__ = ["SearchCreateResponse", "Result"]
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Result(BaseModel):
|
|
@@ -19,7 +19,7 @@ class Result(BaseModel):
|
|
|
19
19
|
last_updated: Optional[str] = None
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
class
|
|
22
|
+
class SearchCreateResponse(BaseModel):
|
|
23
23
|
id: str
|
|
24
24
|
|
|
25
25
|
results: List[Result]
|
|
@@ -9,7 +9,7 @@ import pytest
|
|
|
9
9
|
|
|
10
10
|
from perplexity import Perplexity, AsyncPerplexity
|
|
11
11
|
from tests.utils import assert_matches_type
|
|
12
|
-
from perplexity.types import
|
|
12
|
+
from perplexity.types import SearchCreateResponse
|
|
13
13
|
|
|
14
14
|
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|
15
15
|
|
|
@@ -19,16 +19,16 @@ class TestSearch:
|
|
|
19
19
|
|
|
20
20
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
21
21
|
@parametrize
|
|
22
|
-
def
|
|
23
|
-
search = client.search.
|
|
22
|
+
def test_method_create(self, client: Perplexity) -> None:
|
|
23
|
+
search = client.search.create(
|
|
24
24
|
query="string",
|
|
25
25
|
)
|
|
26
|
-
assert_matches_type(
|
|
26
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
27
27
|
|
|
28
28
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
29
29
|
@parametrize
|
|
30
|
-
def
|
|
31
|
-
search = client.search.
|
|
30
|
+
def test_method_create_with_all_params(self, client: Perplexity) -> None:
|
|
31
|
+
search = client.search.create(
|
|
32
32
|
query="string",
|
|
33
33
|
country="country",
|
|
34
34
|
last_updated_after_filter="last_updated_after_filter",
|
|
@@ -42,31 +42,31 @@ class TestSearch:
|
|
|
42
42
|
search_mode="web",
|
|
43
43
|
search_recency_filter="hour",
|
|
44
44
|
)
|
|
45
|
-
assert_matches_type(
|
|
45
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
46
46
|
|
|
47
47
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
48
48
|
@parametrize
|
|
49
|
-
def
|
|
50
|
-
response = client.search.with_raw_response.
|
|
49
|
+
def test_raw_response_create(self, client: Perplexity) -> None:
|
|
50
|
+
response = client.search.with_raw_response.create(
|
|
51
51
|
query="string",
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
assert response.is_closed is True
|
|
55
55
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
56
56
|
search = response.parse()
|
|
57
|
-
assert_matches_type(
|
|
57
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
58
58
|
|
|
59
59
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
60
60
|
@parametrize
|
|
61
|
-
def
|
|
62
|
-
with client.search.with_streaming_response.
|
|
61
|
+
def test_streaming_response_create(self, client: Perplexity) -> None:
|
|
62
|
+
with client.search.with_streaming_response.create(
|
|
63
63
|
query="string",
|
|
64
64
|
) as response:
|
|
65
65
|
assert not response.is_closed
|
|
66
66
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
67
67
|
|
|
68
68
|
search = response.parse()
|
|
69
|
-
assert_matches_type(
|
|
69
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
70
70
|
|
|
71
71
|
assert cast(Any, response.is_closed) is True
|
|
72
72
|
|
|
@@ -78,16 +78,16 @@ class TestAsyncSearch:
|
|
|
78
78
|
|
|
79
79
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
80
80
|
@parametrize
|
|
81
|
-
async def
|
|
82
|
-
search = await async_client.search.
|
|
81
|
+
async def test_method_create(self, async_client: AsyncPerplexity) -> None:
|
|
82
|
+
search = await async_client.search.create(
|
|
83
83
|
query="string",
|
|
84
84
|
)
|
|
85
|
-
assert_matches_type(
|
|
85
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
86
86
|
|
|
87
87
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
88
88
|
@parametrize
|
|
89
|
-
async def
|
|
90
|
-
search = await async_client.search.
|
|
89
|
+
async def test_method_create_with_all_params(self, async_client: AsyncPerplexity) -> None:
|
|
90
|
+
search = await async_client.search.create(
|
|
91
91
|
query="string",
|
|
92
92
|
country="country",
|
|
93
93
|
last_updated_after_filter="last_updated_after_filter",
|
|
@@ -101,30 +101,30 @@ class TestAsyncSearch:
|
|
|
101
101
|
search_mode="web",
|
|
102
102
|
search_recency_filter="hour",
|
|
103
103
|
)
|
|
104
|
-
assert_matches_type(
|
|
104
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
105
105
|
|
|
106
106
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
107
107
|
@parametrize
|
|
108
|
-
async def
|
|
109
|
-
response = await async_client.search.with_raw_response.
|
|
108
|
+
async def test_raw_response_create(self, async_client: AsyncPerplexity) -> None:
|
|
109
|
+
response = await async_client.search.with_raw_response.create(
|
|
110
110
|
query="string",
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
assert response.is_closed is True
|
|
114
114
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
115
115
|
search = await response.parse()
|
|
116
|
-
assert_matches_type(
|
|
116
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
117
117
|
|
|
118
118
|
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
119
119
|
@parametrize
|
|
120
|
-
async def
|
|
121
|
-
async with async_client.search.with_streaming_response.
|
|
120
|
+
async def test_streaming_response_create(self, async_client: AsyncPerplexity) -> None:
|
|
121
|
+
async with async_client.search.with_streaming_response.create(
|
|
122
122
|
query="string",
|
|
123
123
|
) as response:
|
|
124
124
|
assert not response.is_closed
|
|
125
125
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
126
126
|
|
|
127
127
|
search = await response.parse()
|
|
128
|
-
assert_matches_type(
|
|
128
|
+
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
129
129
|
|
|
130
130
|
assert cast(Any, response.is_closed) is True
|
|
@@ -745,7 +745,7 @@ class TestPerplexity:
|
|
|
745
745
|
respx_mock.post("/search").mock(side_effect=httpx.TimeoutException("Test timeout error"))
|
|
746
746
|
|
|
747
747
|
with pytest.raises(APITimeoutError):
|
|
748
|
-
client.search.with_streaming_response.
|
|
748
|
+
client.search.with_streaming_response.create(query="string").__enter__()
|
|
749
749
|
|
|
750
750
|
assert _get_open_connections(self.client) == 0
|
|
751
751
|
|
|
@@ -755,7 +755,7 @@ class TestPerplexity:
|
|
|
755
755
|
respx_mock.post("/search").mock(return_value=httpx.Response(500))
|
|
756
756
|
|
|
757
757
|
with pytest.raises(APIStatusError):
|
|
758
|
-
client.search.with_streaming_response.
|
|
758
|
+
client.search.with_streaming_response.create(query="string").__enter__()
|
|
759
759
|
assert _get_open_connections(self.client) == 0
|
|
760
760
|
|
|
761
761
|
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
|
|
@@ -784,7 +784,7 @@ class TestPerplexity:
|
|
|
784
784
|
|
|
785
785
|
respx_mock.post("/search").mock(side_effect=retry_handler)
|
|
786
786
|
|
|
787
|
-
response = client.search.with_raw_response.
|
|
787
|
+
response = client.search.with_raw_response.create(query="string")
|
|
788
788
|
|
|
789
789
|
assert response.retries_taken == failures_before_success
|
|
790
790
|
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
|
|
@@ -808,7 +808,7 @@ class TestPerplexity:
|
|
|
808
808
|
|
|
809
809
|
respx_mock.post("/search").mock(side_effect=retry_handler)
|
|
810
810
|
|
|
811
|
-
response = client.search.with_raw_response.
|
|
811
|
+
response = client.search.with_raw_response.create(
|
|
812
812
|
query="string", extra_headers={"x-stainless-retry-count": Omit()}
|
|
813
813
|
)
|
|
814
814
|
|
|
@@ -833,7 +833,7 @@ class TestPerplexity:
|
|
|
833
833
|
|
|
834
834
|
respx_mock.post("/search").mock(side_effect=retry_handler)
|
|
835
835
|
|
|
836
|
-
response = client.search.with_raw_response.
|
|
836
|
+
response = client.search.with_raw_response.create(
|
|
837
837
|
query="string", extra_headers={"x-stainless-retry-count": "42"}
|
|
838
838
|
)
|
|
839
839
|
|
|
@@ -1584,7 +1584,7 @@ class TestAsyncPerplexity:
|
|
|
1584
1584
|
respx_mock.post("/search").mock(side_effect=httpx.TimeoutException("Test timeout error"))
|
|
1585
1585
|
|
|
1586
1586
|
with pytest.raises(APITimeoutError):
|
|
1587
|
-
await async_client.search.with_streaming_response.
|
|
1587
|
+
await async_client.search.with_streaming_response.create(query="string").__aenter__()
|
|
1588
1588
|
|
|
1589
1589
|
assert _get_open_connections(self.client) == 0
|
|
1590
1590
|
|
|
@@ -1596,7 +1596,7 @@ class TestAsyncPerplexity:
|
|
|
1596
1596
|
respx_mock.post("/search").mock(return_value=httpx.Response(500))
|
|
1597
1597
|
|
|
1598
1598
|
with pytest.raises(APIStatusError):
|
|
1599
|
-
await async_client.search.with_streaming_response.
|
|
1599
|
+
await async_client.search.with_streaming_response.create(query="string").__aenter__()
|
|
1600
1600
|
assert _get_open_connections(self.client) == 0
|
|
1601
1601
|
|
|
1602
1602
|
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
|
|
@@ -1626,7 +1626,7 @@ class TestAsyncPerplexity:
|
|
|
1626
1626
|
|
|
1627
1627
|
respx_mock.post("/search").mock(side_effect=retry_handler)
|
|
1628
1628
|
|
|
1629
|
-
response = await client.search.with_raw_response.
|
|
1629
|
+
response = await client.search.with_raw_response.create(query="string")
|
|
1630
1630
|
|
|
1631
1631
|
assert response.retries_taken == failures_before_success
|
|
1632
1632
|
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
|
|
@@ -1651,7 +1651,7 @@ class TestAsyncPerplexity:
|
|
|
1651
1651
|
|
|
1652
1652
|
respx_mock.post("/search").mock(side_effect=retry_handler)
|
|
1653
1653
|
|
|
1654
|
-
response = await client.search.with_raw_response.
|
|
1654
|
+
response = await client.search.with_raw_response.create(
|
|
1655
1655
|
query="string", extra_headers={"x-stainless-retry-count": Omit()}
|
|
1656
1656
|
)
|
|
1657
1657
|
|
|
@@ -1677,7 +1677,7 @@ class TestAsyncPerplexity:
|
|
|
1677
1677
|
|
|
1678
1678
|
respx_mock.post("/search").mock(side_effect=retry_handler)
|
|
1679
1679
|
|
|
1680
|
-
response = await client.search.with_raw_response.
|
|
1680
|
+
response = await client.search.with_raw_response.create(
|
|
1681
1681
|
query="string", extra_headers={"x-stainless-retry-count": "42"}
|
|
1682
1682
|
)
|
|
1683
1683
|
|
perplexityai-0.3.0/api.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Search
|
|
2
|
-
|
|
3
|
-
Types:
|
|
4
|
-
|
|
5
|
-
```python
|
|
6
|
-
from perplexity.types import SearchPerformResponse
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
Methods:
|
|
10
|
-
|
|
11
|
-
- <code title="post /search">client.search.<a href="./src/perplexity/resources/search.py">perform</a>(\*\*<a href="src/perplexity/types/search_perform_params.py">params</a>) -> <a href="./src/perplexity/types/search_perform_response.py">SearchPerformResponse</a></code>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from .search_perform_params import SearchPerformParams as SearchPerformParams
|
|
6
|
-
from .search_perform_response import SearchPerformResponse as SearchPerformResponse
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|