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.
- perplexity/_client.py +1 -9
- perplexity/_models.py +10 -4
- perplexity/_version.py +1 -1
- perplexity/resources/__init__.py +0 -14
- perplexity/resources/async_/chat/completions.py +90 -76
- perplexity/resources/chat/completions.py +174 -80
- perplexity/resources/search.py +2 -60
- perplexity/types/__init__.py +4 -5
- perplexity/types/async_/chat/__init__.py +1 -1
- perplexity/types/async_/chat/completion_create_params.py +185 -40
- perplexity/types/async_/chat/completion_create_response.py +13 -13
- perplexity/types/async_/chat/completion_get_params.py +23 -0
- perplexity/types/async_/chat/completion_get_response.py +13 -13
- perplexity/types/async_/chat/completion_list_response.py +1 -1
- perplexity/types/chat/completion_create_params.py +180 -40
- perplexity/types/chat/completion_create_response.py +13 -10
- perplexity/types/search_create_params.py +0 -24
- perplexity/types/search_create_response.py +0 -7
- perplexity/types/shared/__init__.py +4 -3
- perplexity/types/shared/{search_result.py → api_public_search_result.py} +6 -2
- perplexity/types/shared/chat_message_input.py +212 -0
- perplexity/types/shared/chat_message_output.py +212 -0
- perplexity/types/shared/{chat_choice.py → choice.py} +6 -4
- perplexity/types/shared/usage_info.py +19 -1
- perplexity/types/shared_params/__init__.py +2 -1
- perplexity/types/shared_params/api_public_search_result.py +20 -0
- perplexity/types/shared_params/chat_message_input.py +216 -0
- {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/METADATA +4 -4
- {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/RECORD +31 -32
- perplexity/resources/content.py +0 -167
- perplexity/types/async_/chat/completion_list_params.py +0 -15
- perplexity/types/content_create_params.py +0 -14
- perplexity/types/content_create_response.py +0 -29
- perplexity/types/shared/chat_message.py +0 -31
- perplexity/types/shared_params/chat_message.py +0 -31
- {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/WHEEL +0 -0
- {perplexityai-0.7.2.dist-info → perplexityai-0.9.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,93 +2,238 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Iterable, Optional
|
|
6
|
-
from typing_extensions import Literal, Required, TypedDict
|
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
|
7
7
|
|
|
8
8
|
from ...._types import SequenceNotStr
|
|
9
|
-
from ...shared_params.
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
9
|
+
from ...shared_params.chat_message_input import ChatMessageInput
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"CompletionCreateParams",
|
|
13
|
+
"Request",
|
|
14
|
+
"RequestDebugParams",
|
|
15
|
+
"RequestResponseFormat",
|
|
16
|
+
"RequestResponseFormatResponseFormatText",
|
|
17
|
+
"RequestResponseFormatResponseFormatJsonSchema",
|
|
18
|
+
"RequestResponseFormatResponseFormatJsonSchemaJsonSchema",
|
|
19
|
+
"RequestResponseFormatResponseFormatRegex",
|
|
20
|
+
"RequestResponseFormatResponseFormatRegexRegex",
|
|
21
|
+
"RequestTool",
|
|
22
|
+
"RequestToolFunction",
|
|
23
|
+
"RequestToolFunctionParameters",
|
|
24
|
+
"RequestWebSearchOptions",
|
|
25
|
+
"RequestWebSearchOptionsUserLocation",
|
|
26
|
+
]
|
|
12
27
|
|
|
13
28
|
|
|
14
29
|
class CompletionCreateParams(TypedDict, total=False):
|
|
15
30
|
request: Required[Request]
|
|
16
31
|
|
|
32
|
+
idempotency_key: Optional[str]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RequestDebugParams(TypedDict, total=False):
|
|
36
|
+
summarizer_model_override: Optional[str]
|
|
37
|
+
|
|
38
|
+
summarizer_prompt_override: Optional[str]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RequestResponseFormatResponseFormatText(TypedDict, total=False):
|
|
42
|
+
type: Required[Literal["text"]]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class RequestResponseFormatResponseFormatJsonSchemaJsonSchema(TypedDict, total=False):
|
|
46
|
+
schema: Required[Dict[str, object]]
|
|
47
|
+
|
|
48
|
+
description: Optional[str]
|
|
49
|
+
|
|
50
|
+
name: Optional[str]
|
|
51
|
+
|
|
52
|
+
strict: Optional[bool]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class RequestResponseFormatResponseFormatJsonSchema(TypedDict, total=False):
|
|
56
|
+
json_schema: Required[RequestResponseFormatResponseFormatJsonSchemaJsonSchema]
|
|
57
|
+
|
|
58
|
+
type: Required[Literal["json_schema"]]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class RequestResponseFormatResponseFormatRegexRegex(TypedDict, total=False):
|
|
62
|
+
regex: Required[str]
|
|
63
|
+
|
|
64
|
+
description: Optional[str]
|
|
65
|
+
|
|
66
|
+
name: Optional[str]
|
|
67
|
+
|
|
68
|
+
strict: Optional[bool]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class RequestResponseFormatResponseFormatRegex(TypedDict, total=False):
|
|
72
|
+
regex: Required[RequestResponseFormatResponseFormatRegexRegex]
|
|
73
|
+
|
|
74
|
+
type: Required[Literal["regex"]]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
RequestResponseFormat: TypeAlias = Union[
|
|
78
|
+
RequestResponseFormatResponseFormatText,
|
|
79
|
+
RequestResponseFormatResponseFormatJsonSchema,
|
|
80
|
+
RequestResponseFormatResponseFormatRegex,
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class RequestToolFunctionParameters(TypedDict, total=False):
|
|
85
|
+
properties: Required[Dict[str, object]]
|
|
86
|
+
|
|
87
|
+
type: Required[str]
|
|
88
|
+
|
|
89
|
+
additional_properties: Optional[bool]
|
|
90
|
+
|
|
91
|
+
required: Optional[SequenceNotStr[str]]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class RequestToolFunction(TypedDict, total=False):
|
|
95
|
+
description: Required[str]
|
|
96
|
+
|
|
97
|
+
name: Required[str]
|
|
98
|
+
|
|
99
|
+
parameters: Required[RequestToolFunctionParameters]
|
|
100
|
+
|
|
101
|
+
strict: Optional[bool]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class RequestTool(TypedDict, total=False):
|
|
105
|
+
function: Required[RequestToolFunction]
|
|
106
|
+
|
|
107
|
+
type: Required[Literal["function"]]
|
|
108
|
+
|
|
17
109
|
|
|
18
110
|
class RequestWebSearchOptionsUserLocation(TypedDict, total=False):
|
|
19
111
|
city: Optional[str]
|
|
20
112
|
|
|
21
113
|
country: Optional[str]
|
|
22
|
-
"""Two-letter ISO country code"""
|
|
23
114
|
|
|
24
115
|
latitude: Optional[float]
|
|
25
116
|
|
|
26
117
|
longitude: Optional[float]
|
|
27
118
|
|
|
28
119
|
region: Optional[str]
|
|
29
|
-
"""State/province name"""
|
|
30
120
|
|
|
31
121
|
|
|
32
122
|
class RequestWebSearchOptions(TypedDict, total=False):
|
|
33
|
-
|
|
34
|
-
"""Improves relevance of image search results"""
|
|
123
|
+
image_results_enhanced_relevance: bool
|
|
35
124
|
|
|
36
125
|
search_context_size: Literal["low", "medium", "high"]
|
|
37
|
-
"""
|
|
38
|
-
Amount of search context retrieved: low (cost-saving), medium (balanced), high
|
|
39
|
-
(comprehensive)
|
|
40
|
-
"""
|
|
41
126
|
|
|
42
|
-
|
|
127
|
+
search_type: Literal["fast", "pro", "auto"]
|
|
128
|
+
|
|
129
|
+
user_location: Optional[RequestWebSearchOptionsUserLocation]
|
|
43
130
|
|
|
44
131
|
|
|
45
132
|
class Request(TypedDict, total=False):
|
|
46
|
-
messages: Required[Iterable[
|
|
47
|
-
|
|
133
|
+
messages: Required[Iterable[ChatMessageInput]]
|
|
134
|
+
|
|
135
|
+
model: Required[str]
|
|
48
136
|
|
|
49
|
-
|
|
50
|
-
"""The name of the model that will complete your prompt"""
|
|
137
|
+
_debug_pro_search: bool
|
|
51
138
|
|
|
52
|
-
|
|
53
|
-
"""Disables web search completely - model uses only training data"""
|
|
139
|
+
_inputs: Optional[Iterable[int]]
|
|
54
140
|
|
|
55
|
-
|
|
56
|
-
|
|
141
|
+
_is_browser_agent: Optional[bool]
|
|
142
|
+
|
|
143
|
+
_prompt_token_length: Optional[int]
|
|
144
|
+
|
|
145
|
+
best_of: Optional[int]
|
|
146
|
+
|
|
147
|
+
country: Optional[str]
|
|
148
|
+
|
|
149
|
+
cum_logprobs: Optional[bool]
|
|
150
|
+
|
|
151
|
+
debug_params: Optional[RequestDebugParams]
|
|
152
|
+
|
|
153
|
+
disable_search: Optional[bool]
|
|
154
|
+
|
|
155
|
+
diverse_first_token: Optional[bool]
|
|
156
|
+
|
|
157
|
+
enable_search_classifier: Optional[bool]
|
|
158
|
+
|
|
159
|
+
file_workspace_id: Optional[str]
|
|
160
|
+
|
|
161
|
+
frequency_penalty: Optional[float]
|
|
162
|
+
|
|
163
|
+
has_image_url: bool
|
|
164
|
+
|
|
165
|
+
image_domain_filter: Optional[SequenceNotStr[str]]
|
|
166
|
+
|
|
167
|
+
image_format_filter: Optional[SequenceNotStr[str]]
|
|
57
168
|
|
|
58
169
|
last_updated_after_filter: Optional[str]
|
|
59
|
-
"""Only include content last updated after this date (YYYY-MM-DD)"""
|
|
60
170
|
|
|
61
171
|
last_updated_before_filter: Optional[str]
|
|
62
|
-
"""Only include content last updated before this date (YYYY-MM-DD)"""
|
|
63
172
|
|
|
64
|
-
|
|
65
|
-
|
|
173
|
+
latitude: Optional[float]
|
|
174
|
+
|
|
175
|
+
logprobs: Optional[bool]
|
|
176
|
+
|
|
177
|
+
longitude: Optional[float]
|
|
178
|
+
|
|
179
|
+
max_tokens: Optional[int]
|
|
180
|
+
|
|
181
|
+
n: Optional[int]
|
|
66
182
|
|
|
67
|
-
|
|
68
|
-
"""
|
|
183
|
+
num_images: int
|
|
69
184
|
|
|
70
|
-
|
|
71
|
-
"""Whether to include images in search results"""
|
|
185
|
+
num_search_results: int
|
|
72
186
|
|
|
73
|
-
|
|
74
|
-
|
|
187
|
+
parallel_tool_calls: Optional[bool]
|
|
188
|
+
|
|
189
|
+
presence_penalty: Optional[float]
|
|
190
|
+
|
|
191
|
+
ranking_model: Optional[str]
|
|
192
|
+
|
|
193
|
+
reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]]
|
|
194
|
+
|
|
195
|
+
response_format: Optional[RequestResponseFormat]
|
|
196
|
+
|
|
197
|
+
response_metadata: Optional[Dict[str, object]]
|
|
198
|
+
|
|
199
|
+
return_images: Optional[bool]
|
|
200
|
+
|
|
201
|
+
return_related_questions: Optional[bool]
|
|
202
|
+
|
|
203
|
+
safe_search: Optional[bool]
|
|
75
204
|
|
|
76
205
|
search_after_date_filter: Optional[str]
|
|
77
|
-
"""Only include content published after this date (YYYY-MM-DD)"""
|
|
78
206
|
|
|
79
207
|
search_before_date_filter: Optional[str]
|
|
80
|
-
"""Only include content published before this date (YYYY-MM-DD)"""
|
|
81
208
|
|
|
82
209
|
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
83
|
-
|
|
210
|
+
|
|
211
|
+
search_internal_properties: Optional[Dict[str, object]]
|
|
84
212
|
|
|
85
213
|
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
86
|
-
"""
|
|
87
|
-
Type of search: 'web' for general, 'academic' for scholarly, 'sec' for SEC
|
|
88
|
-
filings
|
|
89
|
-
"""
|
|
90
214
|
|
|
91
215
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
|
92
|
-
|
|
216
|
+
|
|
217
|
+
search_tenant: Optional[str]
|
|
218
|
+
|
|
219
|
+
stop: Union[str, SequenceNotStr[str], None]
|
|
220
|
+
|
|
221
|
+
stream: Optional[bool]
|
|
222
|
+
|
|
223
|
+
temperature: Optional[float]
|
|
224
|
+
|
|
225
|
+
tool_choice: Optional[Literal["none", "auto", "required"]]
|
|
226
|
+
|
|
227
|
+
tools: Optional[Iterable[RequestTool]]
|
|
228
|
+
|
|
229
|
+
top_k: Optional[int]
|
|
230
|
+
|
|
231
|
+
top_logprobs: Optional[int]
|
|
232
|
+
|
|
233
|
+
top_p: Optional[float]
|
|
234
|
+
|
|
235
|
+
updated_after_timestamp: Optional[int]
|
|
236
|
+
|
|
237
|
+
updated_before_timestamp: Optional[int]
|
|
93
238
|
|
|
94
239
|
web_search_options: RequestWebSearchOptions
|
|
@@ -4,43 +4,44 @@ from typing import List, Optional
|
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
6
|
from ...._models import BaseModel
|
|
7
|
+
from ...shared.choice import Choice
|
|
7
8
|
from ...shared.usage_info import UsageInfo
|
|
8
|
-
from ...shared.
|
|
9
|
-
from ...shared.search_result import SearchResult
|
|
9
|
+
from ...shared.api_public_search_result import APIPublicSearchResult
|
|
10
10
|
|
|
11
11
|
__all__ = ["CompletionCreateResponse", "Response"]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Response(BaseModel):
|
|
15
15
|
id: str
|
|
16
|
-
"""Unique identifier for the chat completion"""
|
|
17
16
|
|
|
18
|
-
choices: List[
|
|
17
|
+
choices: List[Choice]
|
|
19
18
|
|
|
20
19
|
created: int
|
|
21
|
-
"""Unix timestamp of creation"""
|
|
22
20
|
|
|
23
21
|
model: str
|
|
24
|
-
"""The model used"""
|
|
25
|
-
|
|
26
|
-
object: str
|
|
27
22
|
|
|
28
23
|
usage: UsageInfo
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
citations: Optional[List[str]] = None
|
|
26
|
+
|
|
27
|
+
object: Optional[str] = None
|
|
28
|
+
|
|
29
|
+
search_results: Optional[List[APIPublicSearchResult]] = None
|
|
30
|
+
|
|
31
|
+
status: Optional[Literal["PENDING", "COMPLETED"]] = None
|
|
32
|
+
|
|
33
|
+
type: Optional[Literal["message", "info", "end_of_stream"]] = None
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
class CompletionCreateResponse(BaseModel):
|
|
35
37
|
id: str
|
|
36
|
-
"""Unique identifier for the async job"""
|
|
37
38
|
|
|
38
39
|
created_at: int
|
|
39
|
-
"""Unix timestamp of creation"""
|
|
40
40
|
|
|
41
41
|
model: str
|
|
42
42
|
|
|
43
43
|
status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
|
|
44
|
+
"""Status enum for async processing."""
|
|
44
45
|
|
|
45
46
|
completed_at: Optional[int] = None
|
|
46
47
|
|
|
@@ -49,6 +50,5 @@ class CompletionCreateResponse(BaseModel):
|
|
|
49
50
|
failed_at: Optional[int] = None
|
|
50
51
|
|
|
51
52
|
response: Optional[Response] = None
|
|
52
|
-
"""The completion response when status is COMPLETED"""
|
|
53
53
|
|
|
54
54
|
started_at: Optional[int] = None
|
|
@@ -0,0 +1,23 @@
|
|
|
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 Annotated, TypedDict
|
|
6
|
+
|
|
7
|
+
from ...._utils import PropertyInfo
|
|
8
|
+
|
|
9
|
+
__all__ = ["CompletionGetParams"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CompletionGetParams(TypedDict, total=False):
|
|
13
|
+
local_mode: bool
|
|
14
|
+
|
|
15
|
+
x_client_env: Annotated[str, PropertyInfo(alias="x-client-env")]
|
|
16
|
+
|
|
17
|
+
x_client_name: Annotated[str, PropertyInfo(alias="x-client-name")]
|
|
18
|
+
|
|
19
|
+
x_request_time: Annotated[str, PropertyInfo(alias="x-request-time")]
|
|
20
|
+
|
|
21
|
+
x_usage_tier: Annotated[str, PropertyInfo(alias="x-usage-tier")]
|
|
22
|
+
|
|
23
|
+
x_user_id: Annotated[str, PropertyInfo(alias="x-user-id")]
|
|
@@ -4,43 +4,44 @@ from typing import List, Optional
|
|
|
4
4
|
from typing_extensions import Literal
|
|
5
5
|
|
|
6
6
|
from ...._models import BaseModel
|
|
7
|
+
from ...shared.choice import Choice
|
|
7
8
|
from ...shared.usage_info import UsageInfo
|
|
8
|
-
from ...shared.
|
|
9
|
-
from ...shared.search_result import SearchResult
|
|
9
|
+
from ...shared.api_public_search_result import APIPublicSearchResult
|
|
10
10
|
|
|
11
11
|
__all__ = ["CompletionGetResponse", "Response"]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Response(BaseModel):
|
|
15
15
|
id: str
|
|
16
|
-
"""Unique identifier for the chat completion"""
|
|
17
16
|
|
|
18
|
-
choices: List[
|
|
17
|
+
choices: List[Choice]
|
|
19
18
|
|
|
20
19
|
created: int
|
|
21
|
-
"""Unix timestamp of creation"""
|
|
22
20
|
|
|
23
21
|
model: str
|
|
24
|
-
"""The model used"""
|
|
25
|
-
|
|
26
|
-
object: str
|
|
27
22
|
|
|
28
23
|
usage: UsageInfo
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
citations: Optional[List[str]] = None
|
|
26
|
+
|
|
27
|
+
object: Optional[str] = None
|
|
28
|
+
|
|
29
|
+
search_results: Optional[List[APIPublicSearchResult]] = None
|
|
30
|
+
|
|
31
|
+
status: Optional[Literal["PENDING", "COMPLETED"]] = None
|
|
32
|
+
|
|
33
|
+
type: Optional[Literal["message", "info", "end_of_stream"]] = None
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
class CompletionGetResponse(BaseModel):
|
|
35
37
|
id: str
|
|
36
|
-
"""Unique identifier for the async job"""
|
|
37
38
|
|
|
38
39
|
created_at: int
|
|
39
|
-
"""Unix timestamp of creation"""
|
|
40
40
|
|
|
41
41
|
model: str
|
|
42
42
|
|
|
43
43
|
status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
|
|
44
|
+
"""Status enum for async processing."""
|
|
44
45
|
|
|
45
46
|
completed_at: Optional[int] = None
|
|
46
47
|
|
|
@@ -49,6 +50,5 @@ class CompletionGetResponse(BaseModel):
|
|
|
49
50
|
failed_at: Optional[int] = None
|
|
50
51
|
|
|
51
52
|
response: Optional[Response] = None
|
|
52
|
-
"""The completion response when status is COMPLETED"""
|
|
53
53
|
|
|
54
54
|
started_at: Optional[int] = None
|
|
@@ -16,6 +16,7 @@ class Request(BaseModel):
|
|
|
16
16
|
model: str
|
|
17
17
|
|
|
18
18
|
status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
|
|
19
|
+
"""Status enum for async processing."""
|
|
19
20
|
|
|
20
21
|
completed_at: Optional[int] = None
|
|
21
22
|
|
|
@@ -28,4 +29,3 @@ class CompletionListResponse(BaseModel):
|
|
|
28
29
|
requests: List[Request]
|
|
29
30
|
|
|
30
31
|
next_token: Optional[str] = None
|
|
31
|
-
"""Token for pagination"""
|