parallel-web 0.1.2__py3-none-any.whl → 0.2.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 parallel-web might be problematic. Click here for more details.
- parallel/__init__.py +2 -1
- parallel/_base_client.py +34 -2
- parallel/_client.py +9 -0
- parallel/_compat.py +1 -0
- parallel/_constants.py +2 -0
- parallel/_files.py +4 -4
- parallel/_models.py +32 -8
- parallel/_types.py +35 -1
- parallel/_utils/__init__.py +1 -0
- parallel/_utils/_typing.py +5 -0
- parallel/_version.py +1 -1
- parallel/lib/_pydantic.py +1 -0
- parallel/lib/_time.py +2 -2
- parallel/resources/__init__.py +14 -0
- parallel/resources/beta/__init__.py +47 -0
- parallel/resources/beta/beta.py +301 -0
- parallel/resources/beta/task_group.py +632 -0
- parallel/resources/beta/task_run.py +499 -0
- parallel/resources/task_run.py +47 -18
- parallel/types/__init__.py +15 -0
- parallel/types/auto_schema.py +13 -0
- parallel/types/auto_schema_param.py +12 -0
- parallel/types/beta/__init__.py +30 -0
- parallel/types/beta/beta_run_input.py +63 -0
- parallel/types/beta/beta_run_input_param.py +65 -0
- parallel/types/beta/beta_search_params.py +47 -0
- parallel/types/beta/beta_task_run_result.py +74 -0
- parallel/types/beta/error_event.py +16 -0
- parallel/types/beta/mcp_server.py +25 -0
- parallel/types/beta/mcp_server_param.py +25 -0
- parallel/types/beta/mcp_tool_call.py +27 -0
- parallel/types/beta/parallel_beta_param.py +12 -0
- parallel/types/beta/search_result.py +16 -0
- parallel/types/beta/task_group.py +24 -0
- parallel/types/beta/task_group_add_runs_params.py +30 -0
- parallel/types/beta/task_group_create_params.py +13 -0
- parallel/types/beta/task_group_events_params.py +16 -0
- parallel/types/beta/task_group_events_response.py +28 -0
- parallel/types/beta/task_group_get_runs_params.py +18 -0
- parallel/types/beta/task_group_get_runs_response.py +12 -0
- parallel/types/beta/task_group_run_response.py +30 -0
- parallel/types/beta/task_group_status.py +27 -0
- parallel/types/beta/task_run_create_params.py +70 -0
- parallel/types/beta/task_run_event.py +32 -0
- parallel/types/beta/task_run_events_response.py +58 -0
- parallel/types/beta/task_run_result_params.py +18 -0
- parallel/types/beta/web_search_result.py +18 -0
- parallel/types/beta/webhook.py +16 -0
- parallel/types/beta/webhook_param.py +16 -0
- parallel/types/citation.py +21 -0
- parallel/types/field_basis.py +25 -0
- parallel/types/json_schema.py +16 -0
- parallel/types/json_schema_param.py +2 -1
- parallel/types/parsed_task_run_result.py +13 -4
- parallel/types/shared/__init__.py +6 -0
- parallel/types/shared/error_object.py +18 -0
- parallel/types/shared/error_response.py +16 -0
- parallel/types/shared/source_policy.py +21 -0
- parallel/types/shared/warning.py +22 -0
- parallel/types/shared_params/__init__.py +3 -0
- parallel/types/shared_params/source_policy.py +22 -0
- parallel/types/task_run.py +17 -18
- parallel/types/task_run_create_params.py +12 -3
- parallel/types/task_run_json_output.py +46 -0
- parallel/types/task_run_result.py +24 -94
- parallel/types/task_run_text_output.py +37 -0
- parallel/types/task_spec.py +31 -0
- parallel/types/task_spec_param.py +3 -2
- parallel/types/text_schema.py +16 -0
- {parallel_web-0.1.2.dist-info → parallel_web-0.2.0.dist-info}/METADATA +48 -136
- parallel_web-0.2.0.dist-info/RECORD +94 -0
- parallel_web-0.1.2.dist-info/RECORD +0 -47
- {parallel_web-0.1.2.dist-info → parallel_web-0.2.0.dist-info}/WHEEL +0 -0
- {parallel_web-0.1.2.dist-info → parallel_web-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Union, Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import Field as FieldInfo
|
|
6
|
+
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from .task_group_status import TaskGroupStatus
|
|
9
|
+
|
|
10
|
+
__all__ = ["TaskGroup"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TaskGroup(BaseModel):
|
|
14
|
+
created_at: Optional[str] = None
|
|
15
|
+
"""Timestamp of the creation of the group, as an RFC 3339 string."""
|
|
16
|
+
|
|
17
|
+
status: TaskGroupStatus
|
|
18
|
+
"""Status of a task group."""
|
|
19
|
+
|
|
20
|
+
task_group_id: str = FieldInfo(alias="taskgroup_id")
|
|
21
|
+
"""ID of the group."""
|
|
22
|
+
|
|
23
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] = None
|
|
24
|
+
"""User-provided metadata stored with the group."""
|
|
@@ -0,0 +1,30 @@
|
|
|
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 List, Iterable, Optional
|
|
6
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._utils import PropertyInfo
|
|
9
|
+
from ..task_spec_param import TaskSpecParam
|
|
10
|
+
from .parallel_beta_param import ParallelBetaParam
|
|
11
|
+
from .beta_run_input_param import BetaRunInputParam
|
|
12
|
+
|
|
13
|
+
__all__ = ["TaskGroupAddRunsParams"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TaskGroupAddRunsParams(TypedDict, total=False):
|
|
17
|
+
inputs: Required[Iterable[BetaRunInputParam]]
|
|
18
|
+
"""List of task runs to execute."""
|
|
19
|
+
|
|
20
|
+
default_task_spec: Optional[TaskSpecParam]
|
|
21
|
+
"""Specification for a task.
|
|
22
|
+
|
|
23
|
+
Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
24
|
+
Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
25
|
+
|
|
26
|
+
For convenience bare strings are also accepted as input or output schemas.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")]
|
|
30
|
+
"""Optional header to specify the beta version(s) to enable."""
|
|
@@ -0,0 +1,13 @@
|
|
|
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 Dict, Union, Optional
|
|
6
|
+
from typing_extensions import TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["TaskGroupCreateParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TaskGroupCreateParams(TypedDict, total=False):
|
|
12
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]]
|
|
13
|
+
"""User-provided metadata stored with the task group."""
|
|
@@ -0,0 +1,16 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._utils import PropertyInfo
|
|
9
|
+
|
|
10
|
+
__all__ = ["TaskGroupEventsParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TaskGroupEventsParams(TypedDict, total=False):
|
|
14
|
+
last_event_id: Optional[str]
|
|
15
|
+
|
|
16
|
+
api_timeout: Annotated[Optional[float], PropertyInfo(alias="timeout")]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._utils import PropertyInfo
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from .error_event import ErrorEvent
|
|
9
|
+
from .task_run_event import TaskRunEvent
|
|
10
|
+
from .task_group_status import TaskGroupStatus
|
|
11
|
+
|
|
12
|
+
__all__ = ["TaskGroupEventsResponse", "TaskGroupStatusEvent"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TaskGroupStatusEvent(BaseModel):
|
|
16
|
+
event_id: str
|
|
17
|
+
"""Cursor to resume the event stream."""
|
|
18
|
+
|
|
19
|
+
status: TaskGroupStatus
|
|
20
|
+
"""Status of a task group."""
|
|
21
|
+
|
|
22
|
+
type: Literal["task_group_status"]
|
|
23
|
+
"""Event type; always 'task_group_status'."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
TaskGroupEventsResponse: TypeAlias = Annotated[
|
|
27
|
+
Union[TaskGroupStatusEvent, TaskRunEvent, ErrorEvent], PropertyInfo(discriminator="type")
|
|
28
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Literal, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["TaskGroupGetRunsParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TaskGroupGetRunsParams(TypedDict, total=False):
|
|
12
|
+
include_input: bool
|
|
13
|
+
|
|
14
|
+
include_output: bool
|
|
15
|
+
|
|
16
|
+
last_event_id: Optional[str]
|
|
17
|
+
|
|
18
|
+
status: Optional[Literal["queued", "action_required", "running", "completed", "failed", "cancelling", "cancelled"]]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
from typing_extensions import Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._utils import PropertyInfo
|
|
7
|
+
from .error_event import ErrorEvent
|
|
8
|
+
from .task_run_event import TaskRunEvent
|
|
9
|
+
|
|
10
|
+
__all__ = ["TaskGroupGetRunsResponse"]
|
|
11
|
+
|
|
12
|
+
TaskGroupGetRunsResponse: TypeAlias = Annotated[Union[TaskRunEvent, ErrorEvent], PropertyInfo(discriminator="type")]
|
|
@@ -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 .task_group_status import TaskGroupStatus
|
|
7
|
+
|
|
8
|
+
__all__ = ["TaskGroupRunResponse"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TaskGroupRunResponse(BaseModel):
|
|
12
|
+
event_cursor: Optional[str] = None
|
|
13
|
+
"""
|
|
14
|
+
Cursor for these runs in the event stream at
|
|
15
|
+
taskgroup/events?last_event_id=<event_cursor>. Empty for the first runs in the
|
|
16
|
+
group.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
run_cursor: Optional[str] = None
|
|
20
|
+
"""
|
|
21
|
+
Cursor for these runs in the run stream at
|
|
22
|
+
taskgroup/runs?last_event_id=<run_cursor>. Empty for the first runs in the
|
|
23
|
+
group.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
run_ids: List[str]
|
|
27
|
+
"""IDs of the newly created runs."""
|
|
28
|
+
|
|
29
|
+
status: TaskGroupStatus
|
|
30
|
+
"""Status of a task group."""
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["TaskGroupStatus"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TaskGroupStatus(BaseModel):
|
|
11
|
+
is_active: bool
|
|
12
|
+
"""True if at least one run in the group is currently active, i.e.
|
|
13
|
+
|
|
14
|
+
status is one of {'cancelling', 'queued', 'running'}.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
modified_at: Optional[str] = None
|
|
18
|
+
"""Timestamp of the last status update to the group, as an RFC 3339 string."""
|
|
19
|
+
|
|
20
|
+
num_task_runs: int
|
|
21
|
+
"""Number of task runs in the group."""
|
|
22
|
+
|
|
23
|
+
status_message: Optional[str] = None
|
|
24
|
+
"""Human-readable status message for the group."""
|
|
25
|
+
|
|
26
|
+
task_run_status_counts: Dict[str, int]
|
|
27
|
+
"""Number of task runs with each status."""
|
|
@@ -0,0 +1,70 @@
|
|
|
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 Dict, List, Union, Iterable, Optional
|
|
6
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._utils import PropertyInfo
|
|
9
|
+
from .webhook_param import WebhookParam
|
|
10
|
+
from ..task_spec_param import TaskSpecParam
|
|
11
|
+
from .mcp_server_param import McpServerParam
|
|
12
|
+
from .parallel_beta_param import ParallelBetaParam
|
|
13
|
+
from ..shared_params.source_policy import SourcePolicy
|
|
14
|
+
|
|
15
|
+
__all__ = ["TaskRunCreateParams"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TaskRunCreateParams(TypedDict, total=False):
|
|
19
|
+
input: Required[Union[str, Dict[str, object]]]
|
|
20
|
+
"""Input to the task, either text or a JSON object."""
|
|
21
|
+
|
|
22
|
+
processor: Required[str]
|
|
23
|
+
"""Processor to use for the task."""
|
|
24
|
+
|
|
25
|
+
enable_events: Optional[bool]
|
|
26
|
+
"""Controls tracking of task run execution progress.
|
|
27
|
+
|
|
28
|
+
When set to true, progress events are recorded and can be accessed via the
|
|
29
|
+
[Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
|
|
30
|
+
false, no progress events are tracked. Note that progress tracking cannot be
|
|
31
|
+
enabled after a run has been created. The flag is set to true by default for
|
|
32
|
+
premium processors (pro and above). This feature is not available via the Python
|
|
33
|
+
SDK. To enable this feature in your API requests, specify the `parallel-beta`
|
|
34
|
+
header with `events-sse-2025-07-24` value.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
mcp_servers: Optional[Iterable[McpServerParam]]
|
|
38
|
+
"""
|
|
39
|
+
Optional list of MCP servers to use for the run. This feature is not available
|
|
40
|
+
via the Python SDK. To enable this feature in your API requests, specify the
|
|
41
|
+
`parallel-beta` header with `mcp-server-2025-07-17` value.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]]
|
|
45
|
+
"""User-provided metadata stored with the run.
|
|
46
|
+
|
|
47
|
+
Keys and values must be strings with a maximum length of 16 and 512 characters
|
|
48
|
+
respectively.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
source_policy: Optional[SourcePolicy]
|
|
52
|
+
"""Source policy for web search results.
|
|
53
|
+
|
|
54
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
task_spec: Optional[TaskSpecParam]
|
|
58
|
+
"""Specification for a task.
|
|
59
|
+
|
|
60
|
+
Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
61
|
+
Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
62
|
+
|
|
63
|
+
For convenience bare strings are also accepted as input or output schemas.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
webhook: Optional[WebhookParam]
|
|
67
|
+
"""Webhooks for Task Runs."""
|
|
68
|
+
|
|
69
|
+
betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")]
|
|
70
|
+
"""Optional header to specify the beta version(s) to enable."""
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union, Optional
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._utils import PropertyInfo
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from ..task_run import TaskRun
|
|
9
|
+
from .beta_run_input import BetaRunInput
|
|
10
|
+
from ..task_run_json_output import TaskRunJsonOutput
|
|
11
|
+
from ..task_run_text_output import TaskRunTextOutput
|
|
12
|
+
|
|
13
|
+
__all__ = ["TaskRunEvent", "Output"]
|
|
14
|
+
|
|
15
|
+
Output: TypeAlias = Annotated[Union[TaskRunTextOutput, TaskRunJsonOutput, None], PropertyInfo(discriminator="type")]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TaskRunEvent(BaseModel):
|
|
19
|
+
event_id: Optional[str] = None
|
|
20
|
+
"""Cursor to resume the event stream. Always empty for non Task Group runs."""
|
|
21
|
+
|
|
22
|
+
run: TaskRun
|
|
23
|
+
"""Status of a task run."""
|
|
24
|
+
|
|
25
|
+
type: Literal["task_run.state"]
|
|
26
|
+
"""Event type; always 'task_run.state'."""
|
|
27
|
+
|
|
28
|
+
input: Optional[BetaRunInput] = None
|
|
29
|
+
"""Task run input with additional beta fields."""
|
|
30
|
+
|
|
31
|
+
output: Optional[Output] = None
|
|
32
|
+
"""Output from the run; included only if requested and if status == `completed`."""
|
|
@@ -0,0 +1,58 @@
|
|
|
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, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._utils import PropertyInfo
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from .error_event import ErrorEvent
|
|
9
|
+
from .task_run_event import TaskRunEvent
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"TaskRunEventsResponse",
|
|
13
|
+
"TaskRunProgressStatsEvent",
|
|
14
|
+
"TaskRunProgressStatsEventSourceStats",
|
|
15
|
+
"TaskRunProgressMessageEvent",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TaskRunProgressStatsEventSourceStats(BaseModel):
|
|
20
|
+
num_sources_considered: Optional[int] = None
|
|
21
|
+
"""Number of sources considered in processing the task."""
|
|
22
|
+
|
|
23
|
+
num_sources_read: Optional[int] = None
|
|
24
|
+
"""Number of sources read in processing the task."""
|
|
25
|
+
|
|
26
|
+
sources_read_sample: Optional[List[str]] = None
|
|
27
|
+
"""A sample of URLs of sources read in processing the task."""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TaskRunProgressStatsEvent(BaseModel):
|
|
31
|
+
source_stats: TaskRunProgressStatsEventSourceStats
|
|
32
|
+
"""Source stats for a task run."""
|
|
33
|
+
|
|
34
|
+
type: Literal["task_run.progress_stats"]
|
|
35
|
+
"""Event type; always 'task_run.progress_stats'."""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class TaskRunProgressMessageEvent(BaseModel):
|
|
39
|
+
message: str
|
|
40
|
+
"""Progress update message."""
|
|
41
|
+
|
|
42
|
+
timestamp: Optional[str] = None
|
|
43
|
+
"""Timestamp of the message."""
|
|
44
|
+
|
|
45
|
+
type: Literal[
|
|
46
|
+
"task_run.progress_msg.plan",
|
|
47
|
+
"task_run.progress_msg.search",
|
|
48
|
+
"task_run.progress_msg.result",
|
|
49
|
+
"task_run.progress_msg.tool_call",
|
|
50
|
+
"task_run.progress_msg.exec_status",
|
|
51
|
+
]
|
|
52
|
+
"""Event type; always starts with 'task_run.progress_msg'."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
TaskRunEventsResponse: TypeAlias = Annotated[
|
|
56
|
+
Union[TaskRunProgressStatsEvent, TaskRunProgressMessageEvent, TaskRunEvent, ErrorEvent],
|
|
57
|
+
PropertyInfo(discriminator="type"),
|
|
58
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
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 List
|
|
6
|
+
from typing_extensions import Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._utils import PropertyInfo
|
|
9
|
+
from .parallel_beta_param import ParallelBetaParam
|
|
10
|
+
|
|
11
|
+
__all__ = ["TaskRunResultParams"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TaskRunResultParams(TypedDict, total=False):
|
|
15
|
+
api_timeout: Annotated[int, PropertyInfo(alias="timeout")]
|
|
16
|
+
|
|
17
|
+
betas: Annotated[List[ParallelBetaParam], PropertyInfo(alias="parallel-beta")]
|
|
18
|
+
"""Optional header to specify the beta version(s) to enable."""
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["WebSearchResult"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WebSearchResult(BaseModel):
|
|
11
|
+
excerpts: List[str]
|
|
12
|
+
"""Text excerpts from the search result which are relevant to the request."""
|
|
13
|
+
|
|
14
|
+
title: str
|
|
15
|
+
"""Title of the search result."""
|
|
16
|
+
|
|
17
|
+
url: str
|
|
18
|
+
"""URL associated with the search result."""
|
|
@@ -0,0 +1,16 @@
|
|
|
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__ = ["Webhook"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Webhook(BaseModel):
|
|
12
|
+
url: str
|
|
13
|
+
"""URL for the webhook."""
|
|
14
|
+
|
|
15
|
+
event_types: Optional[List[Literal["task_run.status"]]] = None
|
|
16
|
+
"""Event types to send the webhook notifications for."""
|
|
@@ -0,0 +1,16 @@
|
|
|
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 List
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["WebhookParam"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class WebhookParam(TypedDict, total=False):
|
|
12
|
+
url: Required[str]
|
|
13
|
+
"""URL for the webhook."""
|
|
14
|
+
|
|
15
|
+
event_types: List[Literal["task_run.status"]]
|
|
16
|
+
"""Event types to send the webhook notifications for."""
|
|
@@ -0,0 +1,21 @@
|
|
|
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__ = ["Citation"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Citation(BaseModel):
|
|
11
|
+
url: str
|
|
12
|
+
"""URL of the citation."""
|
|
13
|
+
|
|
14
|
+
excerpts: Optional[List[str]] = None
|
|
15
|
+
"""Excerpts from the citation supporting the output.
|
|
16
|
+
|
|
17
|
+
Only certain processors provide excerpts.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
title: Optional[str] = None
|
|
21
|
+
"""Title of the citation."""
|
|
@@ -0,0 +1,25 @@
|
|
|
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 .citation import Citation
|
|
7
|
+
|
|
8
|
+
__all__ = ["FieldBasis"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FieldBasis(BaseModel):
|
|
12
|
+
field: str
|
|
13
|
+
"""Name of the output field."""
|
|
14
|
+
|
|
15
|
+
reasoning: str
|
|
16
|
+
"""Reasoning for the output field."""
|
|
17
|
+
|
|
18
|
+
citations: Optional[List[Citation]] = None
|
|
19
|
+
"""List of citations supporting the output field."""
|
|
20
|
+
|
|
21
|
+
confidence: Optional[str] = None
|
|
22
|
+
"""Confidence level for the output field.
|
|
23
|
+
|
|
24
|
+
Only certain processors provide confidence levels.
|
|
25
|
+
"""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["JsonSchema"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class JsonSchema(BaseModel):
|
|
12
|
+
json_schema: Dict[str, object]
|
|
13
|
+
"""A JSON Schema object. Only a subset of JSON Schema is supported."""
|
|
14
|
+
|
|
15
|
+
type: Optional[Literal["json"]] = None
|
|
16
|
+
"""The type of schema being defined. Always `json`."""
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from typing import Dict
|
|
5
6
|
from typing_extensions import Literal, Required, TypedDict
|
|
6
7
|
|
|
7
8
|
__all__ = ["JsonSchemaParam"]
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class JsonSchemaParam(TypedDict, total=False):
|
|
11
|
-
json_schema: Required[object]
|
|
12
|
+
json_schema: Required[Dict[str, object]]
|
|
12
13
|
"""A JSON Schema object. Only a subset of JSON Schema is supported."""
|
|
13
14
|
|
|
14
15
|
type: Literal["json"]
|
|
@@ -3,7 +3,9 @@ from typing import Union, Generic, TypeVar, Optional
|
|
|
3
3
|
from pydantic import BaseModel
|
|
4
4
|
|
|
5
5
|
from .._models import GenericModel
|
|
6
|
-
from .task_run_result import TaskRunResult
|
|
6
|
+
from .task_run_result import TaskRunResult
|
|
7
|
+
from .task_run_json_output import TaskRunJsonOutput
|
|
8
|
+
from .task_run_text_output import TaskRunTextOutput
|
|
7
9
|
|
|
8
10
|
ContentType = TypeVar("ContentType", bound=BaseModel)
|
|
9
11
|
|
|
@@ -14,16 +16,23 @@ ContentType = TypeVar("ContentType", bound=BaseModel)
|
|
|
14
16
|
# pyright: reportIncompatibleVariableOverride=false
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
class
|
|
19
|
+
class ParsedTaskRunTextOutput(TaskRunTextOutput, GenericModel, Generic[ContentType]):
|
|
18
20
|
parsed: None
|
|
19
21
|
"""The parsed output from the task run."""
|
|
20
22
|
|
|
21
23
|
|
|
22
|
-
class
|
|
24
|
+
class ParsedTaskRunJsonOutput(TaskRunJsonOutput, GenericModel, Generic[ContentType]):
|
|
23
25
|
parsed: Optional[ContentType] = None
|
|
24
26
|
"""The parsed output from the task run."""
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
class ParsedTaskRunResult(TaskRunResult, GenericModel, Generic[ContentType]):
|
|
28
|
-
output: Union[
|
|
30
|
+
output: Union[ParsedTaskRunTextOutput[ContentType], ParsedTaskRunJsonOutput[ContentType]] # type: ignore[assignment]
|
|
29
31
|
"""The parsed output from the task run."""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
ParsedOutputTaskRunTextOutput = ParsedTaskRunTextOutput # for backwards compatibility with v0.1.3
|
|
35
|
+
"""This is deprecated, `ParsedTaskRunTextOutput` should be used instead"""
|
|
36
|
+
|
|
37
|
+
ParsedOutputTaskRunJsonOutput = ParsedTaskRunJsonOutput # for backwards compatibility with v0.1.3
|
|
38
|
+
"""This is deprecated, `ParsedTaskRunJsonOutput` should be used instead"""
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .warning import Warning as Warning
|
|
4
|
+
from .error_object import ErrorObject as ErrorObject
|
|
5
|
+
from .source_policy import SourcePolicy as SourcePolicy
|
|
6
|
+
from .error_response import ErrorResponse as ErrorResponse
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["ErrorObject"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ErrorObject(BaseModel):
|
|
11
|
+
message: str
|
|
12
|
+
"""Human-readable message."""
|
|
13
|
+
|
|
14
|
+
ref_id: str
|
|
15
|
+
"""Reference ID for the error."""
|
|
16
|
+
|
|
17
|
+
detail: Optional[Dict[str, object]] = None
|
|
18
|
+
"""Optional detail supporting the error."""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
from .error_object import ErrorObject
|
|
7
|
+
|
|
8
|
+
__all__ = ["ErrorResponse"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ErrorResponse(BaseModel):
|
|
12
|
+
error: ErrorObject
|
|
13
|
+
"""An error message."""
|
|
14
|
+
|
|
15
|
+
type: Literal["error"]
|
|
16
|
+
"""Always 'error'."""
|
|
@@ -0,0 +1,21 @@
|
|
|
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__ = ["SourcePolicy"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SourcePolicy(BaseModel):
|
|
11
|
+
exclude_domains: Optional[List[str]] = None
|
|
12
|
+
"""List of domains to exclude from results.
|
|
13
|
+
|
|
14
|
+
If specified, sources from these domains will be excluded.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
include_domains: Optional[List[str]] = None
|
|
18
|
+
"""List of domains to restrict the results to.
|
|
19
|
+
|
|
20
|
+
If specified, only sources from these domains will be included.
|
|
21
|
+
"""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["Warning"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Warning(BaseModel):
|
|
12
|
+
message: str
|
|
13
|
+
"""Human-readable message."""
|
|
14
|
+
|
|
15
|
+
type: Literal["spec_validation_warning", "input_validation_warning", "warning"]
|
|
16
|
+
"""Type of warning.
|
|
17
|
+
|
|
18
|
+
Note that adding new warning types is considered a backward-compatible change.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
detail: Optional[Dict[str, object]] = None
|
|
22
|
+
"""Optional detail supporting the warning."""
|