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,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Iterable, Optional
|
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
|
6
6
|
from typing_extensions import Literal
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -19,8 +19,8 @@ from ..._response import (
|
|
|
19
19
|
)
|
|
20
20
|
from ...types.chat import completion_create_params
|
|
21
21
|
from ..._base_client import make_request_options
|
|
22
|
-
from ...types.shared_params.chat_message import ChatMessage
|
|
23
22
|
from ...types.chat.completion_create_response import CompletionCreateResponse
|
|
23
|
+
from ...types.shared_params.chat_message_input import ChatMessageInput
|
|
24
24
|
|
|
25
25
|
__all__ = ["CompletionsResource", "AsyncCompletionsResource"]
|
|
26
26
|
|
|
@@ -48,20 +48,59 @@ class CompletionsResource(SyncAPIResource):
|
|
|
48
48
|
def create(
|
|
49
49
|
self,
|
|
50
50
|
*,
|
|
51
|
-
messages: Iterable[
|
|
52
|
-
model:
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
messages: Iterable[ChatMessageInput],
|
|
52
|
+
model: str,
|
|
53
|
+
_debug_pro_search: bool | NotGiven = NOT_GIVEN,
|
|
54
|
+
_inputs: Optional[Iterable[int]] | NotGiven = NOT_GIVEN,
|
|
55
|
+
_is_browser_agent: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
56
|
+
_prompt_token_length: Optional[int] | NotGiven = NOT_GIVEN,
|
|
57
|
+
best_of: Optional[int] | NotGiven = NOT_GIVEN,
|
|
58
|
+
country: Optional[str] | NotGiven = NOT_GIVEN,
|
|
59
|
+
cum_logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
60
|
+
debug_params: Optional[completion_create_params.DebugParams] | NotGiven = NOT_GIVEN,
|
|
61
|
+
disable_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
62
|
+
diverse_first_token: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
63
|
+
enable_search_classifier: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
64
|
+
file_workspace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
65
|
+
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
|
66
|
+
has_image_url: bool | NotGiven = NOT_GIVEN,
|
|
67
|
+
image_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
68
|
+
image_format_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
55
69
|
last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
56
70
|
last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
latitude: Optional[float] | NotGiven = NOT_GIVEN,
|
|
72
|
+
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
73
|
+
longitude: Optional[float] | NotGiven = NOT_GIVEN,
|
|
74
|
+
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
|
|
75
|
+
n: Optional[int] | NotGiven = NOT_GIVEN,
|
|
76
|
+
num_images: int | NotGiven = NOT_GIVEN,
|
|
77
|
+
num_search_results: int | NotGiven = NOT_GIVEN,
|
|
78
|
+
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
79
|
+
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
|
80
|
+
ranking_model: Optional[str] | NotGiven = NOT_GIVEN,
|
|
81
|
+
reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]] | NotGiven = NOT_GIVEN,
|
|
82
|
+
response_format: Optional[completion_create_params.ResponseFormat] | NotGiven = NOT_GIVEN,
|
|
83
|
+
response_metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
|
|
84
|
+
return_images: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
85
|
+
return_related_questions: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
86
|
+
safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
60
87
|
search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
61
88
|
search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
62
89
|
search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
90
|
+
search_internal_properties: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
|
|
63
91
|
search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
|
|
64
92
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
|
|
93
|
+
search_tenant: Optional[str] | NotGiven = NOT_GIVEN,
|
|
94
|
+
stop: Union[str, SequenceNotStr[str], None] | NotGiven = NOT_GIVEN,
|
|
95
|
+
stream: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
96
|
+
temperature: Optional[float] | NotGiven = NOT_GIVEN,
|
|
97
|
+
tool_choice: Optional[Literal["none", "auto", "required"]] | NotGiven = NOT_GIVEN,
|
|
98
|
+
tools: Optional[Iterable[completion_create_params.Tool]] | NotGiven = NOT_GIVEN,
|
|
99
|
+
top_k: Optional[int] | NotGiven = NOT_GIVEN,
|
|
100
|
+
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
|
|
101
|
+
top_p: Optional[float] | NotGiven = NOT_GIVEN,
|
|
102
|
+
updated_after_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
|
|
103
|
+
updated_before_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
|
|
65
104
|
web_search_options: completion_create_params.WebSearchOptions | NotGiven = NOT_GIVEN,
|
|
66
105
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
67
106
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -71,40 +110,9 @@ class CompletionsResource(SyncAPIResource):
|
|
|
71
110
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
72
111
|
) -> CompletionCreateResponse:
|
|
73
112
|
"""
|
|
74
|
-
|
|
75
|
-
search capabilities
|
|
113
|
+
FastAPI wrapper around chat completions
|
|
76
114
|
|
|
77
115
|
Args:
|
|
78
|
-
messages: A list of messages comprising the conversation so far
|
|
79
|
-
|
|
80
|
-
model: The name of the model that will complete your prompt
|
|
81
|
-
|
|
82
|
-
disable_search: Disables web search completely - model uses only training data
|
|
83
|
-
|
|
84
|
-
enable_search_classifier: Enables classifier that decides if web search is needed
|
|
85
|
-
|
|
86
|
-
last_updated_after_filter: Only include content last updated after this date (YYYY-MM-DD)
|
|
87
|
-
|
|
88
|
-
last_updated_before_filter: Only include content last updated before this date (YYYY-MM-DD)
|
|
89
|
-
|
|
90
|
-
reasoning_effort: Controls computational effort for sonar-deep-research model. Higher effort =
|
|
91
|
-
more thorough but more tokens
|
|
92
|
-
|
|
93
|
-
return_images: Whether to include images in search results
|
|
94
|
-
|
|
95
|
-
return_related_questions: Whether to return related questions
|
|
96
|
-
|
|
97
|
-
search_after_date_filter: Only include content published after this date (YYYY-MM-DD)
|
|
98
|
-
|
|
99
|
-
search_before_date_filter: Only include content published before this date (YYYY-MM-DD)
|
|
100
|
-
|
|
101
|
-
search_domain_filter: List of domains to limit search results to. Use '-' prefix to exclude domains
|
|
102
|
-
|
|
103
|
-
search_mode: Type of search: 'web' for general, 'academic' for scholarly, 'sec' for SEC
|
|
104
|
-
filings
|
|
105
|
-
|
|
106
|
-
search_recency_filter: Filter results by how recently they were published
|
|
107
|
-
|
|
108
116
|
extra_headers: Send extra headers
|
|
109
117
|
|
|
110
118
|
extra_query: Add additional query parameters to the request
|
|
@@ -119,18 +127,57 @@ class CompletionsResource(SyncAPIResource):
|
|
|
119
127
|
{
|
|
120
128
|
"messages": messages,
|
|
121
129
|
"model": model,
|
|
130
|
+
"_debug_pro_search": _debug_pro_search,
|
|
131
|
+
"_inputs": _inputs,
|
|
132
|
+
"_is_browser_agent": _is_browser_agent,
|
|
133
|
+
"_prompt_token_length": _prompt_token_length,
|
|
134
|
+
"best_of": best_of,
|
|
135
|
+
"country": country,
|
|
136
|
+
"cum_logprobs": cum_logprobs,
|
|
137
|
+
"debug_params": debug_params,
|
|
122
138
|
"disable_search": disable_search,
|
|
139
|
+
"diverse_first_token": diverse_first_token,
|
|
123
140
|
"enable_search_classifier": enable_search_classifier,
|
|
141
|
+
"file_workspace_id": file_workspace_id,
|
|
142
|
+
"frequency_penalty": frequency_penalty,
|
|
143
|
+
"has_image_url": has_image_url,
|
|
144
|
+
"image_domain_filter": image_domain_filter,
|
|
145
|
+
"image_format_filter": image_format_filter,
|
|
124
146
|
"last_updated_after_filter": last_updated_after_filter,
|
|
125
147
|
"last_updated_before_filter": last_updated_before_filter,
|
|
148
|
+
"latitude": latitude,
|
|
149
|
+
"logprobs": logprobs,
|
|
150
|
+
"longitude": longitude,
|
|
151
|
+
"max_tokens": max_tokens,
|
|
152
|
+
"n": n,
|
|
153
|
+
"num_images": num_images,
|
|
154
|
+
"num_search_results": num_search_results,
|
|
155
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
156
|
+
"presence_penalty": presence_penalty,
|
|
157
|
+
"ranking_model": ranking_model,
|
|
126
158
|
"reasoning_effort": reasoning_effort,
|
|
159
|
+
"response_format": response_format,
|
|
160
|
+
"response_metadata": response_metadata,
|
|
127
161
|
"return_images": return_images,
|
|
128
162
|
"return_related_questions": return_related_questions,
|
|
163
|
+
"safe_search": safe_search,
|
|
129
164
|
"search_after_date_filter": search_after_date_filter,
|
|
130
165
|
"search_before_date_filter": search_before_date_filter,
|
|
131
166
|
"search_domain_filter": search_domain_filter,
|
|
167
|
+
"search_internal_properties": search_internal_properties,
|
|
132
168
|
"search_mode": search_mode,
|
|
133
169
|
"search_recency_filter": search_recency_filter,
|
|
170
|
+
"search_tenant": search_tenant,
|
|
171
|
+
"stop": stop,
|
|
172
|
+
"stream": stream,
|
|
173
|
+
"temperature": temperature,
|
|
174
|
+
"tool_choice": tool_choice,
|
|
175
|
+
"tools": tools,
|
|
176
|
+
"top_k": top_k,
|
|
177
|
+
"top_logprobs": top_logprobs,
|
|
178
|
+
"top_p": top_p,
|
|
179
|
+
"updated_after_timestamp": updated_after_timestamp,
|
|
180
|
+
"updated_before_timestamp": updated_before_timestamp,
|
|
134
181
|
"web_search_options": web_search_options,
|
|
135
182
|
},
|
|
136
183
|
completion_create_params.CompletionCreateParams,
|
|
@@ -165,20 +212,59 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
165
212
|
async def create(
|
|
166
213
|
self,
|
|
167
214
|
*,
|
|
168
|
-
messages: Iterable[
|
|
169
|
-
model:
|
|
170
|
-
|
|
171
|
-
|
|
215
|
+
messages: Iterable[ChatMessageInput],
|
|
216
|
+
model: str,
|
|
217
|
+
_debug_pro_search: bool | NotGiven = NOT_GIVEN,
|
|
218
|
+
_inputs: Optional[Iterable[int]] | NotGiven = NOT_GIVEN,
|
|
219
|
+
_is_browser_agent: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
220
|
+
_prompt_token_length: Optional[int] | NotGiven = NOT_GIVEN,
|
|
221
|
+
best_of: Optional[int] | NotGiven = NOT_GIVEN,
|
|
222
|
+
country: Optional[str] | NotGiven = NOT_GIVEN,
|
|
223
|
+
cum_logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
224
|
+
debug_params: Optional[completion_create_params.DebugParams] | NotGiven = NOT_GIVEN,
|
|
225
|
+
disable_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
226
|
+
diverse_first_token: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
227
|
+
enable_search_classifier: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
228
|
+
file_workspace_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
229
|
+
frequency_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
|
230
|
+
has_image_url: bool | NotGiven = NOT_GIVEN,
|
|
231
|
+
image_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
232
|
+
image_format_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
172
233
|
last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
173
234
|
last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
235
|
+
latitude: Optional[float] | NotGiven = NOT_GIVEN,
|
|
236
|
+
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
237
|
+
longitude: Optional[float] | NotGiven = NOT_GIVEN,
|
|
238
|
+
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
|
|
239
|
+
n: Optional[int] | NotGiven = NOT_GIVEN,
|
|
240
|
+
num_images: int | NotGiven = NOT_GIVEN,
|
|
241
|
+
num_search_results: int | NotGiven = NOT_GIVEN,
|
|
242
|
+
parallel_tool_calls: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
243
|
+
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
|
|
244
|
+
ranking_model: Optional[str] | NotGiven = NOT_GIVEN,
|
|
245
|
+
reasoning_effort: Optional[Literal["minimal", "low", "medium", "high"]] | NotGiven = NOT_GIVEN,
|
|
246
|
+
response_format: Optional[completion_create_params.ResponseFormat] | NotGiven = NOT_GIVEN,
|
|
247
|
+
response_metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
|
|
248
|
+
return_images: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
249
|
+
return_related_questions: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
250
|
+
safe_search: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
177
251
|
search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
178
252
|
search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
|
|
179
253
|
search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
254
|
+
search_internal_properties: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
|
|
180
255
|
search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
|
|
181
256
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
|
|
257
|
+
search_tenant: Optional[str] | NotGiven = NOT_GIVEN,
|
|
258
|
+
stop: Union[str, SequenceNotStr[str], None] | NotGiven = NOT_GIVEN,
|
|
259
|
+
stream: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
260
|
+
temperature: Optional[float] | NotGiven = NOT_GIVEN,
|
|
261
|
+
tool_choice: Optional[Literal["none", "auto", "required"]] | NotGiven = NOT_GIVEN,
|
|
262
|
+
tools: Optional[Iterable[completion_create_params.Tool]] | NotGiven = NOT_GIVEN,
|
|
263
|
+
top_k: Optional[int] | NotGiven = NOT_GIVEN,
|
|
264
|
+
top_logprobs: Optional[int] | NotGiven = NOT_GIVEN,
|
|
265
|
+
top_p: Optional[float] | NotGiven = NOT_GIVEN,
|
|
266
|
+
updated_after_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
|
|
267
|
+
updated_before_timestamp: Optional[int] | NotGiven = NOT_GIVEN,
|
|
182
268
|
web_search_options: completion_create_params.WebSearchOptions | NotGiven = NOT_GIVEN,
|
|
183
269
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
184
270
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -188,40 +274,9 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
188
274
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
189
275
|
) -> CompletionCreateResponse:
|
|
190
276
|
"""
|
|
191
|
-
|
|
192
|
-
search capabilities
|
|
277
|
+
FastAPI wrapper around chat completions
|
|
193
278
|
|
|
194
279
|
Args:
|
|
195
|
-
messages: A list of messages comprising the conversation so far
|
|
196
|
-
|
|
197
|
-
model: The name of the model that will complete your prompt
|
|
198
|
-
|
|
199
|
-
disable_search: Disables web search completely - model uses only training data
|
|
200
|
-
|
|
201
|
-
enable_search_classifier: Enables classifier that decides if web search is needed
|
|
202
|
-
|
|
203
|
-
last_updated_after_filter: Only include content last updated after this date (YYYY-MM-DD)
|
|
204
|
-
|
|
205
|
-
last_updated_before_filter: Only include content last updated before this date (YYYY-MM-DD)
|
|
206
|
-
|
|
207
|
-
reasoning_effort: Controls computational effort for sonar-deep-research model. Higher effort =
|
|
208
|
-
more thorough but more tokens
|
|
209
|
-
|
|
210
|
-
return_images: Whether to include images in search results
|
|
211
|
-
|
|
212
|
-
return_related_questions: Whether to return related questions
|
|
213
|
-
|
|
214
|
-
search_after_date_filter: Only include content published after this date (YYYY-MM-DD)
|
|
215
|
-
|
|
216
|
-
search_before_date_filter: Only include content published before this date (YYYY-MM-DD)
|
|
217
|
-
|
|
218
|
-
search_domain_filter: List of domains to limit search results to. Use '-' prefix to exclude domains
|
|
219
|
-
|
|
220
|
-
search_mode: Type of search: 'web' for general, 'academic' for scholarly, 'sec' for SEC
|
|
221
|
-
filings
|
|
222
|
-
|
|
223
|
-
search_recency_filter: Filter results by how recently they were published
|
|
224
|
-
|
|
225
280
|
extra_headers: Send extra headers
|
|
226
281
|
|
|
227
282
|
extra_query: Add additional query parameters to the request
|
|
@@ -236,18 +291,57 @@ class AsyncCompletionsResource(AsyncAPIResource):
|
|
|
236
291
|
{
|
|
237
292
|
"messages": messages,
|
|
238
293
|
"model": model,
|
|
294
|
+
"_debug_pro_search": _debug_pro_search,
|
|
295
|
+
"_inputs": _inputs,
|
|
296
|
+
"_is_browser_agent": _is_browser_agent,
|
|
297
|
+
"_prompt_token_length": _prompt_token_length,
|
|
298
|
+
"best_of": best_of,
|
|
299
|
+
"country": country,
|
|
300
|
+
"cum_logprobs": cum_logprobs,
|
|
301
|
+
"debug_params": debug_params,
|
|
239
302
|
"disable_search": disable_search,
|
|
303
|
+
"diverse_first_token": diverse_first_token,
|
|
240
304
|
"enable_search_classifier": enable_search_classifier,
|
|
305
|
+
"file_workspace_id": file_workspace_id,
|
|
306
|
+
"frequency_penalty": frequency_penalty,
|
|
307
|
+
"has_image_url": has_image_url,
|
|
308
|
+
"image_domain_filter": image_domain_filter,
|
|
309
|
+
"image_format_filter": image_format_filter,
|
|
241
310
|
"last_updated_after_filter": last_updated_after_filter,
|
|
242
311
|
"last_updated_before_filter": last_updated_before_filter,
|
|
312
|
+
"latitude": latitude,
|
|
313
|
+
"logprobs": logprobs,
|
|
314
|
+
"longitude": longitude,
|
|
315
|
+
"max_tokens": max_tokens,
|
|
316
|
+
"n": n,
|
|
317
|
+
"num_images": num_images,
|
|
318
|
+
"num_search_results": num_search_results,
|
|
319
|
+
"parallel_tool_calls": parallel_tool_calls,
|
|
320
|
+
"presence_penalty": presence_penalty,
|
|
321
|
+
"ranking_model": ranking_model,
|
|
243
322
|
"reasoning_effort": reasoning_effort,
|
|
323
|
+
"response_format": response_format,
|
|
324
|
+
"response_metadata": response_metadata,
|
|
244
325
|
"return_images": return_images,
|
|
245
326
|
"return_related_questions": return_related_questions,
|
|
327
|
+
"safe_search": safe_search,
|
|
246
328
|
"search_after_date_filter": search_after_date_filter,
|
|
247
329
|
"search_before_date_filter": search_before_date_filter,
|
|
248
330
|
"search_domain_filter": search_domain_filter,
|
|
331
|
+
"search_internal_properties": search_internal_properties,
|
|
249
332
|
"search_mode": search_mode,
|
|
250
333
|
"search_recency_filter": search_recency_filter,
|
|
334
|
+
"search_tenant": search_tenant,
|
|
335
|
+
"stop": stop,
|
|
336
|
+
"stream": stream,
|
|
337
|
+
"temperature": temperature,
|
|
338
|
+
"tool_choice": tool_choice,
|
|
339
|
+
"tools": tools,
|
|
340
|
+
"top_k": top_k,
|
|
341
|
+
"top_logprobs": top_logprobs,
|
|
342
|
+
"top_p": top_p,
|
|
343
|
+
"updated_after_timestamp": updated_after_timestamp,
|
|
344
|
+
"updated_before_timestamp": updated_before_timestamp,
|
|
251
345
|
"web_search_options": web_search_options,
|
|
252
346
|
},
|
|
253
347
|
completion_create_params.CompletionCreateParams,
|
perplexity/resources/search.py
CHANGED
|
@@ -68,38 +68,9 @@ class SearchResource(SyncAPIResource):
|
|
|
68
68
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
69
69
|
) -> SearchCreateResponse:
|
|
70
70
|
"""
|
|
71
|
-
|
|
71
|
+
Search
|
|
72
72
|
|
|
73
73
|
Args:
|
|
74
|
-
query: Search query string or array of query strings to search for
|
|
75
|
-
|
|
76
|
-
country: Country code to bias search results towards (e.g., 'US', 'GB', 'CA')
|
|
77
|
-
|
|
78
|
-
last_updated_after_filter: Only include results last updated after this date (ISO 8601 format: YYYY-MM-DD)
|
|
79
|
-
|
|
80
|
-
last_updated_before_filter: Only include results last updated before this date (ISO 8601 format: YYYY-MM-DD)
|
|
81
|
-
|
|
82
|
-
max_results: Maximum number of search results to return
|
|
83
|
-
|
|
84
|
-
max_tokens: Maximum number of tokens to return across all results
|
|
85
|
-
|
|
86
|
-
max_tokens_per_page: Maximum number of tokens to return per individual search result
|
|
87
|
-
|
|
88
|
-
safe_search: Enable safe search filtering to exclude adult content
|
|
89
|
-
|
|
90
|
-
search_after_date_filter: Only include results published after this date (ISO 8601 format: YYYY-MM-DD)
|
|
91
|
-
|
|
92
|
-
search_before_date_filter: Only include results published before this date (ISO 8601 format: YYYY-MM-DD)
|
|
93
|
-
|
|
94
|
-
search_domain_filter: List of domains to restrict search results to (e.g., ['example.com',
|
|
95
|
-
'another.com'])
|
|
96
|
-
|
|
97
|
-
search_mode: Type of search to perform: 'web' for general web search, 'academic' for
|
|
98
|
-
scholarly articles, 'sec' for SEC filings
|
|
99
|
-
|
|
100
|
-
search_recency_filter: Filter results by how recently they were published (hour, day, week, month, or
|
|
101
|
-
year)
|
|
102
|
-
|
|
103
74
|
extra_headers: Send extra headers
|
|
104
75
|
|
|
105
76
|
extra_query: Add additional query parameters to the request
|
|
@@ -179,38 +150,9 @@ class AsyncSearchResource(AsyncAPIResource):
|
|
|
179
150
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
151
|
) -> SearchCreateResponse:
|
|
181
152
|
"""
|
|
182
|
-
|
|
153
|
+
Search
|
|
183
154
|
|
|
184
155
|
Args:
|
|
185
|
-
query: Search query string or array of query strings to search for
|
|
186
|
-
|
|
187
|
-
country: Country code to bias search results towards (e.g., 'US', 'GB', 'CA')
|
|
188
|
-
|
|
189
|
-
last_updated_after_filter: Only include results last updated after this date (ISO 8601 format: YYYY-MM-DD)
|
|
190
|
-
|
|
191
|
-
last_updated_before_filter: Only include results last updated before this date (ISO 8601 format: YYYY-MM-DD)
|
|
192
|
-
|
|
193
|
-
max_results: Maximum number of search results to return
|
|
194
|
-
|
|
195
|
-
max_tokens: Maximum number of tokens to return across all results
|
|
196
|
-
|
|
197
|
-
max_tokens_per_page: Maximum number of tokens to return per individual search result
|
|
198
|
-
|
|
199
|
-
safe_search: Enable safe search filtering to exclude adult content
|
|
200
|
-
|
|
201
|
-
search_after_date_filter: Only include results published after this date (ISO 8601 format: YYYY-MM-DD)
|
|
202
|
-
|
|
203
|
-
search_before_date_filter: Only include results published before this date (ISO 8601 format: YYYY-MM-DD)
|
|
204
|
-
|
|
205
|
-
search_domain_filter: List of domains to restrict search results to (e.g., ['example.com',
|
|
206
|
-
'another.com'])
|
|
207
|
-
|
|
208
|
-
search_mode: Type of search to perform: 'web' for general web search, 'academic' for
|
|
209
|
-
scholarly articles, 'sec' for SEC filings
|
|
210
|
-
|
|
211
|
-
search_recency_filter: Filter results by how recently they were published (hour, day, week, month, or
|
|
212
|
-
year)
|
|
213
|
-
|
|
214
156
|
extra_headers: Send extra headers
|
|
215
157
|
|
|
216
158
|
extra_query: Add additional query parameters to the request
|
perplexity/types/__init__.py
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from .shared import (
|
|
6
|
+
Choice as Choice,
|
|
6
7
|
UsageInfo as UsageInfo,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
ChatMessageInput as ChatMessageInput,
|
|
9
|
+
ChatMessageOutput as ChatMessageOutput,
|
|
10
|
+
APIPublicSearchResult as APIPublicSearchResult,
|
|
10
11
|
)
|
|
11
12
|
from .search_create_params import SearchCreateParams as SearchCreateParams
|
|
12
|
-
from .content_create_params import ContentCreateParams as ContentCreateParams
|
|
13
13
|
from .search_create_response import SearchCreateResponse as SearchCreateResponse
|
|
14
|
-
from .content_create_response import ContentCreateResponse as ContentCreateResponse
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from .
|
|
5
|
+
from .completion_get_params import CompletionGetParams as CompletionGetParams
|
|
6
6
|
from .completion_get_response import CompletionGetResponse as CompletionGetResponse
|
|
7
7
|
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
8
8
|
from .completion_list_response import CompletionListResponse as CompletionListResponse
|