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

from typing import TYPE_CHECKING, Dict, Optional

from pydantic import Field as FieldInfo

from ..._models import BaseModel

__all__ = ["Context"]


class Context(BaseModel):
    """
    Optional context: identity (conversation scoping), attributes (injected into system prompt), and pass-through for tools
    """

    attributes: Optional[Dict[str, Optional[object]]] = None
    """
    Attributes about the user/request that are injected into the system prompt
    (visible to the model)
    """

    identity: Optional[Dict[str, Optional[object]]] = None
    """Identity fields for conversation scoping (e.g., user_id, tenant_id)"""

    if TYPE_CHECKING:
        # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
        # value to this field, so for compatibility we avoid doing it at runtime.
        __pydantic_extra__: Dict[str, Optional[object]] = FieldInfo(init=False)  # pyright: ignore[reportIncompatibleVariableOverride]

        # Stub to indicate that arbitrary properties are accepted.
        # To access properties that are not valid identifiers you can use `getattr`, e.g.
        # `getattr(obj, '$type')`
        def __getattr__(self, attr: str) -> Optional[object]: ...
    else:
        __pydantic_extra__: Dict[str, Optional[object]]
