perplexityai 0.6.0__py3-none-any.whl → 0.7.1__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.1.dist-info}/METADATA +90 -22
  37. perplexityai-0.7.1.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.1.dist-info}/WHEEL +0 -0
  40. {perplexityai-0.6.0.dist-info → perplexityai-0.7.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,295 @@
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 Iterable, Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
11
+ from ..._utils import maybe_transform, async_maybe_transform
12
+ from ..._compat import cached_property
13
+ from ..._resource import SyncAPIResource, AsyncAPIResource
14
+ from ..._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ...types.chat import completion_create_params
21
+ from ..._base_client import make_request_options
22
+ from ...types.shared_params.chat_message import ChatMessage
23
+ from ...types.chat.completion_create_response import CompletionCreateResponse
24
+
25
+ __all__ = ["CompletionsResource", "AsyncCompletionsResource"]
26
+
27
+
28
+ class CompletionsResource(SyncAPIResource):
29
+ @cached_property
30
+ def with_raw_response(self) -> CompletionsResourceWithRawResponse:
31
+ """
32
+ This property can be used as a prefix for any HTTP method call to return
33
+ the raw response object instead of the parsed content.
34
+
35
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
36
+ """
37
+ return CompletionsResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse:
41
+ """
42
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
43
+
44
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
45
+ """
46
+ return CompletionsResourceWithStreamingResponse(self)
47
+
48
+ def create(
49
+ self,
50
+ *,
51
+ messages: Iterable[ChatMessage],
52
+ model: Literal["sonar", "sonar-pro", "sonar-deep-research", "sonar-reasoning", "sonar-reasoning-pro"],
53
+ disable_search: bool | NotGiven = NOT_GIVEN,
54
+ enable_search_classifier: bool | NotGiven = NOT_GIVEN,
55
+ last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
56
+ last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
57
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
58
+ return_images: bool | NotGiven = NOT_GIVEN,
59
+ return_related_questions: bool | NotGiven = NOT_GIVEN,
60
+ search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
61
+ search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
62
+ search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
63
+ search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
64
+ search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
65
+ web_search_options: completion_create_params.WebSearchOptions | NotGiven = NOT_GIVEN,
66
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
67
+ # The extra values given here take precedence over values defined on the client or passed to this method.
68
+ extra_headers: Headers | None = None,
69
+ extra_query: Query | None = None,
70
+ extra_body: Body | None = None,
71
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
72
+ ) -> CompletionCreateResponse:
73
+ """
74
+ Generates a model's response for the given chat conversation with integrated
75
+ search capabilities
76
+
77
+ 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
+ extra_headers: Send extra headers
109
+
110
+ extra_query: Add additional query parameters to the request
111
+
112
+ extra_body: Add additional JSON properties to the request
113
+
114
+ timeout: Override the client-level default timeout for this request, in seconds
115
+ """
116
+ return self._post(
117
+ "/chat/completions",
118
+ body=maybe_transform(
119
+ {
120
+ "messages": messages,
121
+ "model": model,
122
+ "disable_search": disable_search,
123
+ "enable_search_classifier": enable_search_classifier,
124
+ "last_updated_after_filter": last_updated_after_filter,
125
+ "last_updated_before_filter": last_updated_before_filter,
126
+ "reasoning_effort": reasoning_effort,
127
+ "return_images": return_images,
128
+ "return_related_questions": return_related_questions,
129
+ "search_after_date_filter": search_after_date_filter,
130
+ "search_before_date_filter": search_before_date_filter,
131
+ "search_domain_filter": search_domain_filter,
132
+ "search_mode": search_mode,
133
+ "search_recency_filter": search_recency_filter,
134
+ "web_search_options": web_search_options,
135
+ },
136
+ completion_create_params.CompletionCreateParams,
137
+ ),
138
+ options=make_request_options(
139
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
140
+ ),
141
+ cast_to=CompletionCreateResponse,
142
+ )
143
+
144
+
145
+ class AsyncCompletionsResource(AsyncAPIResource):
146
+ @cached_property
147
+ def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse:
148
+ """
149
+ This property can be used as a prefix for any HTTP method call to return
150
+ the raw response object instead of the parsed content.
151
+
152
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
153
+ """
154
+ return AsyncCompletionsResourceWithRawResponse(self)
155
+
156
+ @cached_property
157
+ def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingResponse:
158
+ """
159
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
160
+
161
+ For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
162
+ """
163
+ return AsyncCompletionsResourceWithStreamingResponse(self)
164
+
165
+ async def create(
166
+ self,
167
+ *,
168
+ messages: Iterable[ChatMessage],
169
+ model: Literal["sonar", "sonar-pro", "sonar-deep-research", "sonar-reasoning", "sonar-reasoning-pro"],
170
+ disable_search: bool | NotGiven = NOT_GIVEN,
171
+ enable_search_classifier: bool | NotGiven = NOT_GIVEN,
172
+ last_updated_after_filter: Optional[str] | NotGiven = NOT_GIVEN,
173
+ last_updated_before_filter: Optional[str] | NotGiven = NOT_GIVEN,
174
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
175
+ return_images: bool | NotGiven = NOT_GIVEN,
176
+ return_related_questions: bool | NotGiven = NOT_GIVEN,
177
+ search_after_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
178
+ search_before_date_filter: Optional[str] | NotGiven = NOT_GIVEN,
179
+ search_domain_filter: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
180
+ search_mode: Optional[Literal["web", "academic", "sec"]] | NotGiven = NOT_GIVEN,
181
+ search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]] | NotGiven = NOT_GIVEN,
182
+ web_search_options: completion_create_params.WebSearchOptions | NotGiven = NOT_GIVEN,
183
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
184
+ # The extra values given here take precedence over values defined on the client or passed to this method.
185
+ extra_headers: Headers | None = None,
186
+ extra_query: Query | None = None,
187
+ extra_body: Body | None = None,
188
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
189
+ ) -> CompletionCreateResponse:
190
+ """
191
+ Generates a model's response for the given chat conversation with integrated
192
+ search capabilities
193
+
194
+ 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
+ extra_headers: Send extra headers
226
+
227
+ extra_query: Add additional query parameters to the request
228
+
229
+ extra_body: Add additional JSON properties to the request
230
+
231
+ timeout: Override the client-level default timeout for this request, in seconds
232
+ """
233
+ return await self._post(
234
+ "/chat/completions",
235
+ body=await async_maybe_transform(
236
+ {
237
+ "messages": messages,
238
+ "model": model,
239
+ "disable_search": disable_search,
240
+ "enable_search_classifier": enable_search_classifier,
241
+ "last_updated_after_filter": last_updated_after_filter,
242
+ "last_updated_before_filter": last_updated_before_filter,
243
+ "reasoning_effort": reasoning_effort,
244
+ "return_images": return_images,
245
+ "return_related_questions": return_related_questions,
246
+ "search_after_date_filter": search_after_date_filter,
247
+ "search_before_date_filter": search_before_date_filter,
248
+ "search_domain_filter": search_domain_filter,
249
+ "search_mode": search_mode,
250
+ "search_recency_filter": search_recency_filter,
251
+ "web_search_options": web_search_options,
252
+ },
253
+ completion_create_params.CompletionCreateParams,
254
+ ),
255
+ options=make_request_options(
256
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
257
+ ),
258
+ cast_to=CompletionCreateResponse,
259
+ )
260
+
261
+
262
+ class CompletionsResourceWithRawResponse:
263
+ def __init__(self, completions: CompletionsResource) -> None:
264
+ self._completions = completions
265
+
266
+ self.create = to_raw_response_wrapper(
267
+ completions.create,
268
+ )
269
+
270
+
271
+ class AsyncCompletionsResourceWithRawResponse:
272
+ def __init__(self, completions: AsyncCompletionsResource) -> None:
273
+ self._completions = completions
274
+
275
+ self.create = async_to_raw_response_wrapper(
276
+ completions.create,
277
+ )
278
+
279
+
280
+ class CompletionsResourceWithStreamingResponse:
281
+ def __init__(self, completions: CompletionsResource) -> None:
282
+ self._completions = completions
283
+
284
+ self.create = to_streamed_response_wrapper(
285
+ completions.create,
286
+ )
287
+
288
+
289
+ class AsyncCompletionsResourceWithStreamingResponse:
290
+ def __init__(self, completions: AsyncCompletionsResource) -> None:
291
+ self._completions = completions
292
+
293
+ self.create = async_to_streamed_response_wrapper(
294
+ completions.create,
295
+ )
@@ -53,9 +53,11 @@ class ContentResource(SyncAPIResource):
53
53
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
54
54
  ) -> ContentCreateResponse:
