# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, List, Union, Optional

from .webhook import Webhook
from .._models import BaseModel
from .task_spec import TaskSpec
from .mcp_server import McpServer
from .shared.source_policy import SourcePolicy

__all__ = ["RunInput", "AdvancedSettings"]


class AdvancedSettings(BaseModel):
    """Advanced search configuration for a task run."""

    location: Optional[str] = None
    """ISO 3166-1 alpha-2 country code for geo-targeted search results."""


class RunInput(BaseModel):
    """Request to run a task."""

    input: Union[str, Dict[str, object]]
    """Input to the task, either text or a JSON object."""

    processor: str
    """Processor to use for the task."""

    advanced_settings: Optional[AdvancedSettings] = None
    """Advanced search configuration for a task run."""

    enable_events: Optional[bool] = None
    """Controls tracking of task run execution progress.

    When set to true, progress events are recorded and can be accessed via the
    [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
    no progress events are tracked. Note that progress tracking cannot be enabled
    after a run has been created. The flag is set to true by default for premium
    processors (pro and above).
    """

    mcp_servers: Optional[List[McpServer]] = None
    """Optional list of MCP servers to use for the run."""

    metadata: Optional[Dict[str, Union[str, float, bool]]] = None
    """User-provided metadata stored with the run.

    Keys and values must be strings with a maximum length of 16 and 512 characters
    respectively.
    """

    previous_interaction_id: Optional[str] = None
    """Interaction ID to use as context for this request."""

    source_policy: Optional[SourcePolicy] = None
    """Source policy for web search results.

    This policy governs which sources are allowed/disallowed in results.
    """

    task_spec: Optional[TaskSpec] = None
    """Specification for a task.

    Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
    Not specifying a TaskSpec is the same as setting an auto output schema.

    For convenience bare strings are also accepted as input or output schemas.
    """

    webhook: Optional[Webhook] = None
    """Webhooks for Task Runs."""
