perplexityai 0.5.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.
- perplexity/_client.py +27 -1
- perplexity/_version.py +1 -1
- perplexity/resources/__init__.py +42 -0
- perplexity/resources/async_/__init__.py +33 -0
- perplexity/resources/async_/async_.py +102 -0
- perplexity/resources/async_/chat/__init__.py +33 -0
- perplexity/resources/async_/chat/chat.py +102 -0
- perplexity/resources/async_/chat/completions.py +347 -0
- perplexity/resources/chat/__init__.py +33 -0
- perplexity/resources/chat/chat.py +102 -0
- perplexity/resources/chat/completions.py +295 -0
- perplexity/resources/content.py +167 -0
- perplexity/resources/search.py +64 -2
- perplexity/types/__init__.py +8 -0
- perplexity/types/async_/__init__.py +3 -0
- perplexity/types/async_/chat/__init__.py +9 -0
- perplexity/types/async_/chat/completion_create_params.py +94 -0
- perplexity/types/async_/chat/completion_create_response.py +54 -0
- perplexity/types/async_/chat/completion_get_response.py +54 -0
- perplexity/types/async_/chat/completion_list_params.py +15 -0
- perplexity/types/async_/chat/completion_list_response.py +31 -0
- perplexity/types/chat/__init__.py +6 -0
- perplexity/types/chat/completion_create_params.py +90 -0
- perplexity/types/chat/completion_create_response.py +30 -0
- perplexity/types/content_create_params.py +14 -0
- perplexity/types/content_create_response.py +29 -0
- perplexity/types/search_create_params.py +26 -0
- perplexity/types/search_create_response.py +7 -0
- perplexity/types/shared/__init__.py +6 -0
- perplexity/types/shared/chat_choice.py +17 -0
- perplexity/types/shared/chat_message.py +31 -0
- perplexity/types/shared/search_result.py +15 -0
- perplexity/types/shared/usage_info.py +23 -0
- perplexity/types/shared_params/__init__.py +3 -0
- perplexity/types/shared_params/chat_message.py +31 -0
- {perplexityai-0.5.0.dist-info → perplexityai-0.7.0.dist-info}/METADATA +90 -22
- perplexityai-0.7.0.dist-info/RECORD +65 -0
- perplexityai-0.5.0.dist-info/RECORD +0 -37
- {perplexityai-0.5.0.dist-info → perplexityai-0.7.0.dist-info}/WHEEL +0 -0
- {perplexityai-0.5.0.dist-info → perplexityai-0.7.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -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"""
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
|
|
6
|
+
from .completion_create_response import CompletionCreateResponse as CompletionCreateResponse
|
|
@@ -0,0 +1,90 @@
|
|
|
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", "WebSearchOptions", "WebSearchOptionsUserLocation"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CompletionCreateParams(TypedDict, total=False):
|
|
15
|
+
messages: Required[Iterable[ChatMessage]]
|
|
16
|
+
"""A list of messages comprising the conversation so far"""
|
|
17
|
+
|
|
18
|
+
model: Required[Literal["sonar", "sonar-pro", "sonar-deep-research", "sonar-reasoning", "sonar-reasoning-pro"]]
|
|
19
|
+
"""The name of the model that will complete your prompt"""
|
|
20
|
+
|
|
21
|
+
disable_search: bool
|
|
22
|
+
"""Disables web search completely - model uses only training data"""
|
|
23
|
+
|
|
24
|
+
enable_search_classifier: bool
|
|
25
|
+
"""Enables classifier that decides if web search is needed"""
|
|
26
|
+
|
|
27
|
+
last_updated_after_filter: Optional[str]
|
|
28
|
+
"""Only include content last updated after this date (YYYY-MM-DD)"""
|
|
29
|
+
|
|
30
|
+
last_updated_before_filter: Optional[str]
|
|
31
|
+
"""Only include content last updated before this date (YYYY-MM-DD)"""
|
|
32
|
+
|
|
33
|
+
reasoning_effort: Optional[Literal["low", "medium", "high"]]
|
|
34
|
+
"""Controls computational effort for sonar-deep-research model.
|
|
35
|
+
|
|
36
|
+
Higher effort = more thorough but more tokens
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
return_images: bool
|
|
40
|
+
"""Whether to include images in search results"""
|
|
41
|
+
|
|
42
|
+
return_related_questions: bool
|
|
43
|
+
"""Whether to return related questions"""
|
|
44
|
+
|
|
45
|
+
search_after_date_filter: Optional[str]
|
|
46
|
+
"""Only include content published after this date (YYYY-MM-DD)"""
|
|
47
|
+
|
|
48
|
+
search_before_date_filter: Optional[str]
|
|
49
|
+
"""Only include content published before this date (YYYY-MM-DD)"""
|
|
50
|
+
|
|
51
|
+
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
52
|
+
"""List of domains to limit search results to. Use '-' prefix to exclude domains"""
|
|
53
|
+
|
|
54
|
+
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
55
|
+
"""
|
|
56
|
+
Type of search: 'web' for general, 'academic' for scholarly, 'sec' for SEC
|
|
57
|
+
filings
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
|
61
|
+
"""Filter results by how recently they were published"""
|
|
62
|
+
|
|
63
|
+
web_search_options: WebSearchOptions
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class WebSearchOptionsUserLocation(TypedDict, total=False):
|
|
67
|
+
city: Optional[str]
|
|
68
|
+
|
|
69
|
+
country: Optional[str]
|
|
70
|
+
"""Two-letter ISO country code"""
|
|
71
|
+
|
|
72
|
+
latitude: Optional[float]
|
|
73
|
+
|
|
74
|
+
longitude: Optional[float]
|
|
75
|
+
|
|
76
|
+
region: Optional[str]
|
|
77
|
+
"""State/province name"""
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class WebSearchOptions(TypedDict, total=False):
|
|
81
|
+
image_search_relevance_enhanced: bool
|
|
82
|
+
"""Improves relevance of image search results"""
|
|
83
|
+
|
|
84
|
+
search_context_size: Literal["low", "medium", "high"]
|
|
85
|
+
"""
|
|
86
|
+
Amount of search context retrieved: low (cost-saving), medium (balanced), high
|
|
87
|
+
(comprehensive)
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
user_location: WebSearchOptionsUserLocation
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
from ..shared.usage_info import UsageInfo
|
|
7
|
+
from ..shared.chat_choice import ChatChoice
|
|
8
|
+
from ..shared.search_result import SearchResult
|
|
9
|
+
|
|
10
|
+
__all__ = ["CompletionCreateResponse"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CompletionCreateResponse(BaseModel):
|
|
14
|
+
id: str
|
|
15
|
+
"""Unique identifier for the chat completion"""
|
|
16
|
+
|
|
17
|
+
choices: List[ChatChoice]
|
|
18
|
+
|
|
19
|
+
created: int
|
|
20
|
+
"""Unix timestamp of creation"""
|
|
21
|
+
|
|
22
|
+
model: str
|
|
23
|
+
"""The model used"""
|
|
24
|
+
|
|
25
|
+
object: str
|
|
26
|
+
|
|
27
|
+
usage: UsageInfo
|
|
28
|
+
|
|
29
|
+
search_results: Optional[List[SearchResult]] = None
|
|
30
|
+
"""Search results used in generating the response"""
|
|
@@ -0,0 +1,14 @@
|
|
|
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"""
|
|
@@ -0,0 +1,29 @@
|
|
|
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"""
|
|
@@ -12,25 +12,51 @@ __all__ = ["SearchCreateParams"]
|
|
|
12
12
|
|
|
13
13
|
class SearchCreateParams(TypedDict, total=False):
|
|
14
14
|
query: Required[Union[str, SequenceNotStr[str]]]
|
|
15
|
+
"""Search query string or array of query strings to search for"""
|
|
15
16
|
|
|
16
17
|
country: Optional[str]
|
|
18
|
+
"""Country code to bias search results towards (e.g., 'US', 'GB', 'CA')"""
|
|
17
19
|
|
|
18
20
|
last_updated_after_filter: Optional[str]
|
|
21
|
+
"""Only include results last updated after this date (ISO 8601 format: YYYY-MM-DD)"""
|
|
19
22
|
|
|
20
23
|
last_updated_before_filter: Optional[str]
|
|
24
|
+
"""
|
|
25
|
+
Only include results last updated before this date (ISO 8601 format: YYYY-MM-DD)
|
|
26
|
+
"""
|
|
21
27
|
|
|
22
28
|
max_results: int
|
|
29
|
+
"""Maximum number of search results to return"""
|
|
23
30
|
|
|
24
31
|
max_tokens: int
|
|
32
|
+
"""Maximum number of tokens to return across all results"""
|
|
33
|
+
|
|
34
|
+
max_tokens_per_page: int
|
|
35
|
+
"""Maximum number of tokens to return per individual search result"""
|
|
25
36
|
|
|
26
37
|
safe_search: Optional[bool]
|
|
38
|
+
"""Enable safe search filtering to exclude adult content"""
|
|
27
39
|
|
|
28
40
|
search_after_date_filter: Optional[str]
|
|
41
|
+
"""Only include results published after this date (ISO 8601 format: YYYY-MM-DD)"""
|
|
29
42
|
|
|
30
43
|
search_before_date_filter: Optional[str]
|
|
44
|
+
"""Only include results published before this date (ISO 8601 format: YYYY-MM-DD)"""
|
|
31
45
|
|
|
32
46
|
search_domain_filter: Optional[SequenceNotStr[str]]
|
|
47
|
+
"""
|
|
48
|
+
List of domains to restrict search results to (e.g., ['example.com',
|
|
49
|
+
'another.com'])
|
|
50
|
+
"""
|
|
33
51
|
|
|
34
52
|
search_mode: Optional[Literal["web", "academic", "sec"]]
|
|
53
|
+
"""
|
|
54
|
+
Type of search to perform: 'web' for general web search, 'academic' for
|
|
55
|
+
scholarly articles, 'sec' for SEC filings
|
|
56
|
+
"""
|
|
35
57
|
|
|
36
58
|
search_recency_filter: Optional[Literal["hour", "day", "week", "month", "year"]]
|
|
59
|
+
"""
|
|
60
|
+
Filter results by how recently they were published (hour, day, week, month, or
|
|
61
|
+
year)
|
|
62
|
+
"""
|
|
@@ -9,17 +9,24 @@ __all__ = ["SearchCreateResponse", "Result"]
|
|
|
9
9
|
|
|
10
10
|
class Result(BaseModel):
|
|
11
11
|
snippet: str
|
|
12
|
+
"""A brief excerpt or summary of the page content"""
|
|
12
13
|
|
|
13
14
|
title: str
|
|
15
|
+
"""The title of the search result page"""
|
|
14
16
|
|
|
15
17
|
url: str
|
|
18
|
+
"""The URL of the search result page"""
|
|
16
19
|
|
|
17
20
|
date: Optional[str] = None
|
|
21
|
+
"""The publication date of the content (if available)"""
|
|
18
22
|
|
|
19
23
|
last_updated: Optional[str] = None
|
|
24
|
+
"""When the content was last updated (if available)"""
|
|
20
25
|
|
|
21
26
|
|
|
22
27
|
class SearchCreateResponse(BaseModel):
|
|
23
28
|
id: str
|
|
29
|
+
"""Unique identifier for this search request"""
|
|
24
30
|
|
|
25
31
|
results: List[Result]
|
|
32
|
+
"""Array of search result pages matching the query"""
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .usage_info import UsageInfo as UsageInfo
|
|
4
|
+
from .chat_choice import ChatChoice as ChatChoice
|
|
5
|
+
from .chat_message import ChatMessage as ChatMessage
|
|
6
|
+
from .search_result import SearchResult as SearchResult
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from .chat_message import ChatMessage
|
|
8
|
+
|
|
9
|
+
__all__ = ["ChatChoice"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ChatChoice(BaseModel):
|
|
13
|
+
index: int
|
|
14
|
+
|
|
15
|
+
message: ChatMessage
|
|
16
|
+
|
|
17
|
+
finish_reason: Optional[Literal["stop", "length"]] = None
|
|
@@ -0,0 +1,31 @@
|
|
|
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"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["SearchResult"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SearchResult(BaseModel):
|
|
11
|
+
title: str
|
|
12
|
+
|
|
13
|
+
url: str
|
|
14
|
+
|
|
15
|
+
date: Optional[str] = None
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["UsageInfo"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class UsageInfo(BaseModel):
|
|
11
|
+
completion_tokens: int
|
|
12
|
+
|
|
13
|
+
prompt_tokens: int
|
|
14
|
+
|
|
15
|
+
total_tokens: int
|
|
16
|
+
|
|
17
|
+
citation_tokens: Optional[int] = None
|
|
18
|
+
|
|
19
|
+
num_search_queries: Optional[int] = None
|
|
20
|
+
|
|
21
|
+
reasoning_tokens: Optional[int] = None
|
|
22
|
+
|
|
23
|
+
search_context_size: Optional[str] = None
|
|
@@ -0,0 +1,31 @@
|
|
|
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"""
|