perplexityai 0.8.0__tar.gz → 0.10.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.10.0/.release-please-manifest.json +3 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/CHANGELOG.md +21 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/PKG-INFO +1 -1
- {perplexityai-0.8.0 → perplexityai-0.10.0}/api.md +0 -12
- {perplexityai-0.8.0 → perplexityai-0.10.0}/pyproject.toml +1 -1
- {perplexityai-0.8.0 → perplexityai-0.10.0}/requirements-dev.lock +5 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/requirements.lock +5 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_client.py +1 -9
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_models.py +10 -4
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_version.py +1 -1
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/__init__.py +0 -14
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/chat/completions.py +0 -4
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/search.py +0 -32
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/__init__.py +0 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/completion_create_params.py +0 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/chat/completion_create_params.py +0 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/search_create_params.py +0 -16
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/async_/chat/test_completions.py +0 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/chat/test_completions.py +0 -2
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/test_search.py +0 -16
- perplexityai-0.8.0/.release-please-manifest.json +0 -3
- perplexityai-0.8.0/src/perplexity/resources/content.py +0 -163
- perplexityai-0.8.0/src/perplexity/types/content_create_params.py +0 -13
- perplexityai-0.8.0/src/perplexity/types/content_create_response.py +0 -23
- perplexityai-0.8.0/tests/api_resources/test_content.py +0 -92
- {perplexityai-0.8.0 → perplexityai-0.10.0}/.gitignore +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/CONTRIBUTING.md +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/LICENSE +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/README.md +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/SECURITY.md +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/bin/check-release-environment +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/bin/publish-pypi +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/examples/.keep +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/noxfile.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/release-please-config.json +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_base_client.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_compat.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_constants.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_exceptions.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_files.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_qs.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_resource.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_streaming.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_types.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_compat.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_datetime_parse.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_logs.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_proxy.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_reflection.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_resources_proxy.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_streams.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_sync.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_transform.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_typing.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/_utils/_utils.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/lib/.keep +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/py.typed +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/async_/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/async_/async_.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/async_/chat/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/async_/chat/chat.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/async_/chat/completions.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/chat/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/chat/chat.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/completion_create_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/completion_get_params.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/completion_get_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/completion_list_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/chat/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/chat/completion_create_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/search_create_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/api_public_search_result.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/chat_message_input.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/chat_message_output.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/choice.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/usage_info.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared_params/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared_params/api_public_search_result.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared_params/chat_message_input.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/async_/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/async_/chat/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/chat/__init__.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/conftest.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/sample_file.txt +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_client.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_deepcopy.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_extract_files.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_files.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_models.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_qs.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_required_args.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_response.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_streaming.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_transform.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_utils/test_proxy.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/test_utils/test_typing.py +0 -0
- {perplexityai-0.8.0 → perplexityai-0.10.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 (2025-09-19)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.9.0...v0.10.0](https://github.com/ppl-ai/perplexity-py/compare/v0.9.0...v0.10.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([7f38b2f](https://github.com/ppl-ai/perplexity-py/commit/7f38b2f1eb750a6d5e435a5bfd376b62fa5a9594))
|
|
10
|
+
|
|
11
|
+
## 0.9.0 (2025-09-17)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.8.0...v0.9.0](https://github.com/ppl-ai/perplexity-py/compare/v0.8.0...v0.9.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** manual updates ([8fbe318](https://github.com/ppl-ai/perplexity-py/commit/8fbe318c5ed7df04335c2cd14de708cae5780623))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* **internal:** update pydantic dependency ([cac84f2](https://github.com/ppl-ai/perplexity-py/commit/cac84f25cd550ee57f8971d74231f63ba8d36905))
|
|
23
|
+
|
|
3
24
|
## 0.8.0 (2025-09-15)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v0.7.2...v0.8.0](https://github.com/ppl-ai/perplexity-py/compare/v0.7.2...v0.8.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: perplexityai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.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
|
|
@@ -57,15 +57,3 @@ from perplexity.types import SearchCreateResponse
|
|
|
57
57
|
Methods:
|
|
58
58
|
|
|
59
59
|
- <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>
|
|
60
|
-
|
|
61
|
-
# Content
|
|
62
|
-
|
|
63
|
-
Types:
|
|
64
|
-
|
|
65
|
-
```python
|
|
66
|
-
from perplexity.types import ContentCreateResponse
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Methods:
|
|
70
|
-
|
|
71
|
-
- <code title="post /content">client.content.<a href="./src/perplexity/resources/content.py">create</a>(\*\*<a href="src/perplexity/types/content_create_params.py">params</a>) -> <a href="./src/perplexity/types/content_create_response.py">ContentCreateResponse</a></code>
|
|
@@ -88,9 +88,9 @@ pluggy==1.5.0
|
|
|
88
88
|
propcache==0.3.1
|
|
89
89
|
# via aiohttp
|
|
90
90
|
# via yarl
|
|
91
|
-
pydantic==2.
|
|
91
|
+
pydantic==2.11.9
|
|
92
92
|
# via perplexityai
|
|
93
|
-
pydantic-core==2.
|
|
93
|
+
pydantic-core==2.33.2
|
|
94
94
|
# via pydantic
|
|
95
95
|
pygments==2.18.0
|
|
96
96
|
# via rich
|
|
@@ -126,6 +126,9 @@ typing-extensions==4.12.2
|
|
|
126
126
|
# via pydantic
|
|
127
127
|
# via pydantic-core
|
|
128
128
|
# via pyright
|
|
129
|
+
# via typing-inspection
|
|
130
|
+
typing-inspection==0.4.1
|
|
131
|
+
# via pydantic
|
|
129
132
|
virtualenv==20.24.5
|
|
130
133
|
# via nox
|
|
131
134
|
yarl==1.20.0
|
|
@@ -55,9 +55,9 @@ multidict==6.4.4
|
|
|
55
55
|
propcache==0.3.1
|
|
56
56
|
# via aiohttp
|
|
57
57
|
# via yarl
|
|
58
|
-
pydantic==2.
|
|
58
|
+
pydantic==2.11.9
|
|
59
59
|
# via perplexityai
|
|
60
|
-
pydantic-core==2.
|
|
60
|
+
pydantic-core==2.33.2
|
|
61
61
|
# via pydantic
|
|
62
62
|
sniffio==1.3.0
|
|
63
63
|
# via anyio
|
|
@@ -68,5 +68,8 @@ typing-extensions==4.12.2
|
|
|
68
68
|
# via perplexityai
|
|
69
69
|
# via pydantic
|
|
70
70
|
# via pydantic-core
|
|
71
|
+
# via typing-inspection
|
|
72
|
+
typing-inspection==0.4.1
|
|
73
|
+
# via pydantic
|
|
71
74
|
yarl==1.20.0
|
|
72
75
|
# via aiohttp
|
|
@@ -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
|
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
26
26
|
from ._exceptions import APIStatusError, PerplexityError
|
|
27
27
|
from ._base_client import (
|
|
@@ -48,7 +48,6 @@ class Perplexity(SyncAPIClient):
|
|
|
48
48
|
chat: chat.ChatResource
|
|
49
49
|
async_: async_.AsyncResource
|
|
50
50
|
search: search.SearchResource
|
|
51
|
-
content: content.ContentResource
|
|
52
51
|
with_raw_response: PerplexityWithRawResponse
|
|
53
52
|
with_streaming_response: PerplexityWithStreamedResponse
|
|
54
53
|
|
|
@@ -109,7 +108,6 @@ class Perplexity(SyncAPIClient):
|
|
|
109
108
|
self.chat = chat.ChatResource(self)
|
|
110
109
|
self.async_ = async_.AsyncResource(self)
|
|
111
110
|
self.search = search.SearchResource(self)
|
|
112
|
-
self.content = content.ContentResource(self)
|
|
113
111
|
self.with_raw_response = PerplexityWithRawResponse(self)
|
|
114
112
|
self.with_streaming_response = PerplexityWithStreamedResponse(self)
|
|
115
113
|
|
|
@@ -222,7 +220,6 @@ class AsyncPerplexity(AsyncAPIClient):
|
|
|
222
220
|
chat: chat.AsyncChatResource
|
|
223
221
|
async_: async_.AsyncAsyncResource
|
|
224
222
|
search: search.AsyncSearchResource
|
|
225
|
-
content: content.AsyncContentResource
|
|
226
223
|
with_raw_response: AsyncPerplexityWithRawResponse
|
|
227
224
|
with_streaming_response: AsyncPerplexityWithStreamedResponse
|
|
228
225
|
|
|
@@ -283,7 +280,6 @@ class AsyncPerplexity(AsyncAPIClient):
|
|
|
283
280
|
self.chat = chat.AsyncChatResource(self)
|
|
284
281
|
self.async_ = async_.AsyncAsyncResource(self)
|
|
285
282
|
self.search = search.AsyncSearchResource(self)
|
|
286
|
-
self.content = content.AsyncContentResource(self)
|
|
287
283
|
self.with_raw_response = AsyncPerplexityWithRawResponse(self)
|
|
288
284
|
self.with_streaming_response = AsyncPerplexityWithStreamedResponse(self)
|
|
289
285
|
|
|
@@ -397,7 +393,6 @@ class PerplexityWithRawResponse:
|
|
|
397
393
|
self.chat = chat.ChatResourceWithRawResponse(client.chat)
|
|
398
394
|
self.async_ = async_.AsyncResourceWithRawResponse(client.async_)
|
|
399
395
|
self.search = search.SearchResourceWithRawResponse(client.search)
|
|
400
|
-
self.content = content.ContentResourceWithRawResponse(client.content)
|
|
401
396
|
|
|
402
397
|
|
|
403
398
|
class AsyncPerplexityWithRawResponse:
|
|
@@ -405,7 +400,6 @@ class AsyncPerplexityWithRawResponse:
|
|
|
405
400
|
self.chat = chat.AsyncChatResourceWithRawResponse(client.chat)
|
|
406
401
|
self.async_ = async_.AsyncAsyncResourceWithRawResponse(client.async_)
|
|
407
402
|
self.search = search.AsyncSearchResourceWithRawResponse(client.search)
|
|
408
|
-
self.content = content.AsyncContentResourceWithRawResponse(client.content)
|
|
409
403
|
|
|
410
404
|
|
|
411
405
|
class PerplexityWithStreamedResponse:
|
|
@@ -413,7 +407,6 @@ class PerplexityWithStreamedResponse:
|
|
|
413
407
|
self.chat = chat.ChatResourceWithStreamingResponse(client.chat)
|
|
414
408
|
self.async_ = async_.AsyncResourceWithStreamingResponse(client.async_)
|
|
415
409
|
self.search = search.SearchResourceWithStreamingResponse(client.search)
|
|
416
|
-
self.content = content.ContentResourceWithStreamingResponse(client.content)
|
|
417
410
|
|
|
418
411
|
|
|
419
412
|
class AsyncPerplexityWithStreamedResponse:
|
|
@@ -421,7 +414,6 @@ class AsyncPerplexityWithStreamedResponse:
|
|
|
421
414
|
self.chat = chat.AsyncChatResourceWithStreamingResponse(client.chat)
|
|
422
415
|
self.async_ = async_.AsyncAsyncResourceWithStreamingResponse(client.async_)
|
|
423
416
|
self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
|
|
424
|
-
self.content = content.AsyncContentResourceWithStreamingResponse(client.content)
|
|
425
417
|
|
|
426
418
|
|
|
427
419
|
Client = Perplexity
|
|
@@ -256,7 +256,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
256
256
|
mode: Literal["json", "python"] | str = "python",
|
|
257
257
|
include: IncEx | None = None,
|
|
258
258
|
exclude: IncEx | None = None,
|
|
259
|
-
by_alias: bool =
|
|
259
|
+
by_alias: bool | None = None,
|
|
260
260
|
exclude_unset: bool = False,
|
|
261
261
|
exclude_defaults: bool = False,
|
|
262
262
|
exclude_none: bool = False,
|
|
@@ -264,6 +264,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
264
264
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
265
265
|
context: dict[str, Any] | None = None,
|
|
266
266
|
serialize_as_any: bool = False,
|
|
267
|
+
fallback: Callable[[Any], Any] | None = None,
|
|
267
268
|
) -> dict[str, Any]:
|
|
268
269
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
|
269
270
|
|
|
@@ -295,10 +296,12 @@ class BaseModel(pydantic.BaseModel):
|
|
|
295
296
|
raise ValueError("context is only supported in Pydantic v2")
|
|
296
297
|
if serialize_as_any != False:
|
|
297
298
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
299
|
+
if fallback is not None:
|
|
300
|
+
raise ValueError("fallback is only supported in Pydantic v2")
|
|
298
301
|
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
299
302
|
include=include,
|
|
300
303
|
exclude=exclude,
|
|
301
|
-
by_alias=by_alias,
|
|
304
|
+
by_alias=by_alias if by_alias is not None else False,
|
|
302
305
|
exclude_unset=exclude_unset,
|
|
303
306
|
exclude_defaults=exclude_defaults,
|
|
304
307
|
exclude_none=exclude_none,
|
|
@@ -313,13 +316,14 @@ class BaseModel(pydantic.BaseModel):
|
|
|
313
316
|
indent: int | None = None,
|
|
314
317
|
include: IncEx | None = None,
|
|
315
318
|
exclude: IncEx | None = None,
|
|
316
|
-
by_alias: bool =
|
|
319
|
+
by_alias: bool | None = None,
|
|
317
320
|
exclude_unset: bool = False,
|
|
318
321
|
exclude_defaults: bool = False,
|
|
319
322
|
exclude_none: bool = False,
|
|
320
323
|
round_trip: bool = False,
|
|
321
324
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
322
325
|
context: dict[str, Any] | None = None,
|
|
326
|
+
fallback: Callable[[Any], Any] | None = None,
|
|
323
327
|
serialize_as_any: bool = False,
|
|
324
328
|
) -> str:
|
|
325
329
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json
|
|
@@ -348,11 +352,13 @@ class BaseModel(pydantic.BaseModel):
|
|
|
348
352
|
raise ValueError("context is only supported in Pydantic v2")
|
|
349
353
|
if serialize_as_any != False:
|
|
350
354
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
355
|
+
if fallback is not None:
|
|
356
|
+
raise ValueError("fallback is only supported in Pydantic v2")
|
|
351
357
|
return super().json( # type: ignore[reportDeprecated]
|
|
352
358
|
indent=indent,
|
|
353
359
|
include=include,
|
|
354
360
|
exclude=exclude,
|
|
355
|
-
by_alias=by_alias,
|
|
361
|
+
by_alias=by_alias if by_alias is not None else False,
|
|
356
362
|
exclude_unset=exclude_unset,
|
|
357
363
|
exclude_defaults=exclude_defaults,
|
|
358
364
|
exclude_none=exclude_none,
|
|
@@ -24,14 +24,6 @@ from .search import (
|
|
|
24
24
|
SearchResourceWithStreamingResponse,
|
|
25
25
|
AsyncSearchResourceWithStreamingResponse,
|
|
26
26
|
)
|
|
27
|
-
from .content import (
|
|
28
|
-
ContentResource,
|
|
29
|
-
AsyncContentResource,
|
|
30
|
-
ContentResourceWithRawResponse,
|
|
31
|
-
AsyncContentResourceWithRawResponse,
|
|
32
|
-
ContentResourceWithStreamingResponse,
|
|
33
|
-
AsyncContentResourceWithStreamingResponse,
|
|
34
|
-
)
|
|
35
27
|
|
|
36
28
|
__all__ = [
|
|
37
29
|
"ChatResource",
|
|
@@ -52,10 +44,4 @@ __all__ = [
|
|
|
52
44
|
"AsyncSearchResourceWithRawResponse",
|
|
53
45
|
"SearchResourceWithStreamingResponse",
|
|
54
46
|
"AsyncSearchResourceWithStreamingResponse",
|
|
55
|
-
"ContentResource",
|
|
56
|
-
"AsyncContentResource",
|
|
57
|
-
"ContentResourceWithRawResponse",
|
|
58
|
-
"AsyncContentResourceWithRawResponse",
|
|
59
|
-
"ContentResourceWithStreamingResponse",
|
|
60
|
-
"AsyncContentResourceWithStreamingResponse",
|
|
61
47
|
]
|
|
@@ -83,7 +83,6 @@ class CompletionsResource(SyncAPIResource):
|
|
|
83
83
|
response_metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
|
|
84
84
|
return_images: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
85
85
|
return_related_questions: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
86
|
-
return_videos: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
87
86
|
safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
88
87
|
search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
89
88
|
search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
@@ -161,7 +160,6 @@ class CompletionsResource(SyncAPIResource):
|
|
|
161
160
|
"response_metadata": response_metadata,
|
|
162
161
|
"return_images": return_images,
|
|
163
162
|
"return_related_questions": return_related_questions,
|
|
164
|
-
"return_videos": return_videos,
|
|
165
163
|
"safe_search": safe_search,
|
|
166
164
|
"search_after_date_filter": search_after_date_filter,
|
|
167
165
|
"search_before_date_filter": search_before_date_filter,
|
|
@@ -249,7 +247,6 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
249
247
|
response_metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
|
|
250
248
|
return_images: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
251
249
|
return_related_questions: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
252
|
-
return_videos: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
253
250
|
safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
254
251
|
search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
255
252
|
search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
@@ -327,7 +324,6 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
327
324
|
"response_metadata": response_metadata,
|
|
328
325
|
"return_images": return_images,
|
|
329
326
|
"return_related_questions": return_related_questions,
|
|
330
|
-
"return_videos": return_videos,
|
|
331
327
|
"safe_search": safe_search,
|
|
332
328
|
"search_after_date_filter": search_after_date_filter,
|
|
333
329
|
"search_before_date_filter": search_before_date_filter,
|
|
@@ -48,18 +48,10 @@ class SearchResource(SyncAPIResource):
|
|
|
48
48
|
self,
|
|
49
49
|
*,
|
|
50
50
|
query: Union[str, SequenceNotStr[str]],
|
|
51
|
-
country: Optional[str] | NotGiven = NOT_GIVEN,
|
|
52
|
-
last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
53
|
-
last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
54
51
|
max_results: int | NotGiven = NOT_GIVEN,
|
|
55
52
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
56
53
|
max_tokens_per_page: int | NotGiven = NOT_GIVEN,
|
|
57
|
-
safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
58
|
-
search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
59
|
-
search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
60
|
-
search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
61
54
|
search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
|
|
62
|
-
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
|
|
63
55
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
64
56
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
65
57
|
extra_headers: Headers | None = None,
|
|
@@ -84,18 +76,10 @@ class SearchResource(SyncAPIResource):
|
|
|
84
76
|
body=maybe_transform(
|
|
85
77
|
{
|
|
86
78
|
"query": query,
|
|
87
|
-
"country": country,
|
|
88
|
-
"last_updated_after_filter": last_updated_after_filter,
|
|
89
|
-
"last_updated_before_filter": last_updated_before_filter,
|
|
90
79
|
"max_results": max_results,
|
|
91
80
|
"max_tokens": max_tokens,
|
|
92
81
|
"max_tokens_per_page": max_tokens_per_page,
|
|
93
|
-
"safe_search": safe_search,
|
|
94
|
-
"search_after_date_filter": search_after_date_filter,
|
|
95
|
-
"search_before_date_filter": search_before_date_filter,
|
|
96
|
-
"search_domain_filter": search_domain_filter,
|
|
97
82
|
"search_mode": search_mode,
|
|
98
|
-
"search_recency_filter": search_recency_filter,
|
|
99
83
|
},
|
|
100
84
|
search_create_params.SearchCreateParams,
|
|
101
85
|
),
|
|
@@ -130,18 +114,10 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
130
114
|
self,
|
|
131
115
|
*,
|
|
132
116
|
query: Union[str, SequenceNotStr[str]],
|
|
133
|
-
country: Optional[str] | NotGiven = NOT_GIVEN,
|
|
134
|
-
last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
135
|
-
last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
136
117
|
max_results: int | NotGiven = NOT_GIVEN,
|
|
137
118
|
max_tokens: int | NotGiven = NOT_GIVEN,
|
|
138
119
|
max_tokens_per_page: int | NotGiven = NOT_GIVEN,
|
|
139
|
-
safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
140
|
-
search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
141
|
-
search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
142
|
-
search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
143
120
|
search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
|
|
144
|
-
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
|
|
145
121
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
146
122
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
147
123
|
extra_headers: Headers | None = None,
|
|
@@ -166,18 +142,10 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
166
142
|
body=await async_maybe_transform(
|
|
167
143
|
{
|
|
168
144
|
"query": query,
|
|
169
|
-
"country": country,
|
|
170
|
-
"last_updated_after_filter": last_updated_after_filter,
|
|
171
|
-
"last_updated_before_filter": last_updated_before_filter,
|
|
172
145
|
"max_results": max_results,
|
|
173
146
|
"max_tokens": max_tokens,
|
|
174
147
|
"max_tokens_per_page": max_tokens_per_page,
|
|
175
|
-
"safe_search": safe_search,
|
|
176
|
-
"search_after_date_filter": search_after_date_filter,
|
|
177
|
-
"search_before_date_filter": search_before_date_filter,
|
|
178
|
-
"search_domain_filter": search_domain_filter,
|
|
179
148
|
"search_mode": search_mode,
|
|
180
|
-
"search_recency_filter": search_recency_filter,
|
|
181
149
|
},
|
|
182
150
|
search_create_params.SearchCreateParams,
|
|
183
151
|
),
|
|
@@ -10,6 +10,4 @@ from .shared import (
|
|
|
10
10
|
APIPublicSearchResult as APIPublicSearchResult,
|
|
11
11
|
)
|
|
12
12
|
from .search_create_params import SearchCreateParams as SearchCreateParams
|
|
13
|
-
from .content_create_params import ContentCreateParams as ContentCreateParams
|
|
14
13
|
from .search_create_response import SearchCreateResponse as SearchCreateResponse
|
|
15
|
-
from .content_create_response import ContentCreateResponse as ContentCreateResponse
|
|
@@ -13,26 +13,10 @@ __all__ = ["SearchCreateParams"]
|
|
|
13
13
|
class SearchCreateParams(TypedDict, total=False):
|
|
14
14
|
query: Required[Union[str, SequenceNotStr[str]]]
|
|
15
15
|
|
|
16
|
-
country: Optional[str]
|
|
17
|
-
|
|
18
|
-
last_updated_after_filter: Optional[str]
|
|
19
|
-
|
|
20
|
-
last_updated_before_filter: Optional[str]
|
|
21
|
-
|
|
22
16
|
max_results: int
|
|
23
17
|
|
|
24
18
|
max_tokens: int
|
|
25
19
|
|
|
26
20
|
max_tokens_per_page: int
|
|
27
21
|
|
|
28
|
-
safe_search: Optional[bool]
|
|
29
|
-
|
|
30
|
-
search_after_date_filter: Optional[str]
|
|
31
|
-
|
|
32
|
-
search_before_date_filter: Optional[str]
|
|
33
|
-
|
|
34
|
-
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
35
|
-
|
|
36
22
|
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
37
|
-
|
|
38
|
-
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/tests/api_resources/async_/chat/test_completions.py
RENAMED
|
@@ -139,7 +139,6 @@ class TestCompletions:
|
|
|
139
139
|
"response_metadata": {"foo": "bar"},
|
|
140
140
|
"return_images": True,
|
|
141
141
|
"return_related_questions": True,
|
|
142
|
-
"return_videos": True,
|
|
143
142
|
"safe_search": True,
|
|
144
143
|
"search_after_date_filter": "search_after_date_filter",
|
|
145
144
|
"search_before_date_filter": "search_before_date_filter",
|
|
@@ -440,7 +439,6 @@ class TestAsyncCompletions:
|
|
|
440
439
|
"response_metadata": {"foo": "bar"},
|
|
441
440
|
"return_images": True,
|
|
442
441
|
"return_related_questions": True,
|
|
443
|
-
"return_videos": True,
|
|
444
442
|
"safe_search": True,
|
|
445
443
|
"search_after_date_filter": "search_after_date_filter",
|
|
446
444
|
"search_before_date_filter": "search_before_date_filter",
|
|
@@ -132,7 +132,6 @@ class TestCompletions:
|
|
|
132
132
|
response_metadata={"foo": "bar"},
|
|
133
133
|
return_images=True,
|
|
134
134
|
return_related_questions=True,
|
|
135
|
-
return_videos=True,
|
|
136
135
|
safe_search=True,
|
|
137
136
|
search_after_date_filter="search_after_date_filter",
|
|
138
137
|
search_before_date_filter="search_before_date_filter",
|
|
@@ -340,7 +339,6 @@ class TestAsyncCompletions:
|
|
|
340
339
|
response_metadata={"foo": "bar"},
|
|
341
340
|
return_images=True,
|
|
342
341
|
return_related_questions=True,
|
|
343
|
-
return_videos=True,
|
|
344
342
|
safe_search=True,
|
|
345
343
|
search_after_date_filter="search_after_date_filter",
|
|
346
344
|
search_before_date_filter="search_before_date_filter",
|
|
@@ -30,18 +30,10 @@ class TestSearch:
|
|
|
30
30
|
def test_method_create_with_all_params(self, client: Perplexity) -> None:
|
|
31
31
|
search = client.search.create(
|
|
32
32
|
query="string",
|
|
33
|
-
country="country",
|
|
34
|
-
last_updated_after_filter="last_updated_after_filter",
|
|
35
|
-
last_updated_before_filter="last_updated_before_filter",
|
|
36
33
|
max_results=0,
|
|
37
34
|
max_tokens=0,
|
|
38
35
|
max_tokens_per_page=0,
|
|
39
|
-
safe_search=True,
|
|
40
|
-
search_after_date_filter="search_after_date_filter",
|
|
41
|
-
search_before_date_filter="search_before_date_filter",
|
|
42
|
-
search_domain_filter=["string"],
|
|
43
36
|
search_mode="web",
|
|
44
|
-
search_recency_filter="hour",
|
|
45
37
|
)
|
|
46
38
|
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
47
39
|
|
|
@@ -90,18 +82,10 @@ class TestAsyncSearch:
|
|
|
90
82
|
async def test_method_create_with_all_params(self, async_client: AsyncPerplexity) -> None:
|
|
91
83
|
search = await async_client.search.create(
|
|
92
84
|
query="string",
|
|
93
|
-
country="country",
|
|
94
|
-
last_updated_after_filter="last_updated_after_filter",
|
|
95
|
-
last_updated_before_filter="last_updated_before_filter",
|
|
96
85
|
max_results=0,
|
|
97
86
|
max_tokens=0,
|
|
98
87
|
max_tokens_per_page=0,
|
|
99
|
-
safe_search=True,
|
|
100
|
-
search_after_date_filter="search_after_date_filter",
|
|
101
|
-
search_before_date_filter="search_before_date_filter",
|
|
102
|
-
search_domain_filter=["string"],
|
|
103
88
|
search_mode="web",
|
|
104
|
-
search_recency_filter="hour",
|
|
105
89
|
)
|
|
106
90
|
assert_matches_type(SearchCreateResponse, search, path=["response"])
|
|
107
91
|
|
|
@@ -1,163 +0,0 @@
|
|
|
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
|
-
)
|
|
@@ -1,13 +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 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]]
|
|
@@ -1,23 +0,0 @@
|
|
|
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]
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import os
|
|
6
|
-
from typing import Any, cast
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
|
|
10
|
-
from perplexity import Perplexity, AsyncPerplexity
|
|
11
|
-
from tests.utils import assert_matches_type
|
|
12
|
-
from perplexity.types import ContentCreateResponse
|
|
13
|
-
|
|
14
|
-
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class TestContent:
|
|
18
|
-
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
|
19
|
-
|
|
20
|
-
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
21
|
-
@parametrize
|
|
22
|
-
def test_method_create(self, client: Perplexity) -> None:
|
|
23
|
-
content = client.content.create(
|
|
24
|
-
urls=["string"],
|
|
25
|
-
)
|
|
26
|
-
assert_matches_type(ContentCreateResponse, content, path=["response"])
|
|
27
|
-
|
|
28
|
-
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
29
|
-
@parametrize
|
|
30
|
-
def test_raw_response_create(self, client: Perplexity) -> None:
|
|
31
|
-
response = client.content.with_raw_response.create(
|
|
32
|
-
urls=["string"],
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
assert response.is_closed is True
|
|
36
|
-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
37
|
-
content = response.parse()
|
|
38
|
-
assert_matches_type(ContentCreateResponse, content, path=["response"])
|
|
39
|
-
|
|
40
|
-
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
41
|
-
@parametrize
|
|
42
|
-
def test_streaming_response_create(self, client: Perplexity) -> None:
|
|
43
|
-
with client.content.with_streaming_response.create(
|
|
44
|
-
urls=["string"],
|
|
45
|
-
) as response:
|
|
46
|
-
assert not response.is_closed
|
|
47
|
-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
48
|
-
|
|
49
|
-
content = response.parse()
|
|
50
|
-
assert_matches_type(ContentCreateResponse, content, path=["response"])
|
|
51
|
-
|
|
52
|
-
assert cast(Any, response.is_closed) is True
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class TestAsyncContent:
|
|
56
|
-
parametrize = pytest.mark.parametrize(
|
|
57
|
-
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
61
|
-
@parametrize
|
|
62
|
-
async def test_method_create(self, async_client: AsyncPerplexity) -> None:
|
|
63
|
-
content = await async_client.content.create(
|
|
64
|
-
urls=["string"],
|
|
65
|
-
)
|
|
66
|
-
assert_matches_type(ContentCreateResponse, content, path=["response"])
|
|
67
|
-
|
|
68
|
-
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
69
|
-
@parametrize
|
|
70
|
-
async def test_raw_response_create(self, async_client: AsyncPerplexity) -> None:
|
|
71
|
-
response = await async_client.content.with_raw_response.create(
|
|
72
|
-
urls=["string"],
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
assert response.is_closed is True
|
|
76
|
-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
77
|
-
content = await response.parse()
|
|
78
|
-
assert_matches_type(ContentCreateResponse, content, path=["response"])
|
|
79
|
-
|
|
80
|
-
@pytest.mark.skip(reason="Prism tests are disabled")
|
|
81
|
-
@parametrize
|
|
82
|
-
async def test_streaming_response_create(self, async_client: AsyncPerplexity) -> None:
|
|
83
|
-
async with async_client.content.with_streaming_response.create(
|
|
84
|
-
urls=["string"],
|
|
85
|
-
) as response:
|
|
86
|
-
assert not response.is_closed
|
|
87
|
-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
88
|
-
|
|
89
|
-
content = await response.parse()
|
|
90
|
-
assert_matches_type(ContentCreateResponse, content, path=["response"])
|
|
91
|
-
|
|
92
|
-
assert cast(Any, response.is_closed) is True
|
|
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
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/resources/async_/chat/completions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/async_/chat/completion_get_params.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/chat/completion_create_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/api_public_search_result.py
RENAMED
|
File without changes
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/chat_message_input.py
RENAMED
|
File without changes
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared/chat_message_output.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{perplexityai-0.8.0 → perplexityai-0.10.0}/src/perplexity/types/shared_params/chat_message_input.py
RENAMED
|
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
|