perplexityai 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of perplexityai might be problematic. Click here for more details.

Files changed (40) hide show
  1. perplexity/_client.py +18 -0
  2. perplexity/_version.py +1 -1
  3. perplexity/resources/__init__.py +28 -0
  4. perplexity/resources/async_/__init__.py +33 -0
  5. perplexity/resources/async_/async_.py +102 -0
  6. perplexity/resources/async_/chat/__init__.py +33 -0
  7. perplexity/resources/async_/chat/chat.py +102 -0
  8. perplexity/resources/async_/chat/completions.py +347 -0
  9. perplexity/resources/chat/__init__.py +33 -0
  10. perplexity/resources/chat/chat.py +102 -0
  11. perplexity/resources/chat/completions.py +295 -0
  12. perplexity/resources/content.py +6 -2
  13. perplexity/resources/search.py +60 -2
  14. perplexity/types/__init__.py +6 -0
  15. perplexity/types/async_/__init__.py +3 -0
  16. perplexity/types/async_/chat/__init__.py +9 -0
  17. perplexity/types/async_/chat/completion_create_params.py +94 -0
  18. perplexity/types/async_/chat/completion_create_response.py +54 -0
  19. perplexity/types/async_/chat/completion_get_response.py +54 -0
  20. perplexity/types/async_/chat/completion_list_params.py +15 -0
  21. perplexity/types/async_/chat/completion_list_response.py +31 -0
  22. perplexity/types/chat/__init__.py +6 -0
  23. perplexity/types/chat/completion_create_params.py +90 -0
  24. perplexity/types/chat/completion_create_response.py +30 -0
  25. perplexity/types/content_create_params.py +1 -0
  26. perplexity/types/content_create_response.py +6 -0
  27. perplexity/types/search_create_params.py +24 -0
  28. perplexity/types/search_create_response.py +7 -0
  29. perplexity/types/shared/__init__.py +6 -0
  30. perplexity/types/shared/chat_choice.py +17 -0
  31. perplexity/types/shared/chat_message.py +31 -0
  32. perplexity/types/shared/search_result.py +15 -0
  33. perplexity/types/shared/usage_info.py +23 -0
  34. perplexity/types/shared_params/__init__.py +3 -0
  35. perplexity/types/shared_params/chat_message.py +31 -0
  36. {perplexityai-0.6.0.dist-info → perplexityai-0.7.0.dist-info}/METADATA +90 -22
  37. perplexityai-0.7.0.dist-info/RECORD +65 -0
  38. perplexityai-0.6.0.dist-info/RECORD +0 -40
  39. {perplexityai-0.6.0.dist-info → perplexityai-0.7.0.dist-info}/WHEEL +0 -0
  40. {perplexityai-0.6.0.dist-info → perplexityai-0.7.0.dist-info}/licenses/LICENSE +0 -0
perplexity/_client.py CHANGED
@@ -29,6 +29,8 @@ from ._base_client import (
29
29
  SyncAPIClient,
30
30
  AsyncAPIClient,
31
31
  )
32
+ from .resources.chat import chat
33
+ from .resources.async_ import async_
32
34
 
33
35
  __all__ = [
34
36
  "Timeout",
@@ -43,6 +45,8 @@ __all__ = [
43
45
 
44
46
 
45
47
  class Perplexity(SyncAPIClient):
48
+ chat: chat.ChatResource
49
+ async_: async_.AsyncResource
46
50
  search: search.SearchResource
47
51
  content: content.ContentResource
48
52
  with_raw_response: PerplexityWithRawResponse
@@ -102,6 +106,8 @@ class Perplexity(SyncAPIClient):
102
106
  _strict_response_validation=_strict_response_validation,
103
107
  )
104
108
 
109
+ self.chat = chat.ChatResource(self)
110
+ self.async_ = async_.AsyncResource(self)
105
111
  self.search = search.SearchResource(self)
106
112
  self.content = content.ContentResource(self)
107
113
  self.with_raw_response = PerplexityWithRawResponse(self)
@@ -213,6 +219,8 @@ class Perplexity(SyncAPIClient):
213
219
 
214
220
 
215
221
  class AsyncPerplexity(AsyncAPIClient):
222
+ chat: chat.AsyncChatResource
223
+ async_: async_.AsyncAsyncResource
216
224
  search: search.AsyncSearchResource
217
225
  content: content.AsyncContentResource
218
226
  with_raw_response: AsyncPerplexityWithRawResponse
@@ -272,6 +280,8 @@ class AsyncPerplexity(AsyncAPIClient):
272
280
  _strict_response_validation=_strict_response_validation,
273
281
  )