55
55
  """
56
- Get Urls Content
56
+ Retrieve the full content from specified URLs
57
57
 
58
58
  Args:
59
+ urls: List of URLs to retrieve content from
60
+
59
61
  extra_headers: Send extra headers
60
62
 
61
63
  extra_query: Add additional query parameters to the request
@@ -106,9 +108,11 @@ class AsyncContentResource(AsyncAPIResource):
106
108
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
107
109
  ) -> ContentCreateResponse:
108
110
  """
109
- Get Urls Content
111
+ Retrieve the full content from specified URLs
110
112
 
111
113
  Args:
114
+ urls: List of URLs to retrieve content from
115
+
112
116
  extra_headers: Send extra headers
113
117
 
114
118
  extra_query: Add additional query parameters to the request
@@ -68,9 +68,38 @@ class SearchResource(SyncAPIResource):
68
68
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
69
69
  ) -> SearchCreateResponse:
70
70
  """
71
- Search
71
+ Perform a search query with various filtering and customization options
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
+
74
103
  extra_headers: Send extra headers
75
104
 
76
105
  extra_query: Add additional query parameters to the request
@@ -150,9 +179,38 @@ class AsyncSearchResource(AsyncAPIResource):
150
179
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
151
180
  ) -> SearchCreateResponse:
152
181
  """
