perplexityai 0.7.2__py3-none-any.whl → 0.9.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 (37) hide show
  1. perplexity/_client.py +1 -9
  2. perplexity/_models.py +10 -4
  3. perplexity/_version.py +1 -1
  4. perplexity/resources/__init__.py +0 -14
  5. perplexity/resources/async_/chat/completions.py +90 -76
  6. perplexity/resources/chat/completions.py +174 -80
  7. perplexity/resources/search.py +2 -60
  8. perplexity/types/__init__.py +4 -5
  9. perplexity/types/async_/chat/__init__.py +1 -1
  10. perplexity/types/async_/chat/completion_create_params.py +185 -40
  11. perplexity/types/async_/chat/completion_create_response.py +13 -13
  12. perplexity/types/async_/chat/completion_get_params.py +23 -0
  13. perplexity/types/async_/chat/completion_get_response.py +13 -13
  14. perplexity/types/async_/chat/completion_list_response.py +1 -1
  15. perplexity/types/chat/completion_create_params.py +180 -40
  16. perplexity/types/chat/completion_create_response.py +13 -10
  17. perplexity/types/search_create_params.py +0 -24
  18. perplexity/types/search_create_response.py +0 -7
  19. perplexity/types/shared/__init__.py +4 -3
  20. perplexity/types/shared/{search_result.py → api_public_search_result.py} +6 -2
  21. perplexity/types/shared/chat_message_input.py +212 -0
  22. perplexity/types/shared/chat_message_output.py +212 -0
  23. perplexity/types/shared/{chat_choice.py → choice.py} +6 -4
  24. perplexity/types/shared/usage_info.py +19 -1
  25. perplexity/types/shared_params/__init__.py +2 -1
  26. perplexity/types/shared_params/api_public_search_result.py +20 -0
  27. perplexity/types/shared_params/chat_message_input.py +216 -0
  28. {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/METADATA +4 -4
  29. {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/RECORD +31 -32
  30. perplexity/resources/content.py +0 -167
  31. perplexity/types/async_/chat/completion_list_params.py +0 -15
  32. perplexity/types/content_create_params.py +0 -14
  33. perplexity/types/content_create_response.py +0 -29
  34. perplexity/types/shared/chat_message.py +0 -31
  35. perplexity/types/shared_params/chat_message.py +0 -31
  36. {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/WHEEL +0 -0
  37. {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,167 +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
- Retrieve the full content from specified URLs
57
-
58
- Args:
59
- urls: List of URLs to retrieve content from
60
-
61
- extra_headers: Send extra headers
62
-
63
- extra_query: Add additional query parameters to the request
64
-
65
- extra_body: Add additional JSON properties to the request
66
-
67
- timeout: Override the client-level default timeout for this request, in seconds
68
- """
69
- return self._post(
70
- "/content",
71
- body=maybe_transform({"urls": urls}, content_create_params.ContentCreateParams),
72
- options=make_request_options(
73
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
74
- ),
75
- cast_to=ContentCreateResponse,
76
- )
77
-
78
-
79
- class AsyncContentResource(AsyncAPIResource):
80
- @cached_property
81
- def with_raw_response(self) -> AsyncContentResourceWithRawResponse:
82
- """
83
- This property can be used as a prefix for any HTTP method call to return
84
- the raw response object instead of the parsed content.
85
-
86
- For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
87
- """
88
- return AsyncContentResourceWithRawResponse(self)
89
-
90
- @cached_property
91
- def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse:
92
- """
93
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
94
-
95
- For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
96
- """
97
- return AsyncContentResourceWithStreamingResponse(self)
98
-
99
- async def create(
100
- self,
101
- *,
102
- urls: SequenceNotStr[str],
103
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
104
- # The extra values given here take precedence over values defined on the client or passed to this method.
105
- extra_headers: Headers | None = None,
106
- extra_query: Query | None = None,
107
- extra_body: Body | None = None,
108
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
109
- ) -> ContentCreateResponse:
110
- """
111
- Retrieve the full content from specified URLs
112
-
113
- Args:
114
- urls: List of URLs to retrieve content from
115
-
116
- extra_headers: Send extra headers
117
-
118
- extra_query: Add additional query parameters to the request
119
-
120
- extra_body: Add additional JSON properties to the request
121
-
122
- timeout: Override the client-level default timeout for this request, in seconds
123
- """
124
- return await self._post(
125
- "/content",
126
- body=await async_maybe_transform({"urls": urls}, content_create_params.ContentCreateParams),
127
- options=make_request_options(
128
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
129
- ),
130
- cast_to=ContentCreateResponse,
131
- )
132
-
133
-
134
- class ContentResourceWithRawResponse:
135
- def __init__(self, content: ContentResource) -> None:
136
- self._content = content
137
-
138
- self.create = to_raw_response_wrapper(
139
- content.create,
140
- )
141
-
142
-
143
- class AsyncContentResourceWithRawResponse:
144
- def __init__(self, content: AsyncContentResource) -> None:
145
- self._content = content
146
-
147
- self.create = async_to_raw_response_wrapper(
148
- content.create,
149
- )
150
-
151
-
152
- class ContentResourceWithStreamingResponse:
153
- def __init__(self, content: ContentResource) -> None:
154
- self._content = content
155
-
156
- self.create = to_streamed_response_wrapper(
157
- content.create,
158
- )
159
-
160
-
161
- class AsyncContentResourceWithStreamingResponse:
162
- def __init__(self, content: AsyncContentResource) -> None:
163
- self._content = content
164
-
165
- self.create = async_to_streamed_response_wrapper(
166
- content.create,
167
- )
@@ -1,15 +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 TypedDict
6
-
7
- __all__ = ["CompletionListParams"]
8
-
9
-
10
- class CompletionListParams(TypedDict, total=False):
11
- limit: int
12
- """Maximum number of requests to return"""
13
-
14
- next_token: str
15
- """Token for fetching the next page of results"""
@@ -1,14 +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]]
14
- """List of URLs to retrieve content from"""
@@ -1,29 +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
- """The full text content of the web page or document"""
13
-
14
- title: str
15
- """The title of the web page or document"""
16
-
17
- url: str
18
- """The URL of the web page or document"""
19
-
20
- date: Optional[str] = None
21
- """The publication date of the content (if available)"""
22
-
23
-
24
- class ContentCreateResponse(BaseModel):
25
- id: str
26
- """Unique identifier for this content retrieval request"""
27
-
28
- results: List[Result]
29
- """Array of content objects retrieved from the requested URLs"""
@@ -1,31 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from typing import List, Union, Optional
4
- from typing_extensions import Literal
5
-
6
- from ..._models import BaseModel
7
-
8
- __all__ = ["ChatMessage", "ContentMultipartContent", "ContentMultipartContentImageURL"]
9
-
10
-
11
- class ContentMultipartContentImageURL(BaseModel):
12
- url: str
13
- """URL of the image (base64 or HTTPS)"""
14
-
15
-
16
- class ContentMultipartContent(BaseModel):
17
- type: Literal["text", "image_url"]
18
- """The type of content"""
19
-
20
- image_url: Optional[ContentMultipartContentImageURL] = None
21
-
22
- text: Optional[str] = None
23
- """Text content"""
24
-
25
-
26
- class ChatMessage(BaseModel):
27
- content: Union[str, List[ContentMultipartContent]]
28
- """The content of the message"""
29
-
30
- role: Literal["system", "user", "assistant"]
31
- """The role of the message author"""
@@ -1,31 +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 import Union, Iterable, Optional
6
- from typing_extensions import Literal, Required, TypedDict
7
-
8
- __all__ = ["ChatMessage", "ContentMultipartContent", "ContentMultipartContentImageURL"]
9
-
10
-
11
- class ContentMultipartContentImageURL(TypedDict, total=False):
12
- url: Required[str]
13
- """URL of the image (base64 or HTTPS)"""
14
-
15
-
16
- class ContentMultipartContent(TypedDict, total=False):
17
- type: Required[Literal["text", "image_url"]]
18
- """The type of content"""
19
-
20
- image_url: Optional[ContentMultipartContentImageURL]
21
-
22
- text: Optional[str]
23
- """Text content"""
24
-
25
-
26
- class ChatMessage(TypedDict, total=False):
27
- content: Required[Union[str, Iterable[ContentMultipartContent]]]
28
- """The content of the message"""
29
-
30
- role: Required[Literal["system", "user", "assistant"]]
31
- """The role of the message author"""