274
282
 
283
+ self.chat = chat.AsyncChatResource(self)
284
+ self.async_ = async_.AsyncAsyncResource(self)
275
285
  self.search = search.AsyncSearchResource(self)
276
286
  self.content = content.AsyncContentResource(self)
277
287
  self.with_raw_response = AsyncPerplexityWithRawResponse(self)
@@ -384,24 +394,32 @@ class AsyncPerplexity(AsyncAPIClient):
384
394
 
385
395
  class PerplexityWithRawResponse:
386
396
  def __init__(self, client: Perplexity) -> None:
397
+ self.chat = chat.ChatResourceWithRawResponse(client.chat)
398
+ self.async_ = async_.AsyncResourceWithRawResponse(client.async_)
387
399
  self.search = search.SearchResourceWithRawResponse(client.search)
388
400
  self.content = content.ContentResourceWithRawResponse(client.content)
389
401
 
390
402
 
391
403
  class AsyncPerplexityWithRawResponse:
392
404
  def __init__(self, client: AsyncPerplexity) -> None:
405
+ self.chat = chat.AsyncChatResourceWithRawResponse(client.chat)
406
+ self.async_ = async_.AsyncAsyncResourceWithRawResponse(client.async_)
393
407
  self.search = search.AsyncSearchResourceWithRawResponse(client.search)
394
408
  self.content = content.AsyncContentResourceWithRawResponse(client.content)
395
409
 
396
410
 
397
411
  class PerplexityWithStreamedResponse:
398
412
  def __init__(self, client: Perplexity) -> None:
413
+ self.chat = chat.ChatResourceWithStreamingResponse(client.chat)
414
+ self.async_ = async_.AsyncResourceWithStreamingResponse(client.async_)
399
415
  self.search = search.SearchResourceWithStreamingResponse(client.search)
400
416
  self.content = content.ContentResourceWithStreamingResponse(client.content)
401
417
 
402
418
 
403
419
  class AsyncPerplexityWithStreamedResponse:
404
420
  def __init__(self, client: AsyncPerplexity) -> None:
421
+ self.chat = chat.AsyncChatResourceWithStreamingResponse(client.chat)
422
+ self.async_ = async_.AsyncAsyncResourceWithStreamingResponse(client.async_)
405
423
  self.search = search.AsyncSearchResourceWithStreamingResponse(client.search)
406
424
  self.content = content.AsyncContentResourceWithStreamingResponse(client.content)