153
- Search
182
+ Perform a search query with various filtering and customization options
154
183
 
155
184
  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
+
156
214
  extra_headers: Send extra headers
157
215
 
158
216
  extra_query: Add additional query parameters to the request
@@ -2,6 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from .shared import (
6
+ UsageInfo as UsageInfo,
7
+ ChatChoice as ChatChoice,
8
+ ChatMessage as ChatMessage,
9
+ SearchResult as SearchResult,
10
+ )
5
11
  from .search_create_params import SearchCreateParams as SearchCreateParams
6
12
  from .content_create_params import ContentCreateParams as ContentCreateParams
7
13
  from .search_create_response import SearchCreateResponse as SearchCreateResponse
@@ -0,0 +1,3 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
@@ -0,0 +1,9 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .completion_list_params import CompletionListParams as CompletionListParams
6
+ from .completion_get_response import CompletionGetResponse as CompletionGetResponse
7
+ from .completion_create_params import CompletionCreateParams as CompletionCreateParams
8
+ from .completion_list_response import CompletionListResponse as CompletionListResponse
9
+ from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
@@ -0,0 +1,94 @@
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 Iterable, Optional
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ from ...._types import SequenceNotStr
9
+ from ...shared_params.chat_message import ChatMessage
10
+
11
+ __all__ = ["CompletionCreateParams", "Request", "RequestWebSearchOptions", "RequestWebSearchOptionsUserLocation"]
12
+
13
+
14
+ class CompletionCreateParams(TypedDict, total=False):
15
+ request: Required[Request]
16
+
17
+
18
+ class RequestWebSearchOptionsUserLocation(TypedDict, total=False):
19
+ city: Optional[str]
20
+
21
+ country: Optional[str]
22
+ """Two-letter ISO country code"""
23
+
24
+ latitude: Optional[float]
25
+
26
+ longitude: Optional[float]
27
+
28
+ region: Optional[str]
29
+ """State/province name"""
30
+
31
+
32
+ class RequestWebSearchOptions(TypedDict, total=False):
33
+ image_search_relevance_enhanced: bool
34
+ """Improves relevance of image search results"""
35
+
36
+ search_context_size: Literal["low", "medium", "high"]
37
+ """
38
+ Amount of search context retrieved: low (cost-saving), medium (balanced), high
39
+ (comprehensive)
40
+ """
41
+
42
+ user_location: RequestWebSearchOptionsUserLocation
43
+
44
+
45
+ class Request(TypedDict, total=False):
46
+ messages: Required[Iterable[ChatMessage]]
47
+ """A list of messages comprising the conversation so far"""
48
+
49
+ model: Required[Literal["sonar", "sonar-pro", "sonar-deep-research", "sonar-reasoning", "sonar-reasoning-pro"]]
50
+ """The name of the model that will complete your prompt"""
51
+
52
+ disable_search: bool
53
+ """Disables web search completely - model uses only training data"""
54
+
55
+ enable_search_classifier: bool
56
+ """Enables classifier that decides if web search is needed"""
57
+
58
+ last_updated_after_filter: Optional[str]
59
+ """Only include content last updated after this date (YYYY-MM-DD)"""
60
+
61
+ last_updated_before_filter: Optional[str]
62
+ """Only include content last updated before this date (YYYY-MM-DD)"""
63
+
64
+ reasoning_effort: Optional[Literal["low", "medium", "high"]]
65
+ """Controls computational effort for sonar-deep-research model.
66
+
67
+ Higher effort = more thorough but more tokens
68
+ """
69
+
70
+ return_images: bool
71
+ """Whether to include images in search results"""
72
+
73
+ return_related_questions: bool
74
+ """Whether to return related questions"""
75
+
76
+ search_after_date_filter: Optional[str]
77
+ """Only include content published after this date (YYYY-MM-DD)"""
78
+
79
+ search_before_date_filter: Optional[str]
80
+ """Only include content published before this date (YYYY-MM-DD)"""
81
+
82
+ search_domain_filter: Optional[SequenceNotStr[str]]
83
+ """List of domains to limit search results to. Use '-' prefix to exclude domains"""
84
+
85
+ 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
+
91
+ search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
92
+ """Filter results by how recently they were published"""
93
+
94
+ web_search_options: RequestWebSearchOptions
@@ -0,0 +1,54 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ...._models import BaseModel
7
+ from ...shared.usage_info import UsageInfo
8
+ from ...shared.chat_choice import ChatChoice
9
+ from ...shared.search_result import SearchResult
10
+
11
+ __all__ = ["CompletionCreateResponse", "Response"]
12
+
13
+
14
+ class Response(BaseModel):
15
+ id: str
16
+ """Unique identifier for the chat completion"""
17
+
18
+ choices: List[ChatChoice]
19
+
20
+ created: int
21
+ """Unix timestamp of creation"""
22
+
23
+ model: str
24
+ """The model used"""
25
+
26
+ object: str
27
+
28
+ usage: UsageInfo
29
+
30
+ search_results: Optional[List[SearchResult]] = None
31
+ """Search results used in generating the response"""
32
+
33
+
34
+ class CompletionCreateResponse(BaseModel):
35
+ id: str
36
+ """Unique identifier for the async job"""
37
+
38
+ created_at: int
39
+ """Unix timestamp of creation"""
40
+
41
+ model: str
42
+
43
+ status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
44
+
45
+ completed_at: Optional[int] = None
46
+
47
+ error_message: Optional[str] = None
48
+
49
+ failed_at: Optional[int] = None
50
+
51
+ response: Optional[Response] = None
52
+ """The completion response when status is COMPLETED"""
53
+
54
+ started_at: Optional[int] = None
@@ -0,0 +1,54 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ...._models import BaseModel
7
+ from ...shared.usage_info import UsageInfo
8
+ from ...shared.chat_choice import ChatChoice
9
+ from ...shared.search_result import SearchResult
10
+
11
+ __all__ = ["CompletionGetResponse", "Response"]
12
+
13
+
14
+ class Response(BaseModel):
15
+ id: str
16
+ """Unique identifier for the chat completion"""
17
+
18
+ choices: List[ChatChoice]
19
+
20
+ created: int
21
+ """Unix timestamp of creation"""
22
+
23
+ model: str
24
+ """The model used"""
25
+
26
+ object: str
27
+
28
+ usage: UsageInfo
29
+
30
+ search_results: Optional[List[SearchResult]] = None
31
+ """Search results used in generating the response"""
32
+
33
+
34
+ class CompletionGetResponse(BaseModel):
35
+ id: str
36
+ """Unique identifier for the async job"""
37
+
38
+ created_at: int
39
+ """Unix timestamp of creation"""
40
+
41
+ model: str
42
+
43
+ status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
44
+
45
+ completed_at: Optional[int] = None
46
+
47
+ error_message: Optional[str] = None
48
+
49
+ failed_at: Optional[int] = None
50
+
51
+ response: Optional[Response] = None
52
+ """The completion response when status is COMPLETED"""
53
+
54
+ started_at: Optional[int] = None
@@ -0,0 +1,15 @@
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"""
@@ -0,0 +1,31 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from ...._models import BaseModel
7
+
8
+ __all__ = ["CompletionListResponse", "Request"]
9
+
10
+
11
+ class Request(BaseModel):
12
+ id: str
13
+
14
+ created_at: int
15
+
16
+ model: str
17
+
18
+ status: Literal["CREATED", "IN_PROGRESS", "COMPLETED", "FAILED"]
19
+
20
+ completed_at: Optional[int] = None
21
+
22
+ failed_at: Optional[int] = None
23
+
24
+ started_at: Optional[int] = None
25
+
26
+
27
+ class CompletionListResponse(BaseModel):
28
+ requests: List[Request]
29
+
30
+ next_token: Optional[str] = None
31
+ """Token for pagination"""