407
425
 
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.6.0" # x-release-please-version
4
+ __version__ = "0.7.0" # x-release-please-version
@@ -1,5 +1,21 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .chat import (
4
+ ChatResource,
5
+ AsyncChatResource,
6
+ ChatResourceWithRawResponse,
7
+ AsyncChatResourceWithRawResponse,
8
+ ChatResourceWithStreamingResponse,
9
+ AsyncChatResourceWithStreamingResponse,
10
+ )
11
+ from .async_ import (
12
+ AsyncResource,
13
+ AsyncAsyncResource,
14
+ AsyncResourceWithRawResponse,
15
+ AsyncAsyncResourceWithRawResponse,
16
+ AsyncResourceWithStreamingResponse,
17
+ AsyncAsyncResourceWithStreamingResponse,
18
+ )
3
19
  from .search import (
4
20
  SearchResource,
5
21
  AsyncSearchResource,
@@ -18,6 +34,18 @@ from .content import (
18
34
  )
19
35
 
20
36
  __all__ = [
37
+ "ChatResource",
38
+ "AsyncChatResource",
39
+ "ChatResourceWithRawResponse",
40
+ "AsyncChatResourceWithRawResponse",
41
+ "ChatResourceWithStreamingResponse",
42
+ "AsyncChatResourceWithStreamingResponse",
43
+ "AsyncResource",
44
+ "AsyncAsyncResource",
45
+ "AsyncResourceWithRawResponse",
46
+ "AsyncAsyncResourceWithRawResponse",
47
+ "AsyncResourceWithStreamingResponse",
48
+ "AsyncAsyncResourceWithStreamingResponse",
21
49
  "SearchResource",
22
50
  "AsyncSearchResource",
23
51
  "SearchResourceWithRawResponse",
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .chat import (
4
+ ChatResource,
5
+ AsyncChatResource,
6
+ ChatResourceWithRawResponse,
7
+ AsyncChatResourceWithRawResponse,
8
+ ChatResourceWithStreamingResponse,
9
+ AsyncChatResourceWithStreamingResponse,
10
+ )
11
+ from .async_ import (
12
+ AsyncResource,
13
+ AsyncAsyncResource,
14
+ AsyncResourceWithRawResponse,
15
+ AsyncAsyncResourceWithRawResponse,
16
+ AsyncResourceWithStreamingResponse,
17
+ AsyncAsyncResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "ChatResource",
22
+ "AsyncChatResource",
23
+ "ChatResourceWithRawResponse",
24
+ "AsyncChatResourceWithRawResponse",
25
+ "ChatResourceWithStreamingResponse",
26
+ "AsyncChatResourceWithStreamingResponse",
27
+ "AsyncResource",
28
+ "AsyncAsyncResource",
29
+ "AsyncResourceWithRawResponse",
30
+ "AsyncAsyncResourceWithRawResponse",
31
+ "AsyncResourceWithStreamingResponse",
32
+ "AsyncAsyncResourceWithStreamingResponse",
33
+ ]
@@ -0,0 +1,102 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from ..._compat import cached_property
6
+ from .chat.chat import (
7
+ ChatResource,
8
+ AsyncChatResource,
9
+ ChatResourceWithRawResponse,
10
+ AsyncChatResourceWithRawResponse,
11
+ ChatResourceWithStreamingResponse,
12
+ AsyncChatResourceWithStreamingResponse,
13
+ )
14
+ from ..._resource import SyncAPIResource, AsyncAPIResource
15
+
16
+ __all__ = ["AsyncResource", "AsyncAsyncResource"]
17
+
18
+
19
+ class AsyncResource(SyncAPIResource):
20
+ @cached_property
21
+ def chat(self) -> ChatResource:
22
+ return ChatResource(self._client)
23
+
24
+ @cached_property
25
+ def with_raw_response(self) -> AsyncResourceWithRawResponse:
26
+ """
27
+ This property can be used as a prefix for any HTTP method call to return
28
+ the raw response object instead of the parsed content.
29
+
30
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
31
+ """
32
+ return AsyncResourceWithRawResponse(self)
33
+
34
+ @cached_property
35
+ def with_streaming_response(self) -> AsyncResourceWithStreamingResponse:
36
+ """
37
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
+
39
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
40
+ """
41
+ return AsyncResourceWithStreamingResponse(self)
42
+
43
+
44
+ class AsyncAsyncResource(AsyncAPIResource):
45
+ @cached_property
46
+ def chat(self) -> AsyncChatResource:
47
+ return AsyncChatResource(self._client)
48
+
49
+ @cached_property
50
+ def with_raw_response(self) -> AsyncAsyncResourceWithRawResponse:
51
+ """
52
+ This property can be used as a prefix for any HTTP method call to return
53
+ the raw response object instead of the parsed content.
54
+
55
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
56
+ """
57
+ return AsyncAsyncResourceWithRawResponse(self)
58
+
59
+ @cached_property
60
+ def with_streaming_response(self) -> AsyncAsyncResourceWithStreamingResponse:
61
+ """
62
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
+
64
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
65
+ """
66
+ return AsyncAsyncResourceWithStreamingResponse(self)
67
+
68
+
69
+ class AsyncResourceWithRawResponse:
70
+ def __init__(self, async_: AsyncResource) -> None:
71
+ self._async_ = async_
72
+
73
+ @cached_property
74
+ def chat(self) -> ChatResourceWithRawResponse:
75
+ return ChatResourceWithRawResponse(self._async_.chat)
76
+
77
+
78
+ class AsyncAsyncResourceWithRawResponse:
79
+ def __init__(self, async_: AsyncAsyncResource) -> None:
80
+ self._async_ = async_
81
+
82
+ @cached_property
83
+ def chat(self) -> AsyncChatResourceWithRawResponse:
84
+ return AsyncChatResourceWithRawResponse(self._async_.chat)
85
+
86
+
87
+ class AsyncResourceWithStreamingResponse:
88
+ def __init__(self, async_: AsyncResource) -> None:
89
+ self._async_ = async_
90
+
91
+ @cached_property
92
+ def chat(self) -> ChatResourceWithStreamingResponse:
93
+ return ChatResourceWithStreamingResponse(self._async_.chat)
94
+
95
+
96
+ class AsyncAsyncResourceWithStreamingResponse:
97
+ def __init__(self, async_: AsyncAsyncResource) -> None:
98
+ self._async_ = async_
99
+
100
+ @cached_property
101
+ def chat(self) -> AsyncChatResourceWithStreamingResponse:
102
+ return AsyncChatResourceWithStreamingResponse(self._async_.chat)
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .chat import (
4
+ ChatResource,
5
+ AsyncChatResource,
6
+ ChatResourceWithRawResponse,
7
+ AsyncChatResourceWithRawResponse,
8
+ ChatResourceWithStreamingResponse,
9
+ AsyncChatResourceWithStreamingResponse,
10
+ )
11
+ from .completions import (
12
+ CompletionsResource,
13
+ AsyncCompletionsResource,
14
+ CompletionsResourceWithRawResponse,
15
+ AsyncCompletionsResourceWithRawResponse,
16
+ CompletionsResourceWithStreamingResponse,
17
+ AsyncCompletionsResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "CompletionsResource",
22
+ "AsyncCompletionsResource",
23
+ "CompletionsResourceWithRawResponse",
24
+ "AsyncCompletionsResourceWithRawResponse",
25
+ "CompletionsResourceWithStreamingResponse",
26
+ "AsyncCompletionsResourceWithStreamingResponse",
27
+ "ChatResource",
28
+ "AsyncChatResource",
29
+ "ChatResourceWithRawResponse",
30
+ "AsyncChatResourceWithRawResponse",
31
+ "ChatResourceWithStreamingResponse",
32
+ "AsyncChatResourceWithStreamingResponse",
33
+ ]
@@ -0,0 +1,102 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from ...._compat import cached_property
6
+ from .completions import (
7
+ CompletionsResource,
8
+ AsyncCompletionsResource,
9
+ CompletionsResourceWithRawResponse,
10
+ AsyncCompletionsResourceWithRawResponse,
11
+ CompletionsResourceWithStreamingResponse,
12
+ AsyncCompletionsResourceWithStreamingResponse,
13
+ )
14
+ from ...._resource import SyncAPIResource, AsyncAPIResource
15
+
16
+ __all__ = ["ChatResource", "AsyncChatResource"]
17
+
18
+
19
+ class ChatResource(SyncAPIResource):
20
+ @cached_property
21
+ def completions(self) -> CompletionsResource:
22
+ return CompletionsResource(self._client)
23
+
24
+ @cached_property
25
+ def with_raw_response(self) -> ChatResourceWithRawResponse:
26
+ """
27
+ This property can be used as a prefix for any HTTP method call to return
28
+ the raw response object instead of the parsed content.
29
+
30
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
31
+ """
32
+ return ChatResourceWithRawResponse(self)
33
+
34
+ @cached_property
35
+ def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
36
+ """
37
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
+
39
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
40
+ """
41
+ return ChatResourceWithStreamingResponse(self)
42
+
43
+
44
+ class AsyncChatResource(AsyncAPIResource):
45
+ @cached_property
46
+ def completions(self) -> AsyncCompletionsResource:
47
+ return AsyncCompletionsResource(self._client)
48
+
49
+ @cached_property
50
+ def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
51
+ """
52
+ This property can be used as a prefix for any HTTP method call to return
53
+ the raw response object instead of the parsed content.
54
+
55
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
56
+ """
57
+ return AsyncChatResourceWithRawResponse(self)
58
+
59
+ @cached_property
60
+ def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
61
+ """
62
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
+
64
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
65
+ """
66
+ return AsyncChatResourceWithStreamingResponse(self)
67
+
68
+
69
+ class ChatResourceWithRawResponse:
70
+ def __init__(self, chat: ChatResource) -> None:
71
+ self._chat = chat
72
+
73
+ @cached_property
74
+ def completions(self) -> CompletionsResourceWithRawResponse:
75
+ return CompletionsResourceWithRawResponse(self._chat.completions)
76
+
77
+
78
+ class AsyncChatResourceWithRawResponse:
79
+ def __init__(self, chat: AsyncChatResource) -> None:
80
+ self._chat = chat
81
+
82
+ @cached_property
83
+ def completions(self) -> AsyncCompletionsResourceWithRawResponse:
84
+ return AsyncCompletionsResourceWithRawResponse(self._chat.completions)
85
+
86
+
87
+ class ChatResourceWithStreamingResponse:
88
+ def __init__(self, chat: ChatResource) -> None:
89
+ self._chat = chat
90
+
91
+ @cached_property
92
+ def completions(self) -> CompletionsResourceWithStreamingResponse:
93
+ return CompletionsResourceWithStreamingResponse(self._chat.completions)
94
+
95
+
96
+ class AsyncChatResourceWithStreamingResponse:
97
+ def __init__(self, chat: AsyncChatResource) -> None:
98
+ self._chat = chat
99
+
100
+ @cached_property
101
+ def completions(self) -> AsyncCompletionsResourceWithStreamingResponse:
102
+ return AsyncCompletionsResourceWithStreamingResponse(self._chat.completions)