diff --git a/sdk/agentserver/azure-ai-agentserver-invocations/CHANGELOG.md b/sdk/agentserver/azure-ai-agentserver-invocations/CHANGELOG.md index 11dfc32bd9c6..70f25dc4e1c0 100644 --- a/sdk/agentserver/azure-ai-agentserver-invocations/CHANGELOG.md +++ b/sdk/agentserver/azure-ai-agentserver-invocations/CHANGELOG.md @@ -10,6 +10,8 @@ ### Other Changes +- Generate fallback invocation and session IDs only when no valid supplied ID is available. + ## 1.2.0b1 (2026-09-03) ### Features Added diff --git a/sdk/agentserver/azure-ai-agentserver-invocations/azure/ai/agentserver/invocations/_invocation.py b/sdk/agentserver/azure-ai-agentserver-invocations/azure/ai/agentserver/invocations/_invocation.py index bc9b7e99bb55..d1d58ae697c0 100644 --- a/sdk/agentserver/azure-ai-agentserver-invocations/azure/ai/agentserver/invocations/_invocation.py +++ b/sdk/agentserver/azure-ai-agentserver-invocations/azure/ai/agentserver/invocations/_invocation.py @@ -128,22 +128,23 @@ def _ensure_log_filter() -> None: _log_filter_installed = True -def _sanitize_id(value: str, fallback: str) -> str: +def _sanitize_id(value: str, fallback: str | None = None) -> str: """Validate a user-provided ID string. - Returns *value* unchanged when it passes validation, otherwise returns - *fallback*. This prevents excessively long or malformed IDs from + Returns *value* unchanged when it passes validation, otherwise uses + *fallback* or generates a UUID when it is omitted. This prevents malformed IDs from propagating into headers, span attributes, and log messages. :param value: The raw ID from a header or query parameter. :type value: str - :param fallback: A safe fallback value (typically a generated UUID). - :type fallback: str + :param fallback: A safe fallback value, or ``None`` to generate a UUID only + when *value* fails validation. + :type fallback: str | None :return: The validated ID or the fallback. :rtype: str """ if not value or len(value) > _MAX_ID_LENGTH or not _VALID_ID_RE.match(value): - return fallback + return fallback if fallback is not None else str(uuid.uuid4()) return value @@ -517,14 +518,12 @@ async def _wrapped_body() -> AsyncIterator[Any]: async def _create_invocation_endpoint(self, request: Request) -> Response: invocation_id = _sanitize_id( request.headers.get(InvocationConstants.INVOCATION_ID_HEADER) or "", - str(uuid.uuid4()), ) request.state.invocation_id = invocation_id # Session ID: query param overrides env var / generated UUID session_id = _sanitize_id( request.query_params.get("agent_session_id") or self.config.session_id or "", - str(uuid.uuid4()), ) request.state.session_id = session_id diff --git a/sdk/agentserver/azure-ai-agentserver-invocations/tests/test_lazy_id_fallback.py b/sdk/agentserver/azure-ai-agentserver-invocations/tests/test_lazy_id_fallback.py new file mode 100644 index 000000000000..e1ba855cc176 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-invocations/tests/test_lazy_id_fallback.py @@ -0,0 +1,104 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""UUID generation occurs only when an invocation/session ID needs a fallback.""" + +import asyncio +import uuid +from types import SimpleNamespace +from unittest.mock import AsyncMock, patch + +import pytest +from starlette.requests import Request +from starlette.responses import JSONResponse + +from azure.ai.agentserver.invocations import _invocation + + +@pytest.mark.parametrize("value", ["valid-id", "a" * _invocation._MAX_ID_LENGTH]) +def test_valid_identifier_never_generates_uuid(value): + with patch.object(_invocation.uuid, "uuid4") as generate: + assert _invocation._sanitize_id(value) == value + assert _invocation._sanitize_id(value, "fallback") == value + generate.assert_not_called() + + +@pytest.mark.parametrize("value", ["", "bad id!", "a" * (_invocation._MAX_ID_LENGTH + 1)]) +def test_invalid_identifier_generates_one_uuid_when_no_fallback_supplied(value): + generated = uuid.UUID("11111111-1111-4111-8111-111111111111") + with patch.object(_invocation.uuid, "uuid4", return_value=generated) as generate: + assert _invocation._sanitize_id(value) == str(generated) + generate.assert_called_once_with() + + +@pytest.mark.parametrize("fallback", ["", "literal-invalid fallback"]) +def test_explicit_fallback_retains_existing_get_cancel_behavior(fallback): + with patch.object(_invocation.uuid, "uuid4") as generate: + assert _invocation._sanitize_id("bad id!", fallback) == fallback + generate.assert_not_called() + + +def _request(invocation_id, query): + return Request( + { + "type": "http", + "method": "POST", + "path": "/invocations", + "headers": [(_invocation.InvocationConstants.INVOCATION_ID_HEADER.encode(), invocation_id.encode())], + "query_string": query.encode(), + } + ) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "invocation_id,query,configured,expected_calls,expected_session", + [ + ("valid-id", "agent_session_id=query-session", "config-session", 0, "query-session"), + ("", "agent_session_id=query-session", "", 1, "query-session"), + ("valid-id", "", "config-session", 0, "config-session"), + ("valid-id", "agent_session_id=", "config-session", 0, "config-session"), + ("valid-id", "agent_session_id=bad%20id!", "config-session", 1, None), + ("bad id!", "", "", 2, None), + ], +) +async def test_post_endpoint_generates_only_needed_fallbacks( + invocation_id, query, configured, expected_calls, expected_session +): + request = _request(invocation_id, query) + host = SimpleNamespace( + config=SimpleNamespace(session_id=configured), + _dispatch_invoke=AsyncMock(return_value=JSONResponse({"ok": True})), + ) + real_uuid = uuid.uuid4 + with patch.object(_invocation.uuid, "uuid4", wraps=real_uuid) as generate: + result = await _invocation.InvocationAgentServerHost._create_invocation_endpoint(host, request) + assert result.status_code == 200 + assert generate.call_count == expected_calls + assert result.headers[_invocation.InvocationConstants.SESSION_ID_HEADER] == request.state.session_id + if expected_session is not None: + assert request.state.session_id == expected_session + else: + assert str(uuid.UUID(request.state.session_id)) == request.state.session_id + if invocation_id == "valid-id": + assert request.state.invocation_id == invocation_id + else: + assert str(uuid.UUID(request.state.invocation_id)) == request.state.invocation_id + + +@pytest.mark.asyncio +async def test_concurrent_requests_receive_distinct_fallback_ids(): + host = SimpleNamespace( + config=SimpleNamespace(session_id=""), + _dispatch_invoke=AsyncMock(side_effect=lambda _: JSONResponse({"ok": True})), + ) + first, second = _request("", ""), _request("", "") + + await asyncio.gather( + _invocation.InvocationAgentServerHost._create_invocation_endpoint(host, first), + _invocation.InvocationAgentServerHost._create_invocation_endpoint(host, second), + ) + + assert ( + len({first.state.invocation_id, first.state.session_id, second.state.invocation_id, second.state.session_id}) + == 4 + ) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md b/sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md index 8f9837aa7d44..1efe65234a02 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md +++ b/sdk/agentserver/azure-ai-agentserver-responses/CHANGELOG.md @@ -11,6 +11,12 @@ ### Other Changes +- Reuse request-scoped history lookups and concurrent input-reference resolution without caching failed or cancelled reads. +- Flush streaming telemetry after request-owned handler and iterator cleanup, + including on disconnects, and before HTTP completion instead of delaying the first stream event. +- Construct generated model types on demand while preserving real TypedDict contracts and public exports. +- Avoid redundant event and recovery-seed copies while retaining validation and caller-owned mutation isolation. + - Raised the minimum `azure-ai-agentserver-core` dependency to `>=2.2.0b1`, which provides the session GUID configuration and legacy task lookup used by resilient Responses. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/_scripts/extract_model_contracts.py b/sdk/agentserver/azure-ai-agentserver-responses/_scripts/extract_model_contracts.py index 665885c22a4a..2d1bdf1909d0 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/_scripts/extract_model_contracts.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/_scripts/extract_model_contracts.py @@ -9,7 +9,6 @@ import shutil from pathlib import Path - ROOT_INIT_PREFIX = ( "# coding=utf-8\n" "# --------------------------------------------------------------------------\n" @@ -22,6 +21,7 @@ "from .types import * # type: ignore # noqa: F401,F403\n" ) + def _remove_pycache(root: Path) -> None: for pycache in root.rglob("__pycache__"): shutil.rmtree(pycache) @@ -31,9 +31,7 @@ def _find_emitted_models_root(emitter_output_root: Path) -> Path: candidates = sorted( path for path in emitter_output_root.rglob("types.py") - if path.parent.name == "models" - and (path.parent / "_unions.py").exists() - and (path.parent / "models").is_dir() + if path.parent.name == "models" and (path.parent / "_unions.py").exists() and (path.parent / "models").is_dir() ) if not candidates: raise FileNotFoundError(f"Could not find emitted TypedDict model package under {emitter_output_root}") @@ -118,6 +116,11 @@ def finalize(emitter_output_root: Path, generated_root: Path) -> None: shutil.copy2(emitted_root / "models" / file_name, models_root / file_name) (generated_root / "__init__.py").write_text(ROOT_INIT_PREFIX, encoding="utf-8") + if __package__: + from .lazy_model_emitter import emit + else: + from lazy_model_emitter import emit + emit(generated_root) _remove_pycache(generated_root) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/_scripts/lazy_model_emitter.py b/sdk/agentserver/azure-ai-agentserver-responses/_scripts/lazy_model_emitter.py new file mode 100644 index 000000000000..a3a0842be092 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/_scripts/lazy_model_emitter.py @@ -0,0 +1,222 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# cspell:ignore asname +"""Deterministic post-emitter stage for real, demand-created TypedDict contracts.""" + +from __future__ import annotations + +import ast +from pathlib import Path +import textwrap + +BEGIN = "# BEGIN CANONICAL EMITTER CONTRACT\n" +END = "# END CANONICAL EMITTER CONTRACT\n" +HEADER = ( + "# Copyright (c) Microsoft Corporation.\n" + "# Licensed under the MIT license.\n" + "# Generated by _scripts/lazy_model_emitter.py; do not edit by hand.\n" +) +MODEL_EXCLUDES = { + "Any", + "ItemOutputMessage", + "Literal", + "Optional", + "OutputItemOutputMessage", + "OutputMessageContent", + "OutputMessageContentOutputTextContent", + "OutputMessageContentRefusalContent", + "Required", + "TYPE_CHECKING", + "TypedDict", + "Union", + "builtins", +} + + +def canonical(text: str) -> str: + if BEGIN not in text: + return text.rstrip() + "\n" + block = text.split(BEGIN, 1)[1].split(END, 1)[0] + if not block.startswith("if TYPE_CHECKING:\n"): + raise ValueError("Invalid canonical model contract marker") + return textwrap.dedent(block[len("if TYPE_CHECKING:\n") :]).rstrip() + "\n" + + +def definitions(tree: ast.Module) -> dict[str, ast.ClassDef | ast.Assign]: + result = {} + for node in tree.body: + if isinstance(node, ast.ClassDef): + result[node.name] = node + elif isinstance(node, ast.Assign): + if len(node.targets) != 1 or not isinstance(node.targets[0], ast.Name): + raise ValueError("Unsupported generated assignment") + result[node.targets[0].id] = node + elif not isinstance(node, (ast.Import, ast.ImportFrom, ast.If, ast.Expr)): + raise ValueError(f"Unsupported generated model statement: {type(node).__name__}") + return result + + +def imported_names(tree: ast.Module) -> list[str]: + names = [] + for node in tree.body: + if isinstance(node, (ast.Import, ast.ImportFrom)): + names.extend(alias.asname or alias.name for alias in node.names if not alias.name.startswith("_")) + return names + + +class ReferenceRewriter(ast.NodeTransformer): + def __init__(self, names: set[str], forward: bool = False) -> None: + self.names = names + self.forward = forward + + def visit_Name(self, node: ast.Name) -> ast.AST: + if isinstance(node.ctx, ast.Load) and node.id in self.names: + if self.forward: + return ast.copy_location( + ast.Attribute(value=ast.Name(id="_types", ctx=ast.Load()), attr=node.id, ctx=ast.Load()), node + ) + return ast.copy_location( + ast.Call(func=ast.Name(id="_resolve", ctx=ast.Load()), args=[ast.Constant(node.id)], keywords=[]), node + ) + return node + + def visit_Subscript(self, node: ast.Subscript) -> ast.AST: + # Strings inside Literal are values, not forward references. + if isinstance(node.value, ast.Name) and node.value.id == "Literal": + return node + return self.generic_visit(node) + + def visit_Constant(self, node: ast.Constant) -> ast.AST: + if isinstance(node.value, str) and not self.forward: + expression = ast.parse(node.value, mode="eval") + rewritten = ReferenceRewriter(self.names, forward=True).visit(expression) + return ast.copy_location(ast.Constant(ast.unparse(rewritten)), node) + return node + + +def render_module(source: str, module: str, type_names: set[str]) -> tuple[str, list[str], list[str]]: + tree = ast.parse(source) + declarations = definitions(tree) + exports = list(dict.fromkeys(imported_names(tree) + list(declarations))) + public_models = [] + factories = [] + for name, declaration in declarations.items(): + if isinstance(declaration, ast.ClassDef): + if any(not isinstance(base, ast.Name) or base.id != "TypedDict" for base in declaration.bases): + raise ValueError(f"Unsupported generated model base: {name}") + if any(not isinstance(item, (ast.AnnAssign, ast.Expr, ast.Pass)) for item in declaration.body): + raise ValueError(f"Unsupported generated model body: {name}") + public_models.append(name) + # Reparse to leave the canonical input intact. + node = ast.parse(ast.unparse(declaration)).body[0] + for statement in node.body: + if isinstance(statement, ast.AnnAssign): + statement.annotation = ReferenceRewriter(type_names).visit(statement.annotation) + body = ast.unparse(ast.fix_missing_locations(node)) + body += ( + f"\n{name}.__qualname__ = {name!r}\n" + f"if _version_info < (3, 13):\n {name}.__doc__ = {ast.get_docstring(declaration, clean=False)!r}\n" + f"return {name}\n" + ) + else: + value = ast.parse(ast.unparse(declaration.value), mode="eval").body + if ( + isinstance(value, ast.Subscript) + and isinstance(value.value, ast.Name) + and value.value.id in ("Union", "Literal") + ): + public_models.append(name) + value = ReferenceRewriter(type_names).visit(value) + body = "return " + ast.unparse(ast.fix_missing_locations(value)) + "\n" + factories.append(f"def _make_{name}():\n" + textwrap.indent(body, " ")) + runtime_imports = "\n".join( + ast.unparse(node) for node in tree.body if isinstance(node, (ast.Import, ast.ImportFrom)) + ) + runtime = ( + runtime_imports + "\n" + "from importlib import import_module as _import_module\n" + "from sys import version_info as _version_info\n" + "from .._lazy_models import load_model as _load_model\n" + "_types = _import_module('.types', __package__)\n" + "_unions = _import_module('._unions', __package__)\n\n" + + "\n".join(factories) + + "\n_FACTORIES = {\n" + + "".join(f" {name!r}: _make_{name},\n" for name in declarations) + + "}\n" + + f"__all__ = {exports!r}\n\n" + "def _resolve(name):\n" + " return _load_model(name, globals(), _FACTORIES, __name__)\n\n" + "def __getattr__(name):\n" + " return _resolve(name)\n\n" + "def __dir__():\n" + " return sorted(set(globals()) | set(__all__))\n" + ) + output = ( + HEADER + + "from typing import TYPE_CHECKING\n\n" + + BEGIN + + "if TYPE_CHECKING:\n" + + textwrap.indent(source, " ") + + END + + "else:\n" + + textwrap.indent(runtime, " ") + ) + return output, exports, public_models + + +def emit(generated_root: Path, check: bool = False) -> None: + types_source = canonical((generated_root / "types.py").read_text(encoding="utf-8")) + unions_source = canonical((generated_root / "_unions.py").read_text(encoding="utf-8")) + names = set(definitions(ast.parse(types_source))) + types_output, type_exports, type_models = render_module(types_source, "types", names) + unions_output, union_exports, union_models = render_module(unions_source, "_unions", names) + generated_exports = list(dict.fromkeys(union_exports + ["types"] + type_exports)) + # The original public-model scan used dir(module), hence sorted order in each module. + model_exports = [name for name in sorted(type_models) + sorted(union_models) if name not in MODEL_EXCLUDES] + catalog = HEADER + ( + f"TYPE_EXPORTS = {type_exports!r}\nUNION_EXPORTS = {union_exports!r}\n" + f"GENERATED_EXPORTS = {generated_exports!r}\nMODEL_EXPORTS = {model_exports!r}\n" + ) + init = HEADER + """ +from typing import TYPE_CHECKING +from . import types, _unions +from ._catalog import TYPE_EXPORTS as _TYPE_EXPORTS, GENERATED_EXPORTS as _GENERATED_EXPORTS + +if TYPE_CHECKING: + from ._unions import * + from .types import * + +__all__ = _GENERATED_EXPORTS + +def __getattr__(name): + if name not in __all__: + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") + value = getattr(types if name in _TYPE_EXPORTS else _unions, name) + globals()[name] = value + return value + +def __dir__(): + return sorted(set(globals()) | set(__all__)) +""" + for name, output in { + "types.py": types_output, + "_unions.py": unions_output, + "_catalog.py": catalog, + "__init__.py": init, + }.items(): + path = generated_root / name + if check: + if path.read_text(encoding="utf-8") != output: + raise ValueError(f"Generated model output is stale: {path}") + else: + path.write_text(output, encoding="utf-8", newline="\n") + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--generated-root", type=Path, required=True) + parser.add_argument("--check", action="store_true") + args = parser.parse_args() + emit(args.generated_root, check=args.check) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/_scripts/qualify_model_references.py b/sdk/agentserver/azure-ai-agentserver-responses/_scripts/qualify_model_references.py new file mode 100644 index 000000000000..e0512ba741f9 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/_scripts/qualify_model_references.py @@ -0,0 +1,265 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# cspell:ignore asname +"""Comment-preserving refactor of internal generated type references to the lazy +module-alias form, plus a ``--check`` mode that CI can run to fail the build if any +eager generated-type import remains. + +The rewrite is applied once; ``--check`` enforces the pattern for new changes so a +future ``from ..models._generated import SomeType`` cannot silently reintroduce the +import-time TypedDict construction (cold-start cost) this refactor removes. +""" + +from __future__ import annotations + +import ast +import json +import sys +from pathlib import Path + +from lazy_model_emitter import canonical, definitions + + +class Qualify(ast.NodeTransformer): + def __init__(self, names): + self.names = names + + def visit_Name(self, node): + if isinstance(node.ctx, ast.Load) and node.id in self.names: + return ast.copy_location(ast.parse(self.names[node.id], mode="eval").body, node) + return node + + def visit_Constant(self, node): + if isinstance(node.value, str): + try: + value = ast.parse(node.value, mode="eval") + except SyntaxError: + return node + return ast.copy_location(ast.Constant(ast.unparse(self.visit(value))), node) + return node + + def visit_Subscript(self, node): + if isinstance(node.value, ast.Name) and node.value.id == "Literal": + return node + return self.generic_visit(node) + + +def refactor(path, generated_names, write=True): + source = path.read_text(encoding="utf-8") + tree = ast.parse(source) + lines = source.splitlines(keepends=True) + starts, total = [], 0 + for line in lines: + starts.append(total) + total += len(line) + + def offset(line, column): + return starts[line - 1] + len(lines[line - 1].encode()[:column].decode()) + + def span(node): + return offset(node.lineno, node.col_offset), offset(node.end_lineno, node.end_col_offset) + + parents = {} + for parent in ast.walk(tree): + for child in ast.iter_child_nodes(parent): + parents[child] = parent + edits = [] + names, imports = {}, set() + for node in ast.walk(tree): + if not isinstance(node, ast.ImportFrom): + continue + module = node.module or "" + if not (module.endswith("models") or "_generated" in module): + continue + selected = [alias for alias in node.names if alias.name in generated_names] + if not selected: + continue + alias_name = ( + "_generated_unions" + if module.endswith("_unions") + else "_generated_models" if "_generated" in module else "_public_models" + ) + head, _, tail = module.rpartition(".") + statement = f"from {'.' * node.level}{head} import {tail or module} as {alias_name}" + imports.add(statement) + for alias in selected: + names[alias.asname or alias.name] = f"{alias_name}.{alias.name}" + remaining = [alias for alias in node.names if alias not in selected] + replacement = "" + if remaining: + replacement = f"from {'.' * node.level}{module} import " + ", ".join( + alias.name + (f" as {alias.asname}" if alias.asname else "") for alias in remaining + ) + elif isinstance(parents.get(node), ast.If) and len(parents[node].body) == 1: + replacement = "pass" + edits.append((*span(node), replacement)) + model_modules = {"generated_models", "response_models", "_generated_models", "_public_models", "_generated_unions"} + existing_model_casts = any( + isinstance(node, ast.Call) + and isinstance(node.func, ast.Name) + and node.func.id == "cast" + and node.args + and any(isinstance(child, ast.Name) and child.id in model_modules for child in ast.walk(node.args[0])) + for node in ast.walk(tree) + ) + if not names and not existing_model_casts: + return False + qualifier = Qualify(names) + protected = [item[:2] for item in edits] + + def within(node): + start, end = span(node) + return any(a <= start and end <= b for a, b in protected) + + def changed_type(node): + return ast.unparse(ast.fix_missing_locations(qualifier.visit(ast.parse(ast.unparse(node), mode="eval").body))) + + def has_generated(node): + return any( + isinstance(child, ast.Name) and (child.id in names or child.id in model_modules) for child in ast.walk(node) + ) + + # Casts have no runtime type checking. Keep the type expression for type checkers only. + for node in ast.walk(tree): + if isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id == "cast" and node.args: + arg = node.args[0] + if has_generated(arg) and not within(arg): + a, b = span(arg) + edits.append((a, b, repr(changed_type(arg)))) + protected.append((a, b)) + if ( + isinstance(node, ast.Call) + and isinstance(node.func, ast.Name) + and node.func.id == "_is_type" + and len(node.args) == 3 + ): + arg = node.args[1] + if has_generated(arg): + a, b = span(arg) + edits.append((a, b, repr(changed_type(arg)))) + protected.append((a, b)) + + for node in ast.walk(tree): + annotations = [] + if isinstance(node, ast.AnnAssign): + annotations.append(node.annotation) + elif isinstance(node, ast.arg) and node.annotation is not None: + annotations.append(node.annotation) + elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.returns is not None: + annotations.append(node.returns) + for annotation in annotations: + if not within(annotation): + updated = changed_type(annotation) + a, b = span(annotation) + if ast.dump(ast.parse(updated, mode="eval").body) != ast.dump(annotation): + edits.append((a, b, updated)) + protected.append((a, b)) + + # The routing layer's public callable aliases are typing-only, not model constructors. + for node in tree.body: + if isinstance(node, ast.Assign) and isinstance(node.value, ast.Subscript) and has_generated(node.value): + + def forward_names(item): + if isinstance(item, ast.Name) and item.id in names: + return ast.copy_location(ast.Constant(names[item.id]), item) + for field, value in ast.iter_fields(item): + if isinstance(value, ast.AST): + setattr(item, field, forward_names(value)) + elif isinstance(value, list): + setattr(item, field, [forward_names(v) if isinstance(v, ast.AST) else v for v in value]) + return item + + value = ast.parse(ast.unparse(node.value), mode="eval").body + updated = ast.unparse(ast.fix_missing_locations(forward_names(value))) + a, b = span(node.value) + edits.append((a, b, updated)) + protected.append((a, b)) + + for node in ast.walk(tree): + if isinstance(node, ast.Name) and isinstance(node.ctx, ast.Load) and node.id in names and not within(node): + edits.append((*span(node), names[node.id])) + + # Keep module aliases globally available to public get_type_hints(). + insertion = 0 + if tree.body and isinstance(tree.body[0], ast.Expr) and isinstance(tree.body[0].value, ast.Constant): + insertion = span(tree.body[0])[1] + for node in tree.body: + if isinstance(node, ast.ImportFrom) and node.module == "__future__": + insertion = span(node)[1] + header = "\n" + "\n".join(sorted(imports)) + "\n" + if not any(isinstance(node, ast.ImportFrom) and node.module == "__future__" for node in tree.body): + header = "\nfrom __future__ import annotations\n" + header + edits.append((insertion, insertion, header)) + for start, end, replacement in sorted(edits, reverse=True): + source = source[:start] + replacement + source[end:] + ast.parse(source) + if write: + path.write_text(source, encoding="utf-8") + return True + + +def eager_imports(path, generated_names): + """Return the generated type names *path* imports eagerly. + + An eager import (``from ..models._generated import ResponseObject``) triggers the + models package ``__getattr__`` and constructs that TypedDict at import time, + reintroducing the cold-start cost the lazy module-alias form avoids. The allowed + form binds only the module (``from ..models import _generated as _generated_models``) + and references types as attributes, which constructs nothing at import. + """ + tree = ast.parse(path.read_text(encoding="utf-8")) + found = [] + for node in ast.walk(tree): + if not isinstance(node, ast.ImportFrom): + continue + module = node.module or "" + if not (module.endswith("models") or "_generated" in module): + continue + found.extend(alias.name for alias in node.names if alias.name in generated_names) + return sorted(set(found)) + + +def _iter_source_files(root): + for path in sorted(root.rglob("*.py")): + if "_generated" in path.parts or path in (root / "__init__.py", root / "models" / "__init__.py"): + continue + if path.name in ("_lazy_models.py", "_request_validators.py"): + continue + yield path + + +def _generated_names(root): + generated = root / "models" / "_generated" + names = set() + for name in ("types.py", "_unions.py"): + names.update(definitions(ast.parse(canonical((generated / name).read_text())))) + return names + + +def main(argv=None): + argv = sys.argv[1:] if argv is None else list(argv) + check = "--check" in argv + root = Path(__file__).resolve().parents[1] / "azure" / "ai" / "agentserver" / "responses" + names = _generated_names(root) + if check: + offenders = { + path.relative_to(root).as_posix(): eager + for path in _iter_source_files(root) + if (eager := eager_imports(path, names)) + } + if offenders: + print( + "Eager generated-model imports found. Use the lazy module alias instead, e.g. " + "`from ..models import _generated as _generated_models`, and reference types as " + "`_generated_models.`:" + ) + print(json.dumps(offenders, indent=2)) + raise SystemExit(1) + print("OK: no eager generated-model imports.") + raise SystemExit(0) + changed = [path.relative_to(root).as_posix() for path in _iter_source_files(root) if refactor(path, names)] + print(json.dumps(changed, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/__init__.py index 4643ae665920..7e4af21f8b5a 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/__init__.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/__init__.py @@ -2,6 +2,8 @@ # Licensed under the MIT license. """Public API surface for the Azure AI Agent Server Responses package.""" +from typing import TYPE_CHECKING, Any + from ._version import VERSION __version__ = VERSION @@ -15,7 +17,7 @@ ResponseExitForRecovery, ) from .hosting._routing import ResponsesAgentServerHost -from .models import CreateResponse, ResponseObject +from . import models as _public_models from .store._base import ResponseProviderProtocol from .store._file import FileResponseStore from .store._foundry_errors import ( @@ -30,6 +32,9 @@ from .streaming._event_stream import ResponseEventStream from .streaming._text_response import TextResponse +if TYPE_CHECKING: + from .models import CreateResponse, ResponseObject + __all__ = [ "__version__", "data_url", # pylint: disable=naming-mismatch @@ -53,3 +58,15 @@ "CreateResponse", "ResponseObject", ] + + +def __getattr__(name: str) -> Any: + if name not in ("CreateResponse", "ResponseObject"): + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") + value = getattr(_public_models, name) + globals()[name] = value + return value + + +def __dir__() -> list[str]: + return sorted(set(globals()) | set(__all__)) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/_response_context.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/_response_context.py index 7eca8c88fa17..33931c5f1865 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/_response_context.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/_response_context.py @@ -14,16 +14,14 @@ import asyncio # pylint: disable=do-not-import-asyncio from datetime import datetime, timezone from typing import TYPE_CHECKING, Any, NoReturn, Sequence, cast -from .models._generated import ( - CreateResponse, - Item, - OutputItem, - ResponseObject, -) -from .models._generated._unions import InputParam + + from .models._helpers import get_input_expanded, to_item, to_output_item from .models.runtime import ResponseModeFlags +from .models import _generated as _generated_models +from .models._generated import _unions as _generated_unions + if TYPE_CHECKING: from azure.ai.agentserver.core.tasks import TaskContext as _CoreTaskContext @@ -96,6 +94,110 @@ def __init__(self, *, user_id_key: str | None = None, call_id: str | None = None ``None`` when the header was not sent (protocol ``1.0.0`` or local dev).""" +_HistoryIdsKey = tuple[int, str | None, str | None, int, tuple[str | None, str | None] | None] + + +def _history_ids_key( + provider: "ResponseProviderProtocol", + previous_response_id: str | None, + conversation_id: str | None, + limit: int, + context: PlatformContext | None, +) -> _HistoryIdsKey: + identity = None if context is None else (context.user_id_key, context.call_id) + return id(provider), previous_response_id, conversation_id, limit, identity + + +def _snapshot_platform_context(context: PlatformContext | None) -> PlatformContext | None: + return None if context is None else PlatformContext(user_id_key=context.user_id_key, call_id=context.call_id) + + +class _HistoryIdsEntry: + def __init__(self, provider: "ResponseProviderProtocol", ids: list[str] | None = None) -> None: + # Retain the provider so its identity cannot be recycled within a request. + self.provider = provider + self.ids: tuple[str, ...] | None = None if ids is None else tuple(ids) + self.lock = asyncio.Lock() + + +class _HistoryIdsResolver: + """Request-owned, exact-query cache; locks coalesce successful concurrent reads.""" + + def __init__(self) -> None: + self._entries: dict[_HistoryIdsKey, _HistoryIdsEntry] = {} + + def seed( + self, + provider: "ResponseProviderProtocol", + previous_response_id: str | None, + conversation_id: str | None, + limit: int, + context: PlatformContext | None, + ids: list[str], + ) -> None: + key = _history_ids_key(provider, previous_response_id, conversation_id, limit, context) + self._entries[key] = _HistoryIdsEntry(provider, ids) + + async def resolve( + self, + provider: "ResponseProviderProtocol", + previous_response_id: str | None, + conversation_id: str | None, + limit: int, + context: PlatformContext | None, + ) -> list[str]: + key = _history_ids_key(provider, previous_response_id, conversation_id, limit, context) + entry = self._entries.get(key) + if entry is None: + entry = _HistoryIdsEntry(provider) + self._entries[key] = entry + async with entry.lock: + if entry.ids is None: + ids = await provider.get_history_item_ids(previous_response_id, conversation_id, limit, context=context) + entry.ids = tuple(ids) + # Neither callers nor providers may mutate the cached snapshot. + return list(entry.ids) + + +async def _resolve_history_item_ids( + provider: "ResponseProviderProtocol", + previous_response_id: str | None, + conversation_id: str | None, + limit: int, + *, + context: PlatformContext | None, + request_context: "ResponseContext | None", +) -> list[str]: + """Resolve history item IDs with request-scoped single-flight semantics. + + :param provider: The response storage provider used to fetch history item IDs. + :type provider: ~azure.ai.agentserver.responses.store._base.ResponseProviderProtocol + :param previous_response_id: The previous response ID anchoring the history chain. + :type previous_response_id: str or None + :param conversation_id: The conversation ID scoping the history lookup. + :type conversation_id: str or None + :param limit: The maximum number of history item IDs to fetch. + :type limit: int + :keyword context: Platform context forwarded to the provider. + :paramtype context: ~azure.ai.agentserver.responses._response_context.PlatformContext or None + :keyword request_context: Request context whose resolver coalesces duplicate reads; + ``None`` bypasses request-scoped caching. + :paramtype request_context: ~azure.ai.agentserver.responses._response_context.ResponseContext or None + :return: The resolved history item IDs. + :rtype: list[str] + """ + # Snapshot identity before waiting on a lookup so key and outbound identity + # stay equivalent even if the caller later mutates its PlatformContext. + platform_context = _snapshot_platform_context(context) + if request_context is None: + return await provider.get_history_item_ids( + previous_response_id, conversation_id, limit, context=platform_context + ) + return await request_context._history_ids.resolve( # pylint: disable=protected-access + provider, previous_response_id, conversation_id, limit, platform_context + ) + + class ResponseContext: # pylint: disable=too-many-instance-attributes """Runtime context exposed to response handlers and used by hosting orchestration. @@ -134,7 +236,7 @@ class ResponseContext: # pylint: disable=too-many-instance-attributes # and IDEs surface the precise types without scanning ``__init__``. response_id: str mode_flags: ResponseModeFlags - request: "CreateResponse | None" + request: "_generated_models.CreateResponse | None" created_at: datetime client_headers: dict[str, str] query_parameters: dict[str, str] @@ -145,17 +247,17 @@ class ResponseContext: # pylint: disable=too-many-instance-attributes pending_input_count: int shutdown: asyncio.Event client_cancelled: bool - persisted_response: ResponseObject | None + persisted_response: _generated_models.ResponseObject | None def __init__( # pylint: disable=too-many-arguments self, *, response_id: str, mode_flags: ResponseModeFlags, - request: CreateResponse | None = None, + request: _generated_models.CreateResponse | None = None, created_at: datetime | None = None, provider: "ResponseProviderProtocol | None" = None, - input_items: list[InputParam] | list[OutputItem] | None = None, + input_items: list[_generated_unions.InputParam] | list[_generated_models.OutputItem] | None = None, previous_response_id: str | None = None, conversation_id: str | None = None, history_limit: int = 100, @@ -184,10 +286,23 @@ def __init__( # pylint: disable=too-many-arguments self._previous_response_id: str | None = previous_response_id self.conversation_id: str | None = conversation_id self._history_limit: int = history_limit - self._input_items_resolved_cache: Sequence[Item] | None = None - self._input_items_unresolved_cache: Sequence[Item] | None = None - self._history_cache: Sequence[OutputItem] | None = None + self._input_items_resolved_cache: Sequence[_generated_models.Item] | None = None + self._input_items_resolved_lock = asyncio.Lock() + self._input_items_unresolved_cache: Sequence[_generated_models.Item] | None = None + self._history_cache: Sequence[_generated_models.OutputItem] | None = None + self._history_cache_key: _HistoryIdsKey | None = None + self._history_lock = asyncio.Lock() + self._history_ids = _HistoryIdsResolver() self._prefetched_history_ids: list[str] | None = prefetched_history_ids + if provider is not None and prefetched_history_ids is not None: + self._history_ids.seed( + provider, + previous_response_id, + conversation_id, + history_limit, + self.platform_context, + prefetched_history_ids, + ) # Stash the deployment's ``steerable_conversations`` option so # ``conversation_chain_id`` resolves the correct chain partition: for # non-steerable chains each fork is its own identity (full response_id), @@ -210,7 +325,7 @@ def __init__( # pylint: disable=too-many-arguments # populated by the orchestrator on the recovery path so a recovered # handler can seed its stream from already-persisted items. ``None`` on # fresh entries; never refreshed mid-execution. - self.persisted_response: ResponseObject | None = None + self.persisted_response: _generated_models.ResponseObject | None = None # Composing cancellation surface. ``_cancellation_signal`` is # the per-request cancel Event delivered to the handler as the # 3rd positional argument; it fires on /cancel API calls, client @@ -310,7 +425,7 @@ async def exit_for_recovery(self) -> "NoReturn": ) raise ResponseExitForRecovery() - async def get_input_items(self, *, resolve_references: bool = True) -> Sequence[Item]: + async def get_input_items(self, *, resolve_references: bool = True) -> Sequence[_generated_models.Item]: """Return the caller's input items as :class:`Item` subtypes. Inline items are returned as-is — the same :class:`Item` subtypes from @@ -319,6 +434,8 @@ async def get_input_items(self, *, resolve_references: bool = True) -> Sequence[ :class:`ItemReferenceParam` entries are batch-resolved via the provider and converted back to :class:`Item` subtypes. Unresolvable references (provider returns ``None``) are silently dropped. + Concurrent readers in this request share successful reference resolution. + A failed or cancelled resolution is not cached and can be retried. :keyword resolve_references: When ``True`` (default), :class:`ItemReferenceParam` items are resolved via the provider and @@ -358,13 +475,14 @@ async def get_input_text(self, *, resolve_references: bool = True) -> str: texts.append(text) return "\n".join(texts) - async def _get_input_items_for_persistence(self) -> Sequence[OutputItem]: + async def _get_input_items_for_persistence(self) -> Sequence[_generated_models.OutputItem]: """Return input items as :class:`OutputItem` for storage persistence. The orchestrator needs :class:`OutputItem` instances when creating the stored response. This method resolves references (so stored items are always concrete), converts each :class:`Item` to :class:`OutputItem`, - and caches the result. + without caching the converted output snapshot. Resolved input items + themselves are cached by :meth:`get_input_items`. :returns: A tuple of output items suitable for persistence. :rtype: Sequence[OutputItem] @@ -376,7 +494,7 @@ async def _get_input_items_for_persistence(self) -> Sequence[OutputItem]: # Private resolution helpers (cached independently per mode) # ------------------------------------------------------------------ - async def _get_input_items_resolved(self) -> Sequence[Item]: + async def _get_input_items_resolved(self) -> Sequence[_generated_models.Item]: """Resolve and cache input items with references resolved. :returns: A tuple of resolved input items. @@ -385,15 +503,25 @@ async def _get_input_items_resolved(self) -> Sequence[Item]: if self._input_items_resolved_cache is not None: return self._input_items_resolved_cache + async with self._input_items_resolved_lock: + if self._input_items_resolved_cache is None: + self._input_items_resolved_cache = await self._resolve_input_items() + return self._input_items_resolved_cache + + async def _resolve_input_items(self) -> Sequence[_generated_models.Item]: + """Materialize this request's input; only publish a fully successful result. + + :return: The resolved input items with references materialized. + :rtype: ~typing.Sequence[~azure.ai.agentserver.responses.models._generated.Item] + """ expanded = self._expand_input() if not expanded: - self._input_items_resolved_cache = () - return self._input_items_resolved_cache + return () # Collect ItemReferenceParam positions and IDs for batch resolution. reference_ids: list[str] = [] reference_positions: list[int] = [] - results: list[Item | None] = [] + results: list[_generated_models.Item | None] = [] for item in expanded: if isinstance(item, dict) and item.get("type") == "item_reference": @@ -416,10 +544,9 @@ async def _get_input_items_resolved(self) -> Sequence[Item]: results[pos] = converted # Remove unresolved (None) placeholders. - self._input_items_resolved_cache = tuple(item for item in results if item is not None) - return self._input_items_resolved_cache + return tuple(item for item in results if item is not None) - async def _get_input_items_unresolved(self) -> Sequence[Item]: + async def _get_input_items_unresolved(self) -> Sequence[_generated_models.Item]: """Return input items without resolving references. :returns: A tuple of unresolved input items. @@ -432,7 +559,7 @@ async def _get_input_items_unresolved(self) -> Sequence[Item]: self._input_items_unresolved_cache = tuple(expanded) return self._input_items_unresolved_cache - def _expand_input(self) -> list[Item]: + def _expand_input(self) -> list[_generated_models.Item]: """Normalize raw input into typed Item instances. :returns: A list of typed Item instances. @@ -442,42 +569,49 @@ def _expand_input(self) -> list[Item]: return get_input_expanded(self.request) return list(self._input_items) # type: ignore[arg-type] - async def get_history(self) -> Sequence[OutputItem]: + async def get_history(self) -> Sequence[_generated_models.OutputItem]: """Resolve and cache conversation history items via the provider. When prefetched history IDs are available (from eager validation), the provider's ``get_history_item_ids`` call is skipped and only ``get_items`` is invoked to materialise the items. + Concurrent calls share that materialization. ID lookups are also + shared with persistence for the same provider, query, and identity; + arbitrary ``get_items`` requests are not cached here. :returns: A tuple of conversation history items. :rtype: Sequence[OutputItem] """ - if self._history_cache is not None: - return self._history_cache - - if self._provider is None: - self._history_cache = () - return self._history_cache - - # No conversation context — nothing to look up. - if not self._previous_response_id and not self.conversation_id: - self._history_cache = () - return self._history_cache - - # Use eagerly-prefetched IDs when available; otherwise call provider. - if self._prefetched_history_ids is not None: - item_ids = self._prefetched_history_ids - else: - item_ids = await self._provider.get_history_item_ids( - self._previous_response_id, - self.conversation_id, - self._history_limit, - context=self.platform_context, + async with self._history_lock: + if self._provider is None or (not self._previous_response_id and not self.conversation_id): + self._history_cache = () + self._history_cache_key = None + return self._history_cache + + provider = self._provider + previous_response_id, conversation_id = self._previous_response_id, self.conversation_id + limit = self._history_limit + platform_context = _snapshot_platform_context(self.platform_context) + key = _history_ids_key(provider, previous_response_id, conversation_id, limit, platform_context) + if self._history_cache is not None and self._history_cache_key == key: + return self._history_cache + + item_ids = await _resolve_history_item_ids( + provider, + previous_response_id, + conversation_id, + limit, + context=platform_context, + request_context=self, ) - if not item_ids: - self._history_cache = () + items = await provider.get_items(item_ids, context=platform_context) if item_ids else [] + self._history_cache = tuple(item for item in items if item is not None) + self._history_cache_key = key return self._history_cache - items = await self._provider.get_items(item_ids, context=self.platform_context) - self._history_cache = tuple(item for item in items if item is not None) - return self._history_cache + def _reset_history_cache(self) -> None: + """Discard request-only history snapshots when entering a recovered lifetime.""" + self._history_ids = _HistoryIdsResolver() + self._history_cache = None + self._history_cache_key = None + self._prefetched_history_ids = None diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_acceptance.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_acceptance.py index 1ff76c7381ad..ee48db74c1a2 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_acceptance.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_acceptance.py @@ -12,11 +12,11 @@ import logging from typing import TYPE_CHECKING, Any, Callable, cast -from ..models._generated import ResponseObject +from ..models import _generated as _generated_models if TYPE_CHECKING: from .._response_context import ResponseContext - from ..models._generated import CreateResponse + logger = logging.getLogger("azure.ai.agentserver.responses.acceptance") @@ -25,14 +25,14 @@ # surfaced to the HTTP caller. The internal HTTP path works in plain dicts # (see ``to_snapshot``), so ``dispatch_acceptance_hook`` is the single place # that normalizes the typed result down to a dict. -AcceptanceHookFn = Callable[["CreateResponse", "ResponseContext"], "ResponseObject"] +AcceptanceHookFn = Callable[["_generated_models.CreateResponse", "ResponseContext"], "_generated_models.ResponseObject"] def generate_default_acceptance( *, response_id: str, model: str | None = None, -) -> ResponseObject: +) -> _generated_models.ResponseObject: """Generate the default queued response envelope. Used when no custom acceptance hook is registered, or as fallback @@ -46,7 +46,7 @@ def generate_default_acceptance( :rtype: ~azure.ai.agentserver.responses.models.ResponseObject """ return cast( - ResponseObject, + "_generated_models.ResponseObject", { "id": response_id, "object": "response", @@ -82,7 +82,7 @@ def _to_queued_dict(response: Any) -> dict[str, Any]: def dispatch_acceptance_hook( *, hook: AcceptanceHookFn | None, - request: "CreateResponse", + request: "_generated_models.CreateResponse", context: "ResponseContext", model: str | None = None, ) -> dict[str, Any]: diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_endpoint_handler.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_endpoint_handler.py index d3b6ea436155..5084feb0f66c 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_endpoint_handler.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_endpoint_handler.py @@ -12,14 +12,17 @@ import asyncio # pylint: disable=do-not-import-asyncio import contextvars +from contextlib import aclosing import logging import threading -from typing import TYPE_CHECKING, Any, cast +from typing import TYPE_CHECKING, Any, AsyncGenerator, cast +from anyio import CancelScope from opentelemetry import baggage as _otel_baggage from opentelemetry import context as _otel_context from starlette.requests import Request from starlette.responses import JSONResponse, Response, StreamingResponse +from starlette.types import Message, Send from azure.ai.agentserver.core import ( # pylint: disable=import-error,no-name-in-module FoundryAgentRequestContext, @@ -43,15 +46,12 @@ streams, ) -from ..models._generated import ( - AgentReference, - CreateResponse, -) +from ..models import _generated as _generated_models from .._id_generator import IdGenerator from .._egress import strip_internal_metadata from .._options import ResponsesServerOptions -from .._response_context import PlatformContext, ResponseContext +from .._response_context import PlatformContext, ResponseContext, _resolve_history_item_ids from ..models._helpers import get_input_expanded, to_output_item from ..models.runtime import ( ResponseExecution, @@ -119,6 +119,71 @@ logger = logging.getLogger("azure.ai.agentserver") +async def _flush_spans_async() -> None: + """Drain the bounded core flush off the event loop, even during cancellation.""" + with CancelScope(shield=True): + flush_task = asyncio.create_task(asyncio.to_thread(flush_spans)) + cancellation: asyncio.CancelledError | None = None + while not flush_task.done(): + try: + await asyncio.shield(flush_task) + except asyncio.CancelledError as exc: + # A direct asyncio cancellation must not orphan the exporter. + cancellation = exc + flush_task.result() + if cancellation is not None: + raise cancellation + + +class _CreateStreamingResponse(StreamingResponse): + """Close request-owned iterators and flush before HTTP stream completion.""" + + def __init__( + self, + source: AsyncGenerator[str, None], + interval_seconds: float | None, + *, + headers: dict[str, str], + ) -> None: + self._source = source + self._stream = cast(AsyncGenerator[str, None], with_keep_alive(source, interval_seconds)) + super().__init__(self._stream, media_type="text/event-stream", headers=headers) + + async def stream_response(self, send: Send) -> None: + """Flush after stream work, including on send errors and disconnects. + + :param send: The ASGI ``send`` callable for the response. + :type send: ~starlette.types.Send + """ + finalized = False + + async def finalize() -> None: + nonlocal finalized + if finalized: + return + finalized = True + # Starlette's older ASGI path cancels this task's AnyIO scope on + # disconnect. Finish iterator cleanup before flushing ended spans. + with CancelScope(shield=True): + try: + await self._stream.aclose() + finally: + try: + await self._source.aclose() + finally: + await _flush_spans_async() + + async def send_with_flush(message: Message) -> None: + if message["type"] == "http.response.body" and not message.get("more_body", False): + await finalize() + await send(message) + + try: + await super().stream_response(send_with_flush) + finally: + await finalize() + + def _extract_platform_context(request: Request) -> PlatformContext: """Build a ``PlatformContext`` from platform-injected request headers. @@ -414,9 +479,9 @@ async def _monitor_disconnect( def _build_execution_context( self, *, - parsed: CreateResponse, + parsed: _generated_models.CreateResponse, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _generated_models.AgentReference | dict[str, Any], agent_session_id: str | None = None, agent_session_guid: str | None = None, span: CreateSpan, @@ -575,11 +640,13 @@ async def _prefetch_history_ids( _hdrs = self._session_headers(agent_session_id) try: _context = ctx.context.platform_context if ctx.context else None - prefetched = await self._provider.get_history_item_ids( + prefetched = await _resolve_history_item_ids( + self._provider, ctx.previous_response_id, ctx.conversation_id, self._runtime_options.default_fetch_history_count, context=_context, + request_context=ctx.context, ) ctx.prefetched_history_ids = prefetched if ctx.context is not None: @@ -753,9 +820,10 @@ async def handle_create(self, request: Request) -> Response: # pylint: disable= platform_ctx_token = set_request_context(platform_context) disconnect_task: asyncio.Task[None] | None = None + stream_owns_flush = False try: if ctx.stream: - raw_iter = self._orchestrator.run_stream(ctx) + raw_iter = cast(AsyncGenerator[str, None], self._orchestrator.run_stream(ctx)) # B17: monitor client disconnect for non-background streams if not ctx.background: @@ -773,8 +841,9 @@ async def handle_create(self, request: Request) -> Response: # pylint: disable= async def _iter_with_context(): # type: ignore[return] stream_ctx_token = set_request_context(platform_context) try: - async for chunk in raw_iter: - yield chunk + async with aclosing(raw_iter): + async for chunk in raw_iter: + yield chunk except (asyncio.CancelledError, GeneratorExit): # B17: Hypercorn cancels the generator when the client # disconnects. For a NON-background stream, stamp @@ -797,14 +866,14 @@ async def _iter_with_context(): # type: ignore[return] if disconnect_task and not disconnect_task.done(): disconnect_task.cancel() - sse_response = StreamingResponse( - with_keep_alive( - _iter_with_context(), - self._runtime_options.sse_keep_alive_interval_seconds, - ), - media_type="text/event-stream", + sse_response = _CreateStreamingResponse( + _iter_with_context(), + # Ephemeral orchestration already owns heartbeats. A second + # pump would advance its handler ahead of HTTP sends. + self._runtime_options.sse_keep_alive_interval_seconds if ctx.store else None, headers={**self._sse_headers, **self._session_headers(agent_session_id)}, ) + stream_owns_flush = True return sse_response if not ctx.background: @@ -949,15 +1018,16 @@ async def _iter_with_context(): # type: ignore[return] _conversation_id_var.reset(cid_token) _streaming_var.reset(str_token) reset_request_context(platform_ctx_token) - # Flush pending spans before the response is sent. - # BatchSpanProcessor exports on a timer; in hosted sandboxes - # the platform may freeze the process after the HTTP response, - # losing any buffered spans (e.g. LangGraph per-node spans). - flush_spans() try: - _otel_context.detach(baggage_token) - except ValueError: - pass + # A lazy streaming body owns its flush: no handler spans exist + # yet, and flushing here delays the first real SSE event. + if not stream_owns_flush: + await _flush_spans_async() + finally: + try: + _otel_context.detach(baggage_token) + except ValueError: + pass async def handle_get(self, request: Request) -> Response: # pylint: disable=too-many-branches """Route handler for ``GET /responses/{response_id}``. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_event_subject.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_event_subject.py index a72adcad1b5d..208a24d35b4a 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_event_subject.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_event_subject.py @@ -6,8 +6,8 @@ import asyncio # pylint: disable=do-not-import-asyncio from typing import AsyncIterator, cast +from .. import models as _public_models -from ..models import ResponseStreamEvent class _ResponseEventSubject: @@ -29,12 +29,12 @@ class _ResponseEventSubject: def __init__(self) -> None: """Initialise the subject with an empty event buffer and no subscribers.""" - self._events: list[ResponseStreamEvent] = [] - self._subscribers: list[asyncio.Queue[ResponseStreamEvent | object]] = [] + self._events: list[_public_models.ResponseStreamEvent] = [] + self._subscribers: list[asyncio.Queue[_public_models.ResponseStreamEvent | object]] = [] self._done: bool = False self._lock: asyncio.Lock = asyncio.Lock() - async def publish(self, event: ResponseStreamEvent) -> None: + async def publish(self, event: _public_models.ResponseStreamEvent) -> None: """Push a new event to all current subscribers and append it to the replay buffer. :param event: The normalised event wire payload. @@ -56,7 +56,7 @@ async def complete(self) -> None: for q in self._subscribers: q.put_nowait(self._DONE) - async def subscribe(self, cursor: int = -1) -> AsyncIterator[ResponseStreamEvent]: + async def subscribe(self, cursor: int = -1) -> AsyncIterator[_public_models.ResponseStreamEvent]: """Subscribe to events, yielding buffered history then live events. :param cursor: Sequence-number cursor. Only events whose @@ -66,7 +66,7 @@ async def subscribe(self, cursor: int = -1) -> AsyncIterator[ResponseStreamEvent :returns: An async iterator of event instances. :rtype: AsyncIterator[ResponseStreamEvent] """ - q: asyncio.Queue[ResponseStreamEvent | object] = asyncio.Queue() + q: asyncio.Queue[_public_models.ResponseStreamEvent | object] = asyncio.Queue() async with self._lock: # Replay all buffered events that are after the cursor for event in self._events: @@ -85,7 +85,7 @@ async def subscribe(self, cursor: int = -1) -> AsyncIterator[ResponseStreamEvent if item is self._DONE: return assert isinstance(item, dict) and isinstance(item.get("type"), str) - yield cast(ResponseStreamEvent, item) + yield cast("_public_models.ResponseStreamEvent", item) finally: # Clean up subscription on client disconnect or normal completion async with self._lock: diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_execution_context.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_execution_context.py index a5b8073be62b..da0ee9e306f9 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_execution_context.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_execution_context.py @@ -7,7 +7,7 @@ import asyncio # pylint: disable=do-not-import-asyncio from typing import TYPE_CHECKING, Any -from ..models import AgentReference, CreateResponse, OutputItem +from .. import models as _public_models from .._response_context import ResponseContext @@ -26,17 +26,17 @@ def __init__( self, *, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _public_models.AgentReference | dict[str, Any], model: str | None, store: bool, background: bool, stream: bool, - input_items: list[OutputItem], + input_items: list[_public_models.OutputItem], previous_response_id: str | None, conversation_id: str | None, cancellation_signal: asyncio.Event, span: "CreateSpan", - parsed: CreateResponse, + parsed: _public_models.CreateResponse, agent_session_id: str | None = None, agent_session_guid: str | None = None, context: ResponseContext | None = None, diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_orchestrator.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_orchestrator.py index 01719ccf05b8..6c9e2a03c186 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_orchestrator.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_orchestrator.py @@ -1,5 +1,6 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +# cspell:ignore alives """Event-pipeline orchestration for the Responses server. This module is intentionally free of Starlette imports: it operates purely on @@ -14,7 +15,8 @@ import json import logging from copy import deepcopy -from typing import TYPE_CHECKING, Any, AsyncIterator, Callable, cast +from contextlib import aclosing +from typing import TYPE_CHECKING, Any, AsyncGenerator, AsyncIterator, Callable, cast import anyio @@ -40,7 +42,7 @@ ) from .._options import ResponsesServerOptions -from .._response_context import ResponseExitForRecovery +from .._response_context import ResponseExitForRecovery, _resolve_history_item_ids from ..models import _generated as generated_models from ..models.runtime import ( ResponseExecution, @@ -72,7 +74,6 @@ if TYPE_CHECKING: from .._response_context import ResponseContext - from ..models._generated import AgentReference, CreateResponse logger = logging.getLogger("azure.ai.agentserver") @@ -84,9 +85,20 @@ ) +async def _close_iterator(iterator: AsyncIterator[Any]) -> None: + """Close an owned iterator when it supports asynchronous cleanup. + + :param iterator: The iterator to close when it exposes ``aclose``. + :type iterator: ~typing.AsyncIterator[typing.Any] + """ + close = getattr(iterator, "aclose", None) + if close is not None: + await close() + + async def _iter_handler_with_request_context( create_fn: "Callable[..., AsyncIterator[generated_models.ResponseStreamEvent]]", - parsed: "CreateResponse", + parsed: "generated_models.CreateResponse", context: "ResponseContext | None", cancellation_signal: asyncio.Event, agent_session_id: str | None, @@ -383,7 +395,7 @@ def _bg_normalize_event( handler_event: Any, *, response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, agent_session_id: str | None, conversation_id: str | None, @@ -460,7 +472,7 @@ async def _bg_handle_first_event( store: bool, provider: "ResponseProviderProtocol | None", response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, agent_session_id: str | None, conversation_id: str | None, @@ -535,7 +547,7 @@ async def _bg_handle_first_event( agent_session_id=agent_session_id, conversation_id=conversation_id, ) - record.set_response_snapshot(cast(generated_models.ResponseObject, _initial_snapshot)) + record.set_response_snapshot(cast("generated_models.ResponseObject", _initial_snapshot)) # Honour the handler's initial status (e.g. "queued"). if _initial_snapshot.get("status") == "queued": record.status = "queued" # type: ignore[assignment] @@ -567,7 +579,7 @@ def _bg_resolve_terminal_status( handler_events: "list[generated_models.ResponseStreamEvent]", *, response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, agent_session_id: str | None, conversation_id: str | None, @@ -626,7 +638,7 @@ def _bg_resolve_terminal_status( if record.status in _TERMINAL_STATES: return # leave the marker's terminal state intact if record.status != "cancelled": - record.set_response_snapshot(cast(generated_models.ResponseObject, response_payload)) + record.set_response_snapshot(cast("generated_models.ResponseObject", response_payload)) target = resolved_status if isinstance(resolved_status, str) else "completed" # If still queued, transition through in_progress first so the state # machine stays valid (queued can only reach terminal via in_progress). @@ -672,14 +684,16 @@ async def _bg_persist_at_created( if not (store and provider is not None): return False _context = context.platform_context if context else None - _response_obj = cast(generated_models.ResponseObject, initial_snapshot) + _response_obj = cast("generated_models.ResponseObject", initial_snapshot) try: _history_ids = ( - await provider.get_history_item_ids( + await _resolve_history_item_ids( + provider, record.previous_response_id, None, history_limit, context=_context, + request_context=context, ) if record.previous_response_id else None @@ -718,7 +732,7 @@ def _bg_resolve_cancelled( first_event_processed: bool, runtime_options: "ResponsesServerOptions | None", response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, ) -> bool: """Resolve a ``CancelledError`` raised during bg non-stream processing. @@ -802,7 +816,7 @@ async def _bg_persist_terminal( provider_created: bool, context: "ResponseContext | None", response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, history_limit: int, ) -> None: @@ -867,11 +881,13 @@ async def _bg_persist_terminal( # items if previous_response_id is set so the input_items endpoint # can return history + current. _history_ids = ( - await provider.get_history_item_ids( + await _resolve_history_item_ids( + provider, record.previous_response_id, None, history_limit, context=_context, + request_context=context, ) if record.previous_response_id else None @@ -935,14 +951,14 @@ async def _bg_drain_handler_events( st: "_BgRunState", record: ResponseExecution, create_fn: "Callable[..., AsyncIterator[generated_models.ResponseStreamEvent]]", - parsed: CreateResponse, + parsed: generated_models.CreateResponse, context: "ResponseContext | None", cancellation_signal: asyncio.Event, *, store: bool, provider: "ResponseProviderProtocol | None", response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, agent_session_id: str | None, conversation_id: str | None, @@ -1093,12 +1109,12 @@ async def _bg_drain_handler_events( async def _run_background_non_stream( *, create_fn: Callable[..., AsyncIterator[generated_models.ResponseStreamEvent]], - parsed: CreateResponse, + parsed: generated_models.CreateResponse, context: ResponseContext, cancellation_signal: asyncio.Event, record: ResponseExecution, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: generated_models.AgentReference | dict[str, Any], model: str | None, provider: ResponseProviderProtocol | None = None, store: bool = True, @@ -1510,6 +1526,29 @@ async def _normalize_and_append( :raises ValueError: If the coerced event fails structural validation (B30). """ coerced = _coerce_handler_event(handler_event) + return await self._normalize_owned_and_append(ctx, state, coerced) + + async def _normalize_owned_and_append( + self, + ctx: _ExecutionContext, + state: _PipelineState, + coerced: generated_models.ResponseStreamEvent, + ) -> generated_models.ResponseStreamEvent: + """Validate and append a private copy from ``_coerce_handler_event``. + + The caller must not expose the copy before transferring ownership here. + Structural and stream validation remain identical for both callers. + + :param ctx: Current execution context. + :type ctx: ~azure.ai.agentserver.responses.hosting._execution_context._ExecutionContext + :param state: Mutable pipeline state. + :type state: _PipelineState + :param coerced: Privately owned, coerced handler event. + :type coerced: ~azure.ai.agentserver.responses.models._generated.ResponseStreamEvent + :return: The normalized event. + :rtype: ~azure.ai.agentserver.responses.models._generated.ResponseStreamEvent + :raises ValueError: If structural or stream validation fails. + """ violation = _validate_handler_event(coerced) if violation: raise ValueError(violation) @@ -1522,9 +1561,15 @@ async def _normalize_and_append( agent_session_id=ctx.agent_session_id, conversation_id=ctx.conversation_id, ) + # Run BOTH structural (_validate_handler_event, above) and stream + # ordering/lifecycle validation (validate_next) BEFORE mutating pipeline + # state. Validating after the append/seq bump would let an out-of-order + # or lifecycle-invalid event be appended and consume a sequence number, + # so failure synthesis and persistence could observe an event that was + # never emitted. + state.validator.validate_next(normalized) state.handler_events.append(normalized) state.next_seq += 1 - state.validator.validate_next(normalized) if state.bg_record is not None: state.bg_record.apply_event(normalized, state.handler_events) # Defer emit for terminal events — the buffer-then-persist @@ -1781,7 +1826,7 @@ async def _persist_and_resolve_terminal( if not cancel_race: # Update snapshot on record before persistence attempt - record.set_response_snapshot(cast(generated_models.ResponseObject, response_payload)) + record.set_response_snapshot(cast("generated_models.ResponseObject", response_payload)) record.transition_to(status) # Attempt persistence @@ -1800,18 +1845,20 @@ async def _persist_and_resolve_terminal( # non-bg stream or bg stream where initial create was never registered: # full create _history_ids = ( - await self._provider.get_history_item_ids( + await _resolve_history_item_ids( + self._provider, ctx.previous_response_id, None, self._runtime_options.default_fetch_history_count, context=_context, + request_context=ctx.context, ) if ctx.previous_response_id else None ) _resolved_items = await _resolve_input_items_for_persistence(ctx.context, ctx.input_items) await self._provider.create_response( - cast(generated_models.ResponseObject, response_payload), + cast("generated_models.ResponseObject", response_payload), _resolved_items, _history_ids, context=_context, @@ -1934,7 +1981,7 @@ async def _register_bg_execution( conversation_id=ctx.conversation_id, user_id_key=ctx.user_id, ) - execution.set_response_snapshot(cast(generated_models.ResponseObject, initial_payload)) + execution.set_response_snapshot(cast("generated_models.ResponseObject", initial_payload)) # Bind the per-response stream from the registry — the registry # guarantees the same instance for the same id, so any other caller # that does ``streams.get_or_create(response_id)`` for this id sees @@ -1945,13 +1992,15 @@ async def _register_bg_execution( await self._runtime_state.add(execution) if ctx.store: _context = ctx.context.platform_context if ctx.context else None - _initial_response_obj = cast(generated_models.ResponseObject, initial_payload) + _initial_response_obj = cast("generated_models.ResponseObject", initial_payload) _history_ids = ( - await self._provider.get_history_item_ids( + await _resolve_history_item_ids( + self._provider, ctx.previous_response_id, None, self._runtime_options.default_fetch_history_count, context=_context, + request_context=ctx.context, ) if ctx.previous_response_id else None @@ -2224,7 +2273,7 @@ async def _process_handler_events( ctx: _ExecutionContext, state: _PipelineState, handler_iterator: AsyncIterator[generated_models.ResponseStreamEvent], - ) -> AsyncIterator[generated_models.ResponseStreamEvent]: + ) -> AsyncGenerator[generated_models.ResponseStreamEvent, None]: """Shared event pipeline: coerce → normalise → apply_event → subject publish. This async generator is the single authoritative event pipeline consumed by @@ -2498,7 +2547,7 @@ async def _drain_remaining_events( state.pending_terminal = await self._make_failed_event(ctx, state) return - normalized = await self._normalize_and_append(ctx, state, raw) + normalized = await self._normalize_owned_and_append(ctx, state, _pre_coerced) # Buffer terminal events instead of yielding — the caller will # attempt persistence before emitting the terminal SSE. if normalized.get("type") in self._TERMINAL_SSE_TYPES: @@ -2813,7 +2862,7 @@ async def _finalize_stream(self, ctx: _ExecutionContext, state: _PipelineState) conversation_id=ctx.conversation_id, user_id_key=ctx.user_id, ) - execution.set_response_snapshot(cast(generated_models.ResponseObject, response_payload)) + execution.set_response_snapshot(cast("generated_models.ResponseObject", response_payload)) # Copy persistence_failed from the ephemeral record if one was used if state.bg_record is not None: execution.persistence_failed = state.bg_record.persistence_failed @@ -2951,14 +3000,6 @@ async def _live_stream(self, ctx: _ExecutionContext) -> AsyncIterator[str]: handler_iterator = self._create_fn(ctx.parsed, ctx.context, ctx.cancellation_signal) - # Helper: route to the right finalize method based on the request semantics - # (bg+store → bg_stream path; everything else → non_bg_stream path). - # NOTE: state.bg_record may be None for bg+stream when the handler yields no - # events (fallback path in _process_handler_events); _finalize_bg_stream - # handles that case by creating the record itself. - async def _finalize() -> None: - await self._finalize_stream(ctx, state) - # Stored responses (background / resilient) ALWAYS run via the resilient # task + per-response wire stream, regardless of SSE keep-alive. The # resilient body runs in its own task, independent of the client @@ -3045,41 +3086,23 @@ async def _resilient_stream_fallback() -> None: return # --- Ephemeral (non-stored) responses: no resilient task --- - if not self._runtime_options.sse_keep_alive_enabled: - # Row 4 stream — no store, no resilient task. Inline pipeline. - _stream_completed = False - try: - async for event in self._process_handler_events(ctx, state, handler_iterator): - yield encode_sse_any_event(event) - _stream_completed = True - # Persist-then-yield: resolve the buffered terminal event. - if state.pending_terminal is not None: - record = state.bg_record or _make_ephemeral_record(ctx, state) - resolved = await self._persist_and_resolve_terminal(ctx, state, record) - yield encode_sse_any_event(resolved) - finally: - # If the stream did not complete naturally (e.g. client - # disconnect -> CancelledError), mark it interrupted. - if not _stream_completed: - state.stream_interrupted = True - await _finalize() - return - - # --- Keep-alive path: merge handler events with periodic keep-alive comments --- - async for _chunk in self._live_stream_keep_alive(ctx, state, handler_iterator): - yield _chunk + # The request owns this producer even without keep-alives. Keeping handler + # iteration in one task lets cleanup finish outside the ASGI cancel scope. + async with aclosing(self._live_stream_keep_alive(ctx, state, handler_iterator)) as ephemeral_stream: + async for chunk in ephemeral_stream: + yield chunk - async def _live_stream_keep_alive( + async def _live_stream_keep_alive( # pylint: disable=too-many-statements self, ctx: _ExecutionContext, state: _PipelineState, handler_iterator: AsyncIterator[generated_models.ResponseStreamEvent], - ) -> AsyncIterator[str]: - """Ephemeral streaming with SSE keep-alive comments (Spec 033 §3.2 extract). + ) -> AsyncGenerator[str, None]: + """Ephemeral streaming with optional SSE keep-alive comments. Merges handler events with periodic keep-alive comments via a shared queue so comments are sent even while the handler is idle. Used by the - non-stored streaming path when keep-alive is enabled. + non-stored streaming path. The request owns and awaits the handler task. :param ctx: Current execution context. :type ctx: _ExecutionContext @@ -3091,42 +3114,60 @@ async def _live_stream_keep_alive( :rtype: AsyncIterator[str] """ # via a shared asyncio.Queue so comments are sent even while the handler is idle. - _SENTINEL = object() - merge_queue: asyncio.Queue[str | object] = asyncio.Queue() + merge_queue: asyncio.Queue[tuple[str, bool] | None] = asyncio.Queue() + handler_event_sent = asyncio.Event() async def _handler_producer() -> None: try: - async for event in self._process_handler_events(ctx, state, handler_iterator): - await merge_queue.put(encode_sse_any_event(event)) + try: + async with aclosing(self._process_handler_events(ctx, state, handler_iterator)) as pipeline: + async for event in pipeline: + await merge_queue.put((encode_sse_any_event(event), True)) + # Do not advance the handler past a yielded event + # before the request has finished sending it. + await handler_event_sent.wait() + handler_event_sent.clear() + finally: + # Closing the pipeline alone does not recursively close its + # developer handler. Keep that ownership explicit. + with anyio.CancelScope(shield=True): + await _close_iterator(handler_iterator) # Persist-then-yield: resolve the buffered terminal event if state.pending_terminal is not None: record = state.bg_record or _make_ephemeral_record(ctx, state) resolved = await self._persist_and_resolve_terminal(ctx, state, record) - await merge_queue.put(encode_sse_any_event(resolved)) + await merge_queue.put((encode_sse_any_event(resolved), False)) finally: - await merge_queue.put(_SENTINEL) + await merge_queue.put(None) async def _keep_alive_producer(interval: int) -> None: try: while True: await asyncio.sleep(interval) - await merge_queue.put(encode_keep_alive_comment()) + await merge_queue.put((encode_keep_alive_comment(), False)) except asyncio.CancelledError: return handler_task = asyncio.create_task(_handler_producer()) - keep_alive_task = asyncio.create_task( - _keep_alive_producer(self._runtime_options.sse_keep_alive_interval_seconds) # type: ignore[arg-type] + keep_alive_task = ( + asyncio.create_task( + _keep_alive_producer(self._runtime_options.sse_keep_alive_interval_seconds) # type: ignore[arg-type] + ) + if self._runtime_options.sse_keep_alive_enabled + else None ) _ka_stream_completed = False try: while True: item = await merge_queue.get() - if item is _SENTINEL: + if item is None: _ka_stream_completed = True break - yield item # type: ignore[misc] + chunk, is_handler_event = item + yield chunk + if is_handler_event: + handler_event_sent.set() except Exception as exc: # pylint: disable=broad-exception-caught logger.error( "Stream consumer failed (response_id=%s)", @@ -3137,19 +3178,23 @@ async def _keep_alive_producer(interval: int) -> None: finally: if not _ka_stream_completed: state.stream_interrupted = True - keep_alive_task.cancel() - try: - await keep_alive_task - except asyncio.CancelledError: - pass - # Ensure the handler task has finished before finalising - if not handler_task.done(): - handler_task.cancel() + with anyio.CancelScope(shield=True): + if keep_alive_task is not None: + keep_alive_task.cancel() + try: + await keep_alive_task + except asyncio.CancelledError: + pass + # Only this ephemeral request owns the producer. Stored/resilient + # producers above remain independent of the client connection. + if not handler_task.done(): + handler_task.cancel() try: await handler_task except asyncio.CancelledError: pass - await self._finalize_stream(ctx, state) + finally: + await self._finalize_stream(ctx, state) async def _await_sync_resilient_terminal(self, ctx: _ExecutionContext, record: ResponseExecution) -> None: """Block until the sync resilient task / fallback execution reaches terminal. @@ -3549,7 +3594,7 @@ async def _run_sync_inner(self, ctx: _ExecutionContext, state: _PipelineState) - conversation_id=ctx.conversation_id, user_id_key=ctx.user_id, ) - record.set_response_snapshot(cast(generated_models.ResponseObject, response_payload)) + record.set_response_snapshot(cast("generated_models.ResponseObject", response_payload)) # Always register in runtime state so that cancel/GET can find the record # and return the correct status code (e.g., 400 for non-bg cancel). @@ -3561,13 +3606,15 @@ async def _run_sync_inner(self, ctx: _ExecutionContext, state: _PipelineState) - # §3.1: Persistence failure replaces the response body with storage_error. try: _context = ctx.context.platform_context if ctx.context else None - _response_obj = cast(generated_models.ResponseObject, response_payload) + _response_obj = cast("generated_models.ResponseObject", response_payload) _history_ids = ( - await self._provider.get_history_item_ids( + await _resolve_history_item_ids( + self._provider, ctx.previous_response_id, None, self._runtime_options.default_fetch_history_count, context=_context, + request_context=ctx.context, ) if ctx.previous_response_id else None @@ -3742,12 +3789,12 @@ async def _shielded_runner() -> None: async def _run_resilient_stream_body( self, *, - parsed: "CreateResponse", + parsed: "generated_models.CreateResponse", context: "ResponseContext", cancellation_signal: asyncio.Event, record: ResponseExecution, response_id: str, - agent_reference: "AgentReference | dict[str, Any]", + agent_reference: "generated_models.AgentReference | dict[str, Any]", model: str | None, store: bool, agent_session_id: str | None, diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_request_parsing.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_request_parsing.py index d7ba9451eb28..002a427d5f6d 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_request_parsing.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_request_parsing.py @@ -10,10 +10,12 @@ from typing import Any, Mapping, cast from ..models._wire import get_field -from ..models import AgentReference, CreateResponse + from .._id_generator import IdGenerator from ..models._errors import RequestValidationError +from .. import models as _public_models + _X_AGENT_RESPONSE_ID_HEADER = "x-agent-response-id" @@ -118,7 +120,7 @@ def _validate_response_id(response_id: str) -> None: ) -def _normalize_agent_reference(value: Any) -> AgentReference | dict[str, Any]: +def _normalize_agent_reference(value: Any) -> _public_models.AgentReference | dict[str, Any]: """Normalize an agent reference value into a validated wire payload or empty dict. If *value* is ``None``, an empty dict is returned as a sentinel for @@ -162,7 +164,7 @@ def _normalize_agent_reference(value: Any) -> AgentReference | dict[str, Any]: ) candidate["name"] = name.strip() - return cast(AgentReference, candidate) + return cast("_public_models.AgentReference", candidate) def _prevalidate_identity_payload(payload: dict[str, Any]) -> None: @@ -218,10 +220,10 @@ def _prevalidate_identity_payload(payload: dict[str, Any]) -> None: def _resolve_identity_fields( - parsed: CreateResponse, + parsed: _public_models.CreateResponse, *, request_headers: Mapping[str, str] | None = None, -) -> tuple[str, AgentReference | dict[str, Any]]: +) -> tuple[str, _public_models.AgentReference | dict[str, Any]]: """Resolve the response ID and agent reference from a parsed create request. **B38 — Response ID Resolution**: If the incoming request includes an @@ -266,7 +268,7 @@ def _resolve_identity_fields( return response_id, agent_reference -def _resolve_conversation_id(parsed: CreateResponse) -> str | None: +def _resolve_conversation_id(parsed: _public_models.CreateResponse) -> str | None: """Extract the conversation ID from a parsed ``CreateResponse`` request. Handles both a plain string value and a ``ConversationParam_2`` wire payload. @@ -286,11 +288,11 @@ def _resolve_conversation_id(parsed: CreateResponse) -> str | None: def _resolve_session_id( - parsed: CreateResponse, + parsed: _public_models.CreateResponse, payload: dict[str, Any], *, env_session_id: str = "", - agent_reference: AgentReference | dict[str, Any] | None = None, + agent_reference: _public_models.AgentReference | dict[str, Any] | None = None, ) -> str: """Resolve the session ID for a create-response request. @@ -347,7 +349,7 @@ def derive_session_id( *, conversation_id: str | None = None, previous_response_id: str | None = None, - agent_reference: AgentReference | dict[str, Any] | None = None, + agent_reference: _public_models.AgentReference | dict[str, Any] | None = None, ) -> str: """Derive a deterministic session ID from conversational context. @@ -386,7 +388,7 @@ def derive_session_id( def _extract_agent_identity( - agent_reference: AgentReference | dict[str, Any] | None, + agent_reference: _public_models.AgentReference | dict[str, Any] | None, ) -> tuple[str, str]: """Extract (agent_name, agent_version) from an agent reference. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_input.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_input.py index 3cb6e5a786de..46cef981cd39 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_input.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_input.py @@ -31,8 +31,9 @@ import json from typing import Any, cast -from ..models._generated import CreateResponse + from .._response_context import PlatformContext +from ..models import _generated as _generated_models # Keys emitted by :meth:`ResilientResponseInput.to_task_input` / consumed by @@ -166,7 +167,7 @@ class ResilientResponseInput: def __init__( self, *, - request: CreateResponse, + request: _generated_models.CreateResponse, response_id: str, disposition: str, agent_reference: Any = None, @@ -253,7 +254,9 @@ def from_task_input(cls, params: dict[str, Any]) -> "ResilientResponseInput": raw_request = params.get(_K_REQUEST) if raw_request is None: raise ValueError("ResilientResponseInput missing required 'request'") - request = cast(CreateResponse, raw_request) if isinstance(raw_request, dict) else raw_request + request = ( + cast("_generated_models.CreateResponse", raw_request) if isinstance(raw_request, dict) else raw_request + ) return cls( request=request, diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_orchestrator.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_orchestrator.py index ceb6f8f839e3..5c4363f7e51d 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_orchestrator.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_resilient_orchestrator.py @@ -35,9 +35,11 @@ from ._dispatch import DISPOSITION_MARK_FAILED from ._task_id import derive_task_id, derive_task_session_scope +from ..models import _generated as _generated_models + if TYPE_CHECKING: from .._response_context import ResponseContext - from ..models._generated import CreateResponse, ResponseObject + from ..models.runtime import ResponseExecution from ..store._base import ResponseProviderProtocol from ._orchestrator import _ResponseOrchestrator @@ -163,11 +165,11 @@ def _model_from_params(params: dict[str, Any]) -> str | None: def _overlay_failed_terminal( - snapshot: "ResponseObject", + snapshot: "_generated_models.ResponseObject", *, shutdown_reason: str, message: str | None = None, -) -> "ResponseObject": +) -> "_generated_models.ResponseObject": """Overlay a ``failed`` terminal onto a persisted response snapshot. Per ``docs/responses-resilience-spec.md`` §7.2/§7.3 the crash-failed @@ -192,13 +194,14 @@ def _overlay_failed_terminal( :rtype: ResponseObject """ from ..models.runtime import _apply_failed_terminal # pylint: disable=import-outside-toplevel - from ..models._generated import ResponseObject # pylint: disable=import-outside-toplevel + + # pylint: disable=import-outside-toplevel error = { "code": "server_error", "message": message if message is not None else _server_error_message(shutdown_reason), } - return cast(ResponseObject, _apply_failed_terminal(snapshot, error=error)) + return cast("_generated_models.ResponseObject", _apply_failed_terminal(snapshot, error=error)) # (Spec 033 §3.1) Process-local cache of typed :class:`RuntimeRefs` (record, @@ -1055,6 +1058,9 @@ def _ref(key: str) -> Any: assert context is not None, "context is non-None after reconstruction" assert record is not None, "record is non-None after reconstruction" + if is_recovery: + context._reset_history_cache() # pylint: disable=protected-access + if await self._flatten_recovery_context(ctx, context, is_recovery): return @@ -1363,9 +1369,7 @@ async def _persist_crash_failed( platform context for storage routing). :type params: dict[str, Any] """ - from ..models._generated import ( - ResponseObject, - ) # pylint: disable=import-outside-toplevel + # pylint: disable=import-outside-toplevel from ._resilient_input import ( platform_context_from_params, ) # pylint: disable=import-outside-toplevel @@ -1397,7 +1401,7 @@ async def _persist_crash_failed( # path below — synthesizing carries ``agent_reference``, so an # ``update`` would now succeed and overwrite a progressed snapshot with # empty output. - existing_snapshot: "ResponseObject | None" = None + existing_snapshot: "_generated_models.ResponseObject | None" = None response_known_absent = False for _attempt in range(2): try: @@ -1438,7 +1442,7 @@ async def _persist_crash_failed( # the write still satisfies the store's agent-reference requirement. # Output is empty (no progress could be preserved). failed_response = cast( - ResponseObject, + "_generated_models.ResponseObject", _build_server_error_payload( response_id, shutdown_reason="crash_recovery", diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_routing.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_routing.py index c35257812fd2..988f42adafe1 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_routing.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_routing.py @@ -24,22 +24,20 @@ from .._options import ResponsesServerOptions from .._response_context import ResponseContext from .._version import VERSION as _RESPONSES_VERSION -from ..models._generated import CreateResponse, ResponseStreamEvent +from ..models import _generated as _generated_models + from ..streaming._checkpoint import ResponseCheckpointEvent from ..store._base import ResponseProviderProtocol from ..store._memory import InMemoryResponseProvider from ._endpoint_handler import _ResponseEndpointHandler -from ._orchestrator import _ResponseOrchestrator +from ._orchestrator import _ResponseOrchestrator, _close_iterator from ._runtime_state import _RuntimeState -CreateHandlerEvent = Union[ResponseStreamEvent, ResponseCheckpointEvent, dict[str, Any]] +CreateHandlerEvent = Union["_generated_models.ResponseStreamEvent", ResponseCheckpointEvent, dict[str, Any]] CreateHandlerFn = Callable[ - [CreateResponse, ResponseContext, asyncio.Event], - Union[ - AsyncIterable[CreateHandlerEvent], - Awaitable[AsyncIterable[CreateHandlerEvent]], - ], + ["_generated_models.CreateResponse", ResponseContext, asyncio.Event], + Union[AsyncIterable[CreateHandlerEvent], Awaitable[AsyncIterable[CreateHandlerEvent]]], ] """Type alias for the user-registered create-response handler function. @@ -74,8 +72,11 @@ async def _sync_to_async_gen(sync_gen: types.GeneratorType) -> AsyncIterator: :return: An async iterator yielding items from the synchronous generator. :rtype: AsyncIterator """ - for item in sync_gen: - yield item + try: + for item in sync_gen: + yield item + finally: + sync_gen.close() def _serialize_event_payload(payload: Any) -> bytes: @@ -640,10 +641,10 @@ def my_acceptor( def _dispatch_create( self, - request: CreateResponse, + request: _generated_models.CreateResponse, context: ResponseContext, cancellation_signal: asyncio.Event, - ) -> AsyncIterator[ResponseStreamEvent]: + ) -> AsyncIterator[_generated_models.ResponseStreamEvent]: """Dispatch to the registered create handler. Called by the orchestrator when processing a create request. @@ -669,7 +670,7 @@ def _dispatch_create( result = self._create_fn(request, context, cancellation_signal) return self._normalize_handler_result(result) - def _normalize_handler_result(self, result: Any) -> AsyncIterator[ResponseStreamEvent]: + def _normalize_handler_result(self, result: Any) -> AsyncIterator[_generated_models.ResponseStreamEvent]: """Convert a handler result into an AsyncIterator. Supports sync generators, async generators, coroutines (async def @@ -692,7 +693,9 @@ def _normalize_handler_result(self, result: Any) -> AsyncIterator[ResponseStream return result.__aiter__() # type: ignore[union-attr, return-value] return result # type: ignore[return-value] - async def _await_and_normalize(self, coro: Any) -> AsyncIterator[ResponseStreamEvent]: # type: ignore[misc] + async def _await_and_normalize( # type: ignore[misc] + self, coro: Any + ) -> AsyncIterator[_generated_models.ResponseStreamEvent]: """Await a coroutine and yield events from its normalised result. :param coro: A coroutine to await. @@ -701,5 +704,9 @@ async def _await_and_normalize(self, coro: Any) -> AsyncIterator[ResponseStreamE :rtype: AsyncIterator[ResponseStreamEvent] """ inner = await coro - async for event in self._normalize_handler_result(inner): - yield event + iterator = self._normalize_handler_result(inner) + try: + async for event in iterator: + yield event + finally: + await _close_iterator(iterator) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_runtime_state.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_runtime_state.py index 5fda1906fc4a..9fd8a609b203 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_runtime_state.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_runtime_state.py @@ -8,9 +8,11 @@ from copy import deepcopy from typing import Any, cast -from ..models import OutputItem + from ..models.runtime import ResponseExecution from ..streaming._helpers import strip_nulls +from .. import models as _public_models + def _json_safe_agent_reference(value: Any) -> dict[str, Any]: @@ -160,7 +162,7 @@ def check_user_isolation(stored_key: str | None, request_user_id_key: str | None return True # No enforcement when created without a key return stored_key == request_user_id_key - async def get_input_items(self, response_id: str) -> list[OutputItem]: + async def get_input_items(self, response_id: str) -> list[_public_models.OutputItem]: """Retrieve the full input item chain for a response, including ancestors. Walks the ``previous_response_id`` chain to build the complete ordered @@ -183,7 +185,7 @@ async def get_input_items(self, response_id: str) -> list[OutputItem]: if not record.visible_via_get: raise KeyError(f"response '{response_id}' not found") - history: list[OutputItem] = [] + history: list[_public_models.OutputItem] = [] cursor = record.previous_response_id visited: set[str] = set() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_validation.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_validation.py index 4289c1676a1d..8cec5248f125 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_validation.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/hosting/_validation.py @@ -16,14 +16,15 @@ ) from .._id_generator import IdGenerator from .._options import ResponsesServerOptions -from ..models import ApiErrorResponse, CreateResponse + +from .. import models as _public_models from ..models._errors import RequestValidationError from ..models._validators import ( validate_create_response_payload, ) -def parse_create_response(payload: Mapping[str, Any]) -> CreateResponse: +def parse_create_response(payload: Mapping[str, Any]) -> _public_models.CreateResponse: """Validate incoming JSON payload and return a dict-native ``CreateResponse`` payload. :param payload: Raw request payload mapping. @@ -52,14 +53,14 @@ def parse_create_response(payload: Mapping[str, Any]) -> CreateResponse: ) if isinstance(payload, dict): - return cast(CreateResponse, payload) - return cast(CreateResponse, dict(payload)) + return cast("_public_models.CreateResponse", payload) + return cast("_public_models.CreateResponse", dict(payload)) def normalize_create_response( - request: CreateResponse, + request: _public_models.CreateResponse, options: ResponsesServerOptions | None, -) -> CreateResponse: +) -> _public_models.CreateResponse: """Apply server-side defaults to a parsed create request payload. :param request: The parsed create response model to normalize. @@ -82,7 +83,7 @@ def normalize_create_response( return request -def validate_create_response(request: CreateResponse) -> None: +def validate_create_response(request: _public_models.CreateResponse) -> None: """Validate create request semantics not enforced by generated model typing. :param request: The parsed create response model to validate. @@ -146,7 +147,7 @@ def parse_and_validate_create_response( payload: Mapping[str, Any], *, options: ResponsesServerOptions | None = None, -) -> CreateResponse: +) -> _public_models.CreateResponse: """Parse, normalize, and validate a create request wire payload. :param payload: Raw request payload mapping. @@ -170,7 +171,7 @@ def build_api_error_response( param: str | None = None, error_type: str = "invalid_request_error", debug_info: dict[str, Any] | None = None, -) -> ApiErrorResponse: +) -> _public_models.ApiErrorResponse: """Build an API error envelope for client-visible failures. :param message: Human-readable error message. @@ -194,7 +195,7 @@ def build_api_error_response( } if debug_info is not None: error["debugInfo"] = debug_info - return cast(ApiErrorResponse, {"error": error}) + return cast("_public_models.ApiErrorResponse", {"error": error}) def build_not_found_error_response( @@ -202,7 +203,7 @@ def build_not_found_error_response( *, param: str = "response_id", resource_name: str = "response", -) -> ApiErrorResponse: +) -> _public_models.ApiErrorResponse: """Build a canonical not-found error envelope. :param resource_id: The ID of the resource that was not found. @@ -226,7 +227,7 @@ def build_invalid_mode_error_response( message: str, *, param: str | None = None, -) -> ApiErrorResponse: +) -> _public_models.ApiErrorResponse: """Build a canonical invalid-mode error envelope. :param message: Human-readable error message. @@ -244,7 +245,7 @@ def build_invalid_mode_error_response( ) -def to_api_error_response(error: Exception) -> ApiErrorResponse: +def to_api_error_response(error: Exception) -> _public_models.ApiErrorResponse: """Map a Python exception to an API error wire envelope. :param error: The exception to convert. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/__init__.py index 830cd115bc53..6e86cb81efb5 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/__init__.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/__init__.py @@ -3,13 +3,13 @@ """Canonical non-generated model types for the response server.""" from enum import Enum -from typing import Literal, Union, get_origin +from typing import TYPE_CHECKING, Any, Literal, Union, get_origin from azure.core import CaseInsensitiveEnumMeta -from ._generated import * # type: ignore # noqa: F401,F403 # pylint: disable=unused-wildcard-import -from ._generated import _unions as _generated_unions -from ._generated import types as _generated_types +from . import _generated as _generated_models +from ._generated._catalog import MODEL_EXPORTS as _MODEL_EXPORTS + from ._helpers import ( # pylint: disable=unused-import get_content_expanded, get_conversation_expanded, @@ -22,6 +22,9 @@ TerminalResponseStatus, ) +if TYPE_CHECKING: + from ._generated import * # type: ignore # noqa: F401,F403 # pylint: disable=unused-wildcard-import,wildcard-import + _TYPE_EXPORT_EXCLUDES = { "Any", "ItemOutputMessage", @@ -43,14 +46,7 @@ def _is_public_generated_export(value: object) -> bool: return isinstance(value, type) or get_origin(value) in (Literal, Union) -_generated_all: list[str] = [ - name - for module in (_generated_types, _generated_unions) - for name in dir(module) - if not name.startswith("_") - and name not in _TYPE_EXPORT_EXCLUDES - and _is_public_generated_export(getattr(module, name)) -] +_generated_all: list[str] = list(_MODEL_EXPORTS) class ResponseIncompleteReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -72,3 +68,15 @@ class ResponseIncompleteReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): "get_input_expanded", "get_tool_choice_expanded", ] + _generated_all + + +def __getattr__(name: str) -> Any: + if name not in _generated_models.__all__: + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") + value = getattr(_generated_models, name) + globals()[name] = value + return value + + +def __dir__() -> list[str]: + return sorted(set(globals()) | set(_generated_models.__all__)) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_errors.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_errors.py index e632a92f9ea8..a6d2088cc52f 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_errors.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_errors.py @@ -6,7 +6,7 @@ from typing import Any, cast -from . import ApiErrorResponse, Error +from . import _generated as _generated_models class RequestValidationError(ValueError): @@ -30,17 +30,17 @@ def __init__( self.debug_info = debug_info self.details = details - def to_error(self) -> Error: + def to_error(self) -> _generated_models.Error: """Convert this validation error to an error wire payload. :returns: An error payload populated from this validation error's fields. :rtype: Error """ - detail_errors: list[Error] | None = None + detail_errors: list[_generated_models.Error] | None = None if self.details: detail_errors = [ cast( - Error, + "_generated_models.Error", { "code": d.get("code", "invalid_value"), "message": d.get("message", ""), @@ -51,7 +51,7 @@ def to_error(self) -> Error: for d in self.details ] error = cast( - Error, + "_generated_models.Error", { "code": self.code, "message": self.message, @@ -65,10 +65,10 @@ def to_error(self) -> Error: error["debugInfo"] = self.debug_info return error - def to_api_error_response(self) -> ApiErrorResponse: + def to_api_error_response(self) -> _generated_models.ApiErrorResponse: """Convert this validation error to the API error envelope. :returns: An ``ApiErrorResponse`` wrapping the error payload. :rtype: ApiErrorResponse """ - return cast(ApiErrorResponse, {"error": self.to_error()}) + return cast("_generated_models.ApiErrorResponse", {"error": self.to_error()}) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/__init__.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/__init__.py index 84d94c625c35..b5205c018ab5 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/__init__.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/__init__.py @@ -1,10 +1,23 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._unions import * # type: ignore # noqa: F401,F403 -from .types import * # type: ignore # noqa: F401,F403 +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# Generated by _scripts/lazy_model_emitter.py; do not edit by hand. + +from typing import TYPE_CHECKING +from . import types, _unions +from ._catalog import TYPE_EXPORTS as _TYPE_EXPORTS, GENERATED_EXPORTS as _GENERATED_EXPORTS + +if TYPE_CHECKING: + from ._unions import * + from .types import * + +__all__ = _GENERATED_EXPORTS + +def __getattr__(name): + if name not in __all__: + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") + value = getattr(types if name in _TYPE_EXPORTS else _unions, name) + globals()[name] = value + return value + +def __dir__(): + return sorted(set(globals()) | set(__all__)) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_catalog.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_catalog.py new file mode 100644 index 000000000000..0eef16702d2b --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_catalog.py @@ -0,0 +1,7 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# Generated by _scripts/lazy_model_emitter.py; do not edit by hand. +TYPE_EXPORTS = ['Any', 'Literal', 'Optional', 'TYPE_CHECKING', 'Union', 'Required', 'TypedDict', 'AnnotationType', 'ApplyPatchCallOutputStatus', 'ApplyPatchCallOutputStatusParam', 'ApplyPatchCallStatus', 'ApplyPatchCallStatusParam', 'ApplyPatchFileOperationType', 'ApplyPatchOperationParamType', 'AzureAISearchQueryType', 'CallableToolAllowedCaller', 'ClickButtonType', 'ComputerActionType', 'ComputerEnvironment', 'ContainerMemoryLimit', 'ContainerNetworkPolicyParamType', 'ContainerSkillType', 'CustomToolParamFormatType', 'DetailEnum', 'FileInputDetail', 'FunctionAndCustomToolCallOutputType', 'FunctionCallItemStatus', 'FunctionCallOutputStatusEnum', 'FunctionCallStatus', 'FunctionShellCallEnvironmentType', 'FunctionShellCallItemParamEnvironmentType', 'FunctionShellCallItemStatus', 'FunctionShellCallOutputOutcomeParamType', 'FunctionShellCallOutputOutcomeType', 'FunctionShellCallOutputStatusEnum', 'FunctionShellCallStatus', 'FunctionShellToolParamEnvironmentType', 'GrammarSyntax1', 'ImageDetail', 'ImageGenActionEnum', 'IncludeEnum', 'InputFidelity', 'ItemFieldType', 'ItemType', 'MCPToolCallStatus', 'MemoryItemKind', 'MessageContentType', 'MessagePhase', 'MessageRole', 'MessageStatus', 'ModelIdsCompaction', 'ModerationEntryType', 'ModerationInputType', 'ModerationMode', 'OpenApiAuthType', 'OutputContentType', 'OutputItemType', 'OutputMessageContentType', 'PageOrder', 'ProgramOutputStatus', 'PromptCacheModeEnum', 'PromptCacheRetentionEnum', 'PromptCacheTTLEnum', 'RankerVersionType', 'RealtimeMcpErrorType', 'ReasoningEffort', 'ReasoningModeEnum', 'ResponseErrorCode', 'ResponseStreamEventType', 'SearchContentType', 'SearchContextSize', 'ServiceTierEnum', 'TextResponseFormatConfigurationType', 'ToolCallCallerParamType', 'ToolCallCallerType', 'ToolCallStatus', 'ToolChoiceOptions', 'ToolChoiceParamType', 'ToolSearchExecutionType', 'ToolType', 'A2APreviewTool', 'A2AToolCall', 'A2AToolCallOutput', 'AdditionalToolsItemParam', 'AgentReference', 'AISearchIndexResource', 'ApiErrorResponse', 'ApplyPatchCreateFileOperation', 'ApplyPatchCreateFileOperationParam', 'ApplyPatchDeleteFileOperation', 'ApplyPatchDeleteFileOperationParam', 'ApplyPatchToolCallItemParam', 'ApplyPatchToolCallOutputItemParam', 'ApplyPatchToolParam', 'ApplyPatchUpdateFileOperation', 'ApplyPatchUpdateFileOperationParam', 'ApproximateLocation', 'AutoCodeInterpreterToolParam', 'AzureAISearchTool', 'AzureAISearchToolCall', 'AzureAISearchToolCallOutput', 'AzureAISearchToolResource', 'AzureFunctionBinding', 'AzureFunctionDefinition', 'AzureFunctionDefinitionFunction', 'AzureFunctionStorageQueue', 'AzureFunctionTool', 'AzureFunctionToolCall', 'AzureFunctionToolCallOutput', 'BingCustomSearchConfiguration', 'BingCustomSearchPreviewTool', 'BingCustomSearchToolCall', 'BingCustomSearchToolCallOutput', 'BingCustomSearchToolParameters', 'BingGroundingSearchConfiguration', 'BingGroundingSearchToolParameters', 'BingGroundingTool', 'BingGroundingToolCall', 'BingGroundingToolCallOutput', 'BrowserAutomationPreviewTool', 'BrowserAutomationToolCall', 'BrowserAutomationToolCallOutput', 'BrowserAutomationToolConnectionParameters', 'BrowserAutomationToolParameters', 'CaptureStructuredOutputsTool', 'ChatSummaryMemoryItem', 'ClickParam', 'CodeInterpreterOutputImage', 'CodeInterpreterOutputLogs', 'CodeInterpreterTool', 'CompactionSummaryItemParam', 'CompactResource', 'ComparisonFilter', 'CompoundFilter', 'ComputerCallOutputItemParam', 'ComputerCallSafetyCheckParam', 'ComputerScreenshotContent', 'ComputerScreenshotImage', 'ComputerTool', 'ComputerUsePreviewTool', 'ContainerAutoParam', 'ContainerFileCitationBody', 'ContainerNetworkPolicyAllowlistParam', 'ContainerNetworkPolicyDisabledParam', 'ContainerNetworkPolicyDomainSecretParam', 'ContainerReferenceResource', 'ContextManagementParam', 'ConversationParam_2', 'ConversationReference', 'CoordParam', 'CreateResponse', 'CustomGrammarFormatParam', 'CustomTextFormatParam', 'CustomToolCallOutputResource', 'CustomToolCallResource', 'CustomToolParam', 'DeleteResponseResult', 'DirectToolCallCaller', 'DirectToolCallCallerParam', 'DoubleClickAction', 'DragParam', 'EmptyModelParam', 'Error', 'FabricDataAgentToolCall', 'FabricDataAgentToolCallOutput', 'FabricDataAgentToolParameters', 'FileCitationBody', 'FilePath', 'FileSearchTool', 'FileSearchToolCallResults', 'FunctionAndCustomToolCallOutputInputFileContent', 'FunctionAndCustomToolCallOutputInputImageContent', 'FunctionAndCustomToolCallOutputInputTextContent', 'FunctionCallOutputItemParam', 'FunctionShellAction', 'FunctionShellActionParam', 'FunctionShellCallItemParam', 'FunctionShellCallItemParamEnvironmentContainerReferenceParam', 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam', 'FunctionShellCallOutputContent', 'FunctionShellCallOutputContentParam', 'FunctionShellCallOutputExitOutcome', 'FunctionShellCallOutputExitOutcomeParam', 'FunctionShellCallOutputItemParam', 'FunctionShellCallOutputTimeoutOutcome', 'FunctionShellCallOutputTimeoutOutcomeParam', 'FunctionShellToolParam', 'FunctionShellToolParamEnvironmentContainerReferenceParam', 'FunctionShellToolParamEnvironmentLocalEnvironmentParam', 'FunctionTool', 'FunctionToolParam', 'HybridSearchOptions', 'ImageGenTool', 'ImageGenToolInputImageMask', 'InlineSkillParam', 'InlineSkillSourceParam', 'InputFileContent', 'InputFileContentParam', 'InputImageContent', 'InputImageContentParamAutoParam', 'InputTextContent', 'InputTextContentParam', 'ItemCodeInterpreterToolCall', 'ItemComputerToolCall', 'ItemCustomToolCall', 'ItemCustomToolCallOutput', 'ItemFieldAdditionalTools', 'ItemFieldApplyPatchToolCall', 'ItemFieldApplyPatchToolCallOutput', 'ItemFieldCodeInterpreterToolCall', 'ItemFieldCompactionBody', 'ItemFieldComputerToolCall', 'ItemFieldComputerToolCallOutput', 'ItemFieldCustomToolCall', 'ItemFieldCustomToolCallOutput', 'ItemFieldFileSearchToolCall', 'ItemFieldFunctionShellCall', 'ItemFieldFunctionShellCallOutput', 'ItemFieldFunctionToolCall', 'ItemFieldFunctionToolCallOutput', 'ItemFieldImageGenToolCall', 'ItemFieldLocalShellToolCall', 'ItemFieldLocalShellToolCallOutput', 'ItemFieldMcpApprovalRequest', 'ItemFieldMcpApprovalResponseResource', 'ItemFieldMcpListTools', 'ItemFieldMcpToolCall', 'ItemFieldMessage', 'ItemFieldProgram', 'ItemFieldProgramOutput', 'ItemFieldReasoningItem', 'ItemFieldToolSearchCall', 'ItemFieldToolSearchOutput', 'ItemFieldWebSearchToolCall', 'ItemFileSearchToolCall', 'ItemFunctionToolCall', 'ItemImageGenToolCall', 'ItemLocalShellToolCall', 'ItemLocalShellToolCallOutput', 'ItemMcpApprovalRequest', 'ItemMcpListTools', 'ItemMcpToolCall', 'ItemMessage', 'ItemOutputMessage', 'ItemProgram', 'ItemProgramOutput', 'ItemReasoningItem', 'ItemReferenceParam', 'ItemWebSearchToolCall', 'KeyPressAction', 'LocalEnvironmentResource', 'LocalShellExecAction', 'LocalShellToolParam', 'LocalSkillParam', 'LogProb', 'MCPApprovalResponse', 'MCPListToolsTool', 'MCPListToolsToolAnnotations', 'MCPListToolsToolInputSchema', 'MCPTool', 'MCPToolFilter', 'MCPToolRequireApproval', 'MemorySearchItem', 'MemorySearchOptions', 'MemorySearchPreviewTool', 'MemorySearchToolCallItemParam', 'MemorySearchToolCallItemResource', 'MessageContentInputFileContent', 'MessageContentInputImageContent', 'MessageContentInputTextContent', 'MessageContentOutputTextContent', 'MessageContentReasoningTextContent', 'MessageContentRefusalContent', 'Metadata', 'MicrosoftFabricPreviewTool', 'Moderation', 'ModerationConfigParam', 'ModerationErrorBody', 'ModerationParam', 'ModerationPolicyParam', 'ModerationResultBody', 'MoveParam', 'NamespaceToolParam', 'OAuthConsentRequestOutputItem', 'OpenApiAnonymousAuthDetails', 'OpenApiFunctionDefinition', 'OpenApiFunctionDefinitionFunction', 'OpenApiManagedAuthDetails', 'OpenApiManagedSecurityScheme', 'OpenApiProjectConnectionAuthDetails', 'OpenApiProjectConnectionSecurityScheme', 'OpenApiTool', 'OpenApiToolCall', 'OpenApiToolCallOutput', 'OutputContentOutputTextContent', 'OutputContentReasoningTextContent', 'OutputContentRefusalContent', 'OutputItemAdditionalTools', 'OutputItemApplyPatchToolCall', 'OutputItemApplyPatchToolCallOutput', 'OutputItemCodeInterpreterToolCall', 'OutputItemCompactionBody', 'OutputItemComputerToolCall', 'OutputItemComputerToolCallOutput', 'OutputItemFileSearchToolCall', 'OutputItemFunctionShellCall', 'OutputItemFunctionShellCallOutput', 'OutputItemFunctionToolCall', 'OutputItemFunctionToolCallOutput', 'OutputItemImageGenToolCall', 'OutputItemLocalShellToolCall', 'OutputItemLocalShellToolCallOutput', 'OutputItemMcpApprovalRequest', 'OutputItemMcpApprovalResponseResource', 'OutputItemMcpListTools', 'OutputItemMcpToolCall', 'OutputItemMessage', 'OutputItemOutputMessage', 'OutputItemProgram', 'OutputItemProgramOutput', 'OutputItemReasoningItem', 'OutputItemToolSearchCall', 'OutputItemToolSearchOutput', 'OutputItemWebSearchToolCall', 'OutputMessageContentOutputTextContent', 'OutputMessageContentRefusalContent', 'ProgrammaticToolCallingParam', 'ProgramToolCallCaller', 'ProgramToolCallCallerParam', 'Prompt', 'PromptCacheBreakpointConfig', 'PromptCacheBreakpointParam', 'PromptCacheOptions', 'PromptCacheOptionsParam', 'RankingOptions', 'RealtimeMCPHTTPError', 'RealtimeMCPProtocolError', 'RealtimeMCPToolExecutionError', 'Reasoning', 'ReasoningTextContent', 'ResponseAudioDeltaEvent', 'ResponseAudioDoneEvent', 'ResponseAudioTranscriptDeltaEvent', 'ResponseAudioTranscriptDoneEvent', 'ResponseCodeInterpreterCallCodeDeltaEvent', 'ResponseCodeInterpreterCallCodeDoneEvent', 'ResponseCodeInterpreterCallCompletedEvent', 'ResponseCodeInterpreterCallInProgressEvent', 'ResponseCodeInterpreterCallInterpretingEvent', 'ResponseCompletedEvent', 'ResponseContentPartAddedEvent', 'ResponseContentPartDoneEvent', 'ResponseCreatedEvent', 'ResponseCustomToolCallInputDeltaEvent', 'ResponseCustomToolCallInputDoneEvent', 'ResponseErrorEvent', 'ResponseErrorInfo', 'ResponseFailedEvent', 'ResponseFileSearchCallCompletedEvent', 'ResponseFileSearchCallInProgressEvent', 'ResponseFileSearchCallSearchingEvent', 'ResponseFormatJsonSchemaSchema', 'ResponseFunctionCallArgumentsDeltaEvent', 'ResponseFunctionCallArgumentsDoneEvent', 'ResponseImageGenCallCompletedEvent', 'ResponseImageGenCallGeneratingEvent', 'ResponseImageGenCallInProgressEvent', 'ResponseImageGenCallPartialImageEvent', 'ResponseIncompleteDetails', 'ResponseIncompleteEvent', 'ResponseInProgressEvent', 'ResponseLogProb', 'ResponseLogProbTopLogprobs', 'ResponseMCPCallArgumentsDeltaEvent', 'ResponseMCPCallArgumentsDoneEvent', 'ResponseMCPCallCompletedEvent', 'ResponseMCPCallFailedEvent', 'ResponseMCPCallInProgressEvent', 'ResponseMCPListToolsCompletedEvent', 'ResponseMCPListToolsFailedEvent', 'ResponseMCPListToolsInProgressEvent', 'ResponseObject', 'ResponseOutputItemAddedEvent', 'ResponseOutputItemDoneEvent', 'ResponseOutputTextAnnotationAddedEvent', 'ResponsePromptVariables', 'ResponseQueuedEvent', 'ResponseReasoningSummaryPartAddedEvent', 'ResponseReasoningSummaryPartAddedEventPart', 'ResponseReasoningSummaryPartDoneEvent', 'ResponseReasoningSummaryPartDoneEventPart', 'ResponseReasoningSummaryTextDeltaEvent', 'ResponseReasoningSummaryTextDoneEvent', 'ResponseReasoningTextDeltaEvent', 'ResponseReasoningTextDoneEvent', 'ResponseRefusalDeltaEvent', 'ResponseRefusalDoneEvent', 'ResponseStreamOptions', 'ResponseTextDeltaEvent', 'ResponseTextDoneEvent', 'ResponseTextParam', 'ResponseUsage', 'ResponseUsageInputTokensDetails', 'ResponseUsageOutputTokensDetails', 'ResponseWebSearchCallCompletedEvent', 'ResponseWebSearchCallInProgressEvent', 'ResponseWebSearchCallSearchingEvent', 'ScreenshotParam', 'ScrollParam', 'SharepointGroundingToolCall', 'SharepointGroundingToolCallOutput', 'SharepointGroundingToolParameters', 'SharepointPreviewTool', 'SkillReferenceParam', 'SpecificApplyPatchParam', 'SpecificFunctionShellParam', 'SpecificProgrammaticToolCallingParam', 'StructuredOutputDefinition', 'StructuredOutputsOutputItem', 'SummaryTextContent', 'TextContent', 'TextResponseFormatConfigurationResponseFormatJsonObject', 'TextResponseFormatConfigurationResponseFormatText', 'TextResponseFormatJsonSchema', 'ToolChoiceAllowed', 'ToolChoiceCodeInterpreter', 'ToolChoiceComputer', 'ToolChoiceComputerUse', 'ToolChoiceComputerUsePreview', 'ToolChoiceCustom', 'ToolChoiceFileSearch', 'ToolChoiceFunction', 'ToolChoiceImageGeneration', 'ToolChoiceMCP', 'ToolChoiceWebSearchPreview', 'ToolChoiceWebSearchPreview20250311', 'ToolProjectConnection', 'ToolSearchCallItemParam', 'ToolSearchOutputItemParam', 'ToolSearchToolParam', 'TopLogProb', 'TypeParam', 'UrlCitationBody', 'UserProfileMemoryItem', 'VectorStoreFileAttributes', 'WaitParam', 'WebSearchActionFind', 'WebSearchActionOpenPage', 'WebSearchActionSearch', 'WebSearchActionSearchSources', 'WebSearchApproximateLocation', 'WebSearchConfiguration', 'WebSearchPreviewTool', 'WebSearchTool', 'WebSearchToolFilters', 'WorkflowActionOutputItem', 'WorkIQPreviewTool', 'WorkIQPreviewToolParameters', 'CompactResponseMethodPublicBody', 'Tool', 'OutputItem', 'Item', 'Annotation', 'ApplyPatchFileOperation', 'ApplyPatchOperationParam', 'MemoryItem', 'ComputerAction', 'MessageContent', 'FunctionShellToolParamEnvironment', 'ContainerNetworkPolicyParam', 'FunctionShellCallEnvironment', 'ContainerSkill', 'CustomToolParamFormat', 'ToolCallCaller', 'ToolCallCallerParam', 'FunctionAndCustomToolCallOutput', 'FunctionShellCallItemParamEnvironment', 'FunctionShellCallOutputOutcome', 'FunctionShellCallOutputOutcomeParam', 'ItemField', 'ModerationEntry', 'OpenApiAuthDetails', 'OutputContent', 'OutputMessageContent', 'RealtimeMCPError', 'ResponseStreamEvent', 'ToolChoiceParam', 'TextResponseFormatConfiguration'] +UNION_EXPORTS = ['Any', 'TYPE_CHECKING', 'Union', 'Filters', 'ToolCallOutputContent', 'InputParam', 'ConversationParam', 'CreateResponseStreamingResponse'] +GENERATED_EXPORTS = ['Any', 'TYPE_CHECKING', 'Union', 'Filters', 'ToolCallOutputContent', 'InputParam', 'ConversationParam', 'CreateResponseStreamingResponse', 'types', 'Literal', 'Optional', 'Required', 'TypedDict', 'AnnotationType', 'ApplyPatchCallOutputStatus', 'ApplyPatchCallOutputStatusParam', 'ApplyPatchCallStatus', 'ApplyPatchCallStatusParam', 'ApplyPatchFileOperationType', 'ApplyPatchOperationParamType', 'AzureAISearchQueryType', 'CallableToolAllowedCaller', 'ClickButtonType', 'ComputerActionType', 'ComputerEnvironment', 'ContainerMemoryLimit', 'ContainerNetworkPolicyParamType', 'ContainerSkillType', 'CustomToolParamFormatType', 'DetailEnum', 'FileInputDetail', 'FunctionAndCustomToolCallOutputType', 'FunctionCallItemStatus', 'FunctionCallOutputStatusEnum', 'FunctionCallStatus', 'FunctionShellCallEnvironmentType', 'FunctionShellCallItemParamEnvironmentType', 'FunctionShellCallItemStatus', 'FunctionShellCallOutputOutcomeParamType', 'FunctionShellCallOutputOutcomeType', 'FunctionShellCallOutputStatusEnum', 'FunctionShellCallStatus', 'FunctionShellToolParamEnvironmentType', 'GrammarSyntax1', 'ImageDetail', 'ImageGenActionEnum', 'IncludeEnum', 'InputFidelity', 'ItemFieldType', 'ItemType', 'MCPToolCallStatus', 'MemoryItemKind', 'MessageContentType', 'MessagePhase', 'MessageRole', 'MessageStatus', 'ModelIdsCompaction', 'ModerationEntryType', 'ModerationInputType', 'ModerationMode', 'OpenApiAuthType', 'OutputContentType', 'OutputItemType', 'OutputMessageContentType', 'PageOrder', 'ProgramOutputStatus', 'PromptCacheModeEnum', 'PromptCacheRetentionEnum', 'PromptCacheTTLEnum', 'RankerVersionType', 'RealtimeMcpErrorType', 'ReasoningEffort', 'ReasoningModeEnum', 'ResponseErrorCode', 'ResponseStreamEventType', 'SearchContentType', 'SearchContextSize', 'ServiceTierEnum', 'TextResponseFormatConfigurationType', 'ToolCallCallerParamType', 'ToolCallCallerType', 'ToolCallStatus', 'ToolChoiceOptions', 'ToolChoiceParamType', 'ToolSearchExecutionType', 'ToolType', 'A2APreviewTool', 'A2AToolCall', 'A2AToolCallOutput', 'AdditionalToolsItemParam', 'AgentReference', 'AISearchIndexResource', 'ApiErrorResponse', 'ApplyPatchCreateFileOperation', 'ApplyPatchCreateFileOperationParam', 'ApplyPatchDeleteFileOperation', 'ApplyPatchDeleteFileOperationParam', 'ApplyPatchToolCallItemParam', 'ApplyPatchToolCallOutputItemParam', 'ApplyPatchToolParam', 'ApplyPatchUpdateFileOperation', 'ApplyPatchUpdateFileOperationParam', 'ApproximateLocation', 'AutoCodeInterpreterToolParam', 'AzureAISearchTool', 'AzureAISearchToolCall', 'AzureAISearchToolCallOutput', 'AzureAISearchToolResource', 'AzureFunctionBinding', 'AzureFunctionDefinition', 'AzureFunctionDefinitionFunction', 'AzureFunctionStorageQueue', 'AzureFunctionTool', 'AzureFunctionToolCall', 'AzureFunctionToolCallOutput', 'BingCustomSearchConfiguration', 'BingCustomSearchPreviewTool', 'BingCustomSearchToolCall', 'BingCustomSearchToolCallOutput', 'BingCustomSearchToolParameters', 'BingGroundingSearchConfiguration', 'BingGroundingSearchToolParameters', 'BingGroundingTool', 'BingGroundingToolCall', 'BingGroundingToolCallOutput', 'BrowserAutomationPreviewTool', 'BrowserAutomationToolCall', 'BrowserAutomationToolCallOutput', 'BrowserAutomationToolConnectionParameters', 'BrowserAutomationToolParameters', 'CaptureStructuredOutputsTool', 'ChatSummaryMemoryItem', 'ClickParam', 'CodeInterpreterOutputImage', 'CodeInterpreterOutputLogs', 'CodeInterpreterTool', 'CompactionSummaryItemParam', 'CompactResource', 'ComparisonFilter', 'CompoundFilter', 'ComputerCallOutputItemParam', 'ComputerCallSafetyCheckParam', 'ComputerScreenshotContent', 'ComputerScreenshotImage', 'ComputerTool', 'ComputerUsePreviewTool', 'ContainerAutoParam', 'ContainerFileCitationBody', 'ContainerNetworkPolicyAllowlistParam', 'ContainerNetworkPolicyDisabledParam', 'ContainerNetworkPolicyDomainSecretParam', 'ContainerReferenceResource', 'ContextManagementParam', 'ConversationParam_2', 'ConversationReference', 'CoordParam', 'CreateResponse', 'CustomGrammarFormatParam', 'CustomTextFormatParam', 'CustomToolCallOutputResource', 'CustomToolCallResource', 'CustomToolParam', 'DeleteResponseResult', 'DirectToolCallCaller', 'DirectToolCallCallerParam', 'DoubleClickAction', 'DragParam', 'EmptyModelParam', 'Error', 'FabricDataAgentToolCall', 'FabricDataAgentToolCallOutput', 'FabricDataAgentToolParameters', 'FileCitationBody', 'FilePath', 'FileSearchTool', 'FileSearchToolCallResults', 'FunctionAndCustomToolCallOutputInputFileContent', 'FunctionAndCustomToolCallOutputInputImageContent', 'FunctionAndCustomToolCallOutputInputTextContent', 'FunctionCallOutputItemParam', 'FunctionShellAction', 'FunctionShellActionParam', 'FunctionShellCallItemParam', 'FunctionShellCallItemParamEnvironmentContainerReferenceParam', 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam', 'FunctionShellCallOutputContent', 'FunctionShellCallOutputContentParam', 'FunctionShellCallOutputExitOutcome', 'FunctionShellCallOutputExitOutcomeParam', 'FunctionShellCallOutputItemParam', 'FunctionShellCallOutputTimeoutOutcome', 'FunctionShellCallOutputTimeoutOutcomeParam', 'FunctionShellToolParam', 'FunctionShellToolParamEnvironmentContainerReferenceParam', 'FunctionShellToolParamEnvironmentLocalEnvironmentParam', 'FunctionTool', 'FunctionToolParam', 'HybridSearchOptions', 'ImageGenTool', 'ImageGenToolInputImageMask', 'InlineSkillParam', 'InlineSkillSourceParam', 'InputFileContent', 'InputFileContentParam', 'InputImageContent', 'InputImageContentParamAutoParam', 'InputTextContent', 'InputTextContentParam', 'ItemCodeInterpreterToolCall', 'ItemComputerToolCall', 'ItemCustomToolCall', 'ItemCustomToolCallOutput', 'ItemFieldAdditionalTools', 'ItemFieldApplyPatchToolCall', 'ItemFieldApplyPatchToolCallOutput', 'ItemFieldCodeInterpreterToolCall', 'ItemFieldCompactionBody', 'ItemFieldComputerToolCall', 'ItemFieldComputerToolCallOutput', 'ItemFieldCustomToolCall', 'ItemFieldCustomToolCallOutput', 'ItemFieldFileSearchToolCall', 'ItemFieldFunctionShellCall', 'ItemFieldFunctionShellCallOutput', 'ItemFieldFunctionToolCall', 'ItemFieldFunctionToolCallOutput', 'ItemFieldImageGenToolCall', 'ItemFieldLocalShellToolCall', 'ItemFieldLocalShellToolCallOutput', 'ItemFieldMcpApprovalRequest', 'ItemFieldMcpApprovalResponseResource', 'ItemFieldMcpListTools', 'ItemFieldMcpToolCall', 'ItemFieldMessage', 'ItemFieldProgram', 'ItemFieldProgramOutput', 'ItemFieldReasoningItem', 'ItemFieldToolSearchCall', 'ItemFieldToolSearchOutput', 'ItemFieldWebSearchToolCall', 'ItemFileSearchToolCall', 'ItemFunctionToolCall', 'ItemImageGenToolCall', 'ItemLocalShellToolCall', 'ItemLocalShellToolCallOutput', 'ItemMcpApprovalRequest', 'ItemMcpListTools', 'ItemMcpToolCall', 'ItemMessage', 'ItemOutputMessage', 'ItemProgram', 'ItemProgramOutput', 'ItemReasoningItem', 'ItemReferenceParam', 'ItemWebSearchToolCall', 'KeyPressAction', 'LocalEnvironmentResource', 'LocalShellExecAction', 'LocalShellToolParam', 'LocalSkillParam', 'LogProb', 'MCPApprovalResponse', 'MCPListToolsTool', 'MCPListToolsToolAnnotations', 'MCPListToolsToolInputSchema', 'MCPTool', 'MCPToolFilter', 'MCPToolRequireApproval', 'MemorySearchItem', 'MemorySearchOptions', 'MemorySearchPreviewTool', 'MemorySearchToolCallItemParam', 'MemorySearchToolCallItemResource', 'MessageContentInputFileContent', 'MessageContentInputImageContent', 'MessageContentInputTextContent', 'MessageContentOutputTextContent', 'MessageContentReasoningTextContent', 'MessageContentRefusalContent', 'Metadata', 'MicrosoftFabricPreviewTool', 'Moderation', 'ModerationConfigParam', 'ModerationErrorBody', 'ModerationParam', 'ModerationPolicyParam', 'ModerationResultBody', 'MoveParam', 'NamespaceToolParam', 'OAuthConsentRequestOutputItem', 'OpenApiAnonymousAuthDetails', 'OpenApiFunctionDefinition', 'OpenApiFunctionDefinitionFunction', 'OpenApiManagedAuthDetails', 'OpenApiManagedSecurityScheme', 'OpenApiProjectConnectionAuthDetails', 'OpenApiProjectConnectionSecurityScheme', 'OpenApiTool', 'OpenApiToolCall', 'OpenApiToolCallOutput', 'OutputContentOutputTextContent', 'OutputContentReasoningTextContent', 'OutputContentRefusalContent', 'OutputItemAdditionalTools', 'OutputItemApplyPatchToolCall', 'OutputItemApplyPatchToolCallOutput', 'OutputItemCodeInterpreterToolCall', 'OutputItemCompactionBody', 'OutputItemComputerToolCall', 'OutputItemComputerToolCallOutput', 'OutputItemFileSearchToolCall', 'OutputItemFunctionShellCall', 'OutputItemFunctionShellCallOutput', 'OutputItemFunctionToolCall', 'OutputItemFunctionToolCallOutput', 'OutputItemImageGenToolCall', 'OutputItemLocalShellToolCall', 'OutputItemLocalShellToolCallOutput', 'OutputItemMcpApprovalRequest', 'OutputItemMcpApprovalResponseResource', 'OutputItemMcpListTools', 'OutputItemMcpToolCall', 'OutputItemMessage', 'OutputItemOutputMessage', 'OutputItemProgram', 'OutputItemProgramOutput', 'OutputItemReasoningItem', 'OutputItemToolSearchCall', 'OutputItemToolSearchOutput', 'OutputItemWebSearchToolCall', 'OutputMessageContentOutputTextContent', 'OutputMessageContentRefusalContent', 'ProgrammaticToolCallingParam', 'ProgramToolCallCaller', 'ProgramToolCallCallerParam', 'Prompt', 'PromptCacheBreakpointConfig', 'PromptCacheBreakpointParam', 'PromptCacheOptions', 'PromptCacheOptionsParam', 'RankingOptions', 'RealtimeMCPHTTPError', 'RealtimeMCPProtocolError', 'RealtimeMCPToolExecutionError', 'Reasoning', 'ReasoningTextContent', 'ResponseAudioDeltaEvent', 'ResponseAudioDoneEvent', 'ResponseAudioTranscriptDeltaEvent', 'ResponseAudioTranscriptDoneEvent', 'ResponseCodeInterpreterCallCodeDeltaEvent', 'ResponseCodeInterpreterCallCodeDoneEvent', 'ResponseCodeInterpreterCallCompletedEvent', 'ResponseCodeInterpreterCallInProgressEvent', 'ResponseCodeInterpreterCallInterpretingEvent', 'ResponseCompletedEvent', 'ResponseContentPartAddedEvent', 'ResponseContentPartDoneEvent', 'ResponseCreatedEvent', 'ResponseCustomToolCallInputDeltaEvent', 'ResponseCustomToolCallInputDoneEvent', 'ResponseErrorEvent', 'ResponseErrorInfo', 'ResponseFailedEvent', 'ResponseFileSearchCallCompletedEvent', 'ResponseFileSearchCallInProgressEvent', 'ResponseFileSearchCallSearchingEvent', 'ResponseFormatJsonSchemaSchema', 'ResponseFunctionCallArgumentsDeltaEvent', 'ResponseFunctionCallArgumentsDoneEvent', 'ResponseImageGenCallCompletedEvent', 'ResponseImageGenCallGeneratingEvent', 'ResponseImageGenCallInProgressEvent', 'ResponseImageGenCallPartialImageEvent', 'ResponseIncompleteDetails', 'ResponseIncompleteEvent', 'ResponseInProgressEvent', 'ResponseLogProb', 'ResponseLogProbTopLogprobs', 'ResponseMCPCallArgumentsDeltaEvent', 'ResponseMCPCallArgumentsDoneEvent', 'ResponseMCPCallCompletedEvent', 'ResponseMCPCallFailedEvent', 'ResponseMCPCallInProgressEvent', 'ResponseMCPListToolsCompletedEvent', 'ResponseMCPListToolsFailedEvent', 'ResponseMCPListToolsInProgressEvent', 'ResponseObject', 'ResponseOutputItemAddedEvent', 'ResponseOutputItemDoneEvent', 'ResponseOutputTextAnnotationAddedEvent', 'ResponsePromptVariables', 'ResponseQueuedEvent', 'ResponseReasoningSummaryPartAddedEvent', 'ResponseReasoningSummaryPartAddedEventPart', 'ResponseReasoningSummaryPartDoneEvent', 'ResponseReasoningSummaryPartDoneEventPart', 'ResponseReasoningSummaryTextDeltaEvent', 'ResponseReasoningSummaryTextDoneEvent', 'ResponseReasoningTextDeltaEvent', 'ResponseReasoningTextDoneEvent', 'ResponseRefusalDeltaEvent', 'ResponseRefusalDoneEvent', 'ResponseStreamOptions', 'ResponseTextDeltaEvent', 'ResponseTextDoneEvent', 'ResponseTextParam', 'ResponseUsage', 'ResponseUsageInputTokensDetails', 'ResponseUsageOutputTokensDetails', 'ResponseWebSearchCallCompletedEvent', 'ResponseWebSearchCallInProgressEvent', 'ResponseWebSearchCallSearchingEvent', 'ScreenshotParam', 'ScrollParam', 'SharepointGroundingToolCall', 'SharepointGroundingToolCallOutput', 'SharepointGroundingToolParameters', 'SharepointPreviewTool', 'SkillReferenceParam', 'SpecificApplyPatchParam', 'SpecificFunctionShellParam', 'SpecificProgrammaticToolCallingParam', 'StructuredOutputDefinition', 'StructuredOutputsOutputItem', 'SummaryTextContent', 'TextContent', 'TextResponseFormatConfigurationResponseFormatJsonObject', 'TextResponseFormatConfigurationResponseFormatText', 'TextResponseFormatJsonSchema', 'ToolChoiceAllowed', 'ToolChoiceCodeInterpreter', 'ToolChoiceComputer', 'ToolChoiceComputerUse', 'ToolChoiceComputerUsePreview', 'ToolChoiceCustom', 'ToolChoiceFileSearch', 'ToolChoiceFunction', 'ToolChoiceImageGeneration', 'ToolChoiceMCP', 'ToolChoiceWebSearchPreview', 'ToolChoiceWebSearchPreview20250311', 'ToolProjectConnection', 'ToolSearchCallItemParam', 'ToolSearchOutputItemParam', 'ToolSearchToolParam', 'TopLogProb', 'TypeParam', 'UrlCitationBody', 'UserProfileMemoryItem', 'VectorStoreFileAttributes', 'WaitParam', 'WebSearchActionFind', 'WebSearchActionOpenPage', 'WebSearchActionSearch', 'WebSearchActionSearchSources', 'WebSearchApproximateLocation', 'WebSearchConfiguration', 'WebSearchPreviewTool', 'WebSearchTool', 'WebSearchToolFilters', 'WorkflowActionOutputItem', 'WorkIQPreviewTool', 'WorkIQPreviewToolParameters', 'CompactResponseMethodPublicBody', 'Tool', 'OutputItem', 'Item', 'Annotation', 'ApplyPatchFileOperation', 'ApplyPatchOperationParam', 'MemoryItem', 'ComputerAction', 'MessageContent', 'FunctionShellToolParamEnvironment', 'ContainerNetworkPolicyParam', 'FunctionShellCallEnvironment', 'ContainerSkill', 'CustomToolParamFormat', 'ToolCallCaller', 'ToolCallCallerParam', 'FunctionAndCustomToolCallOutput', 'FunctionShellCallItemParamEnvironment', 'FunctionShellCallOutputOutcome', 'FunctionShellCallOutputOutcomeParam', 'ItemField', 'ModerationEntry', 'OpenApiAuthDetails', 'OutputContent', 'OutputMessageContent', 'RealtimeMCPError', 'ResponseStreamEvent', 'ToolChoiceParam', 'TextResponseFormatConfiguration'] +MODEL_EXPORTS = ['A2APreviewTool', 'A2AToolCall', 'A2AToolCallOutput', 'AISearchIndexResource', 'AdditionalToolsItemParam', 'AgentReference', 'Annotation', 'AnnotationType', 'ApiErrorResponse', 'ApplyPatchCallOutputStatus', 'ApplyPatchCallOutputStatusParam', 'ApplyPatchCallStatus', 'ApplyPatchCallStatusParam', 'ApplyPatchCreateFileOperation', 'ApplyPatchCreateFileOperationParam', 'ApplyPatchDeleteFileOperation', 'ApplyPatchDeleteFileOperationParam', 'ApplyPatchFileOperation', 'ApplyPatchFileOperationType', 'ApplyPatchOperationParam', 'ApplyPatchOperationParamType', 'ApplyPatchToolCallItemParam', 'ApplyPatchToolCallOutputItemParam', 'ApplyPatchToolParam', 'ApplyPatchUpdateFileOperation', 'ApplyPatchUpdateFileOperationParam', 'ApproximateLocation', 'AutoCodeInterpreterToolParam', 'AzureAISearchQueryType', 'AzureAISearchTool', 'AzureAISearchToolCall', 'AzureAISearchToolCallOutput', 'AzureAISearchToolResource', 'AzureFunctionBinding', 'AzureFunctionDefinition', 'AzureFunctionDefinitionFunction', 'AzureFunctionStorageQueue', 'AzureFunctionTool', 'AzureFunctionToolCall', 'AzureFunctionToolCallOutput', 'BingCustomSearchConfiguration', 'BingCustomSearchPreviewTool', 'BingCustomSearchToolCall', 'BingCustomSearchToolCallOutput', 'BingCustomSearchToolParameters', 'BingGroundingSearchConfiguration', 'BingGroundingSearchToolParameters', 'BingGroundingTool', 'BingGroundingToolCall', 'BingGroundingToolCallOutput', 'BrowserAutomationPreviewTool', 'BrowserAutomationToolCall', 'BrowserAutomationToolCallOutput', 'BrowserAutomationToolConnectionParameters', 'BrowserAutomationToolParameters', 'CallableToolAllowedCaller', 'CaptureStructuredOutputsTool', 'ChatSummaryMemoryItem', 'ClickButtonType', 'ClickParam', 'CodeInterpreterOutputImage', 'CodeInterpreterOutputLogs', 'CodeInterpreterTool', 'CompactResource', 'CompactResponseMethodPublicBody', 'CompactionSummaryItemParam', 'ComparisonFilter', 'CompoundFilter', 'ComputerAction', 'ComputerActionType', 'ComputerCallOutputItemParam', 'ComputerCallSafetyCheckParam', 'ComputerEnvironment', 'ComputerScreenshotContent', 'ComputerScreenshotImage', 'ComputerTool', 'ComputerUsePreviewTool', 'ContainerAutoParam', 'ContainerFileCitationBody', 'ContainerMemoryLimit', 'ContainerNetworkPolicyAllowlistParam', 'ContainerNetworkPolicyDisabledParam', 'ContainerNetworkPolicyDomainSecretParam', 'ContainerNetworkPolicyParam', 'ContainerNetworkPolicyParamType', 'ContainerReferenceResource', 'ContainerSkill', 'ContainerSkillType', 'ContextManagementParam', 'ConversationParam_2', 'ConversationReference', 'CoordParam', 'CreateResponse', 'CustomGrammarFormatParam', 'CustomTextFormatParam', 'CustomToolCallOutputResource', 'CustomToolCallResource', 'CustomToolParam', 'CustomToolParamFormat', 'CustomToolParamFormatType', 'DeleteResponseResult', 'DetailEnum', 'DirectToolCallCaller', 'DirectToolCallCallerParam', 'DoubleClickAction', 'DragParam', 'EmptyModelParam', 'Error', 'FabricDataAgentToolCall', 'FabricDataAgentToolCallOutput', 'FabricDataAgentToolParameters', 'FileCitationBody', 'FileInputDetail', 'FilePath', 'FileSearchTool', 'FileSearchToolCallResults', 'FunctionAndCustomToolCallOutput', 'FunctionAndCustomToolCallOutputInputFileContent', 'FunctionAndCustomToolCallOutputInputImageContent', 'FunctionAndCustomToolCallOutputInputTextContent', 'FunctionAndCustomToolCallOutputType', 'FunctionCallItemStatus', 'FunctionCallOutputItemParam', 'FunctionCallOutputStatusEnum', 'FunctionCallStatus', 'FunctionShellAction', 'FunctionShellActionParam', 'FunctionShellCallEnvironment', 'FunctionShellCallEnvironmentType', 'FunctionShellCallItemParam', 'FunctionShellCallItemParamEnvironment', 'FunctionShellCallItemParamEnvironmentContainerReferenceParam', 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam', 'FunctionShellCallItemParamEnvironmentType', 'FunctionShellCallItemStatus', 'FunctionShellCallOutputContent', 'FunctionShellCallOutputContentParam', 'FunctionShellCallOutputExitOutcome', 'FunctionShellCallOutputExitOutcomeParam', 'FunctionShellCallOutputItemParam', 'FunctionShellCallOutputOutcome', 'FunctionShellCallOutputOutcomeParam', 'FunctionShellCallOutputOutcomeParamType', 'FunctionShellCallOutputOutcomeType', 'FunctionShellCallOutputStatusEnum', 'FunctionShellCallOutputTimeoutOutcome', 'FunctionShellCallOutputTimeoutOutcomeParam', 'FunctionShellCallStatus', 'FunctionShellToolParam', 'FunctionShellToolParamEnvironment', 'FunctionShellToolParamEnvironmentContainerReferenceParam', 'FunctionShellToolParamEnvironmentLocalEnvironmentParam', 'FunctionShellToolParamEnvironmentType', 'FunctionTool', 'FunctionToolParam', 'GrammarSyntax1', 'HybridSearchOptions', 'ImageDetail', 'ImageGenActionEnum', 'ImageGenTool', 'ImageGenToolInputImageMask', 'IncludeEnum', 'InlineSkillParam', 'InlineSkillSourceParam', 'InputFidelity', 'InputFileContent', 'InputFileContentParam', 'InputImageContent', 'InputImageContentParamAutoParam', 'InputTextContent', 'InputTextContentParam', 'Item', 'ItemCodeInterpreterToolCall', 'ItemComputerToolCall', 'ItemCustomToolCall', 'ItemCustomToolCallOutput', 'ItemField', 'ItemFieldAdditionalTools', 'ItemFieldApplyPatchToolCall', 'ItemFieldApplyPatchToolCallOutput', 'ItemFieldCodeInterpreterToolCall', 'ItemFieldCompactionBody', 'ItemFieldComputerToolCall', 'ItemFieldComputerToolCallOutput', 'ItemFieldCustomToolCall', 'ItemFieldCustomToolCallOutput', 'ItemFieldFileSearchToolCall', 'ItemFieldFunctionShellCall', 'ItemFieldFunctionShellCallOutput', 'ItemFieldFunctionToolCall', 'ItemFieldFunctionToolCallOutput', 'ItemFieldImageGenToolCall', 'ItemFieldLocalShellToolCall', 'ItemFieldLocalShellToolCallOutput', 'ItemFieldMcpApprovalRequest', 'ItemFieldMcpApprovalResponseResource', 'ItemFieldMcpListTools', 'ItemFieldMcpToolCall', 'ItemFieldMessage', 'ItemFieldProgram', 'ItemFieldProgramOutput', 'ItemFieldReasoningItem', 'ItemFieldToolSearchCall', 'ItemFieldToolSearchOutput', 'ItemFieldType', 'ItemFieldWebSearchToolCall', 'ItemFileSearchToolCall', 'ItemFunctionToolCall', 'ItemImageGenToolCall', 'ItemLocalShellToolCall', 'ItemLocalShellToolCallOutput', 'ItemMcpApprovalRequest', 'ItemMcpListTools', 'ItemMcpToolCall', 'ItemMessage', 'ItemProgram', 'ItemProgramOutput', 'ItemReasoningItem', 'ItemReferenceParam', 'ItemType', 'ItemWebSearchToolCall', 'KeyPressAction', 'LocalEnvironmentResource', 'LocalShellExecAction', 'LocalShellToolParam', 'LocalSkillParam', 'LogProb', 'MCPApprovalResponse', 'MCPListToolsTool', 'MCPListToolsToolAnnotations', 'MCPListToolsToolInputSchema', 'MCPTool', 'MCPToolCallStatus', 'MCPToolFilter', 'MCPToolRequireApproval', 'MemoryItem', 'MemoryItemKind', 'MemorySearchItem', 'MemorySearchOptions', 'MemorySearchPreviewTool', 'MemorySearchToolCallItemParam', 'MemorySearchToolCallItemResource', 'MessageContent', 'MessageContentInputFileContent', 'MessageContentInputImageContent', 'MessageContentInputTextContent', 'MessageContentOutputTextContent', 'MessageContentReasoningTextContent', 'MessageContentRefusalContent', 'MessageContentType', 'MessagePhase', 'MessageRole', 'MessageStatus', 'Metadata', 'MicrosoftFabricPreviewTool', 'ModelIdsCompaction', 'Moderation', 'ModerationConfigParam', 'ModerationEntry', 'ModerationEntryType', 'ModerationErrorBody', 'ModerationInputType', 'ModerationMode', 'ModerationParam', 'ModerationPolicyParam', 'ModerationResultBody', 'MoveParam', 'NamespaceToolParam', 'OAuthConsentRequestOutputItem', 'OpenApiAnonymousAuthDetails', 'OpenApiAuthDetails', 'OpenApiAuthType', 'OpenApiFunctionDefinition', 'OpenApiFunctionDefinitionFunction', 'OpenApiManagedAuthDetails', 'OpenApiManagedSecurityScheme', 'OpenApiProjectConnectionAuthDetails', 'OpenApiProjectConnectionSecurityScheme', 'OpenApiTool', 'OpenApiToolCall', 'OpenApiToolCallOutput', 'OutputContent', 'OutputContentOutputTextContent', 'OutputContentReasoningTextContent', 'OutputContentRefusalContent', 'OutputContentType', 'OutputItem', 'OutputItemAdditionalTools', 'OutputItemApplyPatchToolCall', 'OutputItemApplyPatchToolCallOutput', 'OutputItemCodeInterpreterToolCall', 'OutputItemCompactionBody', 'OutputItemComputerToolCall', 'OutputItemComputerToolCallOutput', 'OutputItemFileSearchToolCall', 'OutputItemFunctionShellCall', 'OutputItemFunctionShellCallOutput', 'OutputItemFunctionToolCall', 'OutputItemFunctionToolCallOutput', 'OutputItemImageGenToolCall', 'OutputItemLocalShellToolCall', 'OutputItemLocalShellToolCallOutput', 'OutputItemMcpApprovalRequest', 'OutputItemMcpApprovalResponseResource', 'OutputItemMcpListTools', 'OutputItemMcpToolCall', 'OutputItemMessage', 'OutputItemProgram', 'OutputItemProgramOutput', 'OutputItemReasoningItem', 'OutputItemToolSearchCall', 'OutputItemToolSearchOutput', 'OutputItemType', 'OutputItemWebSearchToolCall', 'OutputMessageContentType', 'PageOrder', 'ProgramOutputStatus', 'ProgramToolCallCaller', 'ProgramToolCallCallerParam', 'ProgrammaticToolCallingParam', 'Prompt', 'PromptCacheBreakpointConfig', 'PromptCacheBreakpointParam', 'PromptCacheModeEnum', 'PromptCacheOptions', 'PromptCacheOptionsParam', 'PromptCacheRetentionEnum', 'PromptCacheTTLEnum', 'RankerVersionType', 'RankingOptions', 'RealtimeMCPError', 'RealtimeMCPHTTPError', 'RealtimeMCPProtocolError', 'RealtimeMCPToolExecutionError', 'RealtimeMcpErrorType', 'Reasoning', 'ReasoningEffort', 'ReasoningModeEnum', 'ReasoningTextContent', 'ResponseAudioDeltaEvent', 'ResponseAudioDoneEvent', 'ResponseAudioTranscriptDeltaEvent', 'ResponseAudioTranscriptDoneEvent', 'ResponseCodeInterpreterCallCodeDeltaEvent', 'ResponseCodeInterpreterCallCodeDoneEvent', 'ResponseCodeInterpreterCallCompletedEvent', 'ResponseCodeInterpreterCallInProgressEvent', 'ResponseCodeInterpreterCallInterpretingEvent', 'ResponseCompletedEvent', 'ResponseContentPartAddedEvent', 'ResponseContentPartDoneEvent', 'ResponseCreatedEvent', 'ResponseCustomToolCallInputDeltaEvent', 'ResponseCustomToolCallInputDoneEvent', 'ResponseErrorCode', 'ResponseErrorEvent', 'ResponseErrorInfo', 'ResponseFailedEvent', 'ResponseFileSearchCallCompletedEvent', 'ResponseFileSearchCallInProgressEvent', 'ResponseFileSearchCallSearchingEvent', 'ResponseFormatJsonSchemaSchema', 'ResponseFunctionCallArgumentsDeltaEvent', 'ResponseFunctionCallArgumentsDoneEvent', 'ResponseImageGenCallCompletedEvent', 'ResponseImageGenCallGeneratingEvent', 'ResponseImageGenCallInProgressEvent', 'ResponseImageGenCallPartialImageEvent', 'ResponseInProgressEvent', 'ResponseIncompleteDetails', 'ResponseIncompleteEvent', 'ResponseLogProb', 'ResponseLogProbTopLogprobs', 'ResponseMCPCallArgumentsDeltaEvent', 'ResponseMCPCallArgumentsDoneEvent', 'ResponseMCPCallCompletedEvent', 'ResponseMCPCallFailedEvent', 'ResponseMCPCallInProgressEvent', 'ResponseMCPListToolsCompletedEvent', 'ResponseMCPListToolsFailedEvent', 'ResponseMCPListToolsInProgressEvent', 'ResponseObject', 'ResponseOutputItemAddedEvent', 'ResponseOutputItemDoneEvent', 'ResponseOutputTextAnnotationAddedEvent', 'ResponsePromptVariables', 'ResponseQueuedEvent', 'ResponseReasoningSummaryPartAddedEvent', 'ResponseReasoningSummaryPartAddedEventPart', 'ResponseReasoningSummaryPartDoneEvent', 'ResponseReasoningSummaryPartDoneEventPart', 'ResponseReasoningSummaryTextDeltaEvent', 'ResponseReasoningSummaryTextDoneEvent', 'ResponseReasoningTextDeltaEvent', 'ResponseReasoningTextDoneEvent', 'ResponseRefusalDeltaEvent', 'ResponseRefusalDoneEvent', 'ResponseStreamEvent', 'ResponseStreamEventType', 'ResponseStreamOptions', 'ResponseTextDeltaEvent', 'ResponseTextDoneEvent', 'ResponseTextParam', 'ResponseUsage', 'ResponseUsageInputTokensDetails', 'ResponseUsageOutputTokensDetails', 'ResponseWebSearchCallCompletedEvent', 'ResponseWebSearchCallInProgressEvent', 'ResponseWebSearchCallSearchingEvent', 'ScreenshotParam', 'ScrollParam', 'SearchContentType', 'SearchContextSize', 'ServiceTierEnum', 'SharepointGroundingToolCall', 'SharepointGroundingToolCallOutput', 'SharepointGroundingToolParameters', 'SharepointPreviewTool', 'SkillReferenceParam', 'SpecificApplyPatchParam', 'SpecificFunctionShellParam', 'SpecificProgrammaticToolCallingParam', 'StructuredOutputDefinition', 'StructuredOutputsOutputItem', 'SummaryTextContent', 'TextContent', 'TextResponseFormatConfiguration', 'TextResponseFormatConfigurationResponseFormatJsonObject', 'TextResponseFormatConfigurationResponseFormatText', 'TextResponseFormatConfigurationType', 'TextResponseFormatJsonSchema', 'Tool', 'ToolCallCaller', 'ToolCallCallerParam', 'ToolCallCallerParamType', 'ToolCallCallerType', 'ToolCallStatus', 'ToolChoiceAllowed', 'ToolChoiceCodeInterpreter', 'ToolChoiceComputer', 'ToolChoiceComputerUse', 'ToolChoiceComputerUsePreview', 'ToolChoiceCustom', 'ToolChoiceFileSearch', 'ToolChoiceFunction', 'ToolChoiceImageGeneration', 'ToolChoiceMCP', 'ToolChoiceOptions', 'ToolChoiceParam', 'ToolChoiceParamType', 'ToolChoiceWebSearchPreview', 'ToolChoiceWebSearchPreview20250311', 'ToolProjectConnection', 'ToolSearchCallItemParam', 'ToolSearchExecutionType', 'ToolSearchOutputItemParam', 'ToolSearchToolParam', 'ToolType', 'TopLogProb', 'TypeParam', 'UrlCitationBody', 'UserProfileMemoryItem', 'VectorStoreFileAttributes', 'WaitParam', 'WebSearchActionFind', 'WebSearchActionOpenPage', 'WebSearchActionSearch', 'WebSearchActionSearchSources', 'WebSearchApproximateLocation', 'WebSearchConfiguration', 'WebSearchPreviewTool', 'WebSearchTool', 'WebSearchToolFilters', 'WorkIQPreviewTool', 'WorkIQPreviewToolParameters', 'WorkflowActionOutputItem', 'ConversationParam', 'CreateResponseStreamingResponse', 'Filters', 'InputParam', 'ToolCallOutputContent'] diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_unions.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_unions.py index d64fad734dab..b32be0fbddcb 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_unions.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/_unions.py @@ -1,71 +1,119 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING, Union +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# Generated by _scripts/lazy_model_emitter.py; do not edit by hand. +from typing import TYPE_CHECKING +# BEGIN CANONICAL EMITTER CONTRACT if TYPE_CHECKING: - from . import types as _types -Filters = Union["_types.ComparisonFilter", "_types.CompoundFilter"] -ToolCallOutputContent = Union[dict[str, Any], str, list[Any]] -InputParam = Union[str, list["_types.Item"]] -ConversationParam = Union[str, "_types.ConversationParam_2"] -CreateResponseStreamingResponse = Union[ - "_types.ResponseAudioDeltaEvent", - "_types.ResponseAudioTranscriptDeltaEvent", - "_types.ResponseCodeInterpreterCallCodeDeltaEvent", - "_types.ResponseCodeInterpreterCallInProgressEvent", - "_types.ResponseCodeInterpreterCallInterpretingEvent", - "_types.ResponseContentPartAddedEvent", - "_types.ResponseCreatedEvent", - "_types.ResponseErrorEvent", - "_types.ResponseFileSearchCallInProgressEvent", - "_types.ResponseFileSearchCallSearchingEvent", - "_types.ResponseFunctionCallArgumentsDeltaEvent", - "_types.ResponseInProgressEvent", - "_types.ResponseFailedEvent", - "_types.ResponseIncompleteEvent", - "_types.ResponseOutputItemAddedEvent", - "_types.ResponseReasoningSummaryPartAddedEvent", - "_types.ResponseReasoningSummaryTextDeltaEvent", - "_types.ResponseReasoningTextDeltaEvent", - "_types.ResponseRefusalDeltaEvent", - "_types.ResponseTextDeltaEvent", - "_types.ResponseWebSearchCallInProgressEvent", - "_types.ResponseWebSearchCallSearchingEvent", - "_types.ResponseImageGenCallGeneratingEvent", - "_types.ResponseImageGenCallInProgressEvent", - "_types.ResponseImageGenCallPartialImageEvent", - "_types.ResponseMCPCallArgumentsDeltaEvent", - "_types.ResponseMCPCallFailedEvent", - "_types.ResponseMCPCallInProgressEvent", - "_types.ResponseMCPListToolsFailedEvent", - "_types.ResponseMCPListToolsInProgressEvent", - "_types.ResponseOutputTextAnnotationAddedEvent", - "_types.ResponseQueuedEvent", - "_types.ResponseCustomToolCallInputDeltaEvent", - "_types.ResponseAudioDoneEvent", - "_types.ResponseAudioTranscriptDoneEvent", - "_types.ResponseCodeInterpreterCallCodeDoneEvent", - "_types.ResponseCodeInterpreterCallCompletedEvent", - "_types.ResponseCompletedEvent", - "_types.ResponseContentPartDoneEvent", - "_types.ResponseFileSearchCallCompletedEvent", - "_types.ResponseFunctionCallArgumentsDoneEvent", - "_types.ResponseOutputItemDoneEvent", - "_types.ResponseReasoningSummaryPartDoneEvent", - "_types.ResponseReasoningSummaryTextDoneEvent", - "_types.ResponseReasoningTextDoneEvent", - "_types.ResponseRefusalDoneEvent", - "_types.ResponseTextDoneEvent", - "_types.ResponseWebSearchCallCompletedEvent", - "_types.ResponseImageGenCallCompletedEvent", - "_types.ResponseMCPCallArgumentsDoneEvent", - "_types.ResponseMCPCallCompletedEvent", - "_types.ResponseMCPListToolsCompletedEvent", - "_types.ResponseCustomToolCallInputDoneEvent", -] + # coding=utf-8 + # -------------------------------------------------------------------------- + # Copyright (c) Microsoft Corporation. All rights reserved. + # Licensed under the MIT License. See License.txt in the project root for license information. + # Code generated by Microsoft (R) Python Code Generator. + # Changes may cause incorrect behavior and will be lost if the code is regenerated. + # -------------------------------------------------------------------------- + + from typing import Any, TYPE_CHECKING, Union + + if TYPE_CHECKING: + from . import types as _types + Filters = Union["_types.ComparisonFilter", "_types.CompoundFilter"] + ToolCallOutputContent = Union[dict[str, Any], str, list[Any]] + InputParam = Union[str, list["_types.Item"]] + ConversationParam = Union[str, "_types.ConversationParam_2"] + CreateResponseStreamingResponse = Union[ + "_types.ResponseAudioDeltaEvent", + "_types.ResponseAudioTranscriptDeltaEvent", + "_types.ResponseCodeInterpreterCallCodeDeltaEvent", + "_types.ResponseCodeInterpreterCallInProgressEvent", + "_types.ResponseCodeInterpreterCallInterpretingEvent", + "_types.ResponseContentPartAddedEvent", + "_types.ResponseCreatedEvent", + "_types.ResponseErrorEvent", + "_types.ResponseFileSearchCallInProgressEvent", + "_types.ResponseFileSearchCallSearchingEvent", + "_types.ResponseFunctionCallArgumentsDeltaEvent", + "_types.ResponseInProgressEvent", + "_types.ResponseFailedEvent", + "_types.ResponseIncompleteEvent", + "_types.ResponseOutputItemAddedEvent", + "_types.ResponseReasoningSummaryPartAddedEvent", + "_types.ResponseReasoningSummaryTextDeltaEvent", + "_types.ResponseReasoningTextDeltaEvent", + "_types.ResponseRefusalDeltaEvent", + "_types.ResponseTextDeltaEvent", + "_types.ResponseWebSearchCallInProgressEvent", + "_types.ResponseWebSearchCallSearchingEvent", + "_types.ResponseImageGenCallGeneratingEvent", + "_types.ResponseImageGenCallInProgressEvent", + "_types.ResponseImageGenCallPartialImageEvent", + "_types.ResponseMCPCallArgumentsDeltaEvent", + "_types.ResponseMCPCallFailedEvent", + "_types.ResponseMCPCallInProgressEvent", + "_types.ResponseMCPListToolsFailedEvent", + "_types.ResponseMCPListToolsInProgressEvent", + "_types.ResponseOutputTextAnnotationAddedEvent", + "_types.ResponseQueuedEvent", + "_types.ResponseCustomToolCallInputDeltaEvent", + "_types.ResponseAudioDoneEvent", + "_types.ResponseAudioTranscriptDoneEvent", + "_types.ResponseCodeInterpreterCallCodeDoneEvent", + "_types.ResponseCodeInterpreterCallCompletedEvent", + "_types.ResponseCompletedEvent", + "_types.ResponseContentPartDoneEvent", + "_types.ResponseFileSearchCallCompletedEvent", + "_types.ResponseFunctionCallArgumentsDoneEvent", + "_types.ResponseOutputItemDoneEvent", + "_types.ResponseReasoningSummaryPartDoneEvent", + "_types.ResponseReasoningSummaryTextDoneEvent", + "_types.ResponseReasoningTextDoneEvent", + "_types.ResponseRefusalDoneEvent", + "_types.ResponseTextDoneEvent", + "_types.ResponseWebSearchCallCompletedEvent", + "_types.ResponseImageGenCallCompletedEvent", + "_types.ResponseMCPCallArgumentsDoneEvent", + "_types.ResponseMCPCallCompletedEvent", + "_types.ResponseMCPListToolsCompletedEvent", + "_types.ResponseCustomToolCallInputDoneEvent", + ] +# END CANONICAL EMITTER CONTRACT +else: + from typing import Any, TYPE_CHECKING, Union + from importlib import import_module as _import_module + from sys import version_info as _version_info + from .._lazy_models import load_model as _load_model + _types = _import_module('.types', __package__) + _unions = _import_module('._unions', __package__) + + def _make_Filters(): + return Union['_types.ComparisonFilter', '_types.CompoundFilter'] + + def _make_ToolCallOutputContent(): + return Union[dict[str, Any], str, list[Any]] + + def _make_InputParam(): + return Union[str, list['_types.Item']] + + def _make_ConversationParam(): + return Union[str, '_types.ConversationParam_2'] + + def _make_CreateResponseStreamingResponse(): + return Union['_types.ResponseAudioDeltaEvent', '_types.ResponseAudioTranscriptDeltaEvent', '_types.ResponseCodeInterpreterCallCodeDeltaEvent', '_types.ResponseCodeInterpreterCallInProgressEvent', '_types.ResponseCodeInterpreterCallInterpretingEvent', '_types.ResponseContentPartAddedEvent', '_types.ResponseCreatedEvent', '_types.ResponseErrorEvent', '_types.ResponseFileSearchCallInProgressEvent', '_types.ResponseFileSearchCallSearchingEvent', '_types.ResponseFunctionCallArgumentsDeltaEvent', '_types.ResponseInProgressEvent', '_types.ResponseFailedEvent', '_types.ResponseIncompleteEvent', '_types.ResponseOutputItemAddedEvent', '_types.ResponseReasoningSummaryPartAddedEvent', '_types.ResponseReasoningSummaryTextDeltaEvent', '_types.ResponseReasoningTextDeltaEvent', '_types.ResponseRefusalDeltaEvent', '_types.ResponseTextDeltaEvent', '_types.ResponseWebSearchCallInProgressEvent', '_types.ResponseWebSearchCallSearchingEvent', '_types.ResponseImageGenCallGeneratingEvent', '_types.ResponseImageGenCallInProgressEvent', '_types.ResponseImageGenCallPartialImageEvent', '_types.ResponseMCPCallArgumentsDeltaEvent', '_types.ResponseMCPCallFailedEvent', '_types.ResponseMCPCallInProgressEvent', '_types.ResponseMCPListToolsFailedEvent', '_types.ResponseMCPListToolsInProgressEvent', '_types.ResponseOutputTextAnnotationAddedEvent', '_types.ResponseQueuedEvent', '_types.ResponseCustomToolCallInputDeltaEvent', '_types.ResponseAudioDoneEvent', '_types.ResponseAudioTranscriptDoneEvent', '_types.ResponseCodeInterpreterCallCodeDoneEvent', '_types.ResponseCodeInterpreterCallCompletedEvent', '_types.ResponseCompletedEvent', '_types.ResponseContentPartDoneEvent', '_types.ResponseFileSearchCallCompletedEvent', '_types.ResponseFunctionCallArgumentsDoneEvent', '_types.ResponseOutputItemDoneEvent', '_types.ResponseReasoningSummaryPartDoneEvent', '_types.ResponseReasoningSummaryTextDoneEvent', '_types.ResponseReasoningTextDoneEvent', '_types.ResponseRefusalDoneEvent', '_types.ResponseTextDoneEvent', '_types.ResponseWebSearchCallCompletedEvent', '_types.ResponseImageGenCallCompletedEvent', '_types.ResponseMCPCallArgumentsDoneEvent', '_types.ResponseMCPCallCompletedEvent', '_types.ResponseMCPListToolsCompletedEvent', '_types.ResponseCustomToolCallInputDoneEvent'] + + _FACTORIES = { + 'Filters': _make_Filters, + 'ToolCallOutputContent': _make_ToolCallOutputContent, + 'InputParam': _make_InputParam, + 'ConversationParam': _make_ConversationParam, + 'CreateResponseStreamingResponse': _make_CreateResponseStreamingResponse, + } + __all__ = ['Any', 'TYPE_CHECKING', 'Union', 'Filters', 'ToolCallOutputContent', 'InputParam', 'ConversationParam', 'CreateResponseStreamingResponse'] + + def _resolve(name): + return _load_model(name, globals(), _FACTORIES, __name__) + + def __getattr__(name): + return _resolve(name) + + def __dir__(): + return sorted(set(globals()) | set(__all__)) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/types.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/types.py index 3fd1e35b49e5..fe6f60c3fbb0 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/types.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_generated/types.py @@ -1,11192 +1,22944 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Literal, Optional, TYPE_CHECKING, Union -from typing_extensions import Required, TypedDict +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# Generated by _scripts/lazy_model_emitter.py; do not edit by hand. +from typing import TYPE_CHECKING +# BEGIN CANONICAL EMITTER CONTRACT if TYPE_CHECKING: - from . import _unions + # pylint: disable=too-many-lines + # coding=utf-8 + # -------------------------------------------------------------------------- + # Copyright (c) Microsoft Corporation. All rights reserved. + # Licensed under the MIT License. See License.txt in the project root for license information. + # Code generated by Microsoft (R) Python Code Generator. + # Changes may cause incorrect behavior and will be lost if the code is regenerated. + # -------------------------------------------------------------------------- -AnnotationType = Literal["file_citation", "url_citation", "container_file_citation", "file_path"] -"""Type of AnnotationType.""" + from typing import Any, Literal, Optional, TYPE_CHECKING, Union + from typing_extensions import Required, TypedDict -ApplyPatchCallOutputStatus = Literal["completed", "failed"] -"""Type of ApplyPatchCallOutputStatus.""" + if TYPE_CHECKING: + from . import _unions -ApplyPatchCallOutputStatusParam = Literal["completed", "failed"] -"""Apply patch call output status.""" + AnnotationType = Literal["file_citation", "url_citation", "container_file_citation", "file_path"] + """Type of AnnotationType.""" -ApplyPatchCallStatus = Literal["in_progress", "completed"] -"""Type of ApplyPatchCallStatus.""" + ApplyPatchCallOutputStatus = Literal["completed", "failed"] + """Type of ApplyPatchCallOutputStatus.""" -ApplyPatchCallStatusParam = Literal["in_progress", "completed"] -"""Apply patch call status.""" + ApplyPatchCallOutputStatusParam = Literal["completed", "failed"] + """Apply patch call output status.""" -ApplyPatchFileOperationType = Literal["create_file", "delete_file", "update_file"] -"""Type of ApplyPatchFileOperationType.""" + ApplyPatchCallStatus = Literal["in_progress", "completed"] + """Type of ApplyPatchCallStatus.""" -ApplyPatchOperationParamType = Literal["create_file", "delete_file", "update_file"] -"""Type of ApplyPatchOperationParamType.""" + ApplyPatchCallStatusParam = Literal["in_progress", "completed"] + """Apply patch call status.""" -AzureAISearchQueryType = Literal["simple", "semantic", "vector", "vector_simple_hybrid", "vector_semantic_hybrid"] -"""Available query types for Azure AI Search tool.""" + ApplyPatchFileOperationType = Literal["create_file", "delete_file", "update_file"] + """Type of ApplyPatchFileOperationType.""" -CallableToolAllowedCaller = Literal["direct", "programmatic"] -"""Type of CallableToolAllowedCaller.""" + ApplyPatchOperationParamType = Literal["create_file", "delete_file", "update_file"] + """Type of ApplyPatchOperationParamType.""" -ClickButtonType = Literal["left", "right", "wheel", "back", "forward"] -"""Type of ClickButtonType.""" + AzureAISearchQueryType = Literal["simple", "semantic", "vector", "vector_simple_hybrid", "vector_semantic_hybrid"] + """Available query types for Azure AI Search tool.""" -ComputerActionType = Literal[ - "click", "double_click", "drag", "keypress", "move", "screenshot", "scroll", "type", "wait" -] -"""Type of ComputerActionType.""" + CallableToolAllowedCaller = Literal["direct", "programmatic"] + """Type of CallableToolAllowedCaller.""" -ComputerEnvironment = Literal["windows", "mac", "linux", "ubuntu", "browser"] -"""Type of ComputerEnvironment.""" + ClickButtonType = Literal["left", "right", "wheel", "back", "forward"] + """Type of ClickButtonType.""" -ContainerMemoryLimit = Literal["1g", "4g", "16g", "64g"] -"""Type of ContainerMemoryLimit.""" + ComputerActionType = Literal[ + "click", "double_click", "drag", "keypress", "move", "screenshot", "scroll", "type", "wait" + ] + """Type of ComputerActionType.""" -ContainerNetworkPolicyParamType = Literal["disabled", "allowlist"] -"""Type of ContainerNetworkPolicyParamType.""" + ComputerEnvironment = Literal["windows", "mac", "linux", "ubuntu", "browser"] + """Type of ComputerEnvironment.""" -ContainerSkillType = Literal["skill_reference", "inline"] -"""Type of ContainerSkillType.""" + ContainerMemoryLimit = Literal["1g", "4g", "16g", "64g"] + """Type of ContainerMemoryLimit.""" -CustomToolParamFormatType = Literal["text", "grammar"] -"""Type of CustomToolParamFormatType.""" - -DetailEnum = Literal["low", "high", "auto", "original"] -"""Type of DetailEnum.""" - -FileInputDetail = Literal["auto", "low", "high"] -"""Type of FileInputDetail.""" - -FunctionAndCustomToolCallOutputType = Literal["input_text", "input_image", "input_file"] -"""Type of FunctionAndCustomToolCallOutputType.""" - -FunctionCallItemStatus = Literal["in_progress", "completed", "incomplete"] -"""Type of FunctionCallItemStatus.""" - -FunctionCallOutputStatusEnum = Literal["in_progress", "completed", "incomplete"] -"""Type of FunctionCallOutputStatusEnum.""" - -FunctionCallStatus = Literal["in_progress", "completed", "incomplete"] -"""Type of FunctionCallStatus.""" - -FunctionShellCallEnvironmentType = Literal["local", "container_reference"] -"""Type of FunctionShellCallEnvironmentType.""" - -FunctionShellCallItemParamEnvironmentType = Literal["local", "container_reference"] -"""Type of FunctionShellCallItemParamEnvironmentType.""" - -FunctionShellCallItemStatus = Literal["in_progress", "completed", "incomplete"] -"""Shell call status.""" - -FunctionShellCallOutputOutcomeParamType = Literal["timeout", "exit"] -"""Type of FunctionShellCallOutputOutcomeParamType.""" - -FunctionShellCallOutputOutcomeType = Literal["timeout", "exit"] -"""Type of FunctionShellCallOutputOutcomeType.""" - -FunctionShellCallOutputStatusEnum = Literal["in_progress", "completed", "incomplete"] -"""Type of FunctionShellCallOutputStatusEnum.""" - -FunctionShellCallStatus = Literal["in_progress", "completed", "incomplete"] -"""Type of FunctionShellCallStatus.""" - -FunctionShellToolParamEnvironmentType = Literal["container_auto", "local", "container_reference"] -"""Type of FunctionShellToolParamEnvironmentType.""" - -GrammarSyntax1 = Literal["lark", "regex"] -"""Type of GrammarSyntax1.""" - -ImageDetail = Literal["low", "high", "auto", "original"] -"""Type of ImageDetail.""" - -ImageGenActionEnum = Literal["generate", "edit", "auto"] -"""Type of ImageGenActionEnum.""" - -IncludeEnum = Literal[ - "file_search_call.results", - "web_search_call.results", - "web_search_call.action.sources", - "message.input_image.image_url", - "computer_call_output.output.image_url", - "code_interpreter_call.outputs", - "reasoning.encrypted_content", - "message.output_text.logprobs", - "memory_search_call.results", -] -"""Specify additional output data to include in the model response. Currently supported values -are: - -* `web_search_call.results`: Include the search results of the web search tool call. -* `web_search_call.action.sources`: Include the sources of the web search tool call. -* `code_interpreter_call.outputs`: Includes the outputs of python code execution in code -interpreter tool call items. -* `computer_call_output.output.image_url`: Include image urls from the computer call output. -* `file_search_call.results`: Include the search results of the file search tool call. -* `message.input_image.image_url`: Include image urls from the input message. -* `message.output_text.logprobs`: Include logprobs with assistant messages. -* `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning -item outputs. This enables reasoning items to be used in multi-turn conversations when using -the Responses API statelessly (like when the `store` parameter is set to `false`, or when an -organization is enrolled in the zero data retention program).""" - -InputFidelity = Literal["high", "low"] -"""Control how much effort the model will exert to match the style and features, especially facial -features, of input images. This parameter is only supported for ``gpt-image-1`` and -``gpt-image-1.5`` and later models, unsupported for ``gpt-image-1-mini``. Supports ``high`` and -``low``. Defaults to ``low``.""" - -ItemFieldType = Literal[ - "message", - "program", - "program_output", - "function_call", - "tool_search_call", - "tool_search_output", - "additional_tools", - "function_call_output", - "file_search_call", - "web_search_call", - "image_generation_call", - "computer_call", - "computer_call_output", - "reasoning", - "compaction", - "code_interpreter_call", - "local_shell_call", - "local_shell_call_output", - "shell_call", - "shell_call_output", - "apply_patch_call", - "apply_patch_call_output", - "mcp_list_tools", - "mcp_approval_request", - "mcp_approval_response", - "mcp_call", - "custom_tool_call", - "custom_tool_call_output", -] -"""Type of ItemFieldType.""" - -ItemType = Literal[ - "message", - "output_message", - "file_search_call", - "computer_call", - "computer_call_output", - "web_search_call", - "function_call", - "function_call_output", - "tool_search_call", - "tool_search_output", - "additional_tools", - "reasoning", - "compaction", - "image_generation_call", - "code_interpreter_call", - "local_shell_call", - "local_shell_call_output", - "shell_call", - "shell_call_output", - "apply_patch_call", - "apply_patch_call_output", - "mcp_list_tools", - "mcp_approval_request", - "mcp_approval_response", - "mcp_call", - "custom_tool_call_output", - "custom_tool_call", - "item_reference", - "structured_outputs", - "oauth_consent_request", - "memory_search_call", - "workflow_action", - "a2a_preview_call", - "a2a_preview_call_output", - "bing_grounding_call", - "bing_grounding_call_output", - "sharepoint_grounding_preview_call", - "sharepoint_grounding_preview_call_output", - "azure_ai_search_call", - "azure_ai_search_call_output", - "bing_custom_search_preview_call", - "bing_custom_search_preview_call_output", - "openapi_call", - "openapi_call_output", - "browser_automation_preview_call", - "browser_automation_preview_call_output", - "fabric_dataagent_preview_call", - "fabric_dataagent_preview_call_output", - "azure_function_call", - "azure_function_call_output", -] -"""Type of ItemType.""" - -MCPToolCallStatus = Literal["in_progress", "completed", "incomplete", "calling", "failed"] -"""Type of MCPToolCallStatus.""" - -MemoryItemKind = Literal["user_profile", "chat_summary"] -"""Memory item kind.""" - -MessageContentType = Literal[ - "input_text", - "output_text", - "text", - "summary_text", - "reasoning_text", - "refusal", - "input_image", - "computer_screenshot", - "input_file", -] -"""Type of MessageContentType.""" - -MessagePhase = Literal["commentary", "final_answer"] -"""Labels an ``assistant`` message as intermediate commentary (``commentary``) or the final answer -(``final_answer``). For models like ``gpt-5.3-codex`` and beyond, when sending follow-up -requests, preserve and resend phase on all assistant messages — dropping it can degrade -performance. Not used for user messages.""" - -MessageRole = Literal["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"] -"""Type of MessageRole.""" - -MessageStatus = Literal["in_progress", "completed", "incomplete"] -"""Type of MessageStatus.""" - -ModelIdsCompaction = Literal[ - "gpt-5.6-sol", - "gpt-5.6-terra", - "gpt-5.6-luna", - "gpt-5.5", - "gpt-5.5-2026-04-23", - "gpt-5.4", - "gpt-5.4-mini", - "gpt-5.4-nano", - "gpt-5.4-mini-2026-03-17", - "gpt-5.4-nano-2026-03-17", - "gpt-5.3-chat-latest", - "gpt-5.2", - "gpt-5.2-2025-12-11", - "gpt-5.2-chat-latest", - "gpt-5.2-pro", - "gpt-5.2-pro-2025-12-11", - "gpt-5.1", - "gpt-5.1-2025-11-13", - "gpt-5.1-codex", - "gpt-5.1-mini", - "gpt-5.1-chat-latest", - "gpt-5", - "gpt-5-mini", - "gpt-5-nano", - "gpt-5-2025-08-07", - "gpt-5-mini-2025-08-07", - "gpt-5-nano-2025-08-07", - "gpt-5-chat-latest", - "gpt-4.1", - "gpt-4.1-mini", - "gpt-4.1-nano", - "gpt-4.1-2025-04-14", - "gpt-4.1-mini-2025-04-14", - "gpt-4.1-nano-2025-04-14", - "o4-mini", - "o4-mini-2025-04-16", - "o3", - "o3-2025-04-16", - "o3-mini", - "o3-mini-2025-01-31", - "o1", - "o1-2024-12-17", - "o1-preview", - "o1-preview-2024-09-12", - "o1-mini", - "o1-mini-2024-09-12", - "gpt-4o", - "gpt-4o-2024-11-20", - "gpt-4o-2024-08-06", - "gpt-4o-2024-05-13", - "gpt-4o-audio-preview", - "gpt-4o-audio-preview-2024-10-01", - "gpt-4o-audio-preview-2024-12-17", - "gpt-4o-audio-preview-2025-06-03", - "gpt-4o-mini-audio-preview", - "gpt-4o-mini-audio-preview-2024-12-17", - "gpt-4o-search-preview", - "gpt-4o-mini-search-preview", - "gpt-4o-search-preview-2025-03-11", - "gpt-4o-mini-search-preview-2025-03-11", - "chatgpt-4o-latest", - "codex-mini-latest", - "gpt-4o-mini", - "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", - "gpt-4-turbo-2024-04-09", - "gpt-4-0125-preview", - "gpt-4-turbo-preview", - "gpt-4-1106-preview", - "gpt-4-vision-preview", - "gpt-4", - "gpt-4-0314", - "gpt-4-0613", - "gpt-4-32k", - "gpt-4-32k-0314", - "gpt-4-32k-0613", - "gpt-3.5-turbo", - "gpt-3.5-turbo-16k", - "gpt-3.5-turbo-0301", - "gpt-3.5-turbo-0613", - "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", - "gpt-3.5-turbo-16k-0613", - "o1-pro", - "o1-pro-2025-03-19", - "o3-pro", - "o3-pro-2025-06-10", - "o3-deep-research", - "o3-deep-research-2025-06-26", - "o4-mini-deep-research", - "o4-mini-deep-research-2025-06-26", - "computer-use-preview", - "computer-use-preview-2025-03-11", - "gpt-5.5-pro", - "gpt-5.5-pro-2026-04-23", - "gpt-5-codex", - "gpt-5-pro", - "gpt-5-pro-2025-10-06", - "gpt-5.1-codex-max", - "gpt-daybreak-blue-latest", - "gpt-daybreak-red-latest", - "gpt-5.6-cyber", -] -"""Model ID used to generate the response, like ``gpt-5`` or ``o3``. OpenAI offers a wide range of -models with different capabilities, performance characteristics, and price points. Refer to the -`model guide `_ to browse and compare available models.""" - -ModerationEntryType = Literal["moderation_result", "error"] -"""Type of ModerationEntryType.""" - -ModerationInputType = Literal["text", "image"] -"""Type of ModerationInputType.""" - -ModerationMode = Literal["score", "block"] -"""Type of ModerationMode.""" - -OpenApiAuthType = Literal["anonymous", "project_connection", "managed_identity"] -"""Authentication type for OpenApi endpoint. Allowed types are: - -* Anonymous (no authentication required) -* Project Connection (requires project_connection_id to endpoint, as setup in AI Foundry) -* Managed_Identity (requires audience for identity based auth).""" - -OutputContentType = Literal["output_text", "refusal", "reasoning_text"] -"""Type of OutputContentType.""" - -OutputItemType = Literal[ - "output_message", - "file_search_call", - "function_call", - "function_call_output", - "web_search_call", - "computer_call", - "computer_call_output", - "reasoning", - "program", - "program_output", - "tool_search_call", - "tool_search_output", - "additional_tools", - "compaction", - "image_generation_call", - "code_interpreter_call", - "local_shell_call", - "local_shell_call_output", - "shell_call", - "shell_call_output", - "apply_patch_call", - "apply_patch_call_output", - "mcp_call", - "mcp_list_tools", - "mcp_approval_request", - "mcp_approval_response", - "custom_tool_call", - "custom_tool_call_output", - "message", - "structured_outputs", - "oauth_consent_request", - "memory_search_call", - "workflow_action", - "a2a_preview_call", - "a2a_preview_call_output", - "bing_grounding_call", - "bing_grounding_call_output", - "sharepoint_grounding_preview_call", - "sharepoint_grounding_preview_call_output", - "azure_ai_search_call", - "azure_ai_search_call_output", - "bing_custom_search_preview_call", - "bing_custom_search_preview_call_output", - "openapi_call", - "openapi_call_output", - "browser_automation_preview_call", - "browser_automation_preview_call_output", - "fabric_dataagent_preview_call", - "fabric_dataagent_preview_call_output", - "azure_function_call", - "azure_function_call_output", -] -"""Type of OutputItemType.""" - -OutputMessageContentType = Literal["output_text", "refusal"] -"""Type of OutputMessageContentType.""" - -PageOrder = Literal["asc", "desc"] -"""Type of PageOrder.""" - -ProgramOutputStatus = Literal["completed", "incomplete"] -"""Type of ProgramOutputStatus.""" - -PromptCacheModeEnum = Literal["implicit", "explicit"] -"""Type of PromptCacheModeEnum.""" - -PromptCacheRetentionEnum = Literal["in_memory", "24h"] -"""Type of PromptCacheRetentionEnum.""" - -PromptCacheTTLEnum = Literal["30m"] -"""Type of PromptCacheTTLEnum.""" - -RankerVersionType = Literal["auto", "default-2024-11-15"] -"""Type of RankerVersionType.""" - -RealtimeMcpErrorType = Literal["protocol_error", "tool_execution_error", "http_error"] -"""Type of RealtimeMcpErrorType.""" - -ReasoningEffort = Literal["none", "minimal", "low", "medium", "high", "xhigh", "max"] -"""Constrains effort on reasoning for reasoning models. Currently supported values are ``none``, -``minimal``, ``low``, ``medium``, ``high``, ``xhigh``, and ``max``. Reducing reasoning effort -can result in faster responses and fewer tokens used on reasoning in a response. Not all -reasoning models support every value. See the `reasoning guide -`_ for model-specific support.""" - -ReasoningModeEnum = Literal["standard", "pro"] -"""Type of ReasoningModeEnum.""" - -ResponseErrorCode = Literal[ - "server_error", - "rate_limit_exceeded", - "invalid_prompt", - "data_residency_mismatch", - "bio_policy", - "vector_store_timeout", - "invalid_image", - "invalid_image_format", - "invalid_base64_image", - "invalid_image_url", - "image_too_large", - "image_too_small", - "image_parse_error", - "image_content_policy_violation", - "invalid_image_mode", - "image_file_too_large", - "unsupported_image_media_type", - "empty_image_file", - "failed_to_download_image", - "image_file_not_found", -] -"""The error code for the response.""" - -ResponseStreamEventType = Literal[ - "response.audio.delta", - "response.audio.done", - "response.audio.transcript.delta", - "response.audio.transcript.done", - "response.code_interpreter_call_code.delta", - "response.code_interpreter_call_code.done", - "response.code_interpreter_call.completed", - "response.code_interpreter_call.in_progress", - "response.code_interpreter_call.interpreting", - "response.completed", - "response.content_part.added", - "response.content_part.done", - "response.created", - "error", - "response.file_search_call.completed", - "response.file_search_call.in_progress", - "response.file_search_call.searching", - "response.function_call_arguments.delta", - "response.function_call_arguments.done", - "response.shell_call_command.added", - "response.shell_call_command.delta", - "response.shell_call_command.done", - "response.shell_call_output_content.delta", - "response.shell_call_output_content.done", - "response.in_progress", - "response.failed", - "response.incomplete", - "response.output_item.added", - "response.output_item.done", - "response.reasoning_summary_part.added", - "response.reasoning_summary_part.done", - "response.reasoning_summary_text.delta", - "response.reasoning_summary_text.done", - "response.reasoning_text.delta", - "response.reasoning_text.done", - "response.refusal.delta", - "response.refusal.done", - "response.output_text.delta", - "response.output_text.done", - "response.web_search_call.completed", - "response.web_search_call.in_progress", - "response.web_search_call.searching", - "response.image_generation_call.completed", - "response.image_generation_call.generating", - "response.image_generation_call.in_progress", - "response.image_generation_call.partial_image", - "response.mcp_call_arguments.delta", - "response.mcp_call_arguments.done", - "response.mcp_call.completed", - "response.mcp_call.failed", - "response.mcp_call.in_progress", - "response.mcp_list_tools.completed", - "response.mcp_list_tools.failed", - "response.mcp_list_tools.in_progress", - "response.output_text.annotation.added", - "response.queued", - "response.custom_tool_call_input.delta", - "response.custom_tool_call_input.done", -] -"""Type of ResponseStreamEventType.""" - -SearchContentType = Literal["text", "image"] -"""Type of SearchContentType.""" - -SearchContextSize = Literal["low", "medium", "high"] -"""Type of SearchContextSize.""" - -ServiceTierEnum = Literal["auto", "default", "fast", "flex", "priority"] -"""Type of ServiceTierEnum.""" - -TextResponseFormatConfigurationType = Literal["text", "json_schema", "json_object"] -"""Type of TextResponseFormatConfigurationType.""" - -ToolCallCallerParamType = Literal["direct", "program"] -"""Type of ToolCallCallerParamType.""" - -ToolCallCallerType = Literal["direct", "program"] -"""Type of ToolCallCallerType.""" - -ToolCallStatus = Literal["in_progress", "completed", "incomplete", "failed"] -"""The status of a tool call.""" - -ToolChoiceOptions = Literal["none", "auto", "required"] -"""Tool choice mode.""" - -ToolChoiceParamType = Literal[ - "allowed_tools", - "function", - "mcp", - "custom", - "programmatic_tool_calling", - "apply_patch", - "shell", - "file_search", - "web_search_preview", - "computer_use_preview", - "web_search_preview_2025_03_11", - "image_generation", - "code_interpreter", - "computer", - "computer_use", -] -"""Type of ToolChoiceParamType.""" - -ToolSearchExecutionType = Literal["server", "client"] -"""Type of ToolSearchExecutionType.""" - -ToolType = Literal[ - "function", - "file_search", - "computer", - "computer_use_preview", - "web_search", - "mcp", - "code_interpreter", - "programmatic_tool_calling", - "image_generation", - "local_shell", - "shell", - "custom", - "namespace", - "tool_search", - "web_search_preview", - "apply_patch", - "a2a_preview", - "bing_custom_search_preview", - "browser_automation_preview", - "fabric_dataagent_preview", - "sharepoint_grounding_preview", - "memory_search_preview", - "work_iq_preview", - "azure_ai_search", - "azure_function", - "bing_grounding", - "capture_structured_outputs", - "openapi", -] -"""Type of ToolType.""" - - -class A2APreviewTool(TypedDict, total=False): - """An agent implementing the A2A protocol. - - :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2_A_PREVIEW. - :vartype type: Literal["a2a_preview"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar base_url: Base URL of the agent. - :vartype base_url: str - :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not - provided, defaults to ``/.well-known/agent-card.json``. - :vartype agent_card_path: str - :ivar project_connection_id: The connection ID in the project for the A2A server. The - connection stores authentication and other connection details needed to connect to the A2A - server. - :vartype project_connection_id: str - """ - - type: Required[Literal["a2a_preview"]] - """The type of the tool. Always ``\"a2a_preview``. Required. A2_A_PREVIEW.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - base_url: str - """Base URL of the agent.""" - agent_card_path: str - """The path to the agent card relative to the ``base_url``. If not provided, defaults to - ``/.well-known/agent-card.json``.""" - project_connection_id: str - """The connection ID in the project for the A2A server. The connection stores authentication and - other connection details needed to connect to the A2A server.""" - - -class A2AToolCall(TypedDict, total=False): - """An A2A (Agent-to-Agent) tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. A2_A_PREVIEW_CALL. - :vartype type: Literal["a2a_preview_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar name: The name of the A2A agent card being called. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["a2a_preview_call"]] - """Required. A2_A_PREVIEW_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - name: Required[str] - """The name of the A2A agent card being called. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class A2AToolCallOutput(TypedDict, total=False): - """The output of an A2A (Agent-to-Agent) tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. A2_A_PREVIEW_CALL_OUTPUT. - :vartype type: Literal["a2a_preview_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar name: The name of the A2A agent card that was called. Required. - :vartype name: str - :ivar output: The output from the A2A tool call. Is one of the following types: {str: Any}, - str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["a2a_preview_call_output"]] - """Required. A2_A_PREVIEW_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - name: Required[str] - """The name of the A2A agent card that was called. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the A2A tool call. Is one of the following types: {str: Any}, str, [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class AdditionalToolsItemParam(TypedDict, total=False): - """AdditionalToolsItemParam. - - :ivar id: - :vartype id: str - :ivar type: The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. - :vartype type: Literal["additional_tools"] - :ivar role: The role that provided the additional tools. Only ``developer`` is supported. - Required. Default value is "developer". - :vartype role: Literal["developer"] - :ivar tools: A list of additional tools made available at this item. Required. - :vartype tools: list["Tool"] - """ - - id: Optional[str] - type: Required[Literal["additional_tools"]] - """The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.""" - role: Required[Literal["developer"]] - """The role that provided the additional tools. Only ``developer`` is supported. Required. Default - value is \"developer\".""" - tools: Required[list["Tool"]] - """A list of additional tools made available at this item. Required.""" - - -class AgentReference(TypedDict, total=False): - """AgentReference. - - :ivar type: Required. Default value is "agent_reference". - :vartype type: Literal["agent_reference"] - :ivar name: The name of the agent. Required. - :vartype name: str - :ivar version: The version identifier of the agent. - :vartype version: str - """ - - type: Required[Literal["agent_reference"]] - """Required. Default value is \"agent_reference\".""" - name: Required[str] - """The name of the agent. Required.""" - version: str - """The version identifier of the agent.""" - - -class AISearchIndexResource(TypedDict, total=False): - """A AI Search Index resource. - - :ivar project_connection_id: An index connection ID in an IndexResource attached to this agent. - :vartype project_connection_id: str - :ivar index_name: The name of an index in an IndexResource attached to this agent. - :vartype index_name: str - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar query_type: Type of query in an AIIndexResource attached to this agent. Known values are: - "simple", "semantic", "vector", "vector_simple_hybrid", and "vector_semantic_hybrid". - :vartype query_type: AzureAISearchQueryType - :ivar top_k: Number of documents to retrieve from search and present to the model. - :vartype top_k: int - :ivar filter: filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters. - :vartype filter: str - :ivar index_asset_id: Index asset id for search resource. - :vartype index_asset_id: str - """ - - project_connection_id: str - """An index connection ID in an IndexResource attached to this agent.""" - index_name: str - """The name of an index in an IndexResource attached to this agent.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - query_type: AzureAISearchQueryType - """Type of query in an AIIndexResource attached to this agent. Known values are: \"simple\", - \"semantic\", \"vector\", \"vector_simple_hybrid\", and \"vector_semantic_hybrid\".""" - top_k: int - """Number of documents to retrieve from search and present to the model.""" - filter: str - """filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters.""" - index_asset_id: str - """Index asset id for search resource.""" - - -class ApiErrorResponse(TypedDict, total=False): - """Error response for API failures. - - :ivar error: Required. - :vartype error: "Error" - """ - - error: Required["Error"] - """Required.""" - - -class ApplyPatchCreateFileOperation(TypedDict, total=False): - """Apply patch create file operation. - - :ivar type: Create a new file with the provided diff. Required. CREATE_FILE. - :vartype type: Literal["create_file"] - :ivar path: Path of the file to create. Required. - :vartype path: str - :ivar diff: Diff to apply. Required. - :vartype diff: str - """ - - type: Required[Literal["create_file"]] - """Create a new file with the provided diff. Required. CREATE_FILE.""" - path: Required[str] - """Path of the file to create. Required.""" - diff: Required[str] - """Diff to apply. Required.""" - - -class ApplyPatchCreateFileOperationParam(TypedDict, total=False): - """Apply patch create file operation. - - :ivar type: The operation type. Always ``create_file``. Required. CREATE_FILE. - :vartype type: Literal["create_file"] - :ivar path: Path of the file to create relative to the workspace root. Required. - :vartype path: str - :ivar diff: Unified diff content to apply when creating the file. Required. - :vartype diff: str - """ - - type: Required[Literal["create_file"]] - """The operation type. Always ``create_file``. Required. CREATE_FILE.""" - path: Required[str] - """Path of the file to create relative to the workspace root. Required.""" - diff: Required[str] - """Unified diff content to apply when creating the file. Required.""" - - -class ApplyPatchDeleteFileOperation(TypedDict, total=False): - """Apply patch delete file operation. - - :ivar type: Delete the specified file. Required. DELETE_FILE. - :vartype type: Literal["delete_file"] - :ivar path: Path of the file to delete. Required. - :vartype path: str - """ - - type: Required[Literal["delete_file"]] - """Delete the specified file. Required. DELETE_FILE.""" - path: Required[str] - """Path of the file to delete. Required.""" - - -class ApplyPatchDeleteFileOperationParam(TypedDict, total=False): - """Apply patch delete file operation. - - :ivar type: The operation type. Always ``delete_file``. Required. DELETE_FILE. - :vartype type: Literal["delete_file"] - :ivar path: Path of the file to delete relative to the workspace root. Required. - :vartype path: str - """ - - type: Required[Literal["delete_file"]] - """The operation type. Always ``delete_file``. Required. DELETE_FILE.""" - path: Required[str] - """Path of the file to delete relative to the workspace root. Required.""" - - -class ApplyPatchToolCallItemParam(TypedDict, total=False): - """Apply patch tool call. - - :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. - :vartype type: Literal["apply_patch_call"] - :ivar id: - :vartype id: str - :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. - Required. Known values are: "in_progress" and "completed". - :vartype status: ApplyPatchCallStatusParam - :ivar operation: The specific create, delete, or update instruction for the apply_patch tool - call. Required. - :vartype operation: "ApplyPatchOperationParam" - """ - - type: Required[Literal["apply_patch_call"]] - """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" - id: Optional[str] - call_id: Required[str] - """The unique ID of the apply patch tool call generated by the model. Required.""" - caller: Optional["ToolCallCallerParam"] - status: Required[ApplyPatchCallStatusParam] - """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. - Known values are: \"in_progress\" and \"completed\".""" - operation: Required["ApplyPatchOperationParam"] - """The specific create, delete, or update instruction for the apply_patch tool call. Required.""" - - -class ApplyPatchToolCallOutputItemParam(TypedDict, total=False): - """Apply patch tool call output. - - :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. - APPLY_PATCH_CALL_OUTPUT. - :vartype type: Literal["apply_patch_call_output"] - :ivar id: - :vartype id: str - :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar status: The status of the apply patch tool call output. One of ``completed`` or - ``failed``. Required. Known values are: "completed" and "failed". - :vartype status: ApplyPatchCallOutputStatusParam - :ivar output: - :vartype output: str - """ - - type: Required[Literal["apply_patch_call_output"]] - """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" - id: Optional[str] - call_id: Required[str] - """The unique ID of the apply patch tool call generated by the model. Required.""" - caller: Optional["ToolCallCallerParam"] - status: Required[ApplyPatchCallOutputStatusParam] - """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. - Known values are: \"completed\" and \"failed\".""" - output: Optional[str] - - -class ApplyPatchToolParam(TypedDict, total=False): - """Apply patch tool. - - :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. - :vartype type: Literal["apply_patch"] - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - """ - - type: Required[Literal["apply_patch"]] - """The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.""" - allowed_callers: Optional[list[CallableToolAllowedCaller]] - - -class ApplyPatchUpdateFileOperation(TypedDict, total=False): - """Apply patch update file operation. - - :ivar type: Update an existing file with the provided diff. Required. UPDATE_FILE. - :vartype type: Literal["update_file"] - :ivar path: Path of the file to update. Required. - :vartype path: str - :ivar diff: Diff to apply. Required. - :vartype diff: str - """ - - type: Required[Literal["update_file"]] - """Update an existing file with the provided diff. Required. UPDATE_FILE.""" - path: Required[str] - """Path of the file to update. Required.""" - diff: Required[str] - """Diff to apply. Required.""" - - -class ApplyPatchUpdateFileOperationParam(TypedDict, total=False): - """Apply patch update file operation. - - :ivar type: The operation type. Always ``update_file``. Required. UPDATE_FILE. - :vartype type: Literal["update_file"] - :ivar path: Path of the file to update relative to the workspace root. Required. - :vartype path: str - :ivar diff: Unified diff content to apply to the existing file. Required. - :vartype diff: str - """ - - type: Required[Literal["update_file"]] - """The operation type. Always ``update_file``. Required. UPDATE_FILE.""" - path: Required[str] - """Path of the file to update relative to the workspace root. Required.""" - diff: Required[str] - """Unified diff content to apply to the existing file. Required.""" - - -class ApproximateLocation(TypedDict, total=False): - """ApproximateLocation. - - :ivar type: The type of location approximation. Always ``approximate``. Required. Default value - is "approximate". - :vartype type: Literal["approximate"] - :ivar country: - :vartype country: str - :ivar region: - :vartype region: str - :ivar city: - :vartype city: str - :ivar timezone: - :vartype timezone: str - """ - - type: Required[Literal["approximate"]] - """The type of location approximation. Always ``approximate``. Required. Default value is - \"approximate\".""" - country: Optional[str] - region: Optional[str] - city: Optional[str] - timezone: Optional[str] - - -class AutoCodeInterpreterToolParam(TypedDict, total=False): - """Automatic Code Interpreter Tool Parameters. - - :ivar type: Always ``auto``. Required. Default value is "auto". - :vartype type: Literal["auto"] - :ivar file_ids: An optional list of uploaded files to make available to your code. - :vartype file_ids: list[str] - :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". - :vartype memory_limit: ContainerMemoryLimit - :ivar network_policy: - :vartype network_policy: "ContainerNetworkPolicyParam" - """ - - type: Required[Literal["auto"]] - """Always ``auto``. Required. Default value is \"auto\".""" - file_ids: list[str] - """An optional list of uploaded files to make available to your code.""" - memory_limit: Optional[ContainerMemoryLimit] - """Known values are: \"1g\", \"4g\", \"16g\", and \"64g\".""" - network_policy: "ContainerNetworkPolicyParam" - - -class AzureAISearchTool(TypedDict, total=False): - """The input definition information for an Azure AI search tool as used to configure an agent. - - :ivar type: The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH. - :vartype type: Literal["azure_ai_search"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar azure_ai_search: The azure ai search index resource. Required. - :vartype azure_ai_search: "AzureAISearchToolResource" - """ - - type: Required[Literal["azure_ai_search"]] - """The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - azure_ai_search: Required["AzureAISearchToolResource"] - """The azure ai search index resource. Required.""" - - -class AzureAISearchToolCall(TypedDict, total=False): - """An Azure AI Search tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. AZURE_AI_SEARCH_CALL. - :vartype type: Literal["azure_ai_search_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["azure_ai_search_call"]] - """Required. AZURE_AI_SEARCH_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class AzureAISearchToolCallOutput(TypedDict, total=False): - """The output of an Azure AI Search tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. AZURE_AI_SEARCH_CALL_OUTPUT. - :vartype type: Literal["azure_ai_search_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar output: The output from the Azure AI Search tool call. Is one of the following types: - {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["azure_ai_search_call_output"]] - """Required. AZURE_AI_SEARCH_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the Azure AI Search tool call. Is one of the following types: {str: Any}, str, - [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class AzureAISearchToolResource(TypedDict, total=False): - """A set of index resources used by the ``azure_ai_search`` tool. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar indexes: The indices attached to this agent. There can be a maximum of 1 index resource - attached to the agent. Required. - :vartype indexes: list["AISearchIndexResource"] - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - indexes: Required[list["AISearchIndexResource"]] - """The indices attached to this agent. There can be a maximum of 1 index resource attached to the - agent. Required.""" - - -class AzureFunctionBinding(TypedDict, total=False): - """The structure for keeping storage queue name and URI. - - :ivar type: The type of binding, which is always 'storage_queue'. Required. Default value is - "storage_queue". - :vartype type: Literal["storage_queue"] - :ivar storage_queue: Storage queue. Required. - :vartype storage_queue: "AzureFunctionStorageQueue" - """ - - type: Required[Literal["storage_queue"]] - """The type of binding, which is always 'storage_queue'. Required. Default value is - \"storage_queue\".""" - storage_queue: Required["AzureFunctionStorageQueue"] - """Storage queue. Required.""" - - -class AzureFunctionDefinition(TypedDict, total=False): - """The definition of Azure function. - - :ivar function: The definition of azure function and its parameters. Required. - :vartype function: "AzureFunctionDefinitionFunction" - :ivar input_binding: Input storage queue. The queue storage trigger runs a function as messages - are added to it. Required. - :vartype input_binding: "AzureFunctionBinding" - :ivar output_binding: Output storage queue. The function writes output to this queue when the - input items are processed. Required. - :vartype output_binding: "AzureFunctionBinding" - """ - - function: Required["AzureFunctionDefinitionFunction"] - """The definition of azure function and its parameters. Required.""" - input_binding: Required["AzureFunctionBinding"] - """Input storage queue. The queue storage trigger runs a function as messages are added to it. - Required.""" - output_binding: Required["AzureFunctionBinding"] - """Output storage queue. The function writes output to this queue when the input items are - processed. Required.""" - - -class AzureFunctionDefinitionFunction(TypedDict, total=False): - """AzureFunctionDefinitionFunction. - - :ivar name: The name of the function to be called. Required. - :vartype name: str - :ivar description: A description of what the function does, used by the model to choose when - and how to call the function. - :vartype description: str - :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. - Required. - :vartype parameters: dict[str, Any] - """ - - name: Required[str] - """The name of the function to be called. Required.""" - description: str - """A description of what the function does, used by the model to choose when and how to call the - function.""" - parameters: Required[dict[str, Any]] - """The parameters the functions accepts, described as a JSON Schema object. Required.""" - - -class AzureFunctionStorageQueue(TypedDict, total=False): - """The structure for keeping storage queue name and URI. - - :ivar queue_service_endpoint: URI to the Azure Storage Queue service allowing you to manipulate - a queue. Required. - :vartype queue_service_endpoint: str - :ivar queue_name: The name of an Azure function storage queue. Required. - :vartype queue_name: str - """ - - queue_service_endpoint: Required[str] - """URI to the Azure Storage Queue service allowing you to manipulate a queue. Required.""" - queue_name: Required[str] - """The name of an Azure function storage queue. Required.""" - - -class AzureFunctionTool(TypedDict, total=False): - """The input definition information for an Azure Function Tool, as used to configure an Agent. - - :ivar type: The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION. - :vartype type: Literal["azure_function"] - :ivar azure_function: The Azure Function Tool definition. Required. - :vartype azure_function: "AzureFunctionDefinition" - """ - - type: Required[Literal["azure_function"]] - """The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION.""" - azure_function: Required["AzureFunctionDefinition"] - """The Azure Function Tool definition. Required.""" - - -class AzureFunctionToolCall(TypedDict, total=False): - """An Azure Function tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. AZURE_FUNCTION_CALL. - :vartype type: Literal["azure_function_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar name: The name of the Azure Function being called. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["azure_function_call"]] - """Required. AZURE_FUNCTION_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - name: Required[str] - """The name of the Azure Function being called. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class AzureFunctionToolCallOutput(TypedDict, total=False): - """The output of an Azure Function tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. AZURE_FUNCTION_CALL_OUTPUT. - :vartype type: Literal["azure_function_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar name: The name of the Azure Function that was called. Required. - :vartype name: str - :ivar output: The output from the Azure Function tool call. Is one of the following types: - {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["azure_function_call_output"]] - """Required. AZURE_FUNCTION_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - name: Required[str] - """The name of the Azure Function that was called. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the Azure Function tool call. Is one of the following types: {str: Any}, str, - [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BingCustomSearchConfiguration(TypedDict, total=False): - """A bing custom search configuration. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connection_id: Project connection id for grounding with bing search. Required. - :vartype project_connection_id: str - :ivar instance_name: Name of the custom configuration instance given to config. Required. - :vartype instance_name: str - :ivar market: The market where the results come from. - :vartype market: str - :ivar set_lang: The language to use for user interface strings when calling Bing API. - :vartype set_lang: str - :ivar count: The number of search results to return in the bing api response. - :vartype count: int - :ivar freshness: Filter search results by a specific time range. See `accepted values here - `_. - :vartype freshness: str - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connection_id: Required[str] - """Project connection id for grounding with bing search. Required.""" - instance_name: Required[str] - """Name of the custom configuration instance given to config. Required.""" - market: str - """The market where the results come from.""" - set_lang: str - """The language to use for user interface strings when calling Bing API.""" - count: int - """The number of search results to return in the bing api response.""" - freshness: str - """Filter search results by a specific time range. See `accepted values here - `_.""" - - -class BingCustomSearchPreviewTool(TypedDict, total=False): - """The input definition information for a Bing custom search tool as used to configure an agent. - - :ivar type: The object type, which is always 'bing_custom_search_preview'. Required. - BING_CUSTOM_SEARCH_PREVIEW. - :vartype type: Literal["bing_custom_search_preview"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. - :vartype bing_custom_search_preview: "BingCustomSearchToolParameters" - """ - - type: Required[Literal["bing_custom_search_preview"]] - """The object type, which is always 'bing_custom_search_preview'. Required. - BING_CUSTOM_SEARCH_PREVIEW.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - bing_custom_search_preview: Required["BingCustomSearchToolParameters"] - """The bing custom search tool parameters. Required.""" - - -class BingCustomSearchToolCall(TypedDict, total=False): - """A Bing custom search tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL. - :vartype type: Literal["bing_custom_search_preview_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["bing_custom_search_preview_call"]] - """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BingCustomSearchToolCallOutput(TypedDict, total=False): - """The output of a Bing custom search tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT. - :vartype type: Literal["bing_custom_search_preview_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar output: The output from the Bing custom search tool call. Is one of the following types: - {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["bing_custom_search_preview_call_output"]] - """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the Bing custom search tool call. Is one of the following types: {str: Any}, - str, [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BingCustomSearchToolParameters(TypedDict, total=False): - """The bing custom search tool parameters. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar search_configurations: The project connections attached to this tool. There can be a - maximum of 1 connection resource attached to the tool. Required. - :vartype search_configurations: list["BingCustomSearchConfiguration"] - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - search_configurations: Required[list["BingCustomSearchConfiguration"]] - """The project connections attached to this tool. There can be a maximum of 1 connection resource - attached to the tool. Required.""" - - -class BingGroundingSearchConfiguration(TypedDict, total=False): - """Search configuration for Bing Grounding. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connection_id: Project connection id for grounding with bing search. Required. - :vartype project_connection_id: str - :ivar market: The market where the results come from. - :vartype market: str - :ivar set_lang: The language to use for user interface strings when calling Bing API. - :vartype set_lang: str - :ivar count: The number of search results to return in the bing api response. - :vartype count: int - :ivar freshness: Filter search results by a specific time range. See `accepted values here - `_. - :vartype freshness: str - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connection_id: Required[str] - """Project connection id for grounding with bing search. Required.""" - market: str - """The market where the results come from.""" - set_lang: str - """The language to use for user interface strings when calling Bing API.""" - count: int - """The number of search results to return in the bing api response.""" - freshness: str - """Filter search results by a specific time range. See `accepted values here - `_.""" - - -class BingGroundingSearchToolParameters(TypedDict, total=False): - """The bing grounding search tool parameters. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar search_configurations: The search configurations attached to this tool. There can be a - maximum of 1 search configuration resource attached to the tool. Required. - :vartype search_configurations: list["BingGroundingSearchConfiguration"] - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - search_configurations: Required[list["BingGroundingSearchConfiguration"]] - """The search configurations attached to this tool. There can be a maximum of 1 search - configuration resource attached to the tool. Required.""" - - -class BingGroundingTool(TypedDict, total=False): - """The input definition information for a bing grounding search tool as used to configure an - agent. - - :ivar type: The object type, which is always 'bing_grounding'. Required. BING_GROUNDING. - :vartype type: Literal["bing_grounding"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar bing_grounding: The bing grounding search tool parameters. Required. - :vartype bing_grounding: "BingGroundingSearchToolParameters" - """ - - type: Required[Literal["bing_grounding"]] - """The object type, which is always 'bing_grounding'. Required. BING_GROUNDING.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - bing_grounding: Required["BingGroundingSearchToolParameters"] - """The bing grounding search tool parameters. Required.""" - - -class BingGroundingToolCall(TypedDict, total=False): - """A Bing grounding tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. BING_GROUNDING_CALL. - :vartype type: Literal["bing_grounding_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["bing_grounding_call"]] - """Required. BING_GROUNDING_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BingGroundingToolCallOutput(TypedDict, total=False): - """The output of a Bing grounding tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. BING_GROUNDING_CALL_OUTPUT. - :vartype type: Literal["bing_grounding_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar output: The output from the Bing grounding tool call. Is one of the following types: - {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["bing_grounding_call_output"]] - """Required. BING_GROUNDING_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the Bing grounding tool call. Is one of the following types: {str: Any}, str, - [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BrowserAutomationPreviewTool(TypedDict, total=False): - """The input definition information for a Browser Automation Tool, as used to configure an Agent. - - :ivar type: The object type, which is always 'browser_automation_preview'. Required. - BROWSER_AUTOMATION_PREVIEW. - :vartype type: Literal["browser_automation_preview"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. - :vartype browser_automation_preview: "BrowserAutomationToolParameters" - """ - - type: Required[Literal["browser_automation_preview"]] - """The object type, which is always 'browser_automation_preview'. Required. - BROWSER_AUTOMATION_PREVIEW.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - browser_automation_preview: Required["BrowserAutomationToolParameters"] - """The Browser Automation Tool parameters. Required.""" - - -class BrowserAutomationToolCall(TypedDict, total=False): - """A browser automation tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL. - :vartype type: Literal["browser_automation_preview_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["browser_automation_preview_call"]] - """Required. BROWSER_AUTOMATION_PREVIEW_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BrowserAutomationToolCallOutput(TypedDict, total=False): - """The output of a browser automation tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT. - :vartype type: Literal["browser_automation_preview_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar output: The output from the browser automation tool call. Is one of the following types: - {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["browser_automation_preview_call_output"]] - """Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the browser automation tool call. Is one of the following types: {str: Any}, - str, [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class BrowserAutomationToolConnectionParameters(TypedDict, total=False): # pylint: disable=name-too-long - """Definition of input parameters for the connection used by the Browser Automation Tool. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connection_id: The ID of the project connection to your Azure Playwright - resource. Required. - :vartype project_connection_id: str - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connection_id: Required[str] - """The ID of the project connection to your Azure Playwright resource. Required.""" - - -class BrowserAutomationToolParameters(TypedDict, total=False): - """Definition of input parameters for the Browser Automation Tool. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar connection: The project connection parameters associated with the Browser Automation - Tool. Required. - :vartype connection: "BrowserAutomationToolConnectionParameters" - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - connection: Required["BrowserAutomationToolConnectionParameters"] - """The project connection parameters associated with the Browser Automation Tool. Required.""" - - -class CaptureStructuredOutputsTool(TypedDict, total=False): - """A tool for capturing structured outputs. - - :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required. - CAPTURE_STRUCTURED_OUTPUTS. - :vartype type: Literal["capture_structured_outputs"] - :ivar outputs: The structured outputs to capture from the model. Required. - :vartype outputs: "StructuredOutputDefinition" - """ - - type: Required[Literal["capture_structured_outputs"]] - """The type of the tool. Always ``capture_structured_outputs``. Required. - CAPTURE_STRUCTURED_OUTPUTS.""" - outputs: Required["StructuredOutputDefinition"] - """The structured outputs to capture from the model. Required.""" - - -class ChatSummaryMemoryItem(TypedDict, total=False): - """A memory item containing a summary extracted from conversations. - - :ivar memory_id: The unique ID of the memory item. Required. - :vartype memory_id: str - :ivar updated_at: The last update time of the memory item. Required. - :vartype updated_at: int - :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. - Required. - :vartype scope: str - :ivar content: The content of the memory. Required. - :vartype content: str - :ivar kind: The kind of the memory item. Required. Summary of chat conversations. - :vartype kind: Literal["chat_summary"] - """ - - memory_id: Required[str] - """The unique ID of the memory item. Required.""" - updated_at: Required[int] - """The last update time of the memory item. Required.""" - scope: Required[str] - """The namespace that logically groups and isolates memories, such as a user ID. Required.""" - content: Required[str] - """The content of the memory. Required.""" - kind: Required[Literal["chat_summary"]] - """The kind of the memory item. Required. Summary of chat conversations.""" - - -class ClickParam(TypedDict, total=False): - """Click. - - :ivar type: Specifies the event type. For a click action, this property is always ``click``. - Required. CLICK. - :vartype type: Literal["click"] - :ivar button: Indicates which mouse button was pressed during the click. One of ``left``, - ``right``, ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right", - "wheel", "back", and "forward". - :vartype button: ClickButtonType - :ivar x: The x-coordinate where the click occurred. Required. - :vartype x: int - :ivar y: The y-coordinate where the click occurred. Required. - :vartype y: int - :ivar keys: - :vartype keys: list[str] - """ - - type: Required[Literal["click"]] - """Specifies the event type. For a click action, this property is always ``click``. Required. - CLICK.""" - button: Required[ClickButtonType] - """Indicates which mouse button was pressed during the click. One of ``left``, ``right``, - ``wheel``, ``back``, or ``forward``. Required. Known values are: \"left\", \"right\", - \"wheel\", \"back\", and \"forward\".""" - x: Required[int] - """The x-coordinate where the click occurred. Required.""" - y: Required[int] - """The y-coordinate where the click occurred. Required.""" - keys: Optional[list[str]] - - -class CodeInterpreterOutputImage(TypedDict, total=False): - """Code interpreter output image. - - :ivar type: The type of the output. Always ``image``. Required. Default value is "image". - :vartype type: Literal["image"] - :ivar url: The URL of the image output from the code interpreter. Required. - :vartype url: str - """ - - type: Required[Literal["image"]] - """The type of the output. Always ``image``. Required. Default value is \"image\".""" - url: Required[str] - """The URL of the image output from the code interpreter. Required.""" - - -class CodeInterpreterOutputLogs(TypedDict, total=False): - """Code interpreter output logs. - - :ivar type: The type of the output. Always ``logs``. Required. Default value is "logs". - :vartype type: Literal["logs"] - :ivar logs: The logs output from the code interpreter. Required. - :vartype logs: str - """ - - type: Required[Literal["logs"]] - """The type of the output. Always ``logs``. Required. Default value is \"logs\".""" - logs: Required[str] - """The logs output from the code interpreter. Required.""" - - -class CodeInterpreterTool(TypedDict, total=False): - """Code interpreter. - - :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required. - CODE_INTERPRETER. - :vartype type: Literal["code_interpreter"] - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar container: The code interpreter container. Can be a container ID or an object that - specifies uploaded file IDs to make available to your code, along with an optional - ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a - AutoCodeInterpreterToolParam type. - :vartype container: Union[str, "AutoCodeInterpreterToolParam"] - """ - - type: Required[Literal["code_interpreter"]] - """The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER.""" - allowed_callers: Optional[list[CallableToolAllowedCaller]] - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - container: Union[str, "AutoCodeInterpreterToolParam"] - """The code interpreter container. Can be a container ID or an object that specifies uploaded file - IDs to make available to your code, along with an optional ``memory_limit`` setting. If not - provided, the service assumes auto. Is either a str type or a AutoCodeInterpreterToolParam - type.""" - - -class CompactionSummaryItemParam(TypedDict, total=False): - """Compaction item. - - :ivar id: - :vartype id: str - :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. - :vartype type: Literal["compaction"] - :ivar encrypted_content: The encrypted content of the compaction summary. Required. - :vartype encrypted_content: str - """ - - id: Optional[str] - type: Required[Literal["compaction"]] - """The type of the item. Always ``compaction``. Required. COMPACTION.""" - encrypted_content: Required[str] - """The encrypted content of the compaction summary. Required.""" - - -class CompactResource(TypedDict, total=False): - """The compacted response object. - - :ivar id: The unique identifier for the compacted response. Required. - :vartype id: str - :ivar object: The object type. Always ``response.compaction``. Required. Default value is - "response.compaction". - :vartype object: Literal["response.compaction"] - :ivar output: The compacted list of output items. Required. - :vartype output: list["ItemField"] - :ivar created_at: Unix timestamp (in seconds) when the compacted conversation was created. - Required. - :vartype created_at: int - :ivar usage: Token accounting for the compaction pass, including cached, reasoning, and total - tokens. Required. - :vartype usage: "ResponseUsage" - """ - - id: Required[str] - """The unique identifier for the compacted response. Required.""" - object: Required[Literal["response.compaction"]] - """The object type. Always ``response.compaction``. Required. Default value is - \"response.compaction\".""" - output: Required[list["ItemField"]] - """The compacted list of output items. Required.""" - created_at: Required[int] - """Unix timestamp (in seconds) when the compacted conversation was created. Required.""" - usage: Required["ResponseUsage"] - """Token accounting for the compaction pass, including cached, reasoning, and total tokens. - Required.""" - - -class ComparisonFilter(TypedDict, total=False): - """Comparison Filter. - - :ivar type: Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, - ``lte``, ``in``, ``nin``. - - * `eq`: equals - * `ne`: not equal - * `gt`: greater than - * `gte`: greater than or equal - * `lt`: less than - * `lte`: less than or equal - * `in`: in - * `nin`: not in. Required. Is one of the following types: Literal["eq"], Literal["ne"], - Literal["gt"], Literal["gte"], Literal["lt"], Literal["lte"], Literal["in"], Literal["nin"] - :vartype type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"] - :ivar key: The key to compare against the value. Required. - :vartype key: str - :ivar value: The value to compare against the attribute key; supports string, number, or - boolean types. Required. Is one of the following types: str, float, bool, [Union[str, float]] - :vartype value: Union[str, float, bool, list[Union[str, float]]] - """ - - type: Required[Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]] - """Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, ``lte``, ``in``, - ``nin``. - - * `eq`: equals - * `ne`: not equal - * `gt`: greater than - * `gte`: greater than or equal - * `lt`: less than - * `lte`: less than or equal - * `in`: in - * `nin`: not in. Required. Is one of the following types: Literal[\"eq\"], - Literal[\"ne\"], Literal[\"gt\"], Literal[\"gte\"], Literal[\"lt\"], Literal[\"lte\"], - Literal[\"in\"], Literal[\"nin\"]""" - key: Required[str] - """The key to compare against the value. Required.""" - value: Required[Union[str, float, bool, list[Union[str, float]]]] - """The value to compare against the attribute key; supports string, number, or boolean types. - Required. Is one of the following types: str, float, bool, [Union[str, float]]""" - - -class CompoundFilter(TypedDict, total=False): - """Compound Filter. - - :ivar type: Type of operation: ``and`` or ``or``. Required. Is either a Literal["and"] type or - a Literal["or"] type. - :vartype type: Literal["and", "or"] - :ivar filters: Array of filters to combine. Items can be ``ComparisonFilter`` or - ``CompoundFilter``. Required. - :vartype filters: list[Union["ComparisonFilter", Any]] - """ - - type: Required[Literal["and", "or"]] - """Type of operation: ``and`` or ``or``. Required. Is either a Literal[\"and\"] type or a - Literal[\"or\"] type.""" - filters: Required[list[Union["ComparisonFilter", Any]]] - """Array of filters to combine. Items can be ``ComparisonFilter`` or ``CompoundFilter``. Required.""" - - -class ComputerCallOutputItemParam(TypedDict, total=False): - """Computer tool call output. - - :ivar id: - :vartype id: str - :ivar call_id: The ID of the computer tool call that produced the output. Required. - :vartype call_id: str - :ivar type: The type of the computer tool call output. Always ``computer_call_output``. - Required. COMPUTER_CALL_OUTPUT. - :vartype type: Literal["computer_call_output"] - :ivar output: Required. - :vartype output: "ComputerScreenshotImage" - :ivar acknowledged_safety_checks: - :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] - :ivar status: Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallItemStatus - """ - - id: Optional[str] - call_id: Required[str] - """The ID of the computer tool call that produced the output. Required.""" - type: Required[Literal["computer_call_output"]] - """The type of the computer tool call output. Always ``computer_call_output``. Required. - COMPUTER_CALL_OUTPUT.""" - output: Required["ComputerScreenshotImage"] - """Required.""" - acknowledged_safety_checks: Optional[list["ComputerCallSafetyCheckParam"]] - status: Optional[FunctionCallItemStatus] - """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - - -class ComputerCallSafetyCheckParam(TypedDict, total=False): - """A pending safety check for the computer call. - - :ivar id: The ID of the pending safety check. Required. - :vartype id: str - :ivar code: - :vartype code: str - :ivar message: - :vartype message: str - """ - - id: Required[str] - """The ID of the pending safety check. Required.""" - code: Optional[str] - message: Optional[str] - - -class ComputerScreenshotContent(TypedDict, total=False): - """Computer screenshot. - - :ivar type: Specifies the event type. For a computer screenshot, this property is always set to - ``computer_screenshot``. Required. COMPUTER_SCREENSHOT. - :vartype type: Literal["computer_screenshot"] - :ivar image_url: Required. - :vartype image_url: str - :ivar file_id: Required. - :vartype file_id: str - :ivar detail: The detail level of the screenshot image to be sent to the model. One of - ``high``, ``low``, ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: - "low", "high", "auto", and "original". - :vartype detail: ImageDetail - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["computer_screenshot"]] - """Specifies the event type. For a computer screenshot, this property is always set to - ``computer_screenshot``. Required. COMPUTER_SCREENSHOT.""" - image_url: Required[Optional[str]] - """Required.""" - file_id: Required[Optional[str]] - """Required.""" - detail: Required[ImageDetail] - """The detail level of the screenshot image to be sent to the model. One of ``high``, ``low``, - ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", - \"auto\", and \"original\".""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class ComputerScreenshotImage(TypedDict, total=False): - """A computer screenshot image used with the computer use tool. - - :ivar type: Specifies the event type. For a computer screenshot, this property is always set to - ``computer_screenshot``. Required. Default value is "computer_screenshot". - :vartype type: Literal["computer_screenshot"] - :ivar image_url: The URL of the screenshot image. - :vartype image_url: str - :ivar file_id: The identifier of an uploaded file that contains the screenshot. - :vartype file_id: str - """ - - type: Required[Literal["computer_screenshot"]] - """Specifies the event type. For a computer screenshot, this property is always set to - ``computer_screenshot``. Required. Default value is \"computer_screenshot\".""" - image_url: str - """The URL of the screenshot image.""" - file_id: str - """The identifier of an uploaded file that contains the screenshot.""" - - -class ComputerTool(TypedDict, total=False): - """Computer. - - :ivar type: The type of the computer tool. Always ``computer``. Required. COMPUTER. - :vartype type: Literal["computer"] - """ - - type: Required[Literal["computer"]] - """The type of the computer tool. Always ``computer``. Required. COMPUTER.""" - - -class ComputerUsePreviewTool(TypedDict, total=False): - """Computer use preview. - - :ivar type: The type of the computer use tool. Always ``computer_use_preview``. Required. - COMPUTER_USE_PREVIEW. - :vartype type: Literal["computer_use_preview"] - :ivar environment: The type of computer environment to control. Required. Known values are: - "windows", "mac", "linux", "ubuntu", and "browser". - :vartype environment: ComputerEnvironment - :ivar display_width: The width of the computer display. Required. - :vartype display_width: int - :ivar display_height: The height of the computer display. Required. - :vartype display_height: int - """ - - type: Required[Literal["computer_use_preview"]] - """The type of the computer use tool. Always ``computer_use_preview``. Required. - COMPUTER_USE_PREVIEW.""" - environment: Required[ComputerEnvironment] - """The type of computer environment to control. Required. Known values are: \"windows\", \"mac\", - \"linux\", \"ubuntu\", and \"browser\".""" - display_width: Required[int] - """The width of the computer display. Required.""" - display_height: Required[int] - """The height of the computer display. Required.""" - - -class ContainerAutoParam(TypedDict, total=False): - """ContainerAutoParam. - - :ivar type: Automatically creates a container for this request. Required. CONTAINER_AUTO. - :vartype type: Literal["container_auto"] - :ivar file_ids: An optional list of uploaded files to make available to your code. - :vartype file_ids: list[str] - :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". - :vartype memory_limit: ContainerMemoryLimit - :ivar skills: An optional list of skills referenced by id or inline data. - :vartype skills: list["ContainerSkill"] - :ivar network_policy: - :vartype network_policy: "ContainerNetworkPolicyParam" - """ - - type: Required[Literal["container_auto"]] - """Automatically creates a container for this request. Required. CONTAINER_AUTO.""" - file_ids: list[str] - """An optional list of uploaded files to make available to your code.""" - memory_limit: Optional[ContainerMemoryLimit] - """Known values are: \"1g\", \"4g\", \"16g\", and \"64g\".""" - skills: list["ContainerSkill"] - """An optional list of skills referenced by id or inline data.""" - network_policy: "ContainerNetworkPolicyParam" - - -class ContainerFileCitationBody(TypedDict, total=False): - """Container file citation. - - :ivar type: The type of the container file citation. Always ``container_file_citation``. - Required. CONTAINER_FILE_CITATION. - :vartype type: Literal["container_file_citation"] - :ivar container_id: The ID of the container file. Required. - :vartype container_id: str - :ivar file_id: The ID of the file. Required. - :vartype file_id: str - :ivar start_index: The index of the first character of the container file citation in the - message. Required. - :vartype start_index: int - :ivar end_index: The index of the last character of the container file citation in the message. - Required. - :vartype end_index: int - :ivar filename: The filename of the container file cited. Required. - :vartype filename: str - """ - - type: Required[Literal["container_file_citation"]] - """The type of the container file citation. Always ``container_file_citation``. Required. - CONTAINER_FILE_CITATION.""" - container_id: Required[str] - """The ID of the container file. Required.""" - file_id: Required[str] - """The ID of the file. Required.""" - start_index: Required[int] - """The index of the first character of the container file citation in the message. Required.""" - end_index: Required[int] - """The index of the last character of the container file citation in the message. Required.""" - filename: Required[str] - """The filename of the container file cited. Required.""" - - -class ContainerNetworkPolicyAllowlistParam(TypedDict, total=False): - """ContainerNetworkPolicyAllowlistParam. - - :ivar type: Allow outbound network access only to specified domains. Always ``allowlist``. - Required. ALLOWLIST. - :vartype type: Literal["allowlist"] - :ivar allowed_domains: A list of allowed domains when type is ``allowlist``. Required. - :vartype allowed_domains: list[str] - :ivar domain_secrets: Optional domain-scoped secrets for allowlisted domains. - :vartype domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"] - """ - - type: Required[Literal["allowlist"]] - """Allow outbound network access only to specified domains. Always ``allowlist``. Required. - ALLOWLIST.""" - allowed_domains: Required[list[str]] - """A list of allowed domains when type is ``allowlist``. Required.""" - domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"] - """Optional domain-scoped secrets for allowlisted domains.""" - - -class ContainerNetworkPolicyDisabledParam(TypedDict, total=False): - """ContainerNetworkPolicyDisabledParam. - - :ivar type: Disable outbound network access. Always ``disabled``. Required. DISABLED. - :vartype type: Literal["disabled"] - """ - - type: Required[Literal["disabled"]] - """Disable outbound network access. Always ``disabled``. Required. DISABLED.""" - - -class ContainerNetworkPolicyDomainSecretParam(TypedDict, total=False): - """ContainerNetworkPolicyDomainSecretParam. - - :ivar domain: The domain associated with the secret. Required. - :vartype domain: str - :ivar name: The name of the secret to inject for the domain. Required. - :vartype name: str - :ivar value: The secret value to inject for the domain. Required. - :vartype value: str - """ - - domain: Required[str] - """The domain associated with the secret. Required.""" - name: Required[str] - """The name of the secret to inject for the domain. Required.""" - value: Required[str] - """The secret value to inject for the domain. Required.""" - - -class ContainerReferenceResource(TypedDict, total=False): - """Container Reference. - - :ivar type: The environment type. Always ``container_reference``. Required. - CONTAINER_REFERENCE. - :vartype type: Literal["container_reference"] - :ivar container_id: Required. - :vartype container_id: str - """ - - type: Required[Literal["container_reference"]] - """The environment type. Always ``container_reference``. Required. CONTAINER_REFERENCE.""" - container_id: Required[str] - """Required.""" - - -class ContextManagementParam(TypedDict, total=False): - """ContextManagementParam. - - :ivar type: The context management entry type. Currently only 'compaction' is supported. - Required. - :vartype type: str - :ivar compact_threshold: - :vartype compact_threshold: int - """ - - type: Required[str] - """The context management entry type. Currently only 'compaction' is supported. Required.""" - compact_threshold: Optional[int] - - -class ConversationParam_2(TypedDict, total=False): - """Conversation object. - - :ivar id: The unique ID of the conversation. Required. - :vartype id: str - """ - - id: Required[str] - """The unique ID of the conversation. Required.""" - - -class ConversationReference(TypedDict, total=False): - """Conversation. - - :ivar id: The unique ID of the conversation that this response was associated with. Required. - :vartype id: str - """ - - id: Required[str] - """The unique ID of the conversation that this response was associated with. Required.""" - - -class CoordParam(TypedDict, total=False): - """Coordinate. - - :ivar x: The x-coordinate. Required. - :vartype x: int - :ivar y: The y-coordinate. Required. - :vartype y: int - """ - - x: Required[int] - """The x-coordinate. Required.""" - y: Required[int] - """The y-coordinate. Required.""" - - -class CreateResponse(TypedDict, total=False): - """CreateResponse. - - :ivar metadata: - :vartype metadata: "Metadata" - :ivar top_logprobs: - :vartype top_logprobs: int - :ivar temperature: - :vartype temperature: float - :ivar top_p: - :vartype top_p: float - :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use - ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your - end-users. Used to boost cache hit rates by better bucketing similar requests and to help - OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers. - :vartype user: str - :ivar safety_identifier: - :vartype safety_identifier: str - :ivar prompt_cache_key: - :vartype prompt_cache_key: str - :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type. - :vartype prompt_cache_retention: Literal["in_memory", "24h"] - :ivar prompt_cache_options: - :vartype prompt_cache_options: "PromptCacheOptionsParam" - :ivar previous_response_id: - :vartype previous_response_id: str - :ivar model: The model deployment to use for the creation of this response. - :vartype model: str - :ivar background: - :vartype background: bool - :ivar max_tool_calls: - :vartype max_tool_calls: int - :ivar text: - :vartype text: "ResponseTextParam" - :ivar tools: - :vartype tools: list["Tool"] - :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. - :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] - :ivar prompt: - :vartype prompt: "Prompt" - :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], - Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"] - :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast", - "ultrafast"] - :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. - :vartype truncation: Literal["auto", "disabled"] - :ivar reasoning: - :vartype reasoning: "Reasoning" - :ivar input: Is either a str type or a [Item] type. - :vartype input: "_unions.InputParam" - :ivar include: - :vartype include: list[IncludeEnum] - :ivar parallel_tool_calls: - :vartype parallel_tool_calls: bool - :ivar store: - :vartype store: bool - :ivar instructions: - :vartype instructions: str - :ivar moderation: - :vartype moderation: "ModerationParam" - :ivar stream: - :vartype stream: bool - :ivar stream_options: - :vartype stream_options: "ResponseStreamOptions" - :ivar conversation: Is either a str type or a ConversationParam_2 type. - :vartype conversation: "_unions.ConversationParam" - :ivar context_management: Context management configuration for this request. - :vartype context_management: list["ContextManagementParam"] - :ivar max_output_tokens: - :vartype max_output_tokens: int - :ivar agent_reference: The agent to use for generating the response. - :vartype agent_reference: "AgentReference" - :ivar structured_inputs: The structured inputs to the response that can participate in prompt - template substitution or tool argument bindings. - :vartype structured_inputs: dict[str, Any] - """ - - metadata: Optional["Metadata"] - top_logprobs: Optional[int] - temperature: Optional[float] - top_p: Optional[float] - user: str - """This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use - ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your - end-users. Used to boost cache hit rates by better bucketing similar requests and to help - OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.""" - safety_identifier: Optional[str] - prompt_cache_key: Optional[str] - prompt_cache_retention: Optional[Literal["in_memory", "24h"]] - """Is either a Literal[\"in_memory\"] type or a Literal[\"24h\"] type.""" - prompt_cache_options: "PromptCacheOptionsParam" - previous_response_id: Optional[str] - model: str - """The model deployment to use for the creation of this response.""" - background: Optional[bool] - max_tool_calls: Optional[int] - text: "ResponseTextParam" - tools: list["Tool"] - tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] - """Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.""" - prompt: "Prompt" - service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast", "ultrafast"]] - """Is one of the following types: Literal[\"auto\"], Literal[\"default\"], Literal[\"flex\"], - Literal[\"scale\"], Literal[\"priority\"], Literal[\"fast\"], Literal[\"ultrafast\"]""" - truncation: Optional[Literal["auto", "disabled"]] - """Is either a Literal[\"auto\"] type or a Literal[\"disabled\"] type.""" - reasoning: Optional["Reasoning"] - input: "_unions.InputParam" - """Is either a str type or a [Item] type.""" - include: Optional[list[IncludeEnum]] - parallel_tool_calls: Optional[bool] - store: Optional[bool] - instructions: Optional[str] - moderation: Optional["ModerationParam"] - stream: Optional[bool] - stream_options: Optional["ResponseStreamOptions"] - conversation: Optional["_unions.ConversationParam"] - """Is either a str type or a ConversationParam_2 type.""" - context_management: Optional[list["ContextManagementParam"]] - """Context management configuration for this request.""" - max_output_tokens: Optional[int] - agent_reference: "AgentReference" - """The agent to use for generating the response.""" - structured_inputs: dict[str, Any] - """The structured inputs to the response that can participate in prompt template substitution or - tool argument bindings.""" - - -class CustomGrammarFormatParam(TypedDict, total=False): - """Grammar format. - - :ivar type: Grammar format. Always ``grammar``. Required. GRAMMAR. - :vartype type: Literal["grammar"] - :ivar syntax: The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. - Known values are: "lark" and "regex". - :vartype syntax: GrammarSyntax1 - :ivar definition: The grammar definition. Required. - :vartype definition: str - """ - - type: Required[Literal["grammar"]] - """Grammar format. Always ``grammar``. Required. GRAMMAR.""" - syntax: Required[GrammarSyntax1] - """The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. Known values are: - \"lark\" and \"regex\".""" - definition: Required[str] - """The grammar definition. Required.""" - - -class CustomTextFormatParam(TypedDict, total=False): - """Text format. - - :ivar type: Unconstrained text format. Always ``text``. Required. TEXT. - :vartype type: Literal["text"] - """ - - type: Required[Literal["text"]] - """Unconstrained text format. Always ``text``. Required. TEXT.""" - - -class CustomToolCallOutputResource(TypedDict, total=False): - """ResponseCustomToolCallOutputItem. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. - Required. CUSTOM_TOOL_CALL_OUTPUT. - :vartype type: Literal["custom_tool_call_output"] - :ivar id: The unique ID of the custom tool call output in the OpenAI platform. - :vartype id: str - :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. - Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar output: The output from the custom tool call generated by your code. Can be a string or - an list of output content. Required. Is either a str type or a - [FunctionAndCustomToolCallOutput] type. - :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Known values are: "in_progress", - "completed", and "incomplete". - :vartype status: FunctionCallOutputStatusEnum - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["custom_tool_call_output"]] - """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. - CUSTOM_TOOL_CALL_OUTPUT.""" - id: str - """The unique ID of the custom tool call output in the OpenAI platform.""" - call_id: Required[str] - """The call ID, used to map this custom tool call output to a custom tool call. Required.""" - caller: Optional["ToolCallCallerParam"] - output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] - """The output from the custom tool call generated by your code. Can be a string or an list of - output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" - status: Required[FunctionCallOutputStatusEnum] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Required. Known values are: \"in_progress\", \"completed\", - and \"incomplete\".""" - created_by: str - """The identifier of the actor that created the item.""" - - -class CustomToolCallResource(TypedDict, total=False): - """ResponseCustomToolCallItem. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. - CUSTOM_TOOL_CALL. - :vartype type: Literal["custom_tool_call"] - :ivar id: The unique ID of the custom tool call in the OpenAI platform. - :vartype id: str - :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar namespace: The namespace of the custom tool being called. - :vartype namespace: str - :ivar name: The name of the custom tool being called. Required. - :vartype name: str - :ivar input: The input for the custom tool call generated by the model. Required. - :vartype input: str - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Known values are: "in_progress", - "completed", and "incomplete". - :vartype status: FunctionCallStatus - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["custom_tool_call"]] - """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" - id: str - """The unique ID of the custom tool call in the OpenAI platform.""" - call_id: Required[str] - """An identifier used to map this custom tool call to a tool call output. Required.""" - caller: Optional["ToolCallCaller"] - namespace: str - """The namespace of the custom tool being called.""" - name: Required[str] - """The name of the custom tool being called. Required.""" - input: Required[str] - """The input for the custom tool call generated by the model. Required.""" - status: Required[FunctionCallStatus] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Required. Known values are: \"in_progress\", \"completed\", - and \"incomplete\".""" - created_by: str - """The identifier of the actor that created the item.""" - - -class CustomToolParam(TypedDict, total=False): - """Custom tool. - - :ivar type: The type of the custom tool. Always ``custom``. Required. CUSTOM. - :vartype type: Literal["custom"] - :ivar name: The name of the custom tool, used to identify it in tool calls. Required. - :vartype name: str - :ivar description: Optional description of the custom tool, used to provide more context. - :vartype description: str - :ivar format: The input format for the custom tool. Default is unconstrained text. - :vartype format: "CustomToolParamFormat" - :ivar defer_loading: Whether this tool should be deferred and discovered via tool search. - :vartype defer_loading: bool - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - """ - - type: Required[Literal["custom"]] - """The type of the custom tool. Always ``custom``. Required. CUSTOM.""" - name: Required[str] - """The name of the custom tool, used to identify it in tool calls. Required.""" - description: str - """Optional description of the custom tool, used to provide more context.""" - format: "CustomToolParamFormat" - """The input format for the custom tool. Default is unconstrained text.""" - defer_loading: bool - """Whether this tool should be deferred and discovered via tool search.""" - allowed_callers: Optional[list[CallableToolAllowedCaller]] - - -class DeleteResponseResult(TypedDict, total=False): - """The result of a delete response operation. - - :ivar id: The operation ID. Required. - :vartype id: str - :ivar deleted: Always return true. Required. Default value is True. - :vartype deleted: Literal[True] - :ivar object: Required. Default value is "response". - :vartype object: Literal["response"] - """ - - id: Required[str] - """The operation ID. Required.""" - deleted: Required[Literal[True]] - """Always return true. Required. Default value is True.""" - object: Required[Literal["response"]] - """Required. Default value is \"response\".""" - - -class DirectToolCallCaller(TypedDict, total=False): - """DirectToolCallCaller. - - :ivar type: Required. DIRECT. - :vartype type: Literal["direct"] - """ - - type: Required[Literal["direct"]] - """Required. DIRECT.""" - - -class DirectToolCallCallerParam(TypedDict, total=False): - """DirectToolCallCallerParam. - - :ivar type: The caller type. Always ``direct``. Required. DIRECT. - :vartype type: Literal["direct"] - """ - - type: Required[Literal["direct"]] - """The caller type. Always ``direct``. Required. DIRECT.""" - - -class DoubleClickAction(TypedDict, total=False): - """DoubleClick. - - :ivar type: Specifies the event type. For a double click action, this property is always set to - ``double_click``. Required. DOUBLE_CLICK. - :vartype type: Literal["double_click"] - :ivar x: The x-coordinate where the double click occurred. Required. - :vartype x: int - :ivar y: The y-coordinate where the double click occurred. Required. - :vartype y: int - :ivar keys: Required. - :vartype keys: list[str] - """ - - type: Required[Literal["double_click"]] - """Specifies the event type. For a double click action, this property is always set to - ``double_click``. Required. DOUBLE_CLICK.""" - x: Required[int] - """The x-coordinate where the double click occurred. Required.""" - y: Required[int] - """The y-coordinate where the double click occurred. Required.""" - keys: Required[Optional[list[str]]] - """Required.""" - - -class DragParam(TypedDict, total=False): - """Drag. - - :ivar type: Specifies the event type. For a drag action, this property is always set to - ``drag``. Required. DRAG. - :vartype type: Literal["drag"] - :ivar path: Required. An array of coordinates representing the path of the drag action. - Coordinates will appear as an array of objects, eg - - .. code-block:: - - [ - { x: 100, y: 200 }, - { x: 200, y: 300 } - ] - :vartype path: list["CoordParam"] - :ivar keys: - :vartype keys: list[str] - """ - - type: Required[Literal["drag"]] - """Specifies the event type. For a drag action, this property is always set to ``drag``. Required. - DRAG.""" - path: Required[list["CoordParam"]] - """Required. An array of coordinates representing the path of the drag action. Coordinates will - appear as an array of objects, eg - - .. code-block:: - - [ - { x: 100, y: 200 }, - { x: 200, y: 300 } - ]""" - keys: Optional[list[str]] - - -class EmptyModelParam(TypedDict, total=False): - """EmptyModelParam.""" - - -class Error(TypedDict, total=False): - """Error. - - :ivar code: Required. - :vartype code: str - :ivar message: Required. - :vartype message: str - :ivar param: - :vartype param: str - :ivar type: - :vartype type: str - :ivar details: - :vartype details: list["Error"] - :ivar additionalInfo: - :vartype additionalInfo: dict[str, Any] - :ivar debugInfo: - :vartype debugInfo: dict[str, Any] - """ - - code: Required[Optional[str]] - """Required.""" - message: Required[str] - """Required.""" - param: Optional[str] - type: str - details: list["Error"] - additionalInfo: dict[str, Any] - debugInfo: dict[str, Any] - - -class FabricDataAgentToolCall(TypedDict, total=False): - """A Fabric data agent tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL. - :vartype type: Literal["fabric_dataagent_preview_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["fabric_dataagent_preview_call"]] - """Required. FABRIC_DATAAGENT_PREVIEW_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class FabricDataAgentToolCallOutput(TypedDict, total=False): - """The output of a Fabric data agent tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT. - :vartype type: Literal["fabric_dataagent_preview_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar output: The output from the Fabric data agent tool call. Is one of the following types: - {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["fabric_dataagent_preview_call_output"]] - """Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the Fabric data agent tool call. Is one of the following types: {str: Any}, - str, [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class FabricDataAgentToolParameters(TypedDict, total=False): - """The fabric data agent tool parameters. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connections: The project connections attached to this tool. There can be a - maximum of 1 connection resource attached to the tool. - :vartype project_connections: list["ToolProjectConnection"] - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connections: list["ToolProjectConnection"] - """The project connections attached to this tool. There can be a maximum of 1 connection resource - attached to the tool.""" - - -class FileCitationBody(TypedDict, total=False): - """File citation. - - :ivar type: The type of the file citation. Always ``file_citation``. Required. FILE_CITATION. - :vartype type: Literal["file_citation"] - :ivar file_id: The ID of the file. Required. - :vartype file_id: str - :ivar index: The index of the file in the list of files. Required. - :vartype index: int - :ivar filename: The filename of the file cited. Required. - :vartype filename: str - """ - - type: Required[Literal["file_citation"]] - """The type of the file citation. Always ``file_citation``. Required. FILE_CITATION.""" - file_id: Required[str] - """The ID of the file. Required.""" - index: Required[int] - """The index of the file in the list of files. Required.""" - filename: Required[str] - """The filename of the file cited. Required.""" - - -class FilePath(TypedDict, total=False): - """File path. - - :ivar type: The type of the file path. Always ``file_path``. Required. FILE_PATH. - :vartype type: Literal["file_path"] - :ivar file_id: The ID of the file. Required. - :vartype file_id: str - :ivar index: The index of the file in the list of files. Required. - :vartype index: int - """ - - type: Required[Literal["file_path"]] - """The type of the file path. Always ``file_path``. Required. FILE_PATH.""" - file_id: Required[str] - """The ID of the file. Required.""" - index: Required[int] - """The index of the file in the list of files. Required.""" - - -class FileSearchTool(TypedDict, total=False): - """File search. - - :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. - :vartype type: Literal["file_search"] - :ivar vector_store_ids: The IDs of the vector stores to search. Required. - :vartype vector_store_ids: list[str] - :ivar max_num_results: The maximum number of results to return. This number should be between 1 - and 50 inclusive. - :vartype max_num_results: int - :ivar ranking_options: Ranking options for search. - :vartype ranking_options: "RankingOptions" - :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. - :vartype filters: "_unions.Filters" - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - """ - - type: Required[Literal["file_search"]] - """The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.""" - vector_store_ids: Required[list[str]] - """The IDs of the vector stores to search. Required.""" - max_num_results: int - """The maximum number of results to return. This number should be between 1 and 50 inclusive.""" - ranking_options: "RankingOptions" - """Ranking options for search.""" - filters: Optional["_unions.Filters"] - """Is either a ComparisonFilter type or a CompoundFilter type.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - - -class FileSearchToolCallResults(TypedDict, total=False): - """FileSearchToolCallResults. - - :ivar file_id: - :vartype file_id: str - :ivar text: - :vartype text: str - :ivar filename: - :vartype filename: str - :ivar attributes: - :vartype attributes: "VectorStoreFileAttributes" - :ivar score: - :vartype score: float - """ - - file_id: str - text: str - filename: str - attributes: Optional["VectorStoreFileAttributes"] - score: float - - -class FunctionAndCustomToolCallOutputInputFileContent(TypedDict, total=False): # pylint: disable=name-too-long - """Input file. - - :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. - :vartype type: Literal["input_file"] - :ivar file_id: - :vartype file_id: str - :ivar filename: The name of the file to be sent to the model. - :vartype filename: str - :ivar file_data: The content of the file to be sent to the model. - :vartype file_data: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - :ivar file_url: The URL of the file to be sent to the model. - :vartype file_url: str - :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the - system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality - rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or - ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", - "low", and "high". - :vartype detail: FileInputDetail - """ - - type: Required[Literal["input_file"]] - """The type of the input item. Always ``input_file``. Required. INPUT_FILE.""" - file_id: Optional[str] - filename: str - """The name of the file to be sent to the model.""" - file_data: str - """The content of the file to be sent to the model.""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - file_url: str - """The URL of the file to be sent to the model.""" - detail: FileInputDetail - """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the - detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may - increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the - file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and - \"high\".""" - - -class FunctionAndCustomToolCallOutputInputImageContent(TypedDict, total=False): # pylint: disable=name-too-long - """Input image. - - :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. - :vartype type: Literal["input_image"] - :ivar image_url: - :vartype image_url: str - :ivar file_id: - :vartype file_id: str - :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, - ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", - "auto", and "original". - :vartype detail: ImageDetail - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["input_image"]] - """The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.""" - image_url: Optional[str] - file_id: Optional[str] - detail: Required[ImageDetail] - """The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or - ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", \"auto\", - and \"original\".""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class FunctionAndCustomToolCallOutputInputTextContent(TypedDict, total=False): # pylint: disable=name-too-long - """Input text. - - :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. - :vartype type: Literal["input_text"] - :ivar text: The text input to the model. Required. - :vartype text: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["input_text"]] - """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" - text: Required[str] - """The text input to the model. Required.""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class FunctionCallOutputItemParam(TypedDict, total=False): - """Function tool call output. - - :ivar id: - :vartype id: str - :ivar call_id: - :vartype call_id: str - :ivar type: The type of the function tool call output. Always ``function_call_output``. - Required. FUNCTION_CALL_OUTPUT. - :vartype type: Literal["function_call_output"] - :ivar output: Text, image, or file output of the function tool call. Required. Is either a str - type or a [Union["_types.InputTextContentParam", "_types.InputImageContentParamAutoParam", - "_types.InputFileContentParam"]] type. - :vartype output: Union[str, list[Union["InputTextContentParam", - "InputImageContentParamAutoParam", "InputFileContentParam"]]] - :ivar name: - :vartype name: str - :ivar namespace: - :vartype namespace: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar status: Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallItemStatus - """ - - id: Optional[str] - call_id: Optional[str] - type: Required[Literal["function_call_output"]] - """The type of the function tool call output. Always ``function_call_output``. Required. - FUNCTION_CALL_OUTPUT.""" - output: Required[ - Union[str, list[Union["InputTextContentParam", "InputImageContentParamAutoParam", "InputFileContentParam"]]] + ContainerNetworkPolicyParamType = Literal["disabled", "allowlist"] + """Type of ContainerNetworkPolicyParamType.""" + + ContainerSkillType = Literal["skill_reference", "inline"] + """Type of ContainerSkillType.""" + + CustomToolParamFormatType = Literal["text", "grammar"] + """Type of CustomToolParamFormatType.""" + + DetailEnum = Literal["low", "high", "auto", "original"] + """Type of DetailEnum.""" + + FileInputDetail = Literal["auto", "low", "high"] + """Type of FileInputDetail.""" + + FunctionAndCustomToolCallOutputType = Literal["input_text", "input_image", "input_file"] + """Type of FunctionAndCustomToolCallOutputType.""" + + FunctionCallItemStatus = Literal["in_progress", "completed", "incomplete"] + """Type of FunctionCallItemStatus.""" + + FunctionCallOutputStatusEnum = Literal["in_progress", "completed", "incomplete"] + """Type of FunctionCallOutputStatusEnum.""" + + FunctionCallStatus = Literal["in_progress", "completed", "incomplete"] + """Type of FunctionCallStatus.""" + + FunctionShellCallEnvironmentType = Literal["local", "container_reference"] + """Type of FunctionShellCallEnvironmentType.""" + + FunctionShellCallItemParamEnvironmentType = Literal["local", "container_reference"] + """Type of FunctionShellCallItemParamEnvironmentType.""" + + FunctionShellCallItemStatus = Literal["in_progress", "completed", "incomplete"] + """Shell call status.""" + + FunctionShellCallOutputOutcomeParamType = Literal["timeout", "exit"] + """Type of FunctionShellCallOutputOutcomeParamType.""" + + FunctionShellCallOutputOutcomeType = Literal["timeout", "exit"] + """Type of FunctionShellCallOutputOutcomeType.""" + + FunctionShellCallOutputStatusEnum = Literal["in_progress", "completed", "incomplete"] + """Type of FunctionShellCallOutputStatusEnum.""" + + FunctionShellCallStatus = Literal["in_progress", "completed", "incomplete"] + """Type of FunctionShellCallStatus.""" + + FunctionShellToolParamEnvironmentType = Literal["container_auto", "local", "container_reference"] + """Type of FunctionShellToolParamEnvironmentType.""" + + GrammarSyntax1 = Literal["lark", "regex"] + """Type of GrammarSyntax1.""" + + ImageDetail = Literal["low", "high", "auto", "original"] + """Type of ImageDetail.""" + + ImageGenActionEnum = Literal["generate", "edit", "auto"] + """Type of ImageGenActionEnum.""" + + IncludeEnum = Literal[ + "file_search_call.results", + "web_search_call.results", + "web_search_call.action.sources", + "message.input_image.image_url", + "computer_call_output.output.image_url", + "code_interpreter_call.outputs", + "reasoning.encrypted_content", + "message.output_text.logprobs", + "memory_search_call.results", + ] + """Specify additional output data to include in the model response. Currently supported values + are: + + * `web_search_call.results`: Include the search results of the web search tool call. + * `web_search_call.action.sources`: Include the sources of the web search tool call. + * `code_interpreter_call.outputs`: Includes the outputs of python code execution in code + interpreter tool call items. + * `computer_call_output.output.image_url`: Include image urls from the computer call output. + * `file_search_call.results`: Include the search results of the file search tool call. + * `message.input_image.image_url`: Include image urls from the input message. + * `message.output_text.logprobs`: Include logprobs with assistant messages. + * `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning + item outputs. This enables reasoning items to be used in multi-turn conversations when using + the Responses API statelessly (like when the `store` parameter is set to `false`, or when an + organization is enrolled in the zero data retention program).""" + + InputFidelity = Literal["high", "low"] + """Control how much effort the model will exert to match the style and features, especially facial + features, of input images. This parameter is only supported for ``gpt-image-1`` and + ``gpt-image-1.5`` and later models, unsupported for ``gpt-image-1-mini``. Supports ``high`` and + ``low``. Defaults to ``low``.""" + + ItemFieldType = Literal[ + "message", + "program", + "program_output", + "function_call", + "tool_search_call", + "tool_search_output", + "additional_tools", + "function_call_output", + "file_search_call", + "web_search_call", + "image_generation_call", + "computer_call", + "computer_call_output", + "reasoning", + "compaction", + "code_interpreter_call", + "local_shell_call", + "local_shell_call_output", + "shell_call", + "shell_call_output", + "apply_patch_call", + "apply_patch_call_output", + "mcp_list_tools", + "mcp_approval_request", + "mcp_approval_response", + "mcp_call", + "custom_tool_call", + "custom_tool_call_output", + ] + """Type of ItemFieldType.""" + + ItemType = Literal[ + "message", + "output_message", + "file_search_call", + "computer_call", + "computer_call_output", + "web_search_call", + "function_call", + "function_call_output", + "tool_search_call", + "tool_search_output", + "additional_tools", + "reasoning", + "compaction", + "image_generation_call", + "code_interpreter_call", + "local_shell_call", + "local_shell_call_output", + "shell_call", + "shell_call_output", + "apply_patch_call", + "apply_patch_call_output", + "mcp_list_tools", + "mcp_approval_request", + "mcp_approval_response", + "mcp_call", + "custom_tool_call_output", + "custom_tool_call", + "item_reference", + "structured_outputs", + "oauth_consent_request", + "memory_search_call", + "workflow_action", + "a2a_preview_call", + "a2a_preview_call_output", + "bing_grounding_call", + "bing_grounding_call_output", + "sharepoint_grounding_preview_call", + "sharepoint_grounding_preview_call_output", + "azure_ai_search_call", + "azure_ai_search_call_output", + "bing_custom_search_preview_call", + "bing_custom_search_preview_call_output", + "openapi_call", + "openapi_call_output", + "browser_automation_preview_call", + "browser_automation_preview_call_output", + "fabric_dataagent_preview_call", + "fabric_dataagent_preview_call_output", + "azure_function_call", + "azure_function_call_output", + ] + """Type of ItemType.""" + + MCPToolCallStatus = Literal["in_progress", "completed", "incomplete", "calling", "failed"] + """Type of MCPToolCallStatus.""" + + MemoryItemKind = Literal["user_profile", "chat_summary"] + """Memory item kind.""" + + MessageContentType = Literal[ + "input_text", + "output_text", + "text", + "summary_text", + "reasoning_text", + "refusal", + "input_image", + "computer_screenshot", + "input_file", + ] + """Type of MessageContentType.""" + + MessagePhase = Literal["commentary", "final_answer"] + """Labels an ``assistant`` message as intermediate commentary (``commentary``) or the final answer + (``final_answer``). For models like ``gpt-5.3-codex`` and beyond, when sending follow-up + requests, preserve and resend phase on all assistant messages — dropping it can degrade + performance. Not used for user messages.""" + + MessageRole = Literal["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"] + """Type of MessageRole.""" + + MessageStatus = Literal["in_progress", "completed", "incomplete"] + """Type of MessageStatus.""" + + ModelIdsCompaction = Literal[ + "gpt-5.6-sol", + "gpt-5.6-terra", + "gpt-5.6-luna", + "gpt-5.5", + "gpt-5.5-2026-04-23", + "gpt-5.4", + "gpt-5.4-mini", + "gpt-5.4-nano", + "gpt-5.4-mini-2026-03-17", + "gpt-5.4-nano-2026-03-17", + "gpt-5.3-chat-latest", + "gpt-5.2", + "gpt-5.2-2025-12-11", + "gpt-5.2-chat-latest", + "gpt-5.2-pro", + "gpt-5.2-pro-2025-12-11", + "gpt-5.1", + "gpt-5.1-2025-11-13", + "gpt-5.1-codex", + "gpt-5.1-mini", + "gpt-5.1-chat-latest", + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "gpt-5-2025-08-07", + "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", + "gpt-5-chat-latest", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-4.1-2025-04-14", + "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", + "o4-mini", + "o4-mini-2025-04-16", + "o3", + "o3-2025-04-16", + "o3-mini", + "o3-mini-2025-01-31", + "o1", + "o1-2024-12-17", + "o1-preview", + "o1-preview-2024-09-12", + "o1-mini", + "o1-mini-2024-09-12", + "gpt-4o", + "gpt-4o-2024-11-20", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", + "gpt-4o-audio-preview-2024-10-01", + "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", + "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", + "gpt-4o-search-preview", + "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", + "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", + "codex-mini-latest", + "gpt-4o-mini", + "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", + "gpt-4-turbo-2024-04-09", + "gpt-4-0125-preview", + "gpt-4-turbo-preview", + "gpt-4-1106-preview", + "gpt-4-vision-preview", + "gpt-4", + "gpt-4-0314", + "gpt-4-0613", + "gpt-4-32k", + "gpt-4-32k-0314", + "gpt-4-32k-0613", + "gpt-3.5-turbo", + "gpt-3.5-turbo-16k", + "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", + "gpt-3.5-turbo-1106", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-16k-0613", + "o1-pro", + "o1-pro-2025-03-19", + "o3-pro", + "o3-pro-2025-06-10", + "o3-deep-research", + "o3-deep-research-2025-06-26", + "o4-mini-deep-research", + "o4-mini-deep-research-2025-06-26", + "computer-use-preview", + "computer-use-preview-2025-03-11", + "gpt-5.5-pro", + "gpt-5.5-pro-2026-04-23", + "gpt-5-codex", + "gpt-5-pro", + "gpt-5-pro-2025-10-06", + "gpt-5.1-codex-max", + "gpt-daybreak-blue-latest", + "gpt-daybreak-red-latest", + "gpt-5.6-cyber", + ] + """Model ID used to generate the response, like ``gpt-5`` or ``o3``. OpenAI offers a wide range of + models with different capabilities, performance characteristics, and price points. Refer to the + `model guide `_ to browse and compare available models.""" + + ModerationEntryType = Literal["moderation_result", "error"] + """Type of ModerationEntryType.""" + + ModerationInputType = Literal["text", "image"] + """Type of ModerationInputType.""" + + ModerationMode = Literal["score", "block"] + """Type of ModerationMode.""" + + OpenApiAuthType = Literal["anonymous", "project_connection", "managed_identity"] + """Authentication type for OpenApi endpoint. Allowed types are: + + * Anonymous (no authentication required) + * Project Connection (requires project_connection_id to endpoint, as setup in AI Foundry) + * Managed_Identity (requires audience for identity based auth).""" + + OutputContentType = Literal["output_text", "refusal", "reasoning_text"] + """Type of OutputContentType.""" + + OutputItemType = Literal[ + "output_message", + "file_search_call", + "function_call", + "function_call_output", + "web_search_call", + "computer_call", + "computer_call_output", + "reasoning", + "program", + "program_output", + "tool_search_call", + "tool_search_output", + "additional_tools", + "compaction", + "image_generation_call", + "code_interpreter_call", + "local_shell_call", + "local_shell_call_output", + "shell_call", + "shell_call_output", + "apply_patch_call", + "apply_patch_call_output", + "mcp_call", + "mcp_list_tools", + "mcp_approval_request", + "mcp_approval_response", + "custom_tool_call", + "custom_tool_call_output", + "message", + "structured_outputs", + "oauth_consent_request", + "memory_search_call", + "workflow_action", + "a2a_preview_call", + "a2a_preview_call_output", + "bing_grounding_call", + "bing_grounding_call_output", + "sharepoint_grounding_preview_call", + "sharepoint_grounding_preview_call_output", + "azure_ai_search_call", + "azure_ai_search_call_output", + "bing_custom_search_preview_call", + "bing_custom_search_preview_call_output", + "openapi_call", + "openapi_call_output", + "browser_automation_preview_call", + "browser_automation_preview_call_output", + "fabric_dataagent_preview_call", + "fabric_dataagent_preview_call_output", + "azure_function_call", + "azure_function_call_output", + ] + """Type of OutputItemType.""" + + OutputMessageContentType = Literal["output_text", "refusal"] + """Type of OutputMessageContentType.""" + + PageOrder = Literal["asc", "desc"] + """Type of PageOrder.""" + + ProgramOutputStatus = Literal["completed", "incomplete"] + """Type of ProgramOutputStatus.""" + + PromptCacheModeEnum = Literal["implicit", "explicit"] + """Type of PromptCacheModeEnum.""" + + PromptCacheRetentionEnum = Literal["in_memory", "24h"] + """Type of PromptCacheRetentionEnum.""" + + PromptCacheTTLEnum = Literal["30m"] + """Type of PromptCacheTTLEnum.""" + + RankerVersionType = Literal["auto", "default-2024-11-15"] + """Type of RankerVersionType.""" + + RealtimeMcpErrorType = Literal["protocol_error", "tool_execution_error", "http_error"] + """Type of RealtimeMcpErrorType.""" + + ReasoningEffort = Literal["none", "minimal", "low", "medium", "high", "xhigh", "max"] + """Constrains effort on reasoning for reasoning models. Currently supported values are ``none``, + ``minimal``, ``low``, ``medium``, ``high``, ``xhigh``, and ``max``. Reducing reasoning effort + can result in faster responses and fewer tokens used on reasoning in a response. Not all + reasoning models support every value. See the `reasoning guide + `_ for model-specific support.""" + + ReasoningModeEnum = Literal["standard", "pro"] + """Type of ReasoningModeEnum.""" + + ResponseErrorCode = Literal[ + "server_error", + "rate_limit_exceeded", + "invalid_prompt", + "data_residency_mismatch", + "bio_policy", + "vector_store_timeout", + "invalid_image", + "invalid_image_format", + "invalid_base64_image", + "invalid_image_url", + "image_too_large", + "image_too_small", + "image_parse_error", + "image_content_policy_violation", + "invalid_image_mode", + "image_file_too_large", + "unsupported_image_media_type", + "empty_image_file", + "failed_to_download_image", + "image_file_not_found", ] - """Text, image, or file output of the function tool call. Required. Is either a str type or a - [Union[\"_types.InputTextContentParam\", \"_types.InputImageContentParamAutoParam\", - \"_types.InputFileContentParam\"]] type.""" - name: Optional[str] - namespace: Optional[str] - caller: Optional["ToolCallCallerParam"] - status: Optional[FunctionCallItemStatus] - """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - - -class FunctionShellAction(TypedDict, total=False): - """Shell exec action. - - :ivar commands: Required. - :vartype commands: list[str] - :ivar timeout_ms: Required. - :vartype timeout_ms: int - :ivar max_output_length: Required. - :vartype max_output_length: int - """ - - commands: Required[list[str]] - """Required.""" - timeout_ms: Required[Optional[int]] - """Required.""" - max_output_length: Required[Optional[int]] - """Required.""" - - -class FunctionShellActionParam(TypedDict, total=False): - """Shell action. - - :ivar commands: Ordered shell commands for the execution environment to run. Required. - :vartype commands: list[str] - :ivar timeout_ms: - :vartype timeout_ms: int - :ivar max_output_length: - :vartype max_output_length: int - """ - - commands: Required[list[str]] - """Ordered shell commands for the execution environment to run. Required.""" - timeout_ms: Optional[int] - max_output_length: Optional[int] - - -class FunctionShellCallItemParam(TypedDict, total=False): - """Shell tool call. - - :ivar id: - :vartype id: str - :ivar call_id: The unique ID of the shell tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. - :vartype type: Literal["shell_call"] - :ivar action: The shell commands and limits that describe how to run the tool call. Required. - :vartype action: "FunctionShellActionParam" - :ivar status: Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionShellCallItemStatus - :ivar environment: - :vartype environment: "FunctionShellCallItemParamEnvironment" - """ - - id: Optional[str] - call_id: Required[str] - """The unique ID of the shell tool call generated by the model. Required.""" - caller: Optional["ToolCallCallerParam"] - type: Required[Literal["shell_call"]] - """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" - action: Required["FunctionShellActionParam"] - """The shell commands and limits that describe how to run the tool call. Required.""" - status: Optional[FunctionShellCallItemStatus] - """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - environment: Optional["FunctionShellCallItemParamEnvironment"] - - -class FunctionShellCallItemParamEnvironmentContainerReferenceParam( - TypedDict, total=False -): # pylint: disable=name-too-long - """FunctionShellCallItemParamEnvironmentContainerReferenceParam. - - :ivar type: References a container created with the /v1/containers endpoint. Required. - CONTAINER_REFERENCE. - :vartype type: Literal["container_reference"] - :ivar container_id: The ID of the referenced container. Required. - :vartype container_id: str - """ - - type: Required[Literal["container_reference"]] - """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" - container_id: Required[str] - """The ID of the referenced container. Required.""" - - -class FunctionShellCallItemParamEnvironmentLocalEnvironmentParam( - TypedDict, total=False -): # pylint: disable=name-too-long - """FunctionShellCallItemParamEnvironmentLocalEnvironmentParam. - - :ivar type: Use a local computer environment. Required. LOCAL. - :vartype type: Literal["local"] - :ivar skills: An optional list of skills. - :vartype skills: list["LocalSkillParam"] - """ - - type: Required[Literal["local"]] - """Use a local computer environment. Required. LOCAL.""" - skills: list["LocalSkillParam"] - """An optional list of skills.""" - - -class FunctionShellCallOutputContent(TypedDict, total=False): - """Shell call output content. - - :ivar stdout: The standard output that was captured. Required. - :vartype stdout: str - :ivar stderr: The standard error output that was captured. Required. - :vartype stderr: str - :ivar outcome: Shell call outcome. Required. - :vartype outcome: "FunctionShellCallOutputOutcome" - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - stdout: Required[str] - """The standard output that was captured. Required.""" - stderr: Required[str] - """The standard error output that was captured. Required.""" - outcome: Required["FunctionShellCallOutputOutcome"] - """Shell call outcome. Required.""" - created_by: str - """The identifier of the actor that created the item.""" - - -class FunctionShellCallOutputContentParam(TypedDict, total=False): - """Shell output content. - - :ivar stdout: Captured stdout output for the shell call. Required. - :vartype stdout: str - :ivar stderr: Captured stderr output for the shell call. Required. - :vartype stderr: str - :ivar outcome: The exit or timeout outcome associated with this shell call. Required. - :vartype outcome: "FunctionShellCallOutputOutcomeParam" - """ - - stdout: Required[str] - """Captured stdout output for the shell call. Required.""" - stderr: Required[str] - """Captured stderr output for the shell call. Required.""" - outcome: Required["FunctionShellCallOutputOutcomeParam"] - """The exit or timeout outcome associated with this shell call. Required.""" - - -class FunctionShellCallOutputExitOutcome(TypedDict, total=False): - """Shell call exit outcome. - - :ivar type: The outcome type. Always ``exit``. Required. EXIT. - :vartype type: Literal["exit"] - :ivar exit_code: Exit code from the shell process. Required. - :vartype exit_code: int - """ - - type: Required[Literal["exit"]] - """The outcome type. Always ``exit``. Required. EXIT.""" - exit_code: Required[int] - """Exit code from the shell process. Required.""" - - -class FunctionShellCallOutputExitOutcomeParam(TypedDict, total=False): - """Shell call exit outcome. - - :ivar type: The outcome type. Always ``exit``. Required. EXIT. - :vartype type: Literal["exit"] - :ivar exit_code: The exit code returned by the shell process. Required. - :vartype exit_code: int - """ - - type: Required[Literal["exit"]] - """The outcome type. Always ``exit``. Required. EXIT.""" - exit_code: Required[int] - """The exit code returned by the shell process. Required.""" - - -class FunctionShellCallOutputItemParam(TypedDict, total=False): - """Shell tool call output. - - :ivar id: - :vartype id: str - :ivar call_id: The unique ID of the shell tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar type: The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT. - :vartype type: Literal["shell_call_output"] - :ivar output: Captured chunks of stdout and stderr output, along with their associated - outcomes. Required. - :vartype output: list["FunctionShellCallOutputContentParam"] - :ivar status: Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionShellCallItemStatus - :ivar max_output_length: - :vartype max_output_length: int - """ - - id: Optional[str] - call_id: Required[str] - """The unique ID of the shell tool call generated by the model. Required.""" - caller: Optional["ToolCallCallerParam"] - type: Required[Literal["shell_call_output"]] - """The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" - output: Required[list["FunctionShellCallOutputContentParam"]] - """Captured chunks of stdout and stderr output, along with their associated outcomes. Required.""" - status: Optional[FunctionShellCallItemStatus] - """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - max_output_length: Optional[int] - - -class FunctionShellCallOutputTimeoutOutcome(TypedDict, total=False): - """Shell call timeout outcome. - - :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. - :vartype type: Literal["timeout"] - """ - - type: Required[Literal["timeout"]] - """The outcome type. Always ``timeout``. Required. TIMEOUT.""" - - -class FunctionShellCallOutputTimeoutOutcomeParam(TypedDict, total=False): # pylint: disable=name-too-long - """Shell call timeout outcome. - - :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. - :vartype type: Literal["timeout"] - """ - - type: Required[Literal["timeout"]] - """The outcome type. Always ``timeout``. Required. TIMEOUT.""" - - -class FunctionShellToolParam(TypedDict, total=False): - """Shell tool. - - :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. - :vartype type: Literal["shell"] - :ivar environment: - :vartype environment: "FunctionShellToolParamEnvironment" - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - """ - - type: Required[Literal["shell"]] - """The type of the shell tool. Always ``shell``. Required. SHELL.""" - environment: Optional["FunctionShellToolParamEnvironment"] - allowed_callers: Optional[list[CallableToolAllowedCaller]] - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - - -class FunctionShellToolParamEnvironmentContainerReferenceParam(TypedDict, total=False): # pylint: disable=name-too-long - """FunctionShellToolParamEnvironmentContainerReferenceParam. - - :ivar type: References a container created with the /v1/containers endpoint. Required. - CONTAINER_REFERENCE. - :vartype type: Literal["container_reference"] - :ivar container_id: The ID of the referenced container. Required. - :vartype container_id: str - """ - - type: Required[Literal["container_reference"]] - """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" - container_id: Required[str] - """The ID of the referenced container. Required.""" - - -class FunctionShellToolParamEnvironmentLocalEnvironmentParam(TypedDict, total=False): # pylint: disable=name-too-long - """FunctionShellToolParamEnvironmentLocalEnvironmentParam. - - :ivar type: Use a local computer environment. Required. LOCAL. - :vartype type: Literal["local"] - :ivar skills: An optional list of skills. - :vartype skills: list["LocalSkillParam"] - """ - - type: Required[Literal["local"]] - """Use a local computer environment. Required. LOCAL.""" - skills: list["LocalSkillParam"] - """An optional list of skills.""" - - -class FunctionTool(TypedDict, total=False): - """Function. - - :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. - :vartype type: Literal["function"] - :ivar name: The name of the function to call. Required. - :vartype name: str - :ivar description: - :vartype description: str - :ivar parameters: Required. - :vartype parameters: dict[str, Any] - :ivar output_schema: - :vartype output_schema: dict[str, Any] - :ivar strict: Required. - :vartype strict: bool - :ivar defer_loading: Whether this function is deferred and loaded via tool search. - :vartype defer_loading: bool - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - """ - - type: Required[Literal["function"]] - """The type of the function tool. Always ``function``. Required. FUNCTION.""" - name: Required[str] - """The name of the function to call. Required.""" - description: Optional[str] - parameters: Required[Optional[dict[str, Any]]] - """Required.""" - output_schema: Optional[dict[str, Any]] - strict: Required[Optional[bool]] - """Required.""" - defer_loading: bool - """Whether this function is deferred and loaded via tool search.""" - allowed_callers: Optional[list[CallableToolAllowedCaller]] - - -class FunctionToolParam(TypedDict, total=False): - """FunctionToolParam. - - :ivar name: Required. - :vartype name: str - :ivar description: - :vartype description: str - :ivar parameters: - :vartype parameters: "EmptyModelParam" - :ivar strict: - :vartype strict: bool - :ivar type: Required. Default value is "function". - :vartype type: Literal["function"] - :ivar output_schema: - :vartype output_schema: dict[str, Any] - :ivar defer_loading: Whether this function should be deferred and discovered via tool search. - :vartype defer_loading: bool - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - """ - - name: Required[str] - """Required.""" - description: Optional[str] - parameters: Optional["EmptyModelParam"] - strict: Optional[bool] - type: Required[Literal["function"]] - """Required. Default value is \"function\".""" - output_schema: Optional[dict[str, Any]] - defer_loading: bool - """Whether this function should be deferred and discovered via tool search.""" - allowed_callers: Optional[list[CallableToolAllowedCaller]] - - -class HybridSearchOptions(TypedDict, total=False): - """HybridSearchOptions. - - :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required. - :vartype embedding_weight: float - :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required. - :vartype text_weight: float - """ - - embedding_weight: Required[float] - """The weight of the embedding in the reciprocal ranking fusion. Required.""" - text_weight: Required[float] - """The weight of the text in the reciprocal ranking fusion. Required.""" - - -class ImageGenTool(TypedDict, total=False): - """Image generation tool. - - :ivar type: The type of the image generation tool. Always ``image_generation``. Required. - IMAGE_GENERATION. - :vartype type: Literal["image_generation"] - :ivar model: Is one of the following types: Literal["gpt-image-1"], - Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str - :vartype model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], - Literal["gpt-image-1.5"], str] - :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or - ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"], - Literal["high"], Literal["auto"] - :vartype quality: Literal["low", "medium", "high", "auto"] - :ivar size: The size of the generated images. For ``gpt-image-2`` and - ``gpt-image-2-2026-04-21``, arbitrary resolutions are supported as ``WIDTHxHEIGHT`` strings, - for example ``1536x864``. Width and height must both be divisible by 16 and the requested - aspect ratio must be between 1:3 and 3:1. Resolutions above ``2560x1440`` are experimental, and - the maximum supported resolution is ``3840x2160``. The requested size must also satisfy the - model's current pixel and edge limits. The standard sizes ``1024x1024``, ``1536x1024``, and - ``1024x1536`` are supported by the GPT image models; ``auto`` is supported for models that - allow automatic sizing. For ``dall-e-2``, use one of ``256x256``, ``512x512``, or - ``1024x1024``. For ``dall-e-3``, use one of ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is - one of the following types: Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], - Literal["auto"], str - :vartype size: Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], - Literal["auto"], str] - :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or - ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"], - Literal["jpeg"] - :vartype output_format: Literal["png", "webp", "jpeg"] - :ivar output_compression: Compression level for the output image. Default: 100. - :vartype output_compression: int - :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a - Literal["auto"] type or a Literal["low"] type. - :vartype moderation: Literal["auto", "low"] - :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``, - or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"], - Literal["opaque"], Literal["auto"] - :vartype background: Literal["transparent", "opaque", "auto"] - :ivar input_fidelity: Known values are: "high" and "low". - :vartype input_fidelity: InputFidelity - :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional) - and ``file_id`` (string, optional). - :vartype input_image_mask: "ImageGenToolInputImageMask" - :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default - value) to 3. - :vartype partial_images: int - :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. - Known values are: "generate", "edit", and "auto". - :vartype action: ImageGenActionEnum - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - """ - - type: Required[Literal["image_generation"]] - """The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION.""" - model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str] - """Is one of the following types: Literal[\"gpt-image-1\"], Literal[\"gpt-image-1-mini\"], - Literal[\"gpt-image-1.5\"], str""" - quality: Literal["low", "medium", "high", "auto"] - """The quality of the generated image. One of ``low``, ``medium``, ``high``, or ``auto``. Default: - ``auto``. Is one of the following types: Literal[\"low\"], Literal[\"medium\"], - Literal[\"high\"], Literal[\"auto\"]""" - size: Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"], str] - """The size of the generated images. For ``gpt-image-2`` and ``gpt-image-2-2026-04-21``, arbitrary - resolutions are supported as ``WIDTHxHEIGHT`` strings, for example ``1536x864``. Width and - height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. - Resolutions above ``2560x1440`` are experimental, and the maximum supported resolution is - ``3840x2160``. The requested size must also satisfy the model's current pixel and edge limits. - The standard sizes ``1024x1024``, ``1536x1024``, and ``1024x1536`` are supported by the GPT - image models; ``auto`` is supported for models that allow automatic sizing. For ``dall-e-2``, - use one of ``256x256``, ``512x512``, or ``1024x1024``. For ``dall-e-3``, use one of - ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is one of the following types: - Literal[\"1024x1024\"], Literal[\"1024x1536\"], Literal[\"1536x1024\"], Literal[\"auto\"], str""" - output_format: Literal["png", "webp", "jpeg"] - """The output format of the generated image. One of ``png``, ``webp``, or ``jpeg``. Default: - ``png``. Is one of the following types: Literal[\"png\"], Literal[\"webp\"], Literal[\"jpeg\"]""" - output_compression: int - """Compression level for the output image. Default: 100.""" - moderation: Literal["auto", "low"] - """Moderation level for the generated image. Default: ``auto``. Is either a Literal[\"auto\"] type - or a Literal[\"low\"] type.""" - background: Literal["transparent", "opaque", "auto"] - """Background type for the generated image. One of ``transparent``, ``opaque``, or ``auto``. - Default: ``auto``. Is one of the following types: Literal[\"transparent\"], - Literal[\"opaque\"], Literal[\"auto\"]""" - input_fidelity: Optional[InputFidelity] - """Known values are: \"high\" and \"low\".""" - input_image_mask: "ImageGenToolInputImageMask" - """Optional mask for inpainting. Contains ``image_url`` (string, optional) and ``file_id`` - (string, optional).""" - partial_images: int - """Number of partial images to generate in streaming mode, from 0 (default value) to 3.""" - action: ImageGenActionEnum - """Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: - \"generate\", \"edit\", and \"auto\".""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - - -class ImageGenToolInputImageMask(TypedDict, total=False): - """ImageGenToolInputImageMask. - - :ivar image_url: - :vartype image_url: str - :ivar file_id: - :vartype file_id: str - """ - - image_url: str - file_id: str - - -class InlineSkillParam(TypedDict, total=False): - """InlineSkillParam. - - :ivar type: Defines an inline skill for this request. Required. INLINE. - :vartype type: Literal["inline"] - :ivar name: The name of the skill. Required. - :vartype name: str - :ivar description: The description of the skill. Required. - :vartype description: str - :ivar source: Inline skill payload. Required. - :vartype source: "InlineSkillSourceParam" - """ - - type: Required[Literal["inline"]] - """Defines an inline skill for this request. Required. INLINE.""" - name: Required[str] - """The name of the skill. Required.""" - description: Required[str] - """The description of the skill. Required.""" - source: Required["InlineSkillSourceParam"] - """Inline skill payload. Required.""" - - -class InlineSkillSourceParam(TypedDict, total=False): - """Inline skill payload. - - :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is - "base64". - :vartype type: Literal["base64"] - :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``. - Required. Default value is "application/zip". - :vartype media_type: Literal["application/zip"] - :ivar data: Base64-encoded skill zip bundle. Required. - :vartype data: str - """ - - type: Required[Literal["base64"]] - """The type of the inline skill source. Must be ``base64``. Required. Default value is \"base64\".""" - media_type: Required[Literal["application/zip"]] - """The media type of the inline skill payload. Must be ``application/zip``. Required. Default - value is \"application/zip\".""" - data: Required[str] - """Base64-encoded skill zip bundle. Required.""" - - -class InputFileContent(TypedDict, total=False): - """Input file. - - :ivar type: The type of the input item. Always ``input_file``. Required. Default value is - "input_file". - :vartype type: Literal["input_file"] - :ivar file_id: - :vartype file_id: str - :ivar filename: The name of the file to be sent to the model. - :vartype filename: str - :ivar file_data: The content of the file to be sent to the model. - :vartype file_data: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - :ivar file_url: The URL of the file to be sent to the model. - :vartype file_url: str - :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the - system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality - rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or - ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", - "low", and "high". - :vartype detail: FileInputDetail - """ - - type: Required[Literal["input_file"]] - """The type of the input item. Always ``input_file``. Required. Default value is \"input_file\".""" - file_id: Optional[str] - filename: str - """The name of the file to be sent to the model.""" - file_data: str - """The content of the file to be sent to the model.""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - file_url: str - """The URL of the file to be sent to the model.""" - detail: FileInputDetail - """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the - detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may - increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the - file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and - \"high\".""" - - -class InputFileContentParam(TypedDict, total=False): - """Input file. - - :ivar type: The type of the input item. Always ``input_file``. Required. Default value is - "input_file". - :vartype type: Literal["input_file"] - :ivar file_id: - :vartype file_id: str - :ivar filename: - :vartype filename: str - :ivar file_data: - :vartype file_data: str - :ivar file_url: - :vartype file_url: str - :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the - system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality - rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or - ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", - "low", and "high". - :vartype detail: FileInputDetail - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" - """ - - type: Required[Literal["input_file"]] - """The type of the input item. Always ``input_file``. Required. Default value is \"input_file\".""" - file_id: Optional[str] - filename: Optional[str] - file_data: Optional[str] - file_url: Optional[str] - detail: FileInputDetail - """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the - detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may - increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the - file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and - \"high\".""" - prompt_cache_breakpoint: Optional["PromptCacheBreakpointParam"] - - -class InputImageContent(TypedDict, total=False): - """Input image. - - :ivar type: The type of the input item. Always ``input_image``. Required. Default value is - "input_image". - :vartype type: Literal["input_image"] - :ivar image_url: - :vartype image_url: str - :ivar file_id: - :vartype file_id: str - :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, - ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", - "auto", and "original". - :vartype detail: ImageDetail - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["input_image"]] - """The type of the input item. Always ``input_image``. Required. Default value is \"input_image\".""" - image_url: Optional[str] - file_id: Optional[str] - detail: Required[ImageDetail] - """The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or - ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", \"auto\", - and \"original\".""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class InputImageContentParamAutoParam(TypedDict, total=False): - """Input image. - - :ivar type: The type of the input item. Always ``input_image``. Required. Default value is - "input_image". - :vartype type: Literal["input_image"] - :ivar image_url: - :vartype image_url: str - :ivar file_id: - :vartype file_id: str - :ivar detail: Known values are: "low", "high", "auto", and "original". - :vartype detail: DetailEnum - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" - """ - - type: Required[Literal["input_image"]] - """The type of the input item. Always ``input_image``. Required. Default value is \"input_image\".""" - image_url: Optional[str] - file_id: Optional[str] - detail: Optional[DetailEnum] - """Known values are: \"low\", \"high\", \"auto\", and \"original\".""" - prompt_cache_breakpoint: Optional["PromptCacheBreakpointParam"] - - -class InputTextContent(TypedDict, total=False): - """Input text. - - :ivar type: The type of the input item. Always ``input_text``. Required. Default value is - "input_text". - :vartype type: Literal["input_text"] - :ivar text: The text input to the model. Required. - :vartype text: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["input_text"]] - """The type of the input item. Always ``input_text``. Required. Default value is \"input_text\".""" - text: Required[str] - """The text input to the model. Required.""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class InputTextContentParam(TypedDict, total=False): - """Input text. - - :ivar type: The type of the input item. Always ``input_text``. Required. Default value is - "input_text". - :vartype type: Literal["input_text"] - :ivar text: The text input to the model. Required. - :vartype text: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" - """ - - type: Required[Literal["input_text"]] - """The type of the input item. Always ``input_text``. Required. Default value is \"input_text\".""" - text: Required[str] - """The text input to the model. Required.""" - prompt_cache_breakpoint: Optional["PromptCacheBreakpointParam"] - - -class ItemCodeInterpreterToolCall(TypedDict, total=False): - """Code interpreter tool call. - - :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. - Required. Default value is "code_interpreter_call". - :vartype type: Literal["code_interpreter_call"] - :ivar id: The unique ID of the code interpreter tool call. Required. - :vartype id: str - :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, - ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the - following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], - Literal["interpreting"], Literal["failed"] - :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] - :ivar container_id: The ID of the container used to run the code. Required. - :vartype container_id: str - :ivar code: Required. - :vartype code: str - :ivar outputs: Required. - :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] - """ - - type: Required[Literal["code_interpreter_call"]] - """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. Default - value is \"code_interpreter_call\".""" - id: Required[str] - """The unique ID of the code interpreter tool call. Required.""" - status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] - """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, - ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], - Literal[\"interpreting\"], Literal[\"failed\"]""" - container_id: Required[str] - """The ID of the container used to run the code. Required.""" - code: Required[Optional[str]] - """Required.""" - outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] - """Required.""" - - -class ItemComputerToolCall(TypedDict, total=False): - """Computer tool call. - - :ivar type: The type of the computer call. Always ``computer_call``. Required. Default value is - "computer_call". - :vartype type: Literal["computer_call"] - :ivar id: The unique ID of the computer call. Required. - :vartype id: str - :ivar call_id: An identifier used when responding to the tool call with output. Required. - :vartype call_id: str - :ivar action: - :vartype action: "ComputerAction" - :ivar actions: - :vartype actions: list["ComputerAction"] - :ivar pending_safety_checks: The pending safety checks for the computer call. Required. - :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["computer_call"]] - """The type of the computer call. Always ``computer_call``. Required. Default value is - \"computer_call\".""" - id: Required[str] - """The unique ID of the computer call. Required.""" - call_id: Required[str] - """An identifier used when responding to the tool call with output. Required.""" - action: "ComputerAction" - actions: list["ComputerAction"] - pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] - """The pending safety checks for the computer call. Required.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemCustomToolCall(TypedDict, total=False): - """Custom tool call. - - :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. Default - value is "custom_tool_call". - :vartype type: Literal["custom_tool_call"] - :ivar id: The unique ID of the custom tool call in the OpenAI platform. - :vartype id: str - :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar namespace: The namespace of the custom tool being called. - :vartype namespace: str - :ivar name: The name of the custom tool being called. Required. - :vartype name: str - :ivar input: The input for the custom tool call generated by the model. Required. - :vartype input: str - """ - - type: Required[Literal["custom_tool_call"]] - """The type of the custom tool call. Always ``custom_tool_call``. Required. Default value is - \"custom_tool_call\".""" - id: str - """The unique ID of the custom tool call in the OpenAI platform.""" - call_id: Required[str] - """An identifier used to map this custom tool call to a tool call output. Required.""" - caller: Optional["ToolCallCaller"] - namespace: str - """The namespace of the custom tool being called.""" - name: Required[str] - """The name of the custom tool being called. Required.""" - input: Required[str] - """The input for the custom tool call generated by the model. Required.""" - - -class ItemCustomToolCallOutput(TypedDict, total=False): - """Custom tool call output. - - :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. - Required. Default value is "custom_tool_call_output". - :vartype type: Literal["custom_tool_call_output"] - :ivar id: The unique ID of the custom tool call output in the OpenAI platform. - :vartype id: str - :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. - Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar output: The output from the custom tool call generated by your code. Can be a string or - an list of output content. Required. Is either a str type or a - [FunctionAndCustomToolCallOutput] type. - :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] - """ - - type: Required[Literal["custom_tool_call_output"]] - """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. Default - value is \"custom_tool_call_output\".""" - id: str - """The unique ID of the custom tool call output in the OpenAI platform.""" - call_id: Required[str] - """The call ID, used to map this custom tool call output to a custom tool call. Required.""" - caller: Optional["ToolCallCallerParam"] - output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] - """The output from the custom tool call generated by your code. Can be a string or an list of - output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" - - -class ItemFieldAdditionalTools(TypedDict, total=False): - """ItemFieldAdditionalTools. - - :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. - :vartype type: Literal["additional_tools"] - :ivar id: The unique ID of the additional tools item. Required. - :vartype id: str - :ivar role: The role that provided the additional tools. Required. Known values are: "unknown", - "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". - :vartype role: MessageRole - :ivar tools: The additional tool definitions made available at this item. Required. - :vartype tools: list["Tool"] - """ - - type: Required[Literal["additional_tools"]] - """The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.""" - id: Required[str] - """The unique ID of the additional tools item. Required.""" - role: Required[MessageRole] - """The role that provided the additional tools. Required. Known values are: \"unknown\", \"user\", - \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and \"tool\".""" - tools: Required[list["Tool"]] - """The additional tool definitions made available at this item. Required.""" - - -class ItemFieldApplyPatchToolCall(TypedDict, total=False): - """Apply patch tool call. - - :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. - :vartype type: Literal["apply_patch_call"] - :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via - API. Required. - :vartype id: str - :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. - Required. Known values are: "in_progress" and "completed". - :vartype status: ApplyPatchCallStatus - :ivar operation: Apply patch operation. Required. - :vartype operation: "ApplyPatchFileOperation" - :ivar created_by: The ID of the entity that created this tool call. - :vartype created_by: str - """ - - type: Required[Literal["apply_patch_call"]] - """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" - id: Required[str] - """The unique ID of the apply patch tool call. Populated when this item is returned via API. - Required.""" - call_id: Required[str] - """The unique ID of the apply patch tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - status: Required[ApplyPatchCallStatus] - """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. - Known values are: \"in_progress\" and \"completed\".""" - operation: Required["ApplyPatchFileOperation"] - """Apply patch operation. Required.""" - created_by: str - """The ID of the entity that created this tool call.""" - - -class ItemFieldApplyPatchToolCallOutput(TypedDict, total=False): - """Apply patch tool call output. - - :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. - APPLY_PATCH_CALL_OUTPUT. - :vartype type: Literal["apply_patch_call_output"] - :ivar id: The unique ID of the apply patch tool call output. Populated when this item is - returned via API. Required. - :vartype id: str - :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar status: The status of the apply patch tool call output. One of ``completed`` or - ``failed``. Required. Known values are: "completed" and "failed". - :vartype status: ApplyPatchCallOutputStatus - :ivar output: - :vartype output: str - :ivar created_by: The ID of the entity that created this tool call output. - :vartype created_by: str - """ - - type: Required[Literal["apply_patch_call_output"]] - """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" - id: Required[str] - """The unique ID of the apply patch tool call output. Populated when this item is returned via - API. Required.""" - call_id: Required[str] - """The unique ID of the apply patch tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - status: Required[ApplyPatchCallOutputStatus] - """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. - Known values are: \"completed\" and \"failed\".""" - output: Optional[str] - created_by: str - """The ID of the entity that created this tool call output.""" - - -class ItemFieldCodeInterpreterToolCall(TypedDict, total=False): - """Code interpreter tool call. - - :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. - Required. CODE_INTERPRETER_CALL. - :vartype type: Literal["code_interpreter_call"] - :ivar id: The unique ID of the code interpreter tool call. Required. - :vartype id: str - :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, - ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the - following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], - Literal["interpreting"], Literal["failed"] - :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] - :ivar container_id: The ID of the container used to run the code. Required. - :vartype container_id: str - :ivar code: Required. - :vartype code: str - :ivar outputs: Required. - :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] - """ - - type: Required[Literal["code_interpreter_call"]] - """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. - CODE_INTERPRETER_CALL.""" - id: Required[str] - """The unique ID of the code interpreter tool call. Required.""" - status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] - """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, - ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], - Literal[\"interpreting\"], Literal[\"failed\"]""" - container_id: Required[str] - """The ID of the container used to run the code. Required.""" - code: Required[Optional[str]] - """Required.""" - outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] - """Required.""" - - -class ItemFieldCompactionBody(TypedDict, total=False): - """Compaction item. - - :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. - :vartype type: Literal["compaction"] - :ivar id: The unique ID of the compaction item. Required. - :vartype id: str - :ivar encrypted_content: The encrypted content that was produced by compaction. Required. - :vartype encrypted_content: str - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - type: Required[Literal["compaction"]] - """The type of the item. Always ``compaction``. Required. COMPACTION.""" - id: Required[str] - """The unique ID of the compaction item. Required.""" - encrypted_content: Required[str] - """The encrypted content that was produced by compaction. Required.""" - created_by: str - """The identifier of the actor that created the item.""" - - -class ItemFieldComputerToolCall(TypedDict, total=False): - """Computer tool call. - - :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. - :vartype type: Literal["computer_call"] - :ivar id: The unique ID of the computer call. Required. - :vartype id: str - :ivar call_id: An identifier used when responding to the tool call with output. Required. - :vartype call_id: str - :ivar action: - :vartype action: "ComputerAction" - :ivar actions: - :vartype actions: list["ComputerAction"] - :ivar pending_safety_checks: The pending safety checks for the computer call. Required. - :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["computer_call"]] - """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" - id: Required[str] - """The unique ID of the computer call. Required.""" - call_id: Required[str] - """An identifier used when responding to the tool call with output. Required.""" - action: "ComputerAction" - actions: list["ComputerAction"] - pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] - """The pending safety checks for the computer call. Required.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemFieldComputerToolCallOutput(TypedDict, total=False): - """Computer tool call output. - - :ivar type: The type of the computer tool call output. Always ``computer_call_output``. - Required. COMPUTER_CALL_OUTPUT. - :vartype type: Literal["computer_call_output"] - :ivar id: The ID of the computer tool call output. Required. - :vartype id: str - :ivar call_id: The ID of the computer tool call that produced the output. Required. - :vartype call_id: str - :ivar acknowledged_safety_checks: The safety checks reported by the API that have been - acknowledged by the developer. - :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] - :ivar output: Required. - :vartype output: "ComputerScreenshotImage" - :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or - ``incomplete``. Populated when input items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["computer_call_output"]] - """The type of the computer tool call output. Always ``computer_call_output``. Required. - COMPUTER_CALL_OUTPUT.""" - id: Required[str] - """The ID of the computer tool call output. Required.""" - call_id: Required[str] - """The ID of the computer tool call that produced the output. Required.""" - acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] - """The safety checks reported by the API that have been acknowledged by the developer.""" - output: Required["ComputerScreenshotImage"] - """Required.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when input items are returned via API. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemFieldCustomToolCall(TypedDict, total=False): - """Custom tool call. - - :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. - CUSTOM_TOOL_CALL. - :vartype type: Literal["custom_tool_call"] - :ivar id: The unique ID of the custom tool call in the OpenAI platform. - :vartype id: str - :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar namespace: The namespace of the custom tool being called. - :vartype namespace: str - :ivar name: The name of the custom tool being called. Required. - :vartype name: str - :ivar input: The input for the custom tool call generated by the model. Required. - :vartype input: str - """ - - type: Required[Literal["custom_tool_call"]] - """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" - id: str - """The unique ID of the custom tool call in the OpenAI platform.""" - call_id: Required[str] - """An identifier used to map this custom tool call to a tool call output. Required.""" - caller: Optional["ToolCallCaller"] - namespace: str - """The namespace of the custom tool being called.""" - name: Required[str] - """The name of the custom tool being called. Required.""" - input: Required[str] - """The input for the custom tool call generated by the model. Required.""" - - -class ItemFieldCustomToolCallOutput(TypedDict, total=False): - """Custom tool call output. - - :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. - Required. CUSTOM_TOOL_CALL_OUTPUT. - :vartype type: Literal["custom_tool_call_output"] - :ivar id: The unique ID of the custom tool call output in the OpenAI platform. - :vartype id: str - :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. - Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar output: The output from the custom tool call generated by your code. Can be a string or - an list of output content. Required. Is either a str type or a - [FunctionAndCustomToolCallOutput] type. - :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] - """ - - type: Required[Literal["custom_tool_call_output"]] - """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. - CUSTOM_TOOL_CALL_OUTPUT.""" - id: str - """The unique ID of the custom tool call output in the OpenAI platform.""" - call_id: Required[str] - """The call ID, used to map this custom tool call output to a custom tool call. Required.""" - caller: Optional["ToolCallCallerParam"] - output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] - """The output from the custom tool call generated by your code. Can be a string or an list of - output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" - - -class ItemFieldFileSearchToolCall(TypedDict, total=False): - """File search tool call. - - :ivar id: The unique ID of the file search tool call. Required. - :vartype id: str - :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. - FILE_SEARCH_CALL. - :vartype type: Literal["file_search_call"] - :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, - ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], - Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] - :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] - :ivar queries: The queries used to search for files. Required. - :vartype queries: list[str] - :ivar results: - :vartype results: list["FileSearchToolCallResults"] - """ - - id: Required[str] - """The unique ID of the file search tool call. Required.""" - type: Required[Literal["file_search_call"]] - """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" - status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] - """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` - or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], - Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" - queries: Required[list[str]] - """The queries used to search for files. Required.""" - results: Optional[list["FileSearchToolCallResults"]] - - -class ItemFieldFunctionShellCall(TypedDict, total=False): - """Shell tool call. - - :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. - :vartype type: Literal["shell_call"] - :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. - Required. - :vartype id: str - :ivar call_id: The unique ID of the shell tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar action: The shell commands and limits that describe how to run the tool call. Required. - :vartype action: "FunctionShellAction" - :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or - ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionShellCallStatus - :ivar environment: Required. - :vartype environment: "FunctionShellCallEnvironment" - :ivar created_by: The ID of the entity that created this tool call. - :vartype created_by: str - """ - - type: Required[Literal["shell_call"]] - """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" - id: Required[str] - """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" - call_id: Required[str] - """The unique ID of the shell tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - action: Required["FunctionShellAction"] - """The shell commands and limits that describe how to run the tool call. Required.""" - status: Required[FunctionShellCallStatus] - """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. - Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - environment: Required[Optional["FunctionShellCallEnvironment"]] - """Required.""" - created_by: str - """The ID of the entity that created this tool call.""" - - -class ItemFieldFunctionShellCallOutput(TypedDict, total=False): - """Shell call output. - - :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. - SHELL_CALL_OUTPUT. - :vartype type: Literal["shell_call_output"] - :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. - Required. - :vartype id: str - :ivar call_id: The unique ID of the shell tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or - ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionShellCallOutputStatusEnum - :ivar output: An array of shell call output contents. Required. - :vartype output: list["FunctionShellCallOutputContent"] - :ivar max_output_length: Required. - :vartype max_output_length: int - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - type: Required[Literal["shell_call_output"]] - """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" - id: Required[str] - """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" - call_id: Required[str] - """The unique ID of the shell tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - status: Required[FunctionShellCallOutputStatusEnum] - """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. - Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - output: Required[list["FunctionShellCallOutputContent"]] - """An array of shell call output contents. Required.""" - max_output_length: Required[Optional[int]] - """Required.""" - created_by: str - """The identifier of the actor that created the item.""" - - -class ItemFieldFunctionToolCall(TypedDict, total=False): - """Function tool call. - - :ivar id: The unique ID of the function tool call. Required. - :vartype id: str - :ivar type: The type of the function tool call. Always ``function_call``. Required. - FUNCTION_CALL. - :vartype type: Literal["function_call"] - :ivar call_id: The unique ID of the function tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar namespace: The namespace of the function to run. - :vartype namespace: str - :ivar name: The name of the function to run. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments to pass to the function. Required. - :vartype arguments: str - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - id: Required[str] - """The unique ID of the function tool call. Required.""" - type: Required[Literal["function_call"]] - """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" - call_id: Required[str] - """The unique ID of the function tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - namespace: str - """The namespace of the function to run.""" - name: Required[str] - """The name of the function to run. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the function. Required.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemFieldFunctionToolCallOutput(TypedDict, total=False): - """Function tool call output. - - :ivar id: The unique ID of the function tool call output. Populated when this item is returned - via API. Required. - :vartype id: str - :ivar type: The type of the function tool call output. Always ``function_call_output``. - Required. FUNCTION_CALL_OUTPUT. - :vartype type: Literal["function_call_output"] - :ivar call_id: The unique ID of the function tool call generated by the model. - :vartype call_id: str - :ivar name: The name of the tool that produced the output. - :vartype name: str - :ivar namespace: The namespace of the tool that produced the output. - :vartype namespace: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar output: The output from the function call generated by your code. Can be a string or an - list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] - type. - :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - id: Required[str] - """The unique ID of the function tool call output. Populated when this item is returned via API. - Required.""" - type: Required[Literal["function_call_output"]] - """The type of the function tool call output. Always ``function_call_output``. Required. - FUNCTION_CALL_OUTPUT.""" - call_id: str - """The unique ID of the function tool call generated by the model.""" - name: str - """The name of the tool that produced the output.""" - namespace: str - """The namespace of the tool that produced the output.""" - caller: Optional["ToolCallCallerParam"] - output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] - """The output from the function call generated by your code. Can be a string or an list of output - content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemFieldImageGenToolCall(TypedDict, total=False): - """Image generation call. - - :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. - IMAGE_GENERATION_CALL. - :vartype type: Literal["image_generation_call"] - :ivar id: The unique ID of the image generation call. Required. - :vartype id: str - :ivar status: The status of the image generation call. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] - :vartype status: Literal["in_progress", "completed", "generating", "failed"] - :ivar result: Required. - :vartype result: str - """ - - type: Required[Literal["image_generation_call"]] - """The type of the image generation call. Always ``image_generation_call``. Required. - IMAGE_GENERATION_CALL.""" - id: Required[str] - """The unique ID of the image generation call. Required.""" - status: Required[Literal["in_progress", "completed", "generating", "failed"]] - """The status of the image generation call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" - result: Required[Optional[str]] - """Required.""" - - -class ItemFieldLocalShellToolCall(TypedDict, total=False): - """Local shell call. - - :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. - LOCAL_SHELL_CALL. - :vartype type: Literal["local_shell_call"] - :ivar id: The unique ID of the local shell call. Required. - :vartype id: str - :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. - :vartype call_id: str - :ivar action: Required. - :vartype action: "LocalShellExecAction" - :ivar status: The status of the local shell call. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["local_shell_call"]] - """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" - id: Required[str] - """The unique ID of the local shell call. Required.""" - call_id: Required[str] - """The unique ID of the local shell tool call generated by the model. Required.""" - action: Required["LocalShellExecAction"] - """Required.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the local shell call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemFieldLocalShellToolCallOutput(TypedDict, total=False): - """Local shell call output. - - :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. - Required. LOCAL_SHELL_CALL_OUTPUT. - :vartype type: Literal["local_shell_call_output"] - :ivar id: The unique ID of the local shell tool call generated by the model. Required. - :vartype id: str - :ivar output: A JSON string of the output of the local shell tool call. Required. - :vartype output: str - :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], - Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["local_shell_call_output"]] - """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. - LOCAL_SHELL_CALL_OUTPUT.""" - id: Required[str] - """The unique ID of the local shell tool call generated by the model. Required.""" - output: Required[str] - """A JSON string of the output of the local shell tool call. Required.""" - status: Optional[Literal["in_progress", "completed", "incomplete"]] - """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], - Literal[\"incomplete\"]""" - - -class ItemFieldMcpApprovalRequest(TypedDict, total=False): - """MCP approval request. - - :ivar type: The type of the item. Always ``mcp_approval_request``. Required. - MCP_APPROVAL_REQUEST. - :vartype type: Literal["mcp_approval_request"] - :ivar id: The unique ID of the approval request. Required. - :vartype id: str - :ivar server_label: The label of the MCP server making the request. Required. - :vartype server_label: str - :ivar name: The name of the tool to run. Required. - :vartype name: str - :ivar arguments: A JSON string of arguments for the tool. Required. - :vartype arguments: str - """ - - type: Required[Literal["mcp_approval_request"]] - """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" - id: Required[str] - """The unique ID of the approval request. Required.""" - server_label: Required[str] - """The label of the MCP server making the request. Required.""" - name: Required[str] - """The name of the tool to run. Required.""" - arguments: Required[str] - """A JSON string of arguments for the tool. Required.""" - - -class ItemFieldMcpApprovalResponseResource(TypedDict, total=False): - """MCP approval response. - - :ivar type: The type of the item. Always ``mcp_approval_response``. Required. - MCP_APPROVAL_RESPONSE. - :vartype type: Literal["mcp_approval_response"] - :ivar id: The unique ID of the approval response. Required. - :vartype id: str - :ivar approval_request_id: The ID of the approval request being answered. Required. - :vartype approval_request_id: str - :ivar approve: Whether the request was approved. Required. - :vartype approve: bool - :ivar reason: - :vartype reason: str - """ - - type: Required[Literal["mcp_approval_response"]] - """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" - id: Required[str] - """The unique ID of the approval response. Required.""" - approval_request_id: Required[str] - """The ID of the approval request being answered. Required.""" - approve: Required[bool] - """Whether the request was approved. Required.""" - reason: Optional[str] - - -class ItemFieldMcpListTools(TypedDict, total=False): - """MCP list tools. - - :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. - :vartype type: Literal["mcp_list_tools"] - :ivar id: The unique ID of the list. Required. - :vartype id: str - :ivar server_label: The label of the MCP server. Required. - :vartype server_label: str - :ivar tools: The tools available on the server. Required. - :vartype tools: list["MCPListToolsTool"] - :ivar error: - :vartype error: "RealtimeMCPError" - """ - - type: Required[Literal["mcp_list_tools"]] - """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" - id: Required[str] - """The unique ID of the list. Required.""" - server_label: Required[str] - """The label of the MCP server. Required.""" - tools: Required[list["MCPListToolsTool"]] - """The tools available on the server. Required.""" - error: "RealtimeMCPError" - - -class ItemFieldMcpToolCall(TypedDict, total=False): - """MCP tool call. - - :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. - :vartype type: Literal["mcp_call"] - :ivar id: The unique ID of the tool call. Required. - :vartype id: str - :ivar server_label: The label of the MCP server running the tool. Required. - :vartype server_label: str - :ivar name: The name of the tool that was run. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments passed to the tool. Required. - :vartype arguments: str - :ivar output: - :vartype output: str - :ivar error: The error from the tool call, if any. - :vartype error: dict[str, Any] - :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, - ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", - "incomplete", "calling", and "failed". - :vartype status: MCPToolCallStatus - :ivar approval_request_id: - :vartype approval_request_id: str - """ - - type: Required[Literal["mcp_call"]] - """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" - id: Required[str] - """The unique ID of the tool call. Required.""" - server_label: Required[str] - """The label of the MCP server running the tool. Required.""" - name: Required[str] - """The name of the tool that was run. Required.""" - arguments: Required[str] - """A JSON string of the arguments passed to the tool. Required.""" - output: Optional[str] - error: dict[str, Any] - """The error from the tool call, if any.""" - status: MCPToolCallStatus - """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, - ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", - \"calling\", and \"failed\".""" - approval_request_id: Optional[str] - - -class ItemFieldMessage(TypedDict, total=False): - """Message. - - :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. - :vartype type: Literal["message"] - :ivar id: The unique ID of the message. Required. - :vartype id: str - :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Known values are: "in_progress", - "completed", and "incomplete". - :vartype status: MessageStatus - :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, - ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: - "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". - :vartype role: MessageRole - :ivar content: The content of the message. Required. - :vartype content: list["MessageContent"] - :ivar phase: Known values are: "commentary" and "final_answer". - :vartype phase: MessagePhase - """ - - type: Required[Literal["message"]] - """The type of the message. Always set to ``message``. Required. MESSAGE.""" - id: Required[str] - """The unique ID of the message. Required.""" - status: Required[MessageStatus] - """The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when - items are returned via API. Required. Known values are: \"in_progress\", \"completed\", and - \"incomplete\".""" - role: Required[MessageRole] - """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, - ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", - \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and - \"tool\".""" - content: Required[list["MessageContent"]] - """The content of the message. Required.""" - phase: Optional[MessagePhase] - """Known values are: \"commentary\" and \"final_answer\".""" - - -class ItemFieldProgram(TypedDict, total=False): - """ItemFieldProgram. - - :ivar type: The type of the item. Always ``program``. Required. PROGRAM. - :vartype type: Literal["program"] - :ivar id: The unique ID of the program item. Required. - :vartype id: str - :ivar call_id: The stable call ID of the program item. Required. - :vartype call_id: str - :ivar code: The JavaScript source executed by programmatic tool calling. Required. - :vartype code: str - :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. - :vartype fingerprint: str - """ - - type: Required[Literal["program"]] - """The type of the item. Always ``program``. Required. PROGRAM.""" - id: Required[str] - """The unique ID of the program item. Required.""" - call_id: Required[str] - """The stable call ID of the program item. Required.""" - code: Required[str] - """The JavaScript source executed by programmatic tool calling. Required.""" - fingerprint: Required[str] - """Opaque program replay fingerprint that must be round-tripped. Required.""" - - -class ItemFieldProgramOutput(TypedDict, total=False): - """ItemFieldProgramOutput. - - :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT. - :vartype type: Literal["program_output"] - :ivar id: The unique ID of the program output item. Required. - :vartype id: str - :ivar call_id: The call ID of the program item. Required. - :vartype call_id: str - :ivar result: The result produced by the program item. Required. - :vartype result: str - :ivar status: The terminal status of the program output item. Required. Known values are: - "completed" and "incomplete". - :vartype status: ProgramOutputStatus - """ - - type: Required[Literal["program_output"]] - """The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.""" - id: Required[str] - """The unique ID of the program output item. Required.""" - call_id: Required[str] - """The call ID of the program item. Required.""" - result: Required[str] - """The result produced by the program item. Required.""" - status: Required[ProgramOutputStatus] - """The terminal status of the program output item. Required. Known values are: \"completed\" and - \"incomplete\".""" - - -class ItemFieldReasoningItem(TypedDict, total=False): - """Reasoning. - - :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. - :vartype type: Literal["reasoning"] - :ivar id: The unique identifier of the reasoning content. Required. - :vartype id: str - :ivar encrypted_content: - :vartype encrypted_content: str - :ivar summary: Reasoning summary content. Required. - :vartype summary: list["SummaryTextContent"] - :ivar content: Reasoning text content. - :vartype content: list["ReasoningTextContent"] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["reasoning"]] - """The type of the object. Always ``reasoning``. Required. REASONING.""" - id: Required[str] - """The unique identifier of the reasoning content. Required.""" - encrypted_content: Optional[str] - summary: Required[list["SummaryTextContent"]] - """Reasoning summary content. Required.""" - content: list["ReasoningTextContent"] - """Reasoning text content.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemFieldToolSearchCall(TypedDict, total=False): - """ItemFieldToolSearchCall. - - :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. - :vartype type: Literal["tool_search_call"] - :ivar id: The unique ID of the tool search call item. Required. - :vartype id: str - :ivar call_id: Required. - :vartype call_id: str - :ivar execution: Whether tool search was executed by the server or by the client. Required. - Known values are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar arguments: Arguments used for the tool search call. Required. - :vartype arguments: Any - :ivar status: The status of the tool search call item that was recorded. Required. Known values - are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallStatus - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - type: Required[Literal["tool_search_call"]] - """The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.""" - id: Required[str] - """The unique ID of the tool search call item. Required.""" - call_id: Required[Optional[str]] - """Required.""" - execution: Required[ToolSearchExecutionType] - """Whether tool search was executed by the server or by the client. Required. Known values are: - \"server\" and \"client\".""" - arguments: Required[Any] - """Arguments used for the tool search call. Required.""" - status: Required[FunctionCallStatus] - """The status of the tool search call item that was recorded. Required. Known values are: - \"in_progress\", \"completed\", and \"incomplete\".""" - created_by: str - """The identifier of the actor that created the item.""" - - -class ItemFieldToolSearchOutput(TypedDict, total=False): - """ItemFieldToolSearchOutput. - - :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. - :vartype type: Literal["tool_search_output"] - :ivar id: The unique ID of the tool search output item. Required. - :vartype id: str - :ivar call_id: Required. - :vartype call_id: str - :ivar execution: Whether tool search was executed by the server or by the client. Required. - Known values are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar tools: The loaded tool definitions returned by tool search. Required. - :vartype tools: list["Tool"] - :ivar status: The status of the tool search output item that was recorded. Required. Known - values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallOutputStatusEnum - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - type: Required[Literal["tool_search_output"]] - """The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.""" - id: Required[str] - """The unique ID of the tool search output item. Required.""" - call_id: Required[Optional[str]] - """Required.""" - execution: Required[ToolSearchExecutionType] - """Whether tool search was executed by the server or by the client. Required. Known values are: - \"server\" and \"client\".""" - tools: Required[list["Tool"]] - """The loaded tool definitions returned by tool search. Required.""" - status: Required[FunctionCallOutputStatusEnum] - """The status of the tool search output item that was recorded. Required. Known values are: - \"in_progress\", \"completed\", and \"incomplete\".""" - created_by: str - """The identifier of the actor that created the item.""" - - -class ItemFieldWebSearchToolCall(TypedDict, total=False): - """Web search tool call. - - :ivar id: The unique ID of the web search tool call. Required. - :vartype id: str - :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. - WEB_SEARCH_CALL. - :vartype type: Literal["web_search_call"] - :ivar status: The status of the web search tool call. Required. Is one of the following types: - Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], - Literal["incomplete"] - :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] - :ivar action: An object describing the specific action taken in this web search call. Includes - details on how the model used the web (search, open_page, find_in_page). Required. Is one of - the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind - :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", - "WebSearchActionFind"] - """ - - id: Required[str] - """The unique ID of the web search tool call. Required.""" - type: Required[Literal["web_search_call"]] - """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" - status: Required[Literal["in_progress", "searching", "completed", "failed", "incomplete"]] - """The status of the web search tool call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"], - Literal[\"incomplete\"]""" - action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] - """An object describing the specific action taken in this web search call. Includes details on how - the model used the web (search, open_page, find_in_page). Required. Is one of the following - types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" - - -class ItemFileSearchToolCall(TypedDict, total=False): - """File search tool call. - - :ivar id: The unique ID of the file search tool call. Required. - :vartype id: str - :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. - Default value is "file_search_call". - :vartype type: Literal["file_search_call"] - :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, - ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], - Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] - :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] - :ivar queries: The queries used to search for files. Required. - :vartype queries: list[str] - :ivar results: - :vartype results: list["FileSearchToolCallResults"] - """ - - id: Required[str] - """The unique ID of the file search tool call. Required.""" - type: Required[Literal["file_search_call"]] - """The type of the file search tool call. Always ``file_search_call``. Required. Default value is - \"file_search_call\".""" - status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] - """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` - or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], - Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" - queries: Required[list[str]] - """The queries used to search for files. Required.""" - results: Optional[list["FileSearchToolCallResults"]] - - -class ItemFunctionToolCall(TypedDict, total=False): - """Function tool call. - - :ivar type: The type of the function tool call. Always ``function_call``. Required. Default - value is "function_call". - :vartype type: Literal["function_call"] - :ivar call_id: The unique ID of the function tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar namespace: The namespace of the function to run. - :vartype namespace: str - :ivar name: The name of the function to run. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments to pass to the function. Required. - :vartype arguments: str - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["function_call"]] - """The type of the function tool call. Always ``function_call``. Required. Default value is - \"function_call\".""" - call_id: Required[str] - """The unique ID of the function tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - namespace: str - """The namespace of the function to run.""" - name: Required[str] - """The name of the function to run. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the function. Required.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemImageGenToolCall(TypedDict, total=False): - """Image generation call. - - :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. - Default value is "image_generation_call". - :vartype type: Literal["image_generation_call"] - :ivar id: The unique ID of the image generation call. Required. - :vartype id: str - :ivar status: The status of the image generation call. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] - :vartype status: Literal["in_progress", "completed", "generating", "failed"] - :ivar result: Required. - :vartype result: str - """ - - type: Required[Literal["image_generation_call"]] - """The type of the image generation call. Always ``image_generation_call``. Required. Default - value is \"image_generation_call\".""" - id: Required[str] - """The unique ID of the image generation call. Required.""" - status: Required[Literal["in_progress", "completed", "generating", "failed"]] - """The status of the image generation call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" - result: Required[Optional[str]] - """Required.""" - - -class ItemLocalShellToolCall(TypedDict, total=False): - """Local shell call. - - :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. Default - value is "local_shell_call". - :vartype type: Literal["local_shell_call"] - :ivar id: The unique ID of the local shell call. Required. - :vartype id: str - :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. - :vartype call_id: str - :ivar action: Required. - :vartype action: "LocalShellExecAction" - :ivar status: The status of the local shell call. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["local_shell_call"]] - """The type of the local shell call. Always ``local_shell_call``. Required. Default value is - \"local_shell_call\".""" - id: Required[str] - """The unique ID of the local shell call. Required.""" - call_id: Required[str] - """The unique ID of the local shell tool call generated by the model. Required.""" - action: Required["LocalShellExecAction"] - """Required.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the local shell call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemLocalShellToolCallOutput(TypedDict, total=False): - """Local shell call output. - - :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. - Required. Default value is "local_shell_call_output". - :vartype type: Literal["local_shell_call_output"] - :ivar id: The unique ID of the local shell tool call generated by the model. Required. - :vartype id: str - :ivar output: A JSON string of the output of the local shell tool call. Required. - :vartype output: str - :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], - Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["local_shell_call_output"]] - """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. - Default value is \"local_shell_call_output\".""" - id: Required[str] - """The unique ID of the local shell tool call generated by the model. Required.""" - output: Required[str] - """A JSON string of the output of the local shell tool call. Required.""" - status: Optional[Literal["in_progress", "completed", "incomplete"]] - """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], - Literal[\"incomplete\"]""" - - -class ItemMcpApprovalRequest(TypedDict, total=False): - """MCP approval request. - - :ivar type: The type of the item. Always ``mcp_approval_request``. Required. Default value is - "mcp_approval_request". - :vartype type: Literal["mcp_approval_request"] - :ivar id: The unique ID of the approval request. Required. - :vartype id: str - :ivar server_label: The label of the MCP server making the request. Required. - :vartype server_label: str - :ivar name: The name of the tool to run. Required. - :vartype name: str - :ivar arguments: A JSON string of arguments for the tool. Required. - :vartype arguments: str - """ - - type: Required[Literal["mcp_approval_request"]] - """The type of the item. Always ``mcp_approval_request``. Required. Default value is - \"mcp_approval_request\".""" - id: Required[str] - """The unique ID of the approval request. Required.""" - server_label: Required[str] - """The label of the MCP server making the request. Required.""" - name: Required[str] - """The name of the tool to run. Required.""" - arguments: Required[str] - """A JSON string of arguments for the tool. Required.""" - - -class ItemMcpListTools(TypedDict, total=False): - """MCP list tools. - - :ivar type: The type of the item. Always ``mcp_list_tools``. Required. Default value is - "mcp_list_tools". - :vartype type: Literal["mcp_list_tools"] - :ivar id: The unique ID of the list. Required. - :vartype id: str - :ivar server_label: The label of the MCP server. Required. - :vartype server_label: str - :ivar tools: The tools available on the server. Required. - :vartype tools: list["MCPListToolsTool"] - :ivar error: - :vartype error: "RealtimeMCPError" - """ - - type: Required[Literal["mcp_list_tools"]] - """The type of the item. Always ``mcp_list_tools``. Required. Default value is \"mcp_list_tools\".""" - id: Required[str] - """The unique ID of the list. Required.""" - server_label: Required[str] - """The label of the MCP server. Required.""" - tools: Required[list["MCPListToolsTool"]] - """The tools available on the server. Required.""" - error: "RealtimeMCPError" - - -class ItemMcpToolCall(TypedDict, total=False): - """MCP tool call. - - :ivar type: The type of the item. Always ``mcp_call``. Required. Default value is "mcp_call". - :vartype type: Literal["mcp_call"] - :ivar id: The unique ID of the tool call. Required. - :vartype id: str - :ivar server_label: The label of the MCP server running the tool. Required. - :vartype server_label: str - :ivar name: The name of the tool that was run. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments passed to the tool. Required. - :vartype arguments: str - :ivar output: - :vartype output: str - :ivar error: The error from the tool call, if any. - :vartype error: dict[str, Any] - :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, - ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", - "incomplete", "calling", and "failed". - :vartype status: MCPToolCallStatus - :ivar approval_request_id: - :vartype approval_request_id: str - """ - - type: Required[Literal["mcp_call"]] - """The type of the item. Always ``mcp_call``. Required. Default value is \"mcp_call\".""" - id: Required[str] - """The unique ID of the tool call. Required.""" - server_label: Required[str] - """The label of the MCP server running the tool. Required.""" - name: Required[str] - """The name of the tool that was run. Required.""" - arguments: Required[str] - """A JSON string of the arguments passed to the tool. Required.""" - output: Optional[str] - error: dict[str, Any] - """The error from the tool call, if any.""" - status: MCPToolCallStatus - """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, - ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", - \"calling\", and \"failed\".""" - approval_request_id: Optional[str] - - -class ItemMessage(TypedDict, total=False): - """Message. - - :ivar type: The type of the message. Always set to ``message``. Required. Default value is - "message". - :vartype type: Literal["message"] - :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, - ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: - "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". - :vartype role: MessageRole - :ivar phase: Known values are: "commentary" and "final_answer". - :vartype phase: MessagePhase - :ivar content: Required. Is either a str type or a [MessageContent] type. - :vartype content: Union[str, list["MessageContent"]] - """ - - type: Required[Literal["message"]] - """The type of the message. Always set to ``message``. Required. Default value is \"message\".""" - role: Required[MessageRole] - """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, - ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", - \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and - \"tool\".""" - phase: Optional[MessagePhase] - """Known values are: \"commentary\" and \"final_answer\".""" - content: Required[Union[str, list["MessageContent"]]] - """Required. Is either a str type or a [MessageContent] type.""" - - -class ItemOutputMessage(TypedDict, total=False): - """Output message. - - :ivar id: The unique ID of the output message. Required. - :vartype id: str - :ivar type: The type of the output message. Always ``message``. Required. Default value is - "output_message". - :vartype type: Literal["output_message"] - :ivar role: The role of the output message. Always ``assistant``. Required. Default value is - "assistant". - :vartype role: Literal["assistant"] - :ivar content: The content of the output message. Required. - :vartype content: list["OutputMessageContent"] - :ivar phase: Known values are: "commentary" and "final_answer". - :vartype phase: MessagePhase - :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or - ``incomplete``. Populated when input items are returned via API. Required. Is one of the - following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - id: Required[str] - """The unique ID of the output message. Required.""" - type: Required[Literal["output_message"]] - """The type of the output message. Always ``message``. Required. Default value is - \"output_message\".""" - role: Required[Literal["assistant"]] - """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" - content: Required[list["OutputMessageContent"]] - """The content of the output message. Required.""" - phase: Optional[MessagePhase] - """Known values are: \"commentary\" and \"final_answer\".""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when input items are returned via API. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemProgram(TypedDict, total=False): - """ItemProgram. - - :ivar type: The type of the item. Always ``program``. Required. Default value is "program". - :vartype type: Literal["program"] - :ivar id: The unique ID of the program item. Required. - :vartype id: str - :ivar call_id: The stable call ID of the program item. Required. - :vartype call_id: str - :ivar code: The JavaScript source executed by programmatic tool calling. Required. - :vartype code: str - :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. - :vartype fingerprint: str - """ - - type: Required[Literal["program"]] - """The type of the item. Always ``program``. Required. Default value is \"program\".""" - id: Required[str] - """The unique ID of the program item. Required.""" - call_id: Required[str] - """The stable call ID of the program item. Required.""" - code: Required[str] - """The JavaScript source executed by programmatic tool calling. Required.""" - fingerprint: Required[str] - """Opaque program replay fingerprint that must be round-tripped. Required.""" - - -class ItemProgramOutput(TypedDict, total=False): - """ItemProgramOutput. - - :ivar type: The type of the item. Always ``program_output``. Required. Default value is - "program_output". - :vartype type: Literal["program_output"] - :ivar id: The unique ID of the program output item. Required. - :vartype id: str - :ivar call_id: The call ID of the program item. Required. - :vartype call_id: str - :ivar result: The result produced by the program item. Required. - :vartype result: str - :ivar status: The terminal status of the program output item. Required. Known values are: - "completed" and "incomplete". - :vartype status: ProgramOutputStatus - """ - - type: Required[Literal["program_output"]] - """The type of the item. Always ``program_output``. Required. Default value is \"program_output\".""" - id: Required[str] - """The unique ID of the program output item. Required.""" - call_id: Required[str] - """The call ID of the program item. Required.""" - result: Required[str] - """The result produced by the program item. Required.""" - status: Required[ProgramOutputStatus] - """The terminal status of the program output item. Required. Known values are: \"completed\" and - \"incomplete\".""" - - -class ItemReasoningItem(TypedDict, total=False): - """Reasoning. - - :ivar type: The type of the object. Always ``reasoning``. Required. Default value is - "reasoning". - :vartype type: Literal["reasoning"] - :ivar id: The unique identifier of the reasoning content. Required. - :vartype id: str - :ivar encrypted_content: - :vartype encrypted_content: str - :ivar summary: Reasoning summary content. Required. - :vartype summary: list["SummaryTextContent"] - :ivar content: Reasoning text content. - :vartype content: list["ReasoningTextContent"] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - type: Required[Literal["reasoning"]] - """The type of the object. Always ``reasoning``. Required. Default value is \"reasoning\".""" - id: Required[str] - """The unique identifier of the reasoning content. Required.""" - encrypted_content: Optional[str] - summary: Required[list["SummaryTextContent"]] - """Reasoning summary content. Required.""" - content: list["ReasoningTextContent"] - """Reasoning text content.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class ItemReferenceParam(TypedDict, total=False): - """Item reference. - - :ivar type: The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE. - :vartype type: Literal["item_reference"] - :ivar id: The ID of the item to reference. Required. - :vartype id: str - """ - - type: Required[Literal["item_reference"]] - """The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE.""" - id: Required[str] - """The ID of the item to reference. Required.""" - - -class ItemWebSearchToolCall(TypedDict, total=False): - """Web search tool call. - - :ivar id: The unique ID of the web search tool call. Required. - :vartype id: str - :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. Default - value is "web_search_call". - :vartype type: Literal["web_search_call"] - :ivar status: The status of the web search tool call. Required. Is one of the following types: - Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], - Literal["incomplete"] - :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] - :ivar action: An object describing the specific action taken in this web search call. Includes - details on how the model used the web (search, open_page, find_in_page). Required. Is one of - the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind - :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", - "WebSearchActionFind"] - """ - - id: Required[str] - """The unique ID of the web search tool call. Required.""" - type: Required[Literal["web_search_call"]] - """The type of the web search tool call. Always ``web_search_call``. Required. Default value is - \"web_search_call\".""" - status: Required[Literal["in_progress", "searching", "completed", "failed", "incomplete"]] - """The status of the web search tool call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"], - Literal[\"incomplete\"]""" - action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] - """An object describing the specific action taken in this web search call. Includes details on how - the model used the web (search, open_page, find_in_page). Required. Is one of the following - types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" - - -class KeyPressAction(TypedDict, total=False): - """KeyPress. - - :ivar type: Specifies the event type. For a keypress action, this property is always set to - ``keypress``. Required. KEYPRESS. - :vartype type: Literal["keypress"] - :ivar keys: The combination of keys the model is requesting to be pressed. This is an array of - strings, each representing a key. Required. - :vartype keys: list[str] - """ - - type: Required[Literal["keypress"]] - """Specifies the event type. For a keypress action, this property is always set to ``keypress``. - Required. KEYPRESS.""" - keys: Required[list[str]] - """The combination of keys the model is requesting to be pressed. This is an array of strings, - each representing a key. Required.""" - - -class LocalEnvironmentResource(TypedDict, total=False): - """Local Environment. - - :ivar type: The environment type. Always ``local``. Required. LOCAL. - :vartype type: Literal["local"] - """ - - type: Required[Literal["local"]] - """The environment type. Always ``local``. Required. LOCAL.""" - - -class LocalShellExecAction(TypedDict, total=False): - """Local shell exec action. - - :ivar type: The type of the local shell action. Always ``exec``. Required. Default value is - "exec". - :vartype type: Literal["exec"] - :ivar command: The command to run. Required. - :vartype command: list[str] - :ivar timeout_ms: - :vartype timeout_ms: int - :ivar working_directory: - :vartype working_directory: str - :ivar env: Environment variables to set for the command. Required. - :vartype env: dict[str, str] - :ivar user: - :vartype user: str - """ - - type: Required[Literal["exec"]] - """The type of the local shell action. Always ``exec``. Required. Default value is \"exec\".""" - command: Required[list[str]] - """The command to run. Required.""" - timeout_ms: Optional[int] - working_directory: Optional[str] - env: Required[dict[str, str]] - """Environment variables to set for the command. Required.""" - user: Optional[str] - - -class LocalShellToolParam(TypedDict, total=False): - """Local shell tool. - - :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. - :vartype type: Literal["local_shell"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - """ - - type: Required[Literal["local_shell"]] - """The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - - -class LocalSkillParam(TypedDict, total=False): - """LocalSkillParam. - - :ivar name: The name of the skill. Required. - :vartype name: str - :ivar description: The description of the skill. Required. - :vartype description: str - :ivar path: The path to the directory containing the skill. Required. - :vartype path: str - """ - - name: Required[str] - """The name of the skill. Required.""" - description: Required[str] - """The description of the skill. Required.""" - path: Required[str] - """The path to the directory containing the skill. Required.""" - - -class LogProb(TypedDict, total=False): - """Log probability. - - :ivar token: Required. - :vartype token: str - :ivar logprob: Required. - :vartype logprob: float - :ivar bytes: Required. - :vartype bytes: list[int] - :ivar top_logprobs: Required. - :vartype top_logprobs: list["TopLogProb"] - """ - - token: Required[str] - """Required.""" - logprob: Required[float] - """Required.""" - bytes: Required[list[int]] - """Required.""" - top_logprobs: Required[list["TopLogProb"]] - """Required.""" - - -class MCPApprovalResponse(TypedDict, total=False): - """MCP approval response. - - :ivar type: The type of the item. Always ``mcp_approval_response``. Required. - MCP_APPROVAL_RESPONSE. - :vartype type: Literal["mcp_approval_response"] - :ivar id: - :vartype id: str - :ivar approval_request_id: The ID of the approval request being answered. Required. - :vartype approval_request_id: str - :ivar approve: Whether the request was approved. Required. - :vartype approve: bool - :ivar reason: - :vartype reason: str - """ - - type: Required[Literal["mcp_approval_response"]] - """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" - id: Optional[str] - approval_request_id: Required[str] - """The ID of the approval request being answered. Required.""" - approve: Required[bool] - """Whether the request was approved. Required.""" - reason: Optional[str] - - -class MCPListToolsTool(TypedDict, total=False): - """MCP list tools tool. - - :ivar name: The name of the tool. Required. - :vartype name: str - :ivar description: - :vartype description: str - :ivar input_schema: The JSON schema describing the tool's input. Required. - :vartype input_schema: "MCPListToolsToolInputSchema" - :ivar annotations: - :vartype annotations: "MCPListToolsToolAnnotations" - """ - - name: Required[str] - """The name of the tool. Required.""" - description: Optional[str] - input_schema: Required["MCPListToolsToolInputSchema"] - """The JSON schema describing the tool's input. Required.""" - annotations: Optional["MCPListToolsToolAnnotations"] - - -class MCPListToolsToolAnnotations(TypedDict, total=False): - """MCPListToolsToolAnnotations.""" - - -class MCPListToolsToolInputSchema(TypedDict, total=False): - """MCPListToolsToolInputSchema.""" - - -class MCPTool(TypedDict, total=False): - """MCP tool. - - :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. - :vartype type: Literal["mcp"] - :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. - :vartype server_label: str - :ivar server_url: The URL for the MCP server. One of ``server_url``, ``connector_id``, or - ``tunnel_id`` must be provided. - :vartype server_url: str - :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of - ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service - connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported - ``connector_id`` values are: - - * Dropbox: `connector_dropbox` - * Gmail: `connector_gmail` - * Google Calendar: `connector_googlecalendar` - * Google Drive: `connector_googledrive` - * Microsoft Teams: `connector_microsoftteams` - * Outlook Calendar: `connector_outlookcalendar` - * Outlook Email: `connector_outlookemail` - * SharePoint: `connector_sharepoint`. Is one of the following types: - Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], - Literal["connector_googledrive"], Literal["connector_microsoftteams"], - Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], - Literal["connector_sharepoint"] - :vartype connector_id: Literal["connector_dropbox", "connector_gmail", - "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", - "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"] - :ivar tunnel_id: The Secure MCP Tunnel ID to use instead of a direct server URL. One of - ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. - :vartype tunnel_id: str - :ivar authorization: An OAuth access token that can be used with a remote MCP server, either - with a custom MCP server URL or a service connector. Your application must handle the OAuth - authorization flow and provide the token here. - :vartype authorization: str - :ivar server_description: Optional description of the MCP server, used to provide more context. - :vartype server_description: str - :ivar headers: - :vartype headers: dict[str, str] - :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. - :vartype allowed_tools: Union[list[str], "MCPToolFilter"] - :ivar allowed_callers: - :vartype allowed_callers: list[CallableToolAllowedCaller] - :ivar require_approval: Is one of the following types: MCPToolRequireApproval, - Literal["always"], Literal["never"] - :vartype require_approval: Union["MCPToolRequireApproval", Literal["always"], Literal["never"]] - :ivar defer_loading: Whether this MCP tool is deferred and discovered via tool search. - :vartype defer_loading: bool - :ivar project_connection_id: The connection ID in the project for the MCP server. The - connection stores authentication and other connection details needed to connect to the MCP - server. - :vartype project_connection_id: str - """ - - type: Required[Literal["mcp"]] - """The type of the MCP tool. Always ``mcp``. Required. MCP.""" - server_label: Required[str] - """A label for this MCP server, used to identify it in tool calls. Required.""" - server_url: str - """The URL for the MCP server. One of ``server_url``, ``connector_id``, or ``tunnel_id`` must be - provided.""" - connector_id: Literal[ - "connector_dropbox", - "connector_gmail", - "connector_googlecalendar", - "connector_googledrive", - "connector_microsoftteams", - "connector_outlookcalendar", - "connector_outlookemail", - "connector_sharepoint", + """The error code for the response.""" + + ResponseStreamEventType = Literal[ + "response.audio.delta", + "response.audio.done", + "response.audio.transcript.delta", + "response.audio.transcript.done", + "response.code_interpreter_call_code.delta", + "response.code_interpreter_call_code.done", + "response.code_interpreter_call.completed", + "response.code_interpreter_call.in_progress", + "response.code_interpreter_call.interpreting", + "response.completed", + "response.content_part.added", + "response.content_part.done", + "response.created", + "error", + "response.file_search_call.completed", + "response.file_search_call.in_progress", + "response.file_search_call.searching", + "response.function_call_arguments.delta", + "response.function_call_arguments.done", + "response.shell_call_command.added", + "response.shell_call_command.delta", + "response.shell_call_command.done", + "response.shell_call_output_content.delta", + "response.shell_call_output_content.done", + "response.in_progress", + "response.failed", + "response.incomplete", + "response.output_item.added", + "response.output_item.done", + "response.reasoning_summary_part.added", + "response.reasoning_summary_part.done", + "response.reasoning_summary_text.delta", + "response.reasoning_summary_text.done", + "response.reasoning_text.delta", + "response.reasoning_text.done", + "response.refusal.delta", + "response.refusal.done", + "response.output_text.delta", + "response.output_text.done", + "response.web_search_call.completed", + "response.web_search_call.in_progress", + "response.web_search_call.searching", + "response.image_generation_call.completed", + "response.image_generation_call.generating", + "response.image_generation_call.in_progress", + "response.image_generation_call.partial_image", + "response.mcp_call_arguments.delta", + "response.mcp_call_arguments.done", + "response.mcp_call.completed", + "response.mcp_call.failed", + "response.mcp_call.in_progress", + "response.mcp_list_tools.completed", + "response.mcp_list_tools.failed", + "response.mcp_list_tools.in_progress", + "response.output_text.annotation.added", + "response.queued", + "response.custom_tool_call_input.delta", + "response.custom_tool_call_input.done", ] - """Identifier for service connectors, like those available in ChatGPT. One of ``server_url``, - ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported ``connector_id`` values are: - - * Dropbox: `connector_dropbox` - * Gmail: `connector_gmail` - * Google Calendar: `connector_googlecalendar` - * Google Drive: `connector_googledrive` - * Microsoft Teams: `connector_microsoftteams` - * Outlook Calendar: `connector_outlookcalendar` - * Outlook Email: `connector_outlookemail` - * SharePoint: `connector_sharepoint`. Is one of the following types: - Literal[\"connector_dropbox\"], Literal[\"connector_gmail\"], - Literal[\"connector_googlecalendar\"], Literal[\"connector_googledrive\"], - Literal[\"connector_microsoftteams\"], Literal[\"connector_outlookcalendar\"], - Literal[\"connector_outlookemail\"], Literal[\"connector_sharepoint\"]""" - tunnel_id: str - """The Secure MCP Tunnel ID to use instead of a direct server URL. One of ``server_url``, - ``connector_id``, or ``tunnel_id`` must be provided.""" - authorization: str - """An OAuth access token that can be used with a remote MCP server, either with a custom MCP - server URL or a service connector. Your application must handle the OAuth authorization flow - and provide the token here.""" - server_description: str - """Optional description of the MCP server, used to provide more context.""" - headers: Optional[dict[str, str]] - allowed_tools: Optional[Union[list[str], "MCPToolFilter"]] - """Is either a [str] type or a MCPToolFilter type.""" - allowed_callers: Optional[list[CallableToolAllowedCaller]] - require_approval: Optional[Union["MCPToolRequireApproval", Literal["always"], Literal["never"]]] - """Is one of the following types: MCPToolRequireApproval, Literal[\"always\"], Literal[\"never\"]""" - defer_loading: bool - """Whether this MCP tool is deferred and discovered via tool search.""" - project_connection_id: str - """The connection ID in the project for the MCP server. The connection stores authentication and - other connection details needed to connect to the MCP server.""" - - -class MCPToolFilter(TypedDict, total=False): - """MCP tool filter. - - :ivar tool_names: MCP allowed tools. - :vartype tool_names: list[str] - :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP - server is `annotated with `readOnlyHint` - `_, - it will match this filter. - :vartype read_only: bool - """ - - tool_names: list[str] - """MCP allowed tools.""" - read_only: bool - """Indicates whether or not a tool modifies data or is read-only. If an MCP server is `annotated - with `readOnlyHint` - `_, - it will match this filter.""" - - -class MCPToolRequireApproval(TypedDict, total=False): - """MCPToolRequireApproval. - - :ivar always: - :vartype always: "MCPToolFilter" - :ivar never: - :vartype never: "MCPToolFilter" - """ - - always: "MCPToolFilter" - never: "MCPToolFilter" - - -class MemorySearchItem(TypedDict, total=False): - """A retrieved memory item from memory search. - - :ivar memory_item: Retrieved memory item. Required. - :vartype memory_item: "MemoryItem" - """ - - memory_item: Required["MemoryItem"] - """Retrieved memory item. Required.""" - - -class MemorySearchOptions(TypedDict, total=False): - """Memory search options. - - :ivar max_memories: Maximum number of memory items to return. - :vartype max_memories: int - """ - - max_memories: int - """Maximum number of memory items to return.""" - - -class MemorySearchPreviewTool(TypedDict, total=False): - """A tool for integrating memories into the agent. - - :ivar type: The type of the tool. Always ``memory_search_preview``. Required. - MEMORY_SEARCH_PREVIEW. - :vartype type: Literal["memory_search_preview"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar memory_store_name: The name of the memory store to use. Required. - :vartype memory_store_name: str - :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which - memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to - the current signed-in user. Required. - :vartype scope: str - :ivar search_options: Options for searching the memory store. - :vartype search_options: "MemorySearchOptions" - :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default - 300. - :vartype update_delay: int - """ - - type: Required[Literal["memory_search_preview"]] - """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - memory_store_name: Required[str] - """The name of the memory store to use. Required.""" - scope: Required[str] - """The namespace used to group and isolate memories, such as a user ID. Limits which memories can - be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current - signed-in user. Required.""" - search_options: "MemorySearchOptions" - """Options for searching the memory store.""" - update_delay: int - """Time to wait before updating memories after inactivity (seconds). Default 300.""" - - -class MemorySearchToolCallItemParam(TypedDict, total=False): - """MemorySearchToolCallItemParam. - - :ivar type: Required. Default value is "memory_search_call". - :vartype type: Literal["memory_search_call"] - :ivar results: The results returned from the memory search. - :vartype results: list["MemorySearchItem"] - """ - - type: Required[Literal["memory_search_call"]] - """Required. Default value is \"memory_search_call\".""" - results: Optional[list["MemorySearchItem"]] - """The results returned from the memory search.""" - - -class MemorySearchToolCallItemResource(TypedDict, total=False): - """MemorySearchToolCallItemResource. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. MEMORY_SEARCH_CALL. - :vartype type: Literal["memory_search_call"] - :ivar status: The status of the memory search tool call. One of ``in_progress``, ``searching``, - ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: - Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["incomplete"], - Literal["failed"] - :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] - :ivar results: The results returned from the memory search. - :vartype results: list["MemorySearchItem"] - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["memory_search_call"]] - """Required. MEMORY_SEARCH_CALL.""" - status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] - """The status of the memory search tool call. One of ``in_progress``, ``searching``, - ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], - Literal[\"incomplete\"], Literal[\"failed\"]""" - results: Optional[list["MemorySearchItem"]] - """The results returned from the memory search.""" - id: Required[str] - """Required.""" - - -class MessageContentInputFileContent(TypedDict, total=False): - """Input file. - - :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. - :vartype type: Literal["input_file"] - :ivar file_id: - :vartype file_id: str - :ivar filename: The name of the file to be sent to the model. - :vartype filename: str - :ivar file_data: The content of the file to be sent to the model. - :vartype file_data: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - :ivar file_url: The URL of the file to be sent to the model. - :vartype file_url: str - :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the - system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality - rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or - ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", - "low", and "high". - :vartype detail: FileInputDetail - """ - - type: Required[Literal["input_file"]] - """The type of the input item. Always ``input_file``. Required. INPUT_FILE.""" - file_id: Optional[str] - filename: str - """The name of the file to be sent to the model.""" - file_data: str - """The content of the file to be sent to the model.""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - file_url: str - """The URL of the file to be sent to the model.""" - detail: FileInputDetail - """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the - detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may - increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the - file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and - \"high\".""" - - -class MessageContentInputImageContent(TypedDict, total=False): - """Input image. - - :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. - :vartype type: Literal["input_image"] - :ivar image_url: - :vartype image_url: str - :ivar file_id: - :vartype file_id: str - :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, - ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", - "auto", and "original". - :vartype detail: ImageDetail - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["input_image"]] - """The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.""" - image_url: Optional[str] - file_id: Optional[str] - detail: Required[ImageDetail] - """The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or - ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", \"auto\", - and \"original\".""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class MessageContentInputTextContent(TypedDict, total=False): - """Input text. - - :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. - :vartype type: Literal["input_text"] - :ivar text: The text input to the model. Required. - :vartype text: str - :ivar prompt_cache_breakpoint: - :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - """ - - type: Required[Literal["input_text"]] - """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" - text: Required[str] - """The text input to the model. Required.""" - prompt_cache_breakpoint: "PromptCacheBreakpointConfig" - - -class MessageContentOutputTextContent(TypedDict, total=False): - """Output text. - - :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. - :vartype type: Literal["output_text"] - :ivar text: The text output from the model. Required. - :vartype text: str - :ivar annotations: The annotations of the text output. - :vartype annotations: list["Annotation"] - :ivar logprobs: - :vartype logprobs: list["LogProb"] - """ - - type: Required[Literal["output_text"]] - """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" - text: Required[str] - """The text output from the model. Required.""" - annotations: list["Annotation"] - """The annotations of the text output.""" - logprobs: list["LogProb"] - - -class MessageContentReasoningTextContent(TypedDict, total=False): - """Reasoning text. - - :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. - REASONING_TEXT. - :vartype type: Literal["reasoning_text"] - :ivar text: The reasoning text from the model. Required. - :vartype text: str - """ - - type: Required[Literal["reasoning_text"]] - """The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.""" - text: Required[str] - """The reasoning text from the model. Required.""" - - -class MessageContentRefusalContent(TypedDict, total=False): - """Refusal. - - :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. - :vartype type: Literal["refusal"] - :ivar refusal: The refusal explanation from the model. Required. - :vartype refusal: str - """ - - type: Required[Literal["refusal"]] - """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" - refusal: Required[str] - """The refusal explanation from the model. Required.""" - - -class Metadata(TypedDict, total=False): - """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing - additional information about the object in a structured format, and querying for objects via - API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are - strings with a maximum length of 512 characters. - - """ - - -class MicrosoftFabricPreviewTool(TypedDict, total=False): - """The input definition information for a Microsoft Fabric tool as used to configure an agent. - - :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. - FABRIC_DATAAGENT_PREVIEW. - :vartype type: Literal["fabric_dataagent_preview"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. - :vartype fabric_dataagent_preview: "FabricDataAgentToolParameters" - """ - - type: Required[Literal["fabric_dataagent_preview"]] - """The object type, which is always 'fabric_dataagent_preview'. Required. - FABRIC_DATAAGENT_PREVIEW.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - fabric_dataagent_preview: Required["FabricDataAgentToolParameters"] - """The fabric data agent tool parameters. Required.""" - - -class Moderation(TypedDict, total=False): - """Moderation. - - :ivar input: Moderation for the response input. Required. - :vartype input: "ModerationEntry" - :ivar output: Moderation for the response output. Required. - :vartype output: "ModerationEntry" - """ - - input: Required["ModerationEntry"] - """Moderation for the response input. Required.""" - output: Required["ModerationEntry"] - """Moderation for the response output. Required.""" - - -class ModerationConfigParam(TypedDict, total=False): - """The moderation policy for the response input. - - :ivar mode: Required. Known values are: "score" and "block". - :vartype mode: ModerationMode - """ - - mode: Required[ModerationMode] - """Required. Known values are: \"score\" and \"block\".""" - - -class ModerationErrorBody(TypedDict, total=False): - """Moderation error. - - :ivar type: The object type, which was always ``error`` for moderation failures. Required. - ERROR. - :vartype type: Literal["error"] - :ivar code: The error code. Required. - :vartype code: str - :ivar message: The error message. Required. - :vartype message: str - """ - - type: Required[Literal["error"]] - """The object type, which was always ``error`` for moderation failures. Required. ERROR.""" - code: Required[str] - """The error code. Required.""" - message: Required[str] - """The error message. Required.""" - - -class ModerationParam(TypedDict, total=False): - """Configuration for running moderation on the input and output of this response. - - :ivar model: The moderation model to use for moderated completions, e.g. - 'omni-moderation-latest'. Required. - :vartype model: str - :ivar policy: - :vartype policy: "ModerationPolicyParam" - """ - - model: Required[str] - """The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'. Required.""" - policy: Optional["ModerationPolicyParam"] - - -class ModerationPolicyParam(TypedDict, total=False): - """The policy to apply to moderated response input and output. - - :ivar input: - :vartype input: "ModerationConfigParam" - :ivar output: - :vartype output: "ModerationConfigParam" - """ - - input: Optional["ModerationConfigParam"] - output: Optional["ModerationConfigParam"] - - -class ModerationResultBody(TypedDict, total=False): - """Moderation result. - - :ivar type: The object type, which was always ``moderation_result`` for successful moderation - results. Required. MODERATION_RESULT. - :vartype type: Literal["moderation_result"] - :ivar model: The moderation model that produced this result. Required. - :vartype model: str - :ivar flagged: A boolean indicating whether the content was flagged by any category. Required. - :vartype flagged: bool - :ivar categories: A dictionary of moderation categories to booleans, True if the input is - flagged under this category. Required. - :vartype categories: dict[str, bool] - :ivar category_scores: A dictionary of moderation categories to scores. Required. - :vartype category_scores: dict[str, float] - :ivar category_applied_input_types: Which modalities of input are reflected by the score for - each category. Required. - :vartype category_applied_input_types: dict[str, list[ModerationInputType]] - """ - - type: Required[Literal["moderation_result"]] - """The object type, which was always ``moderation_result`` for successful moderation results. - Required. MODERATION_RESULT.""" - model: Required[str] - """The moderation model that produced this result. Required.""" - flagged: Required[bool] - """A boolean indicating whether the content was flagged by any category. Required.""" - categories: Required[dict[str, bool]] - """A dictionary of moderation categories to booleans, True if the input is flagged under this - category. Required.""" - category_scores: Required[dict[str, float]] - """A dictionary of moderation categories to scores. Required.""" - category_applied_input_types: Required[dict[str, list[ModerationInputType]]] - """Which modalities of input are reflected by the score for each category. Required.""" - - -class MoveParam(TypedDict, total=False): - """Move. - - :ivar type: Specifies the event type. For a move action, this property is always set to - ``move``. Required. MOVE. - :vartype type: Literal["move"] - :ivar x: The x-coordinate to move to. Required. - :vartype x: int - :ivar y: The y-coordinate to move to. Required. - :vartype y: int - :ivar keys: - :vartype keys: list[str] - """ - - type: Required[Literal["move"]] - """Specifies the event type. For a move action, this property is always set to ``move``. Required. - MOVE.""" - x: Required[int] - """The x-coordinate to move to. Required.""" - y: Required[int] - """The y-coordinate to move to. Required.""" - keys: Optional[list[str]] - - -class NamespaceToolParam(TypedDict, total=False): - """Namespace. - - :ivar type: The type of the tool. Always ``namespace``. Required. NAMESPACE. - :vartype type: Literal["namespace"] - :ivar name: The namespace name used in tool calls (for example, ``crm``). Required. - :vartype name: str - :ivar description: A description of the namespace shown to the model. Required. - :vartype description: str - :ivar tools: The function/custom tools available inside this namespace. Required. - :vartype tools: list[Union["FunctionToolParam", "CustomToolParam"]] - """ - - type: Required[Literal["namespace"]] - """The type of the tool. Always ``namespace``. Required. NAMESPACE.""" - name: Required[str] - """The namespace name used in tool calls (for example, ``crm``). Required.""" - description: Required[str] - """A description of the namespace shown to the model. Required.""" - tools: Required[list[Union["FunctionToolParam", "CustomToolParam"]]] - """The function/custom tools available inside this namespace. Required.""" - - -class OAuthConsentRequestOutputItem(TypedDict, total=False): - """Request from the service for the user to perform OAuth consent. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar id: Required. - :vartype id: str - :ivar type: Required. OAUTH_CONSENT_REQUEST. - :vartype type: Literal["oauth_consent_request"] - :ivar consent_link: The link the user can use to perform OAuth consent. Required. - :vartype consent_link: str - :ivar server_label: The server label for the OAuth consent request. Required. - :vartype server_label: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - id: Required[str] - """Required.""" - type: Required[Literal["oauth_consent_request"]] - """Required. OAUTH_CONSENT_REQUEST.""" - consent_link: Required[str] - """The link the user can use to perform OAuth consent. Required.""" - server_label: Required[str] - """The server label for the OAuth consent request. Required.""" - - -class OpenApiAnonymousAuthDetails(TypedDict, total=False): - """Security details for OpenApi anonymous authentication. - - :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. - :vartype type: Literal["anonymous"] - """ - - type: Required[Literal["anonymous"]] - """The object type, which is always 'anonymous'. Required. ANONYMOUS.""" - - -class OpenApiFunctionDefinition(TypedDict, total=False): - """The input definition information for an openapi function. - - :ivar name: The name of the function to be called. Required. - :vartype name: str - :ivar description: A description of what the function does, used by the model to choose when - and how to call the function. - :vartype description: str - :ivar spec: The openapi function shape, described as a JSON Schema object. Required. - :vartype spec: dict[str, Any] - :ivar auth: Open API authentication details. Required. - :vartype auth: "OpenApiAuthDetails" - :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults. - :vartype default_params: list[str] - :ivar functions: List of function definitions used by OpenApi tool. - :vartype functions: list["OpenApiFunctionDefinitionFunction"] - """ - - name: Required[str] - """The name of the function to be called. Required.""" - description: str - """A description of what the function does, used by the model to choose when and how to call the - function.""" - spec: Required[dict[str, Any]] - """The openapi function shape, described as a JSON Schema object. Required.""" - auth: Required["OpenApiAuthDetails"] - """Open API authentication details. Required.""" - default_params: list[str] - """List of OpenAPI spec parameters that will use user-provided defaults.""" - functions: list["OpenApiFunctionDefinitionFunction"] - """List of function definitions used by OpenApi tool.""" - - -class OpenApiFunctionDefinitionFunction(TypedDict, total=False): - """OpenApiFunctionDefinitionFunction. - - :ivar name: The name of the function to be called. Required. - :vartype name: str - :ivar description: A description of what the function does, used by the model to choose when - and how to call the function. - :vartype description: str - :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. - Required. - :vartype parameters: dict[str, Any] - """ - - name: Required[str] - """The name of the function to be called. Required.""" - description: str - """A description of what the function does, used by the model to choose when and how to call the - function.""" - parameters: Required[dict[str, Any]] - """The parameters the functions accepts, described as a JSON Schema object. Required.""" - - -class OpenApiManagedAuthDetails(TypedDict, total=False): - """Security details for OpenApi managed_identity authentication. - - :ivar type: The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY. - :vartype type: Literal["managed_identity"] - :ivar security_scheme: Connection auth security details. Required. - :vartype security_scheme: "OpenApiManagedSecurityScheme" - """ - - type: Required[Literal["managed_identity"]] - """The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY.""" - security_scheme: Required["OpenApiManagedSecurityScheme"] - """Connection auth security details. Required.""" - - -class OpenApiManagedSecurityScheme(TypedDict, total=False): - """Security scheme for OpenApi managed_identity authentication. - - :ivar audience: Authentication scope for managed_identity auth type. Required. - :vartype audience: str - """ - - audience: Required[str] - """Authentication scope for managed_identity auth type. Required.""" - - -class OpenApiProjectConnectionAuthDetails(TypedDict, total=False): - """Security details for OpenApi project connection authentication. - - :ivar type: The object type, which is always 'project_connection'. Required. - PROJECT_CONNECTION. - :vartype type: Literal["project_connection"] - :ivar security_scheme: Project connection auth security details. Required. - :vartype security_scheme: "OpenApiProjectConnectionSecurityScheme" - """ - - type: Required[Literal["project_connection"]] - """The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION.""" - security_scheme: Required["OpenApiProjectConnectionSecurityScheme"] - """Project connection auth security details. Required.""" - - -class OpenApiProjectConnectionSecurityScheme(TypedDict, total=False): - """Security scheme for OpenApi managed_identity authentication. - - :ivar project_connection_id: Project connection id for Project Connection auth type. Required. - :vartype project_connection_id: str - """ - - project_connection_id: Required[str] - """Project connection id for Project Connection auth type. Required.""" - - -class OpenApiTool(TypedDict, total=False): - """The input definition information for an OpenAPI tool as used to configure an agent. - - :ivar type: The object type, which is always 'openapi'. Required. OPENAPI. - :vartype type: Literal["openapi"] - :ivar openapi: The openapi function definition. Required. - :vartype openapi: "OpenApiFunctionDefinition" - """ - - type: Required[Literal["openapi"]] - """The object type, which is always 'openapi'. Required. OPENAPI.""" - openapi: Required["OpenApiFunctionDefinition"] - """The openapi function definition. Required.""" - - -class OpenApiToolCall(TypedDict, total=False): - """An OpenAPI tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. OPENAPI_CALL. - :vartype type: Literal["openapi_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar name: The name of the OpenAPI operation being called. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["openapi_call"]] - """Required. OPENAPI_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - name: Required[str] - """The name of the OpenAPI operation being called. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class OpenApiToolCallOutput(TypedDict, total=False): - """The output of an OpenAPI tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. OPENAPI_CALL_OUTPUT. - :vartype type: Literal["openapi_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar name: The name of the OpenAPI operation that was called. Required. - :vartype name: str - :ivar output: The output from the OpenAPI tool call. Is one of the following types: {str: Any}, - str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["openapi_call_output"]] - """Required. OPENAPI_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - name: Required[str] - """The name of the OpenAPI operation that was called. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the OpenAPI tool call. Is one of the following types: {str: Any}, str, [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class OutputContentOutputTextContent(TypedDict, total=False): - """Output text. - - :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. - :vartype type: Literal["output_text"] - :ivar text: The text output from the model. Required. - :vartype text: str - :ivar annotations: The annotations of the text output. - :vartype annotations: list["Annotation"] - :ivar logprobs: - :vartype logprobs: list["LogProb"] - """ - - type: Required[Literal["output_text"]] - """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" - text: Required[str] - """The text output from the model. Required.""" - annotations: list["Annotation"] - """The annotations of the text output.""" - logprobs: list["LogProb"] - - -class OutputContentReasoningTextContent(TypedDict, total=False): - """Reasoning text. - - :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. - REASONING_TEXT. - :vartype type: Literal["reasoning_text"] - :ivar text: The reasoning text from the model. Required. - :vartype text: str - """ - - type: Required[Literal["reasoning_text"]] - """The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.""" - text: Required[str] - """The reasoning text from the model. Required.""" - - -class OutputContentRefusalContent(TypedDict, total=False): - """Refusal. - - :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. - :vartype type: Literal["refusal"] - :ivar refusal: The refusal explanation from the model. Required. - :vartype refusal: str - """ - - type: Required[Literal["refusal"]] - """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" - refusal: Required[str] - """The refusal explanation from the model. Required.""" - - -class OutputItemAdditionalTools(TypedDict, total=False): - """OutputItemAdditionalTools. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. - :vartype type: Literal["additional_tools"] - :ivar id: The unique ID of the additional tools item. Required. - :vartype id: str - :ivar role: The role that provided the additional tools. Required. Known values are: "unknown", - "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". - :vartype role: MessageRole - :ivar tools: The additional tool definitions made available at this item. Required. - :vartype tools: list["Tool"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["additional_tools"]] - """The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.""" - id: Required[str] - """The unique ID of the additional tools item. Required.""" - role: Required[MessageRole] - """The role that provided the additional tools. Required. Known values are: \"unknown\", \"user\", - \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and \"tool\".""" - tools: Required[list["Tool"]] - """The additional tool definitions made available at this item. Required.""" - - -class OutputItemApplyPatchToolCall(TypedDict, total=False): - """Apply patch tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. - :vartype type: Literal["apply_patch_call"] - :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via - API. Required. - :vartype id: str - :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. - Required. Known values are: "in_progress" and "completed". - :vartype status: ApplyPatchCallStatus - :ivar operation: Apply patch operation. Required. - :vartype operation: "ApplyPatchFileOperation" - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["apply_patch_call"]] - """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" - id: Required[str] - """The unique ID of the apply patch tool call. Populated when this item is returned via API. - Required.""" - call_id: Required[str] - """The unique ID of the apply patch tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - status: Required[ApplyPatchCallStatus] - """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. - Known values are: \"in_progress\" and \"completed\".""" - operation: Required["ApplyPatchFileOperation"] - """Apply patch operation. Required.""" - - -class OutputItemApplyPatchToolCallOutput(TypedDict, total=False): - """Apply patch tool call output. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. - APPLY_PATCH_CALL_OUTPUT. - :vartype type: Literal["apply_patch_call_output"] - :ivar id: The unique ID of the apply patch tool call output. Populated when this item is - returned via API. Required. - :vartype id: str - :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar status: The status of the apply patch tool call output. One of ``completed`` or - ``failed``. Required. Known values are: "completed" and "failed". - :vartype status: ApplyPatchCallOutputStatus - :ivar output: - :vartype output: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["apply_patch_call_output"]] - """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" - id: Required[str] - """The unique ID of the apply patch tool call output. Populated when this item is returned via - API. Required.""" - call_id: Required[str] - """The unique ID of the apply patch tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - status: Required[ApplyPatchCallOutputStatus] - """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. - Known values are: \"completed\" and \"failed\".""" - output: Optional[str] - - -class OutputItemCodeInterpreterToolCall(TypedDict, total=False): - """Code interpreter tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. - Required. CODE_INTERPRETER_CALL. - :vartype type: Literal["code_interpreter_call"] - :ivar id: The unique ID of the code interpreter tool call. Required. - :vartype id: str - :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, - ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the - following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], - Literal["interpreting"], Literal["failed"] - :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] - :ivar container_id: The ID of the container used to run the code. Required. - :vartype container_id: str - :ivar code: Required. - :vartype code: str - :ivar outputs: Required. - :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["code_interpreter_call"]] - """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. - CODE_INTERPRETER_CALL.""" - id: Required[str] - """The unique ID of the code interpreter tool call. Required.""" - status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] - """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, - ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], - Literal[\"interpreting\"], Literal[\"failed\"]""" - container_id: Required[str] - """The ID of the container used to run the code. Required.""" - code: Required[Optional[str]] - """Required.""" - outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] - """Required.""" - - -class OutputItemCompactionBody(TypedDict, total=False): - """Compaction item. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. - :vartype type: Literal["compaction"] - :ivar id: The unique ID of the compaction item. Required. - :vartype id: str - :ivar encrypted_content: The encrypted content that was produced by compaction. Required. - :vartype encrypted_content: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["compaction"]] - """The type of the item. Always ``compaction``. Required. COMPACTION.""" - id: Required[str] - """The unique ID of the compaction item. Required.""" - encrypted_content: Required[str] - """The encrypted content that was produced by compaction. Required.""" - - -class OutputItemComputerToolCall(TypedDict, total=False): - """Computer tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. - :vartype type: Literal["computer_call"] - :ivar id: The unique ID of the computer call. Required. - :vartype id: str - :ivar call_id: An identifier used when responding to the tool call with output. Required. - :vartype call_id: str - :ivar action: - :vartype action: "ComputerAction" - :ivar actions: - :vartype actions: list["ComputerAction"] - :ivar pending_safety_checks: The pending safety checks for the computer call. Required. - :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["computer_call"]] - """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" - id: Required[str] - """The unique ID of the computer call. Required.""" - call_id: Required[str] - """An identifier used when responding to the tool call with output. Required.""" - action: "ComputerAction" - actions: list["ComputerAction"] - pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] - """The pending safety checks for the computer call. Required.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemComputerToolCallOutput(TypedDict, total=False): - """Computer tool call output. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the computer tool call output. Always ``computer_call_output``. - Required. COMPUTER_CALL_OUTPUT. - :vartype type: Literal["computer_call_output"] - :ivar id: The ID of the computer tool call output. Required. - :vartype id: str - :ivar call_id: The ID of the computer tool call that produced the output. Required. - :vartype call_id: str - :ivar acknowledged_safety_checks: The safety checks reported by the API that have been - acknowledged by the developer. - :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] - :ivar output: Required. - :vartype output: "ComputerScreenshotImage" - :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or - ``incomplete``. Populated when input items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["computer_call_output"]] - """The type of the computer tool call output. Always ``computer_call_output``. Required. - COMPUTER_CALL_OUTPUT.""" - id: Required[str] - """The ID of the computer tool call output. Required.""" - call_id: Required[str] - """The ID of the computer tool call that produced the output. Required.""" - acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] - """The safety checks reported by the API that have been acknowledged by the developer.""" - output: Required["ComputerScreenshotImage"] - """Required.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when input items are returned via API. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemFileSearchToolCall(TypedDict, total=False): - """File search tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar id: The unique ID of the file search tool call. Required. - :vartype id: str - :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. - FILE_SEARCH_CALL. - :vartype type: Literal["file_search_call"] - :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, - ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], - Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] - :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] - :ivar queries: The queries used to search for files. Required. - :vartype queries: list[str] - :ivar results: - :vartype results: list["FileSearchToolCallResults"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - id: Required[str] - """The unique ID of the file search tool call. Required.""" - type: Required[Literal["file_search_call"]] - """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" - status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] - """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` - or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], - Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" - queries: Required[list[str]] - """The queries used to search for files. Required.""" - results: Optional[list["FileSearchToolCallResults"]] - - -class OutputItemFunctionShellCall(TypedDict, total=False): - """Shell tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. - :vartype type: Literal["shell_call"] - :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. - Required. - :vartype id: str - :ivar call_id: The unique ID of the shell tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar action: The shell commands and limits that describe how to run the tool call. Required. - :vartype action: "FunctionShellAction" - :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or - ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionShellCallStatus - :ivar environment: Required. - :vartype environment: "FunctionShellCallEnvironment" - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["shell_call"]] - """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" - id: Required[str] - """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" - call_id: Required[str] - """The unique ID of the shell tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - action: Required["FunctionShellAction"] - """The shell commands and limits that describe how to run the tool call. Required.""" - status: Required[FunctionShellCallStatus] - """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. - Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - environment: Required[Optional["FunctionShellCallEnvironment"]] - """Required.""" - - -class OutputItemFunctionShellCallOutput(TypedDict, total=False): - """Shell call output. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. - SHELL_CALL_OUTPUT. - :vartype type: Literal["shell_call_output"] - :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. - Required. - :vartype id: str - :ivar call_id: The unique ID of the shell tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or - ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionShellCallOutputStatusEnum - :ivar output: An array of shell call output contents. Required. - :vartype output: list["FunctionShellCallOutputContent"] - :ivar max_output_length: Required. - :vartype max_output_length: int - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["shell_call_output"]] - """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" - id: Required[str] - """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" - call_id: Required[str] - """The unique ID of the shell tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - status: Required[FunctionShellCallOutputStatusEnum] - """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. - Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - output: Required[list["FunctionShellCallOutputContent"]] - """An array of shell call output contents. Required.""" - max_output_length: Required[Optional[int]] - """Required.""" - - -class OutputItemFunctionToolCall(TypedDict, total=False): - """Function tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar id: The unique ID of the function tool call. Required. - :vartype id: str - :ivar type: The type of the function tool call. Always ``function_call``. Required. - FUNCTION_CALL. - :vartype type: Literal["function_call"] - :ivar call_id: The unique ID of the function tool call generated by the model. Required. - :vartype call_id: str - :ivar caller: - :vartype caller: "ToolCallCaller" - :ivar namespace: The namespace of the function to run. - :vartype namespace: str - :ivar name: The name of the function to run. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments to pass to the function. Required. - :vartype arguments: str - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - id: Required[str] - """The unique ID of the function tool call. Required.""" - type: Required[Literal["function_call"]] - """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" - call_id: Required[str] - """The unique ID of the function tool call generated by the model. Required.""" - caller: Optional["ToolCallCaller"] - namespace: str - """The namespace of the function to run.""" - name: Required[str] - """The name of the function to run. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the function. Required.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemFunctionToolCallOutput(TypedDict, total=False): - """Function tool call output. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar id: The unique ID of the function tool call output. Populated when this item is returned - via API. Required. - :vartype id: str - :ivar type: The type of the function tool call output. Always ``function_call_output``. - Required. FUNCTION_CALL_OUTPUT. - :vartype type: Literal["function_call_output"] - :ivar call_id: The unique ID of the function tool call generated by the model. - :vartype call_id: str - :ivar name: The name of the tool that produced the output. - :vartype name: str - :ivar namespace: The namespace of the tool that produced the output. - :vartype namespace: str - :ivar caller: - :vartype caller: "ToolCallCallerParam" - :ivar output: The output from the function call generated by your code. Can be a string or an - list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] - type. - :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - id: Required[str] - """The unique ID of the function tool call output. Populated when this item is returned via API. - Required.""" - type: Required[Literal["function_call_output"]] - """The type of the function tool call output. Always ``function_call_output``. Required. - FUNCTION_CALL_OUTPUT.""" - call_id: str - """The unique ID of the function tool call generated by the model.""" - name: str - """The name of the tool that produced the output.""" - namespace: str - """The namespace of the tool that produced the output.""" - caller: Optional["ToolCallCallerParam"] - output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] - """The output from the function call generated by your code. Can be a string or an list of output - content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemImageGenToolCall(TypedDict, total=False): - """Image generation call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. - IMAGE_GENERATION_CALL. - :vartype type: Literal["image_generation_call"] - :ivar id: The unique ID of the image generation call. Required. - :vartype id: str - :ivar status: The status of the image generation call. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] - :vartype status: Literal["in_progress", "completed", "generating", "failed"] - :ivar result: Required. - :vartype result: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["image_generation_call"]] - """The type of the image generation call. Always ``image_generation_call``. Required. - IMAGE_GENERATION_CALL.""" - id: Required[str] - """The unique ID of the image generation call. Required.""" - status: Required[Literal["in_progress", "completed", "generating", "failed"]] - """The status of the image generation call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" - result: Required[Optional[str]] - """Required.""" - - -class OutputItemLocalShellToolCall(TypedDict, total=False): - """Local shell call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. - LOCAL_SHELL_CALL. - :vartype type: Literal["local_shell_call"] - :ivar id: The unique ID of the local shell call. Required. - :vartype id: str - :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. - :vartype call_id: str - :ivar action: Required. - :vartype action: "LocalShellExecAction" - :ivar status: The status of the local shell call. Required. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["local_shell_call"]] - """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" - id: Required[str] - """The unique ID of the local shell call. Required.""" - call_id: Required[str] - """The unique ID of the local shell tool call generated by the model. Required.""" - action: Required["LocalShellExecAction"] - """Required.""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the local shell call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemLocalShellToolCallOutput(TypedDict, total=False): - """Local shell call output. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. - Required. LOCAL_SHELL_CALL_OUTPUT. - :vartype type: Literal["local_shell_call_output"] - :ivar id: The unique ID of the local shell tool call generated by the model. Required. - :vartype id: str - :ivar output: A JSON string of the output of the local shell tool call. Required. - :vartype output: str - :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], - Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["local_shell_call_output"]] - """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. - LOCAL_SHELL_CALL_OUTPUT.""" - id: Required[str] - """The unique ID of the local shell tool call generated by the model. Required.""" - output: Required[str] - """A JSON string of the output of the local shell tool call. Required.""" - status: Optional[Literal["in_progress", "completed", "incomplete"]] - """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], - Literal[\"incomplete\"]""" - - -class OutputItemMcpApprovalRequest(TypedDict, total=False): - """MCP approval request. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``mcp_approval_request``. Required. - MCP_APPROVAL_REQUEST. - :vartype type: Literal["mcp_approval_request"] - :ivar id: The unique ID of the approval request. Required. - :vartype id: str - :ivar server_label: The label of the MCP server making the request. Required. - :vartype server_label: str - :ivar name: The name of the tool to run. Required. - :vartype name: str - :ivar arguments: A JSON string of arguments for the tool. Required. - :vartype arguments: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["mcp_approval_request"]] - """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" - id: Required[str] - """The unique ID of the approval request. Required.""" - server_label: Required[str] - """The label of the MCP server making the request. Required.""" - name: Required[str] - """The name of the tool to run. Required.""" - arguments: Required[str] - """A JSON string of arguments for the tool. Required.""" - - -class OutputItemMcpApprovalResponseResource(TypedDict, total=False): - """MCP approval response. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``mcp_approval_response``. Required. - MCP_APPROVAL_RESPONSE. - :vartype type: Literal["mcp_approval_response"] - :ivar id: The unique ID of the approval response. Required. - :vartype id: str - :ivar approval_request_id: The ID of the approval request being answered. Required. - :vartype approval_request_id: str - :ivar approve: Whether the request was approved. Required. - :vartype approve: bool - :ivar reason: - :vartype reason: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["mcp_approval_response"]] - """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" - id: Required[str] - """The unique ID of the approval response. Required.""" - approval_request_id: Required[str] - """The ID of the approval request being answered. Required.""" - approve: Required[bool] - """Whether the request was approved. Required.""" - reason: Optional[str] - - -class OutputItemMcpListTools(TypedDict, total=False): - """MCP list tools. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. - :vartype type: Literal["mcp_list_tools"] - :ivar id: The unique ID of the list. Required. - :vartype id: str - :ivar server_label: The label of the MCP server. Required. - :vartype server_label: str - :ivar tools: The tools available on the server. Required. - :vartype tools: list["MCPListToolsTool"] - :ivar error: - :vartype error: "RealtimeMCPError" - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["mcp_list_tools"]] - """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" - id: Required[str] - """The unique ID of the list. Required.""" - server_label: Required[str] - """The label of the MCP server. Required.""" - tools: Required[list["MCPListToolsTool"]] - """The tools available on the server. Required.""" - error: "RealtimeMCPError" - - -class OutputItemMcpToolCall(TypedDict, total=False): - """MCP tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. - :vartype type: Literal["mcp_call"] - :ivar id: The unique ID of the tool call. Required. - :vartype id: str - :ivar server_label: The label of the MCP server running the tool. Required. - :vartype server_label: str - :ivar name: The name of the tool that was run. Required. - :vartype name: str - :ivar arguments: A JSON string of the arguments passed to the tool. Required. - :vartype arguments: str - :ivar output: - :vartype output: str - :ivar error: The error from the tool call, if any. - :vartype error: dict[str, Any] - :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, - ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", - "incomplete", "calling", and "failed". - :vartype status: MCPToolCallStatus - :ivar approval_request_id: - :vartype approval_request_id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["mcp_call"]] - """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" - id: Required[str] - """The unique ID of the tool call. Required.""" - server_label: Required[str] - """The label of the MCP server running the tool. Required.""" - name: Required[str] - """The name of the tool that was run. Required.""" - arguments: Required[str] - """A JSON string of the arguments passed to the tool. Required.""" - output: Optional[str] - error: dict[str, Any] - """The error from the tool call, if any.""" - status: MCPToolCallStatus - """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, - ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", - \"calling\", and \"failed\".""" - approval_request_id: Optional[str] - - -class OutputItemMessage(TypedDict, total=False): - """Message. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. - :vartype type: Literal["message"] - :ivar id: The unique ID of the message. Required. - :vartype id: str - :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Required. Known values are: "in_progress", - "completed", and "incomplete". - :vartype status: MessageStatus - :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, - ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: - "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". - :vartype role: MessageRole - :ivar content: The content of the message. Required. - :vartype content: list["MessageContent"] - :ivar phase: Known values are: "commentary" and "final_answer". - :vartype phase: MessagePhase - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["message"]] - """The type of the message. Always set to ``message``. Required. MESSAGE.""" - id: Required[str] - """The unique ID of the message. Required.""" - status: Required[MessageStatus] - """The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when - items are returned via API. Required. Known values are: \"in_progress\", \"completed\", and - \"incomplete\".""" - role: Required[MessageRole] - """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, - ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", - \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and - \"tool\".""" - content: Required[list["MessageContent"]] - """The content of the message. Required.""" - phase: Optional[MessagePhase] - """Known values are: \"commentary\" and \"final_answer\".""" - - -class OutputItemOutputMessage(TypedDict, total=False): - """Output message. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar id: The unique ID of the output message. Required. - :vartype id: str - :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE. - :vartype type: Literal["output_message"] - :ivar role: The role of the output message. Always ``assistant``. Required. Default value is - "assistant". - :vartype role: Literal["assistant"] - :ivar content: The content of the output message. Required. - :vartype content: list["OutputMessageContent"] - :ivar phase: Known values are: "commentary" and "final_answer". - :vartype phase: MessagePhase - :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or - ``incomplete``. Populated when input items are returned via API. Required. Is one of the - following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - id: Required[str] - """The unique ID of the output message. Required.""" - type: Required[Literal["output_message"]] - """The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.""" - role: Required[Literal["assistant"]] - """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" - content: Required[list["OutputMessageContent"]] - """The content of the output message. Required.""" - phase: Optional[MessagePhase] - """Known values are: \"commentary\" and \"final_answer\".""" - status: Required[Literal["in_progress", "completed", "incomplete"]] - """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when input items are returned via API. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemProgram(TypedDict, total=False): - """OutputItemProgram. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``program``. Required. PROGRAM. - :vartype type: Literal["program"] - :ivar id: The unique ID of the program item. Required. - :vartype id: str - :ivar call_id: The stable call ID of the program item. Required. - :vartype call_id: str - :ivar code: The JavaScript source executed by programmatic tool calling. Required. - :vartype code: str - :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. - :vartype fingerprint: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["program"]] - """The type of the item. Always ``program``. Required. PROGRAM.""" - id: Required[str] - """The unique ID of the program item. Required.""" - call_id: Required[str] - """The stable call ID of the program item. Required.""" - code: Required[str] - """The JavaScript source executed by programmatic tool calling. Required.""" - fingerprint: Required[str] - """Opaque program replay fingerprint that must be round-tripped. Required.""" - - -class OutputItemProgramOutput(TypedDict, total=False): - """OutputItemProgramOutput. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT. - :vartype type: Literal["program_output"] - :ivar id: The unique ID of the program output item. Required. - :vartype id: str - :ivar call_id: The call ID of the program item. Required. - :vartype call_id: str - :ivar result: The result produced by the program item. Required. - :vartype result: str - :ivar status: The terminal status of the program output item. Required. Known values are: - "completed" and "incomplete". - :vartype status: ProgramOutputStatus - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["program_output"]] - """The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.""" - id: Required[str] - """The unique ID of the program output item. Required.""" - call_id: Required[str] - """The call ID of the program item. Required.""" - result: Required[str] - """The result produced by the program item. Required.""" - status: Required[ProgramOutputStatus] - """The terminal status of the program output item. Required. Known values are: \"completed\" and - \"incomplete\".""" - - -class OutputItemReasoningItem(TypedDict, total=False): - """Reasoning. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. - :vartype type: Literal["reasoning"] - :ivar id: The unique identifier of the reasoning content. Required. - :vartype id: str - :ivar encrypted_content: - :vartype encrypted_content: str - :ivar summary: Reasoning summary content. Required. - :vartype summary: list["SummaryTextContent"] - :ivar content: Reasoning text content. - :vartype content: list["ReasoningTextContent"] - :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. - Populated when items are returned via API. Is one of the following types: - Literal["in_progress"], Literal["completed"], Literal["incomplete"] - :vartype status: Literal["in_progress", "completed", "incomplete"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["reasoning"]] - """The type of the object. Always ``reasoning``. Required. REASONING.""" - id: Required[str] - """The unique identifier of the reasoning content. Required.""" - encrypted_content: Optional[str] - summary: Required[list["SummaryTextContent"]] - """Reasoning summary content. Required.""" - content: list["ReasoningTextContent"] - """Reasoning text content.""" - status: Literal["in_progress", "completed", "incomplete"] - """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated - when items are returned via API. Is one of the following types: Literal[\"in_progress\"], - Literal[\"completed\"], Literal[\"incomplete\"]""" - - -class OutputItemToolSearchCall(TypedDict, total=False): - """OutputItemToolSearchCall. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. - :vartype type: Literal["tool_search_call"] - :ivar id: The unique ID of the tool search call item. Required. - :vartype id: str - :ivar call_id: Required. - :vartype call_id: str - :ivar execution: Whether tool search was executed by the server or by the client. Required. - Known values are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar arguments: Arguments used for the tool search call. Required. - :vartype arguments: Any - :ivar status: The status of the tool search call item that was recorded. Required. Known values - are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallStatus - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["tool_search_call"]] - """The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.""" - id: Required[str] - """The unique ID of the tool search call item. Required.""" - call_id: Required[Optional[str]] - """Required.""" - execution: Required[ToolSearchExecutionType] - """Whether tool search was executed by the server or by the client. Required. Known values are: - \"server\" and \"client\".""" - arguments: Required[Any] - """Arguments used for the tool search call. Required.""" - status: Required[FunctionCallStatus] - """The status of the tool search call item that was recorded. Required. Known values are: - \"in_progress\", \"completed\", and \"incomplete\".""" - created_by: str - """The identifier of the actor that created the item.""" - - -class OutputItemToolSearchOutput(TypedDict, total=False): - """OutputItemToolSearchOutput. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. - :vartype type: Literal["tool_search_output"] - :ivar id: The unique ID of the tool search output item. Required. - :vartype id: str - :ivar call_id: Required. - :vartype call_id: str - :ivar execution: Whether tool search was executed by the server or by the client. Required. - Known values are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar tools: The loaded tool definitions returned by tool search. Required. - :vartype tools: list["Tool"] - :ivar status: The status of the tool search output item that was recorded. Required. Known - values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallOutputStatusEnum - :ivar created_by: The identifier of the actor that created the item. - :vartype created_by: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["tool_search_output"]] - """The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.""" - id: Required[str] - """The unique ID of the tool search output item. Required.""" - call_id: Required[Optional[str]] - """Required.""" - execution: Required[ToolSearchExecutionType] - """Whether tool search was executed by the server or by the client. Required. Known values are: - \"server\" and \"client\".""" - tools: Required[list["Tool"]] - """The loaded tool definitions returned by tool search. Required.""" - status: Required[FunctionCallOutputStatusEnum] - """The status of the tool search output item that was recorded. Required. Known values are: - \"in_progress\", \"completed\", and \"incomplete\".""" - created_by: str - """The identifier of the actor that created the item.""" - - -class OutputItemWebSearchToolCall(TypedDict, total=False): - """Web search tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar id: The unique ID of the web search tool call. Required. - :vartype id: str - :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. - WEB_SEARCH_CALL. - :vartype type: Literal["web_search_call"] - :ivar status: The status of the web search tool call. Required. Is one of the following types: - Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], - Literal["incomplete"] - :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] - :ivar action: An object describing the specific action taken in this web search call. Includes - details on how the model used the web (search, open_page, find_in_page). Required. Is one of - the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind - :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", - "WebSearchActionFind"] - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - id: Required[str] - """The unique ID of the web search tool call. Required.""" - type: Required[Literal["web_search_call"]] - """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" - status: Required[Literal["in_progress", "searching", "completed", "failed", "incomplete"]] - """The status of the web search tool call. Required. Is one of the following types: - Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"], - Literal[\"incomplete\"]""" - action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] - """An object describing the specific action taken in this web search call. Includes details on how - the model used the web (search, open_page, find_in_page). Required. Is one of the following - types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" - - -class OutputMessageContentOutputTextContent(TypedDict, total=False): - """Output text. - - :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. - :vartype type: Literal["output_text"] - :ivar text: The text output from the model. Required. - :vartype text: str - :ivar annotations: The annotations of the text output. - :vartype annotations: list["Annotation"] - :ivar logprobs: - :vartype logprobs: list["LogProb"] - """ - - type: Required[Literal["output_text"]] - """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" - text: Required[str] - """The text output from the model. Required.""" - annotations: list["Annotation"] - """The annotations of the text output.""" - logprobs: list["LogProb"] - - -class OutputMessageContentRefusalContent(TypedDict, total=False): - """Refusal. - - :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. - :vartype type: Literal["refusal"] - :ivar refusal: The refusal explanation from the model. Required. - :vartype refusal: str - """ - - type: Required[Literal["refusal"]] - """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" - refusal: Required[str] - """The refusal explanation from the model. Required.""" - - -class ProgrammaticToolCallingParam(TypedDict, total=False): - """ProgrammaticToolCallingParam. - - :ivar type: The type of the tool. Always ``programmatic_tool_calling``. Required. - PROGRAMMATIC_TOOL_CALLING. - :vartype type: Literal["programmatic_tool_calling"] - """ - - type: Required[Literal["programmatic_tool_calling"]] - """The type of the tool. Always ``programmatic_tool_calling``. Required. - PROGRAMMATIC_TOOL_CALLING.""" - - -class ProgramToolCallCaller(TypedDict, total=False): - """ProgramToolCallCaller. - - :ivar type: Required. PROGRAM. - :vartype type: Literal["program"] - :ivar caller_id: The call ID of the program item that produced this tool call. Required. - :vartype caller_id: str - """ - - type: Required[Literal["program"]] - """Required. PROGRAM.""" - caller_id: Required[str] - """The call ID of the program item that produced this tool call. Required.""" - - -class ProgramToolCallCallerParam(TypedDict, total=False): - """ProgramToolCallCallerParam. - - :ivar type: The caller type. Always ``program``. Required. PROGRAM. - :vartype type: Literal["program"] - :ivar caller_id: The call ID of the program item that produced this tool call. Required. - :vartype caller_id: str - """ - - type: Required[Literal["program"]] - """The caller type. Always ``program``. Required. PROGRAM.""" - caller_id: Required[str] - """The call ID of the program item that produced this tool call. Required.""" - - -class Prompt(TypedDict, total=False): - """Reference to a prompt template and its variables. Learn more: /docs/guides/text?api-mode=responses#reusable-prompts. - - :ivar id: The unique identifier of the prompt template to use. Required. - :vartype id: str - :ivar version: - :vartype version: str - :ivar variables: - :vartype variables: "ResponsePromptVariables" - """ - - id: Required[str] - """The unique identifier of the prompt template to use. Required.""" - version: Optional[str] - variables: Optional["ResponsePromptVariables"] - - -class PromptCacheBreakpointConfig(TypedDict, total=False): - """Prompt cache breakpoint. - - :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit". - :vartype mode: Literal["explicit"] - """ - - mode: Required[Literal["explicit"]] - """The breakpoint mode. Always ``explicit``. Required. Default value is \"explicit\".""" - - -class PromptCacheBreakpointParam(TypedDict, total=False): - """Prompt cache breakpoint. - - :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit". - :vartype mode: Literal["explicit"] - """ - - mode: Required[Literal["explicit"]] - """The breakpoint mode. Always ``explicit``. Required. Default value is \"explicit\".""" - - -class PromptCacheOptions(TypedDict, total=False): - """Prompt cache options. - - :ivar ttl: The minimum lifetime applied to each cache breakpoint. Required. "30m" - :vartype ttl: PromptCacheTTLEnum - :ivar mode: Whether implicit prompt-cache breakpoints were enabled. Required. Known values are: - "implicit" and "explicit". - :vartype mode: PromptCacheModeEnum - """ - - ttl: Required[PromptCacheTTLEnum] - """The minimum lifetime applied to each cache breakpoint. Required. \"30m\"""" - mode: Required[PromptCacheModeEnum] - """Whether implicit prompt-cache breakpoints were enabled. Required. Known values are: - \"implicit\" and \"explicit\".""" - - -class PromptCacheOptionsParam(TypedDict, total=False): - """Prompt cache options. - - :ivar ttl: The minimum lifetime applied to every implicit and explicit cache breakpoint written - by the request. Defaults to ``30m``, which is currently the only supported value. The backend - may retain cache entries for longer. "30m" - :vartype ttl: PromptCacheTTLEnum - :ivar mode: Controls whether OpenAI automatically creates an implicit cache breakpoint. - Defaults to ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes - up to the latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not - create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there - are no explicit breakpoints, the request does not use prompt caching. Known values are: - "implicit" and "explicit". - :vartype mode: PromptCacheModeEnum - """ - - ttl: PromptCacheTTLEnum - """The minimum lifetime applied to every implicit and explicit cache breakpoint written by the - request. Defaults to ``30m``, which is currently the only supported value. The backend may - retain cache entries for longer. \"30m\"""" - mode: PromptCacheModeEnum - """Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to - ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes up to the - latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not create an - implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no - explicit breakpoints, the request does not use prompt caching. Known values are: \"implicit\" - and \"explicit\".""" - - -class RankingOptions(TypedDict, total=False): - """RankingOptions. - - :ivar ranker: The ranker to use for the file search. Known values are: "auto" and - "default-2024-11-15". - :vartype ranker: RankerVersionType - :ivar score_threshold: The score threshold for the file search, a number between 0 and 1. - Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer - results. - :vartype score_threshold: float - :ivar hybrid_search: Weights that control how reciprocal rank fusion balances semantic - embedding matches versus sparse keyword matches when hybrid search is enabled. - :vartype hybrid_search: "HybridSearchOptions" - """ - - ranker: RankerVersionType - """The ranker to use for the file search. Known values are: \"auto\" and \"default-2024-11-15\".""" - score_threshold: float - """The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will - attempt to return only the most relevant results, but may return fewer results.""" - hybrid_search: "HybridSearchOptions" - """Weights that control how reciprocal rank fusion balances semantic embedding matches versus - sparse keyword matches when hybrid search is enabled.""" - - -class RealtimeMCPHTTPError(TypedDict, total=False): - """Realtime MCP HTTP error. - - :ivar type: Required. HTTP_ERROR. - :vartype type: Literal["http_error"] - :ivar code: Required. - :vartype code: int - :ivar message: Required. - :vartype message: str - """ - - type: Required[Literal["http_error"]] - """Required. HTTP_ERROR.""" - code: Required[int] - """Required.""" - message: Required[str] - """Required.""" - - -class RealtimeMCPProtocolError(TypedDict, total=False): - """Realtime MCP protocol error. - - :ivar type: Required. PROTOCOL_ERROR. - :vartype type: Literal["protocol_error"] - :ivar code: Required. - :vartype code: int - :ivar message: Required. - :vartype message: str - """ - - type: Required[Literal["protocol_error"]] - """Required. PROTOCOL_ERROR.""" - code: Required[int] - """Required.""" - message: Required[str] - """Required.""" - - -class RealtimeMCPToolExecutionError(TypedDict, total=False): - """Realtime MCP tool execution error. - - :ivar type: Required. TOOL_EXECUTION_ERROR. - :vartype type: Literal["tool_execution_error"] - :ivar message: Required. - :vartype message: str - """ - - type: Required[Literal["tool_execution_error"]] - """Required. TOOL_EXECUTION_ERROR.""" - message: Required[str] - """Required.""" - - -class Reasoning(TypedDict, total=False): - """Reasoning. - - :ivar mode: Controls the reasoning execution mode for the request. When returned on a response, - this is the effective execution mode. Known values are: "standard" and "pro". - :vartype mode: ReasoningModeEnum - :ivar effort: Known values are: "none", "minimal", "low", "medium", "high", "xhigh", and "max". - :vartype effort: ReasoningEffort - :ivar summary: Is one of the following types: Literal["auto"], Literal["concise"], - Literal["detailed"] - :vartype summary: Literal["auto", "concise", "detailed"] - :ivar context: Is one of the following types: Literal["auto"], Literal["current_turn"], - Literal["all_turns"] - :vartype context: Literal["auto", "current_turn", "all_turns"] - :ivar generate_summary: Is one of the following types: Literal["auto"], Literal["concise"], - Literal["detailed"] - :vartype generate_summary: Literal["auto", "concise", "detailed"] - """ - - mode: ReasoningModeEnum - """Controls the reasoning execution mode for the request. When returned on a response, this is the - effective execution mode. Known values are: \"standard\" and \"pro\".""" - effort: Optional[ReasoningEffort] - """Known values are: \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", and \"max\".""" - summary: Optional[Literal["auto", "concise", "detailed"]] - """Is one of the following types: Literal[\"auto\"], Literal[\"concise\"], Literal[\"detailed\"]""" - context: Optional[Literal["auto", "current_turn", "all_turns"]] - """Is one of the following types: Literal[\"auto\"], Literal[\"current_turn\"], - Literal[\"all_turns\"]""" - generate_summary: Optional[Literal["auto", "concise", "detailed"]] - """Is one of the following types: Literal[\"auto\"], Literal[\"concise\"], Literal[\"detailed\"]""" - - -class ReasoningTextContent(TypedDict, total=False): - """Reasoning text. - - :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. Default value - is "reasoning_text". - :vartype type: Literal["reasoning_text"] - :ivar text: The reasoning text from the model. Required. - :vartype text: str - """ - - type: Required[Literal["reasoning_text"]] - """The type of the reasoning text. Always ``reasoning_text``. Required. Default value is - \"reasoning_text\".""" - text: Required[str] - """The reasoning text from the model. Required.""" - - -class ResponseAudioDeltaEvent(TypedDict, total=False): - """Emitted when there is a partial audio response. - - :ivar type: The type of the event. Always ``response.audio.delta``. Required. - RESPONSE_AUDIO_DELTA. - :vartype type: Literal["response.audio.delta"] - :ivar sequence_number: A sequence number for this chunk of the stream response. Required. - :vartype sequence_number: int - :ivar delta: A chunk of Base64 encoded response audio bytes. Required. - :vartype delta: str - """ - - type: Required[Literal["response.audio.delta"]] - """The type of the event. Always ``response.audio.delta``. Required. RESPONSE_AUDIO_DELTA.""" - sequence_number: Required[int] - """A sequence number for this chunk of the stream response. Required.""" - delta: Required[str] - """A chunk of Base64 encoded response audio bytes. Required.""" - - -class ResponseAudioDoneEvent(TypedDict, total=False): - """Emitted when the audio response is complete. - - :ivar type: The type of the event. Always ``response.audio.done``. Required. - RESPONSE_AUDIO_DONE. - :vartype type: Literal["response.audio.done"] - :ivar sequence_number: The sequence number of the delta. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.audio.done"]] - """The type of the event. Always ``response.audio.done``. Required. RESPONSE_AUDIO_DONE.""" - sequence_number: Required[int] - """The sequence number of the delta. Required.""" - - -class ResponseAudioTranscriptDeltaEvent(TypedDict, total=False): - """Emitted when there is a partial transcript of audio. - - :ivar type: The type of the event. Always ``response.audio.transcript.delta``. Required. - RESPONSE_AUDIO_TRANSCRIPT_DELTA. - :vartype type: Literal["response.audio.transcript.delta"] - :ivar delta: The partial transcript of the audio response. Required. - :vartype delta: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.audio.transcript.delta"]] - """The type of the event. Always ``response.audio.transcript.delta``. Required. - RESPONSE_AUDIO_TRANSCRIPT_DELTA.""" - delta: Required[str] - """The partial transcript of the audio response. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseAudioTranscriptDoneEvent(TypedDict, total=False): - """Emitted when the full audio transcript is completed. - - :ivar type: The type of the event. Always ``response.audio.transcript.done``. Required. - RESPONSE_AUDIO_TRANSCRIPT_DONE. - :vartype type: Literal["response.audio.transcript.done"] - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.audio.transcript.done"]] - """The type of the event. Always ``response.audio.transcript.done``. Required. - RESPONSE_AUDIO_TRANSCRIPT_DONE.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseCodeInterpreterCallCodeDeltaEvent(TypedDict, total=False): # pylint: disable=name-too-long - """Emitted when a partial code snippet is streamed by the code interpreter. - - :ivar type: The type of the event. Always ``response.code_interpreter_call_code.delta``. - Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA. - :vartype type: Literal["response.code_interpreter_call_code.delta"] - :ivar output_index: The index of the output item in the response for which the code is being - streamed. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the code interpreter tool call item. Required. - :vartype item_id: str - :ivar delta: The partial code snippet being streamed by the code interpreter. Required. - :vartype delta: str - :ivar sequence_number: The sequence number of this event, used to order streaming events. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.code_interpreter_call_code.delta"]] - """The type of the event. Always ``response.code_interpreter_call_code.delta``. Required. - RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA.""" - output_index: Required[int] - """The index of the output item in the response for which the code is being streamed. Required.""" - item_id: Required[str] - """The unique identifier of the code interpreter tool call item. Required.""" - delta: Required[str] - """The partial code snippet being streamed by the code interpreter. Required.""" - sequence_number: Required[int] - """The sequence number of this event, used to order streaming events. Required.""" - - -class ResponseCodeInterpreterCallCodeDoneEvent(TypedDict, total=False): - """Emitted when the code snippet is finalized by the code interpreter. - - :ivar type: The type of the event. Always ``response.code_interpreter_call_code.done``. - Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE. - :vartype type: Literal["response.code_interpreter_call_code.done"] - :ivar output_index: The index of the output item in the response for which the code is - finalized. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the code interpreter tool call item. Required. - :vartype item_id: str - :ivar code: The final code snippet output by the code interpreter. Required. - :vartype code: str - :ivar sequence_number: The sequence number of this event, used to order streaming events. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.code_interpreter_call_code.done"]] - """The type of the event. Always ``response.code_interpreter_call_code.done``. Required. - RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE.""" - output_index: Required[int] - """The index of the output item in the response for which the code is finalized. Required.""" - item_id: Required[str] - """The unique identifier of the code interpreter tool call item. Required.""" - code: Required[str] - """The final code snippet output by the code interpreter. Required.""" - sequence_number: Required[int] - """The sequence number of this event, used to order streaming events. Required.""" - - -class ResponseCodeInterpreterCallCompletedEvent(TypedDict, total=False): # pylint: disable=name-too-long - """Emitted when the code interpreter call is completed. - - :ivar type: The type of the event. Always ``response.code_interpreter_call.completed``. - Required. RESPONSE_CODE_INTERPRETER_CALL_COMPLETED. - :vartype type: Literal["response.code_interpreter_call.completed"] - :ivar output_index: The index of the output item in the response for which the code interpreter - call is completed. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the code interpreter tool call item. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of this event, used to order streaming events. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.code_interpreter_call.completed"]] - """The type of the event. Always ``response.code_interpreter_call.completed``. Required. - RESPONSE_CODE_INTERPRETER_CALL_COMPLETED.""" - output_index: Required[int] - """The index of the output item in the response for which the code interpreter call is completed. - Required.""" - item_id: Required[str] - """The unique identifier of the code interpreter tool call item. Required.""" - sequence_number: Required[int] - """The sequence number of this event, used to order streaming events. Required.""" - - -class ResponseCodeInterpreterCallInProgressEvent(TypedDict, total=False): # pylint: disable=name-too-long - """Emitted when a code interpreter call is in progress. - - :ivar type: The type of the event. Always ``response.code_interpreter_call.in_progress``. - Required. RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS. - :vartype type: Literal["response.code_interpreter_call.in_progress"] - :ivar output_index: The index of the output item in the response for which the code interpreter - call is in progress. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the code interpreter tool call item. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of this event, used to order streaming events. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.code_interpreter_call.in_progress"]] - """The type of the event. Always ``response.code_interpreter_call.in_progress``. Required. - RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS.""" - output_index: Required[int] - """The index of the output item in the response for which the code interpreter call is in - progress. Required.""" - item_id: Required[str] - """The unique identifier of the code interpreter tool call item. Required.""" - sequence_number: Required[int] - """The sequence number of this event, used to order streaming events. Required.""" - - -class ResponseCodeInterpreterCallInterpretingEvent(TypedDict, total=False): # pylint: disable=name-too-long - """Emitted when the code interpreter is actively interpreting the code snippet. - - :ivar type: The type of the event. Always ``response.code_interpreter_call.interpreting``. - Required. RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING. - :vartype type: Literal["response.code_interpreter_call.interpreting"] - :ivar output_index: The index of the output item in the response for which the code interpreter - is interpreting code. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the code interpreter tool call item. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of this event, used to order streaming events. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.code_interpreter_call.interpreting"]] - """The type of the event. Always ``response.code_interpreter_call.interpreting``. Required. - RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING.""" - output_index: Required[int] - """The index of the output item in the response for which the code interpreter is interpreting - code. Required.""" - item_id: Required[str] - """The unique identifier of the code interpreter tool call item. Required.""" - sequence_number: Required[int] - """The sequence number of this event, used to order streaming events. Required.""" - - -class ResponseCompletedEvent(TypedDict, total=False): - """Emitted when the model response is complete. - - :ivar type: The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED. - :vartype type: Literal["response.completed"] - :ivar response: Properties of the completed response. Required. - :vartype response: "ResponseObject" - :ivar sequence_number: The sequence number for this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.completed"]] - """The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED.""" - response: Required["ResponseObject"] - """Properties of the completed response. Required.""" - sequence_number: Required[int] - """The sequence number for this event. Required.""" - - -class ResponseContentPartAddedEvent(TypedDict, total=False): - """Emitted when a new content part is added. - - :ivar type: The type of the event. Always ``response.content_part.added``. Required. - RESPONSE_CONTENT_PART_ADDED. - :vartype type: Literal["response.content_part.added"] - :ivar item_id: The ID of the output item that the content part was added to. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the content part was added to. Required. - :vartype output_index: int - :ivar content_index: The index of the content part that was added. Required. - :vartype content_index: int - :ivar part: The content part that was added. Required. - :vartype part: "OutputContent" - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.content_part.added"]] - """The type of the event. Always ``response.content_part.added``. Required. - RESPONSE_CONTENT_PART_ADDED.""" - item_id: Required[str] - """The ID of the output item that the content part was added to. Required.""" - output_index: Required[int] - """The index of the output item that the content part was added to. Required.""" - content_index: Required[int] - """The index of the content part that was added. Required.""" - part: Required["OutputContent"] - """The content part that was added. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseContentPartDoneEvent(TypedDict, total=False): - """Emitted when a content part is done. - - :ivar type: The type of the event. Always ``response.content_part.done``. Required. - RESPONSE_CONTENT_PART_DONE. - :vartype type: Literal["response.content_part.done"] - :ivar item_id: The ID of the output item that the content part was added to. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the content part was added to. Required. - :vartype output_index: int - :ivar content_index: The index of the content part that is done. Required. - :vartype content_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar part: The content part that is done. Required. - :vartype part: "OutputContent" - """ - - type: Required[Literal["response.content_part.done"]] - """The type of the event. Always ``response.content_part.done``. Required. - RESPONSE_CONTENT_PART_DONE.""" - item_id: Required[str] - """The ID of the output item that the content part was added to. Required.""" - output_index: Required[int] - """The index of the output item that the content part was added to. Required.""" - content_index: Required[int] - """The index of the content part that is done. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - part: Required["OutputContent"] - """The content part that is done. Required.""" - - -class ResponseCreatedEvent(TypedDict, total=False): - """An event that is emitted when a response is created. - - :ivar type: The type of the event. Always ``response.created``. Required. RESPONSE_CREATED. - :vartype type: Literal["response.created"] - :ivar response: The response that was created. Required. - :vartype response: "ResponseObject" - :ivar sequence_number: The sequence number for this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.created"]] - """The type of the event. Always ``response.created``. Required. RESPONSE_CREATED.""" - response: Required["ResponseObject"] - """The response that was created. Required.""" - sequence_number: Required[int] - """The sequence number for this event. Required.""" - - -class ResponseCustomToolCallInputDeltaEvent(TypedDict, total=False): - """ResponseCustomToolCallInputDelta. - - :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA. - :vartype type: Literal["response.custom_tool_call_input.delta"] - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar output_index: The index of the output this delta applies to. Required. - :vartype output_index: int - :ivar item_id: Unique identifier for the API item associated with this event. Required. - :vartype item_id: str - :ivar delta: The incremental input data (delta) for the custom tool call. Required. - :vartype delta: str - """ - - type: Required[Literal["response.custom_tool_call_input.delta"]] - """The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - output_index: Required[int] - """The index of the output this delta applies to. Required.""" - item_id: Required[str] - """Unique identifier for the API item associated with this event. Required.""" - delta: Required[str] - """The incremental input data (delta) for the custom tool call. Required.""" - - -class ResponseCustomToolCallInputDoneEvent(TypedDict, total=False): - """ResponseCustomToolCallInputDone. - - :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE. - :vartype type: Literal["response.custom_tool_call_input.done"] - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar output_index: The index of the output this event applies to. Required. - :vartype output_index: int - :ivar item_id: Unique identifier for the API item associated with this event. Required. - :vartype item_id: str - :ivar input: The complete input data for the custom tool call. Required. - :vartype input: str - """ - - type: Required[Literal["response.custom_tool_call_input.done"]] - """The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - output_index: Required[int] - """The index of the output this event applies to. Required.""" - item_id: Required[str] - """Unique identifier for the API item associated with this event. Required.""" - input: Required[str] - """The complete input data for the custom tool call. Required.""" - - -class ResponseErrorEvent(TypedDict, total=False): - """Emitted when an error occurs. - - :ivar type: The type of the event. Always ``error``. Required. ERROR. - :vartype type: Literal["error"] - :ivar code: Required. - :vartype code: str - :ivar message: The error message. Required. - :vartype message: str - :ivar param: Required. - :vartype param: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["error"]] - """The type of the event. Always ``error``. Required. ERROR.""" - code: Required[Optional[str]] - """Required.""" - message: Required[str] - """The error message. Required.""" - param: Required[Optional[str]] - """Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseErrorInfo(TypedDict, total=False): - """An error object returned when the model fails to generate a Response. - - :ivar code: Required. Known values are: "server_error", "rate_limit_exceeded", - "invalid_prompt", "data_residency_mismatch", "bio_policy", "vector_store_timeout", - "invalid_image", "invalid_image_format", "invalid_base64_image", "invalid_image_url", - "image_too_large", "image_too_small", "image_parse_error", "image_content_policy_violation", - "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type", - "empty_image_file", "failed_to_download_image", and "image_file_not_found". - :vartype code: ResponseErrorCode - :ivar message: A human-readable description of the error. Required. - :vartype message: str - """ - - code: Required[ResponseErrorCode] - """Required. Known values are: \"server_error\", \"rate_limit_exceeded\", \"invalid_prompt\", - \"data_residency_mismatch\", \"bio_policy\", \"vector_store_timeout\", \"invalid_image\", - \"invalid_image_format\", \"invalid_base64_image\", \"invalid_image_url\", \"image_too_large\", - \"image_too_small\", \"image_parse_error\", \"image_content_policy_violation\", - \"invalid_image_mode\", \"image_file_too_large\", \"unsupported_image_media_type\", - \"empty_image_file\", \"failed_to_download_image\", and \"image_file_not_found\".""" - message: Required[str] - """A human-readable description of the error. Required.""" - - -class ResponseFailedEvent(TypedDict, total=False): - """An event that is emitted when a response fails. - - :ivar type: The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED. - :vartype type: Literal["response.failed"] - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar response: The response that failed. Required. - :vartype response: "ResponseObject" - """ - - type: Required[Literal["response.failed"]] - """The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - response: Required["ResponseObject"] - """The response that failed. Required.""" - - -class ResponseFileSearchCallCompletedEvent(TypedDict, total=False): - """Emitted when a file search call is completed (results found). - - :ivar type: The type of the event. Always ``response.file_search_call.completed``. Required. - RESPONSE_FILE_SEARCH_CALL_COMPLETED. - :vartype type: Literal["response.file_search_call.completed"] - :ivar output_index: The index of the output item that the file search call is initiated. - Required. - :vartype output_index: int - :ivar item_id: The ID of the output item that the file search call is initiated. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.file_search_call.completed"]] - """The type of the event. Always ``response.file_search_call.completed``. Required. - RESPONSE_FILE_SEARCH_CALL_COMPLETED.""" - output_index: Required[int] - """The index of the output item that the file search call is initiated. Required.""" - item_id: Required[str] - """The ID of the output item that the file search call is initiated. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseFileSearchCallInProgressEvent(TypedDict, total=False): - """Emitted when a file search call is initiated. - - :ivar type: The type of the event. Always ``response.file_search_call.in_progress``. Required. - RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS. - :vartype type: Literal["response.file_search_call.in_progress"] - :ivar output_index: The index of the output item that the file search call is initiated. - Required. - :vartype output_index: int - :ivar item_id: The ID of the output item that the file search call is initiated. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.file_search_call.in_progress"]] - """The type of the event. Always ``response.file_search_call.in_progress``. Required. - RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS.""" - output_index: Required[int] - """The index of the output item that the file search call is initiated. Required.""" - item_id: Required[str] - """The ID of the output item that the file search call is initiated. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseFileSearchCallSearchingEvent(TypedDict, total=False): - """Emitted when a file search is currently searching. - - :ivar type: The type of the event. Always ``response.file_search_call.searching``. Required. - RESPONSE_FILE_SEARCH_CALL_SEARCHING. - :vartype type: Literal["response.file_search_call.searching"] - :ivar output_index: The index of the output item that the file search call is searching. - Required. - :vartype output_index: int - :ivar item_id: The ID of the output item that the file search call is initiated. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.file_search_call.searching"]] - """The type of the event. Always ``response.file_search_call.searching``. Required. - RESPONSE_FILE_SEARCH_CALL_SEARCHING.""" - output_index: Required[int] - """The index of the output item that the file search call is searching. Required.""" - item_id: Required[str] - """The ID of the output item that the file search call is initiated. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseFormatJsonSchemaSchema(TypedDict, total=False): - """JSON schema.""" - - -class ResponseFunctionCallArgumentsDeltaEvent(TypedDict, total=False): - """Emitted when there is a partial function-call arguments delta. - - :ivar type: The type of the event. Always ``response.function_call_arguments.delta``. Required. - RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA. - :vartype type: Literal["response.function_call_arguments.delta"] - :ivar item_id: The ID of the output item that the function-call arguments delta is added to. - Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the function-call arguments delta is - added to. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar delta: The function-call arguments delta that is added. Required. - :vartype delta: str - """ - - type: Required[Literal["response.function_call_arguments.delta"]] - """The type of the event. Always ``response.function_call_arguments.delta``. Required. - RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA.""" - item_id: Required[str] - """The ID of the output item that the function-call arguments delta is added to. Required.""" - output_index: Required[int] - """The index of the output item that the function-call arguments delta is added to. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - delta: Required[str] - """The function-call arguments delta that is added. Required.""" - - -class ResponseFunctionCallArgumentsDoneEvent(TypedDict, total=False): - """Emitted when function-call arguments are finalized. - - :ivar type: Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE. - :vartype type: Literal["response.function_call_arguments.done"] - :ivar item_id: The ID of the item. Required. - :vartype item_id: str - :ivar name: The name of the function that was called. Required. - :vartype name: str - :ivar output_index: The index of the output item. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar arguments: The function-call arguments. Required. - :vartype arguments: str - """ - - type: Required[Literal["response.function_call_arguments.done"]] - """Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE.""" - item_id: Required[str] - """The ID of the item. Required.""" - name: Required[str] - """The name of the function that was called. Required.""" - output_index: Required[int] - """The index of the output item. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - arguments: Required[str] - """The function-call arguments. Required.""" - - -class ResponseImageGenCallCompletedEvent(TypedDict, total=False): - """ResponseImageGenCallCompletedEvent. - - :ivar type: The type of the event. Always 'response.image_generation_call.completed'. Required. - RESPONSE_IMAGE_GENERATION_CALL_COMPLETED. - :vartype type: Literal["response.image_generation_call.completed"] - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar item_id: The unique identifier of the image generation item being processed. Required. - :vartype item_id: str - """ - - type: Required[Literal["response.image_generation_call.completed"]] - """The type of the event. Always 'response.image_generation_call.completed'. Required. - RESPONSE_IMAGE_GENERATION_CALL_COMPLETED.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - item_id: Required[str] - """The unique identifier of the image generation item being processed. Required.""" - - -class ResponseImageGenCallGeneratingEvent(TypedDict, total=False): - """ResponseImageGenCallGeneratingEvent. - - :ivar type: The type of the event. Always 'response.image_generation_call.generating'. - Required. RESPONSE_IMAGE_GENERATION_CALL_GENERATING. - :vartype type: Literal["response.image_generation_call.generating"] - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the image generation item being processed. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of the image generation item being processed. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.image_generation_call.generating"]] - """The type of the event. Always 'response.image_generation_call.generating'. Required. - RESPONSE_IMAGE_GENERATION_CALL_GENERATING.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - item_id: Required[str] - """The unique identifier of the image generation item being processed. Required.""" - sequence_number: Required[int] - """The sequence number of the image generation item being processed. Required.""" - - -class ResponseImageGenCallInProgressEvent(TypedDict, total=False): - """ResponseImageGenCallInProgressEvent. - - :ivar type: The type of the event. Always 'response.image_generation_call.in_progress'. - Required. RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS. - :vartype type: Literal["response.image_generation_call.in_progress"] - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the image generation item being processed. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of the image generation item being processed. - Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.image_generation_call.in_progress"]] - """The type of the event. Always 'response.image_generation_call.in_progress'. Required. - RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - item_id: Required[str] - """The unique identifier of the image generation item being processed. Required.""" - sequence_number: Required[int] - """The sequence number of the image generation item being processed. Required.""" - - -class ResponseImageGenCallPartialImageEvent(TypedDict, total=False): - """ResponseImageGenCallPartialImageEvent. - - :ivar type: The type of the event. Always 'response.image_generation_call.partial_image'. - Required. RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE. - :vartype type: Literal["response.image_generation_call.partial_image"] - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the image generation item being processed. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of the image generation item being processed. - Required. - :vartype sequence_number: int - :ivar partial_image_index: 0-based index for the partial image (backend is 1-based, but this is - 0-based for the user). Required. - :vartype partial_image_index: int - :ivar partial_image_b64: Base64-encoded partial image data, suitable for rendering as an image. - Required. - :vartype partial_image_b64: str - :ivar size: The image size that was used. - :vartype size: str - :ivar quality: The image quality that was used. - :vartype quality: str - :ivar background: The background setting that was used. - :vartype background: str - :ivar output_format: The output format that was used. - :vartype output_format: str - """ - - type: Required[Literal["response.image_generation_call.partial_image"]] - """The type of the event. Always 'response.image_generation_call.partial_image'. Required. - RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - item_id: Required[str] - """The unique identifier of the image generation item being processed. Required.""" - sequence_number: Required[int] - """The sequence number of the image generation item being processed. Required.""" - partial_image_index: Required[int] - """0-based index for the partial image (backend is 1-based, but this is 0-based for the user). - Required.""" - partial_image_b64: Required[str] - """Base64-encoded partial image data, suitable for rendering as an image. Required.""" - size: str - """The image size that was used.""" - quality: str - """The image quality that was used.""" - background: str - """The background setting that was used.""" - output_format: str - """The output format that was used.""" - - -class ResponseIncompleteDetails(TypedDict, total=False): - """ResponseIncompleteDetails. - - :ivar reason: Is either a Literal["max_output_tokens"] type or a Literal["content_filter"] - type. - :vartype reason: Literal["max_output_tokens", "content_filter"] - """ - - reason: Literal["max_output_tokens", "content_filter"] - """Is either a Literal[\"max_output_tokens\"] type or a Literal[\"content_filter\"] type.""" - - -class ResponseIncompleteEvent(TypedDict, total=False): - """An event that is emitted when a response finishes as incomplete. - - :ivar type: The type of the event. Always ``response.incomplete``. Required. - RESPONSE_INCOMPLETE. - :vartype type: Literal["response.incomplete"] - :ivar response: The response that was incomplete. Required. - :vartype response: "ResponseObject" - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.incomplete"]] - """The type of the event. Always ``response.incomplete``. Required. RESPONSE_INCOMPLETE.""" - response: Required["ResponseObject"] - """The response that was incomplete. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseInProgressEvent(TypedDict, total=False): - """Emitted when the response is in progress. - - :ivar type: The type of the event. Always ``response.in_progress``. Required. - RESPONSE_IN_PROGRESS. - :vartype type: Literal["response.in_progress"] - :ivar response: The response that is in progress. Required. - :vartype response: "ResponseObject" - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.in_progress"]] - """The type of the event. Always ``response.in_progress``. Required. RESPONSE_IN_PROGRESS.""" - response: Required["ResponseObject"] - """The response that is in progress. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseLogProb(TypedDict, total=False): - """A logprob is the logarithmic probability that the model assigns to producing a particular token - at a given position in the sequence. Less-negative (higher) logprob values indicate greater - model confidence in that token choice. - - :ivar token: A possible text token. Required. - :vartype token: str - :ivar logprob: The log probability of this token. Required. - :vartype logprob: float - :ivar top_logprobs: The log probabilities of up to 20 of the most likely tokens. - :vartype top_logprobs: list["ResponseLogProbTopLogprobs"] - """ - - token: Required[str] - """A possible text token. Required.""" - logprob: Required[float] - """The log probability of this token. Required.""" - top_logprobs: list["ResponseLogProbTopLogprobs"] - """The log probabilities of up to 20 of the most likely tokens.""" - - -class ResponseLogProbTopLogprobs(TypedDict, total=False): - """ResponseLogProbTopLogprobs. - - :ivar token: - :vartype token: str - :ivar logprob: - :vartype logprob: float - """ - - token: str - logprob: float - - -class ResponseMCPCallArgumentsDeltaEvent(TypedDict, total=False): - """ResponseMCPCallArgumentsDeltaEvent. - - :ivar type: The type of the event. Always 'response.mcp_call_arguments.delta'. Required. - RESPONSE_MCP_CALL_ARGUMENTS_DELTA. - :vartype type: Literal["response.mcp_call_arguments.delta"] - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. - :vartype item_id: str - :ivar delta: A JSON string containing the partial update to the arguments for the MCP tool - call. Required. - :vartype delta: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_call_arguments.delta"]] - """The type of the event. Always 'response.mcp_call_arguments.delta'. Required. - RESPONSE_MCP_CALL_ARGUMENTS_DELTA.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - item_id: Required[str] - """The unique identifier of the MCP tool call item being processed. Required.""" - delta: Required[str] - """A JSON string containing the partial update to the arguments for the MCP tool call. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseMCPCallArgumentsDoneEvent(TypedDict, total=False): - """ResponseMCPCallArgumentsDoneEvent. - - :ivar type: The type of the event. Always 'response.mcp_call_arguments.done'. Required. - RESPONSE_MCP_CALL_ARGUMENTS_DONE. - :vartype type: Literal["response.mcp_call_arguments.done"] - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. - :vartype item_id: str - :ivar arguments: A JSON string containing the finalized arguments for the MCP tool call. - Required. - :vartype arguments: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_call_arguments.done"]] - """The type of the event. Always 'response.mcp_call_arguments.done'. Required. - RESPONSE_MCP_CALL_ARGUMENTS_DONE.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - item_id: Required[str] - """The unique identifier of the MCP tool call item being processed. Required.""" - arguments: Required[str] - """A JSON string containing the finalized arguments for the MCP tool call. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseMCPCallCompletedEvent(TypedDict, total=False): - """ResponseMCPCallCompletedEvent. - - :ivar type: The type of the event. Always 'response.mcp_call.completed'. Required. - RESPONSE_MCP_CALL_COMPLETED. - :vartype type: Literal["response.mcp_call.completed"] - :ivar item_id: The ID of the MCP tool call item that completed. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that completed. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_call.completed"]] - """The type of the event. Always 'response.mcp_call.completed'. Required. - RESPONSE_MCP_CALL_COMPLETED.""" - item_id: Required[str] - """The ID of the MCP tool call item that completed. Required.""" - output_index: Required[int] - """The index of the output item that completed. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseMCPCallFailedEvent(TypedDict, total=False): - """ResponseMCPCallFailedEvent. - - :ivar type: The type of the event. Always 'response.mcp_call.failed'. Required. - RESPONSE_MCP_CALL_FAILED. - :vartype type: Literal["response.mcp_call.failed"] - :ivar item_id: The ID of the MCP tool call item that failed. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that failed. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_call.failed"]] - """The type of the event. Always 'response.mcp_call.failed'. Required. RESPONSE_MCP_CALL_FAILED.""" - item_id: Required[str] - """The ID of the MCP tool call item that failed. Required.""" - output_index: Required[int] - """The index of the output item that failed. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseMCPCallInProgressEvent(TypedDict, total=False): - """ResponseMCPCallInProgressEvent. - - :ivar type: The type of the event. Always 'response.mcp_call.in_progress'. Required. - RESPONSE_MCP_CALL_IN_PROGRESS. - :vartype type: Literal["response.mcp_call.in_progress"] - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. - :vartype item_id: str - """ - - type: Required[Literal["response.mcp_call.in_progress"]] - """The type of the event. Always 'response.mcp_call.in_progress'. Required. - RESPONSE_MCP_CALL_IN_PROGRESS.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - item_id: Required[str] - """The unique identifier of the MCP tool call item being processed. Required.""" - - -class ResponseMCPListToolsCompletedEvent(TypedDict, total=False): - """ResponseMCPListToolsCompletedEvent. - - :ivar type: The type of the event. Always 'response.mcp_list_tools.completed'. Required. - RESPONSE_MCP_LIST_TOOLS_COMPLETED. - :vartype type: Literal["response.mcp_list_tools.completed"] - :ivar item_id: The ID of the MCP tool call item that produced this output. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that was processed. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_list_tools.completed"]] - """The type of the event. Always 'response.mcp_list_tools.completed'. Required. - RESPONSE_MCP_LIST_TOOLS_COMPLETED.""" - item_id: Required[str] - """The ID of the MCP tool call item that produced this output. Required.""" - output_index: Required[int] - """The index of the output item that was processed. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseMCPListToolsFailedEvent(TypedDict, total=False): - """ResponseMCPListToolsFailedEvent. - - :ivar type: The type of the event. Always 'response.mcp_list_tools.failed'. Required. - RESPONSE_MCP_LIST_TOOLS_FAILED. - :vartype type: Literal["response.mcp_list_tools.failed"] - :ivar item_id: The ID of the MCP tool call item that failed. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that failed. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_list_tools.failed"]] - """The type of the event. Always 'response.mcp_list_tools.failed'. Required. - RESPONSE_MCP_LIST_TOOLS_FAILED.""" - item_id: Required[str] - """The ID of the MCP tool call item that failed. Required.""" - output_index: Required[int] - """The index of the output item that failed. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseMCPListToolsInProgressEvent(TypedDict, total=False): - """ResponseMCPListToolsInProgressEvent. - - :ivar type: The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. - RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS. - :vartype type: Literal["response.mcp_list_tools.in_progress"] - :ivar item_id: The ID of the MCP tool call item that is being processed. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that is being processed. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.mcp_list_tools.in_progress"]] - """The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. - RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS.""" - item_id: Required[str] - """The ID of the MCP tool call item that is being processed. Required.""" - output_index: Required[int] - """The index of the output item that is being processed. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseObject(TypedDict, total=False): - """The response object. - - :ivar metadata: - :vartype metadata: "Metadata" - :ivar top_logprobs: - :vartype top_logprobs: int - :ivar temperature: - :vartype temperature: float - :ivar top_p: - :vartype top_p: float - :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use - ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your - end-users. Used to boost cache hit rates by better bucketing similar requests and to help - OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers. - :vartype user: str - :ivar safety_identifier: - :vartype safety_identifier: str - :ivar prompt_cache_key: - :vartype prompt_cache_key: str - :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type. - :vartype prompt_cache_retention: Literal["in_memory", "24h"] - :ivar previous_response_id: - :vartype previous_response_id: str - :ivar model: The model deployment to use for the creation of this response. - :vartype model: str - :ivar background: - :vartype background: bool - :ivar max_tool_calls: - :vartype max_tool_calls: int - :ivar text: - :vartype text: "ResponseTextParam" - :ivar tools: - :vartype tools: list["Tool"] - :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. - :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] - :ivar prompt: - :vartype prompt: "Prompt" - :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], - Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"] - :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast", - "ultrafast"] - :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. - :vartype truncation: Literal["auto", "disabled"] - :ivar id: Unique identifier for this Response. Required. - :vartype id: str - :ivar object: The object type of this resource - always set to ``response``. Required. Default - value is "response". - :vartype object: Literal["response"] - :ivar status: The status of the response generation. One of ``completed``, ``failed``, - ``in_progress``, ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: - Literal["completed"], Literal["failed"], Literal["in_progress"], Literal["cancelled"], - Literal["queued"], Literal["incomplete"] - :vartype status: Literal["completed", "failed", "in_progress", "cancelled", "queued", - "incomplete"] - :ivar created_at: Unix timestamp (in seconds) of when this Response was created. Required. - :vartype created_at: int - :ivar completed_at: - :vartype completed_at: int - :ivar error: Required. - :vartype error: "ResponseErrorInfo" - :ivar incomplete_details: Required. - :vartype incomplete_details: "ResponseIncompleteDetails" - :ivar output: An array of content items generated by the model. The length and order of items - depends on the model response. Use the output_text property instead of assuming the first item - is an assistant message. Required. - :vartype output: list["OutputItem"] - :ivar reasoning: - :vartype reasoning: "Reasoning" - :ivar instructions: Required. Is either a str type or a [Item] type. - :vartype instructions: Union[str, list["Item"]] - :ivar output_text: - :vartype output_text: str - :ivar usage: - :vartype usage: "ResponseUsage" - :ivar prompt_cache_options: - :vartype prompt_cache_options: "PromptCacheOptions" - :ivar moderation: - :vartype moderation: "Moderation" - :ivar parallel_tool_calls: Whether to allow the model to run tool calls in parallel. Required. - :vartype parallel_tool_calls: bool - :ivar conversation: - :vartype conversation: "ConversationReference" - :ivar max_output_tokens: - :vartype max_output_tokens: int - :ivar agent_reference: The agent used for this response. Required. - :vartype agent_reference: "AgentReference" - """ - - metadata: Optional["Metadata"] - top_logprobs: Optional[int] - temperature: Optional[float] - top_p: Optional[float] - user: str - """This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use - ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your - end-users. Used to boost cache hit rates by better bucketing similar requests and to help - OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.""" - safety_identifier: Optional[str] - prompt_cache_key: Optional[str] - prompt_cache_retention: Optional[Literal["in_memory", "24h"]] - """Is either a Literal[\"in_memory\"] type or a Literal[\"24h\"] type.""" - previous_response_id: Optional[str] - model: str - """The model deployment to use for the creation of this response.""" - background: Optional[bool] - max_tool_calls: Optional[int] - text: "ResponseTextParam" - tools: list["Tool"] - tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] - """Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.""" - prompt: "Prompt" - service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast", "ultrafast"]] - """Is one of the following types: Literal[\"auto\"], Literal[\"default\"], Literal[\"flex\"], - Literal[\"scale\"], Literal[\"priority\"], Literal[\"fast\"], Literal[\"ultrafast\"]""" - truncation: Optional[Literal["auto", "disabled"]] - """Is either a Literal[\"auto\"] type or a Literal[\"disabled\"] type.""" - id: Required[str] - """Unique identifier for this Response. Required.""" - object: Required[Literal["response"]] - """The object type of this resource - always set to ``response``. Required. Default value is - \"response\".""" - status: Literal["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"] - """The status of the response generation. One of ``completed``, ``failed``, ``in_progress``, - ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: - Literal[\"completed\"], Literal[\"failed\"], Literal[\"in_progress\"], Literal[\"cancelled\"], - Literal[\"queued\"], Literal[\"incomplete\"]""" - created_at: Required[int] - """Unix timestamp (in seconds) of when this Response was created. Required.""" - completed_at: Optional[int] - error: Required[Optional["ResponseErrorInfo"]] - """Required.""" - incomplete_details: Required[Optional["ResponseIncompleteDetails"]] - """Required.""" - output: Required[list["OutputItem"]] - """An array of content items generated by the model. The length and order of items depends on the - model response. Use the output_text property instead of assuming the first item is an assistant - message. Required.""" - reasoning: Optional["Reasoning"] - instructions: Required[Optional[Union[str, list["Item"]]]] - """Required. Is either a str type or a [Item] type.""" - output_text: Optional[str] - usage: "ResponseUsage" - prompt_cache_options: "PromptCacheOptions" - moderation: Optional["Moderation"] - parallel_tool_calls: Required[bool] - """Whether to allow the model to run tool calls in parallel. Required.""" - conversation: Optional["ConversationReference"] - max_output_tokens: Optional[int] - agent_reference: Required[Optional["AgentReference"]] - """The agent used for this response. Required.""" - - -class ResponseOutputItemAddedEvent(TypedDict, total=False): - """Emitted when a new output item is added. - - :ivar type: The type of the event. Always ``response.output_item.added``. Required. - RESPONSE_OUTPUT_ITEM_ADDED. - :vartype type: Literal["response.output_item.added"] - :ivar output_index: The index of the output item that was added. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar item: The output item that was added. For reasoning items, ``encrypted_content`` may be - incomplete while the item is in progress. Use the reasoning item from the corresponding - ``response.output_item.done`` event when passing it as input to a subsequent request. Required. - :vartype item: "OutputItem" - """ - - type: Required[Literal["response.output_item.added"]] - """The type of the event. Always ``response.output_item.added``. Required. - RESPONSE_OUTPUT_ITEM_ADDED.""" - output_index: Required[int] - """The index of the output item that was added. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - item: Required["OutputItem"] - """The output item that was added. For reasoning items, ``encrypted_content`` may be incomplete - while the item is in progress. Use the reasoning item from the corresponding - ``response.output_item.done`` event when passing it as input to a subsequent request. Required.""" - - -class ResponseOutputItemDoneEvent(TypedDict, total=False): - """Emitted when an output item is marked done. - - :ivar type: The type of the event. Always ``response.output_item.done``. Required. - RESPONSE_OUTPUT_ITEM_DONE. - :vartype type: Literal["response.output_item.done"] - :ivar output_index: The index of the output item that was marked done. Required. - :vartype output_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar item: The output item that was marked done. Required. - :vartype item: "OutputItem" - """ - - type: Required[Literal["response.output_item.done"]] - """The type of the event. Always ``response.output_item.done``. Required. - RESPONSE_OUTPUT_ITEM_DONE.""" - output_index: Required[int] - """The index of the output item that was marked done. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - item: Required["OutputItem"] - """The output item that was marked done. Required.""" - - -class ResponseOutputTextAnnotationAddedEvent(TypedDict, total=False): - """ResponseOutputTextAnnotationAddedEvent. - - :ivar type: The type of the event. Always 'response.output_text.annotation.added'. Required. - RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED. - :vartype type: Literal["response.output_text.annotation.added"] - :ivar item_id: The unique identifier of the item to which the annotation is being added. - Required. - :vartype item_id: str - :ivar output_index: The index of the output item in the response's output array. Required. - :vartype output_index: int - :ivar content_index: The index of the content part within the output item. Required. - :vartype content_index: int - :ivar annotation_index: The index of the annotation within the content part. Required. - :vartype annotation_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar annotation: The annotation object being added. (See annotation schema for details.). - Required. - :vartype annotation: "Annotation" - """ - - type: Required[Literal["response.output_text.annotation.added"]] - """The type of the event. Always 'response.output_text.annotation.added'. Required. - RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED.""" - item_id: Required[str] - """The unique identifier of the item to which the annotation is being added. Required.""" - output_index: Required[int] - """The index of the output item in the response's output array. Required.""" - content_index: Required[int] - """The index of the content part within the output item. Required.""" - annotation_index: Required[int] - """The index of the annotation within the content part. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - annotation: Required["Annotation"] - """The annotation object being added. (See annotation schema for details.). Required.""" - - -class ResponsePromptVariables(TypedDict, total=False): - """Prompt Variables.""" - - -class ResponseQueuedEvent(TypedDict, total=False): - """ResponseQueuedEvent. - - :ivar type: The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED. - :vartype type: Literal["response.queued"] - :ivar response: The full response object that is queued. Required. - :vartype response: "ResponseObject" - :ivar sequence_number: The sequence number for this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.queued"]] - """The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED.""" - response: Required["ResponseObject"] - """The full response object that is queued. Required.""" - sequence_number: Required[int] - """The sequence number for this event. Required.""" - - -class ResponseReasoningSummaryPartAddedEvent(TypedDict, total=False): - """Emitted when a new reasoning summary part is added. - - :ivar type: The type of the event. Always ``response.reasoning_summary_part.added``. Required. - RESPONSE_REASONING_SUMMARY_PART_ADDED. - :vartype type: Literal["response.reasoning_summary_part.added"] - :ivar item_id: The ID of the item this summary part is associated with. Required. - :vartype item_id: str - :ivar output_index: The index of the output item this summary part is associated with. - Required. - :vartype output_index: int - :ivar summary_index: The index of the summary part within the reasoning summary. Required. - :vartype summary_index: int - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar part: The summary part that was added. Required. - :vartype part: "ResponseReasoningSummaryPartAddedEventPart" - """ - - type: Required[Literal["response.reasoning_summary_part.added"]] - """The type of the event. Always ``response.reasoning_summary_part.added``. Required. - RESPONSE_REASONING_SUMMARY_PART_ADDED.""" - item_id: Required[str] - """The ID of the item this summary part is associated with. Required.""" - output_index: Required[int] - """The index of the output item this summary part is associated with. Required.""" - summary_index: Required[int] - """The index of the summary part within the reasoning summary. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - part: Required["ResponseReasoningSummaryPartAddedEventPart"] - """The summary part that was added. Required.""" - - -class ResponseReasoningSummaryPartAddedEventPart(TypedDict, total=False): # pylint: disable=name-too-long - """ResponseReasoningSummaryPartAddedEventPart. - - :ivar type: Required. Default value is "summary_text". - :vartype type: Literal["summary_text"] - :ivar text: Required. - :vartype text: str - """ - - type: Required[Literal["summary_text"]] - """Required. Default value is \"summary_text\".""" - text: Required[str] - """Required.""" - - -class ResponseReasoningSummaryPartDoneEvent(TypedDict, total=False): - """Emitted when a reasoning summary part is completed. - - :ivar type: The type of the event. Always ``response.reasoning_summary_part.done``. Required. - RESPONSE_REASONING_SUMMARY_PART_DONE. - :vartype type: Literal["response.reasoning_summary_part.done"] - :ivar item_id: The ID of the item this summary part is associated with. Required. - :vartype item_id: str - :ivar output_index: The index of the output item this summary part is associated with. - Required. - :vartype output_index: int - :ivar summary_index: The index of the summary part within the reasoning summary. Required. - :vartype summary_index: int - :ivar status: The completion status of the summary part. Omitted when the part completed - normally and set to ``incomplete`` when generation was interrupted. Default value is - "incomplete". - :vartype status: Literal["incomplete"] - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - :ivar part: The completed summary part. Required. - :vartype part: "ResponseReasoningSummaryPartDoneEventPart" - """ - - type: Required[Literal["response.reasoning_summary_part.done"]] - """The type of the event. Always ``response.reasoning_summary_part.done``. Required. - RESPONSE_REASONING_SUMMARY_PART_DONE.""" - item_id: Required[str] - """The ID of the item this summary part is associated with. Required.""" - output_index: Required[int] - """The index of the output item this summary part is associated with. Required.""" - summary_index: Required[int] - """The index of the summary part within the reasoning summary. Required.""" - status: Literal["incomplete"] - """The completion status of the summary part. Omitted when the part completed normally and set to - ``incomplete`` when generation was interrupted. Default value is \"incomplete\".""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - part: Required["ResponseReasoningSummaryPartDoneEventPart"] - """The completed summary part. Required.""" - - -class ResponseReasoningSummaryPartDoneEventPart(TypedDict, total=False): # pylint: disable=name-too-long - """ResponseReasoningSummaryPartDoneEventPart. - - :ivar type: Required. Default value is "summary_text". - :vartype type: Literal["summary_text"] - :ivar text: Required. - :vartype text: str - """ - - type: Required[Literal["summary_text"]] - """Required. Default value is \"summary_text\".""" - text: Required[str] - """Required.""" - - -class ResponseReasoningSummaryTextDeltaEvent(TypedDict, total=False): - """Emitted when a delta is added to a reasoning summary text. - - :ivar type: The type of the event. Always ``response.reasoning_summary_text.delta``. Required. - RESPONSE_REASONING_SUMMARY_TEXT_DELTA. - :vartype type: Literal["response.reasoning_summary_text.delta"] - :ivar item_id: The ID of the item this summary text delta is associated with. Required. - :vartype item_id: str - :ivar output_index: The index of the output item this summary text delta is associated with. - Required. - :vartype output_index: int - :ivar summary_index: The index of the summary part within the reasoning summary. Required. - :vartype summary_index: int - :ivar delta: The text delta that was added to the summary. Required. - :vartype delta: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.reasoning_summary_text.delta"]] - """The type of the event. Always ``response.reasoning_summary_text.delta``. Required. - RESPONSE_REASONING_SUMMARY_TEXT_DELTA.""" - item_id: Required[str] - """The ID of the item this summary text delta is associated with. Required.""" - output_index: Required[int] - """The index of the output item this summary text delta is associated with. Required.""" - summary_index: Required[int] - """The index of the summary part within the reasoning summary. Required.""" - delta: Required[str] - """The text delta that was added to the summary. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseReasoningSummaryTextDoneEvent(TypedDict, total=False): - """Emitted when a reasoning summary text is completed. - - :ivar type: The type of the event. Always ``response.reasoning_summary_text.done``. Required. - RESPONSE_REASONING_SUMMARY_TEXT_DONE. - :vartype type: Literal["response.reasoning_summary_text.done"] - :ivar item_id: The ID of the item this summary text is associated with. Required. - :vartype item_id: str - :ivar output_index: The index of the output item this summary text is associated with. - Required. - :vartype output_index: int - :ivar summary_index: The index of the summary part within the reasoning summary. Required. - :vartype summary_index: int - :ivar text: The full text of the completed reasoning summary. Required. - :vartype text: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.reasoning_summary_text.done"]] - """The type of the event. Always ``response.reasoning_summary_text.done``. Required. - RESPONSE_REASONING_SUMMARY_TEXT_DONE.""" - item_id: Required[str] - """The ID of the item this summary text is associated with. Required.""" - output_index: Required[int] - """The index of the output item this summary text is associated with. Required.""" - summary_index: Required[int] - """The index of the summary part within the reasoning summary. Required.""" - text: Required[str] - """The full text of the completed reasoning summary. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseReasoningTextDeltaEvent(TypedDict, total=False): - """Emitted when a delta is added to a reasoning text. - - :ivar type: The type of the event. Always ``response.reasoning_text.delta``. Required. - RESPONSE_REASONING_TEXT_DELTA. - :vartype type: Literal["response.reasoning_text.delta"] - :ivar item_id: The ID of the item this reasoning text delta is associated with. Required. - :vartype item_id: str - :ivar output_index: The index of the output item this reasoning text delta is associated with. - Required. - :vartype output_index: int - :ivar content_index: The index of the reasoning content part this delta is associated with. - Required. - :vartype content_index: int - :ivar delta: The text delta that was added to the reasoning content. Required. - :vartype delta: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.reasoning_text.delta"]] - """The type of the event. Always ``response.reasoning_text.delta``. Required. - RESPONSE_REASONING_TEXT_DELTA.""" - item_id: Required[str] - """The ID of the item this reasoning text delta is associated with. Required.""" - output_index: Required[int] - """The index of the output item this reasoning text delta is associated with. Required.""" - content_index: Required[int] - """The index of the reasoning content part this delta is associated with. Required.""" - delta: Required[str] - """The text delta that was added to the reasoning content. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseReasoningTextDoneEvent(TypedDict, total=False): - """Emitted when a reasoning text is completed. - - :ivar type: The type of the event. Always ``response.reasoning_text.done``. Required. - RESPONSE_REASONING_TEXT_DONE. - :vartype type: Literal["response.reasoning_text.done"] - :ivar item_id: The ID of the item this reasoning text is associated with. Required. - :vartype item_id: str - :ivar output_index: The index of the output item this reasoning text is associated with. - Required. - :vartype output_index: int - :ivar content_index: The index of the reasoning content part. Required. - :vartype content_index: int - :ivar text: The full text of the completed reasoning content. Required. - :vartype text: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.reasoning_text.done"]] - """The type of the event. Always ``response.reasoning_text.done``. Required. - RESPONSE_REASONING_TEXT_DONE.""" - item_id: Required[str] - """The ID of the item this reasoning text is associated with. Required.""" - output_index: Required[int] - """The index of the output item this reasoning text is associated with. Required.""" - content_index: Required[int] - """The index of the reasoning content part. Required.""" - text: Required[str] - """The full text of the completed reasoning content. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseRefusalDeltaEvent(TypedDict, total=False): - """Emitted when there is a partial refusal text. - - :ivar type: The type of the event. Always ``response.refusal.delta``. Required. - RESPONSE_REFUSAL_DELTA. - :vartype type: Literal["response.refusal.delta"] - :ivar item_id: The ID of the output item that the refusal text is added to. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the refusal text is added to. Required. - :vartype output_index: int - :ivar content_index: The index of the content part that the refusal text is added to. Required. - :vartype content_index: int - :ivar delta: The refusal text that is added. Required. - :vartype delta: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.refusal.delta"]] - """The type of the event. Always ``response.refusal.delta``. Required. RESPONSE_REFUSAL_DELTA.""" - item_id: Required[str] - """The ID of the output item that the refusal text is added to. Required.""" - output_index: Required[int] - """The index of the output item that the refusal text is added to. Required.""" - content_index: Required[int] - """The index of the content part that the refusal text is added to. Required.""" - delta: Required[str] - """The refusal text that is added. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseRefusalDoneEvent(TypedDict, total=False): - """Emitted when refusal text is finalized. - - :ivar type: The type of the event. Always ``response.refusal.done``. Required. - RESPONSE_REFUSAL_DONE. - :vartype type: Literal["response.refusal.done"] - :ivar item_id: The ID of the output item that the refusal text is finalized. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the refusal text is finalized. Required. - :vartype output_index: int - :ivar content_index: The index of the content part that the refusal text is finalized. - Required. - :vartype content_index: int - :ivar refusal: The refusal text that is finalized. Required. - :vartype refusal: str - :ivar sequence_number: The sequence number of this event. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.refusal.done"]] - """The type of the event. Always ``response.refusal.done``. Required. RESPONSE_REFUSAL_DONE.""" - item_id: Required[str] - """The ID of the output item that the refusal text is finalized. Required.""" - output_index: Required[int] - """The index of the output item that the refusal text is finalized. Required.""" - content_index: Required[int] - """The index of the content part that the refusal text is finalized. Required.""" - refusal: Required[str] - """The refusal text that is finalized. Required.""" - sequence_number: Required[int] - """The sequence number of this event. Required.""" - - -class ResponseStreamOptions(TypedDict, total=False): - """Options for streaming responses. Only set this when you set ``stream: true``. - - :ivar include_obfuscation: When true, stream obfuscation will be enabled. Stream obfuscation - adds random characters to an ``obfuscation`` field on streaming delta events to normalize - payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are - included by default, but add a small amount of overhead to the data stream. You can set - ``include_obfuscation`` to false to optimize for bandwidth if you trust the network links - between your application and the OpenAI API. - :vartype include_obfuscation: bool - """ - - include_obfuscation: bool - """When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an - ``obfuscation`` field on streaming delta events to normalize payload sizes as a mitigation to - certain side-channel attacks. These obfuscation fields are included by default, but add a small - amount of overhead to the data stream. You can set ``include_obfuscation`` to false to optimize - for bandwidth if you trust the network links between your application and the OpenAI API.""" - - -class ResponseTextDeltaEvent(TypedDict, total=False): - """Emitted when there is an additional text delta. - - :ivar type: The type of the event. Always ``response.output_text.delta``. Required. - RESPONSE_OUTPUT_TEXT_DELTA. - :vartype type: Literal["response.output_text.delta"] - :ivar item_id: The ID of the output item that the text delta was added to. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the text delta was added to. Required. - :vartype output_index: int - :ivar content_index: The index of the content part that the text delta was added to. Required. - :vartype content_index: int - :ivar delta: The text delta that was added. Required. - :vartype delta: str - :ivar sequence_number: The sequence number for this event. Required. - :vartype sequence_number: int - :ivar logprobs: The log probabilities of the tokens in the delta. Required. - :vartype logprobs: list["ResponseLogProb"] - """ - - type: Required[Literal["response.output_text.delta"]] - """The type of the event. Always ``response.output_text.delta``. Required. - RESPONSE_OUTPUT_TEXT_DELTA.""" - item_id: Required[str] - """The ID of the output item that the text delta was added to. Required.""" - output_index: Required[int] - """The index of the output item that the text delta was added to. Required.""" - content_index: Required[int] - """The index of the content part that the text delta was added to. Required.""" - delta: Required[str] - """The text delta that was added. Required.""" - sequence_number: Required[int] - """The sequence number for this event. Required.""" - logprobs: Required[list["ResponseLogProb"]] - """The log probabilities of the tokens in the delta. Required.""" - - -class ResponseTextDoneEvent(TypedDict, total=False): - """Emitted when text content is finalized. - - :ivar type: The type of the event. Always ``response.output_text.done``. Required. - RESPONSE_OUTPUT_TEXT_DONE. - :vartype type: Literal["response.output_text.done"] - :ivar item_id: The ID of the output item that the text content is finalized. Required. - :vartype item_id: str - :ivar output_index: The index of the output item that the text content is finalized. Required. - :vartype output_index: int - :ivar content_index: The index of the content part that the text content is finalized. - Required. - :vartype content_index: int - :ivar text: The text content that is finalized. Required. - :vartype text: str - :ivar sequence_number: The sequence number for this event. Required. - :vartype sequence_number: int - :ivar logprobs: The log probabilities of the tokens in the delta. Required. - :vartype logprobs: list["ResponseLogProb"] - """ - - type: Required[Literal["response.output_text.done"]] - """The type of the event. Always ``response.output_text.done``. Required. - RESPONSE_OUTPUT_TEXT_DONE.""" - item_id: Required[str] - """The ID of the output item that the text content is finalized. Required.""" - output_index: Required[int] - """The index of the output item that the text content is finalized. Required.""" - content_index: Required[int] - """The index of the content part that the text content is finalized. Required.""" - text: Required[str] - """The text content that is finalized. Required.""" - sequence_number: Required[int] - """The sequence number for this event. Required.""" - logprobs: Required[list["ResponseLogProb"]] - """The log probabilities of the tokens in the delta. Required.""" - - -class ResponseTextParam(TypedDict, total=False): - """Configuration options for a text response from the model. Can be plain - text or structured JSON data. Learn more: - - * [Text inputs and outputs](/docs/guides/text) - * [Structured Outputs](/docs/guides/structured-outputs). - - :ivar format: - :vartype format: "TextResponseFormatConfiguration" - :ivar verbosity: Is one of the following types: Literal["low"], Literal["medium"], - Literal["high"] - :vartype verbosity: Literal["low", "medium", "high"] - """ - - format: "TextResponseFormatConfiguration" - verbosity: Optional[Literal["low", "medium", "high"]] - """Is one of the following types: Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" - - -class ResponseUsage(TypedDict, total=False): - """Represents token usage details including input tokens, output tokens, a breakdown of output - tokens, and the total tokens used. - - :ivar input_tokens: The number of input tokens. Required. - :vartype input_tokens: int - :ivar input_tokens_details: A detailed breakdown of the input tokens. Required. - :vartype input_tokens_details: "ResponseUsageInputTokensDetails" - :ivar output_tokens: The number of output tokens. Required. - :vartype output_tokens: int - :ivar output_tokens_details: A detailed breakdown of the output tokens. Required. - :vartype output_tokens_details: "ResponseUsageOutputTokensDetails" - :ivar total_tokens: The total number of tokens used. Required. - :vartype total_tokens: int - """ - - input_tokens: Required[int] - """The number of input tokens. Required.""" - input_tokens_details: Required["ResponseUsageInputTokensDetails"] - """A detailed breakdown of the input tokens. Required.""" - output_tokens: Required[int] - """The number of output tokens. Required.""" - output_tokens_details: Required["ResponseUsageOutputTokensDetails"] - """A detailed breakdown of the output tokens. Required.""" - total_tokens: Required[int] - """The total number of tokens used. Required.""" - - -class ResponseUsageInputTokensDetails(TypedDict, total=False): - """ResponseUsageInputTokensDetails. - - :ivar cached_tokens: Required. - :vartype cached_tokens: int - :ivar cache_write_tokens: Required. - :vartype cache_write_tokens: int - """ - - cached_tokens: Required[int] - """Required.""" - cache_write_tokens: Required[int] - """Required.""" - - -class ResponseUsageOutputTokensDetails(TypedDict, total=False): - """ResponseUsageOutputTokensDetails. - - :ivar reasoning_tokens: Required. - :vartype reasoning_tokens: int - """ - - reasoning_tokens: Required[int] - """Required.""" - - -class ResponseWebSearchCallCompletedEvent(TypedDict, total=False): - """Emitted when a web search call is completed. - - :ivar type: The type of the event. Always ``response.web_search_call.completed``. Required. - RESPONSE_WEB_SEARCH_CALL_COMPLETED. - :vartype type: Literal["response.web_search_call.completed"] - :ivar output_index: The index of the output item that the web search call is associated with. - Required. - :vartype output_index: int - :ivar item_id: Unique ID for the output item associated with the web search call. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of the web search call being processed. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.web_search_call.completed"]] - """The type of the event. Always ``response.web_search_call.completed``. Required. - RESPONSE_WEB_SEARCH_CALL_COMPLETED.""" - output_index: Required[int] - """The index of the output item that the web search call is associated with. Required.""" - item_id: Required[str] - """Unique ID for the output item associated with the web search call. Required.""" - sequence_number: Required[int] - """The sequence number of the web search call being processed. Required.""" - - -class ResponseWebSearchCallInProgressEvent(TypedDict, total=False): - """Emitted when a web search call is initiated. - - :ivar type: The type of the event. Always ``response.web_search_call.in_progress``. Required. - RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS. - :vartype type: Literal["response.web_search_call.in_progress"] - :ivar output_index: The index of the output item that the web search call is associated with. - Required. - :vartype output_index: int - :ivar item_id: Unique ID for the output item associated with the web search call. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of the web search call being processed. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.web_search_call.in_progress"]] - """The type of the event. Always ``response.web_search_call.in_progress``. Required. - RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS.""" - output_index: Required[int] - """The index of the output item that the web search call is associated with. Required.""" - item_id: Required[str] - """Unique ID for the output item associated with the web search call. Required.""" - sequence_number: Required[int] - """The sequence number of the web search call being processed. Required.""" - - -class ResponseWebSearchCallSearchingEvent(TypedDict, total=False): - """Emitted when a web search call is executing. - - :ivar type: The type of the event. Always ``response.web_search_call.searching``. Required. - RESPONSE_WEB_SEARCH_CALL_SEARCHING. - :vartype type: Literal["response.web_search_call.searching"] - :ivar output_index: The index of the output item that the web search call is associated with. - Required. - :vartype output_index: int - :ivar item_id: Unique ID for the output item associated with the web search call. Required. - :vartype item_id: str - :ivar sequence_number: The sequence number of the web search call being processed. Required. - :vartype sequence_number: int - """ - - type: Required[Literal["response.web_search_call.searching"]] - """The type of the event. Always ``response.web_search_call.searching``. Required. - RESPONSE_WEB_SEARCH_CALL_SEARCHING.""" - output_index: Required[int] - """The index of the output item that the web search call is associated with. Required.""" - item_id: Required[str] - """Unique ID for the output item associated with the web search call. Required.""" - sequence_number: Required[int] - """The sequence number of the web search call being processed. Required.""" - - -class ScreenshotParam(TypedDict, total=False): - """Screenshot. - - :ivar type: Specifies the event type. For a screenshot action, this property is always set to - ``screenshot``. Required. SCREENSHOT. - :vartype type: Literal["screenshot"] - """ - - type: Required[Literal["screenshot"]] - """Specifies the event type. For a screenshot action, this property is always set to - ``screenshot``. Required. SCREENSHOT.""" - - -class ScrollParam(TypedDict, total=False): - """Scroll. - - :ivar type: Specifies the event type. For a scroll action, this property is always set to - ``scroll``. Required. SCROLL. - :vartype type: Literal["scroll"] - :ivar x: The x-coordinate where the scroll occurred. Required. - :vartype x: int - :ivar y: The y-coordinate where the scroll occurred. Required. - :vartype y: int - :ivar scroll_x: The horizontal scroll distance. Required. - :vartype scroll_x: int - :ivar scroll_y: The vertical scroll distance. Required. - :vartype scroll_y: int - :ivar keys: - :vartype keys: list[str] - """ - - type: Required[Literal["scroll"]] - """Specifies the event type. For a scroll action, this property is always set to ``scroll``. - Required. SCROLL.""" - x: Required[int] - """The x-coordinate where the scroll occurred. Required.""" - y: Required[int] - """The y-coordinate where the scroll occurred. Required.""" - scroll_x: Required[int] - """The horizontal scroll distance. Required.""" - scroll_y: Required[int] - """The vertical scroll distance. Required.""" - keys: Optional[list[str]] - - -class SharepointGroundingToolCall(TypedDict, total=False): - """A SharePoint grounding tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL. - :vartype type: Literal["sharepoint_grounding_preview_call"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar arguments: A JSON string of the arguments to pass to the tool. Required. - :vartype arguments: str - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["sharepoint_grounding_preview_call"]] - """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - arguments: Required[str] - """A JSON string of the arguments to pass to the tool. Required.""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class SharepointGroundingToolCallOutput(TypedDict, total=False): - """The output of a SharePoint grounding tool call. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT. - :vartype type: Literal["sharepoint_grounding_preview_call_output"] - :ivar call_id: The unique ID of the tool call generated by the model. Required. - :vartype call_id: str - :ivar output: The output from the SharePoint grounding tool call. Is one of the following - types: {str: Any}, str, [Any] - :vartype output: "_unions.ToolCallOutputContent" - :ivar status: The status of the tool call. Required. Known values are: "in_progress", - "completed", "incomplete", and "failed". - :vartype status: ToolCallStatus - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["sharepoint_grounding_preview_call_output"]] - """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.""" - call_id: Required[str] - """The unique ID of the tool call generated by the model. Required.""" - output: "_unions.ToolCallOutputContent" - """The output from the SharePoint grounding tool call. Is one of the following types: {str: Any}, - str, [Any]""" - status: Required[ToolCallStatus] - """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", - \"incomplete\", and \"failed\".""" - id: Required[str] - """Required.""" - - -class SharepointGroundingToolParameters(TypedDict, total=False): - """The sharepoint grounding tool parameters. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connections: The project connections attached to this tool. There can be a - maximum of 1 connection resource attached to the tool. - :vartype project_connections: list["ToolProjectConnection"] - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connections: list["ToolProjectConnection"] - """The project connections attached to this tool. There can be a maximum of 1 connection resource - attached to the tool.""" - - -class SharepointPreviewTool(TypedDict, total=False): - """The input definition information for a sharepoint tool as used to configure an agent. - - :ivar type: The object type, which is always 'sharepoint_grounding_preview'. Required. - SHAREPOINT_GROUNDING_PREVIEW. - :vartype type: Literal["sharepoint_grounding_preview"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. - :vartype sharepoint_grounding_preview: "SharepointGroundingToolParameters" - """ - - type: Required[Literal["sharepoint_grounding_preview"]] - """The object type, which is always 'sharepoint_grounding_preview'. Required. - SHAREPOINT_GROUNDING_PREVIEW.""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - sharepoint_grounding_preview: Required["SharepointGroundingToolParameters"] - """The sharepoint grounding tool parameters. Required.""" - - -class SkillReferenceParam(TypedDict, total=False): - """SkillReferenceParam. - - :ivar type: References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE. - :vartype type: Literal["skill_reference"] - :ivar skill_id: The ID of the referenced skill. Required. - :vartype skill_id: str - :ivar version: Optional skill version. Use a positive integer or 'latest'. Omit for default. - :vartype version: str - """ - - type: Required[Literal["skill_reference"]] - """References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE.""" - skill_id: Required[str] - """The ID of the referenced skill. Required.""" - version: str - """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" - - -class SpecificApplyPatchParam(TypedDict, total=False): - """Specific apply patch tool choice. - - :ivar type: The tool to call. Always ``apply_patch``. Required. APPLY_PATCH. - :vartype type: Literal["apply_patch"] - """ - - type: Required[Literal["apply_patch"]] - """The tool to call. Always ``apply_patch``. Required. APPLY_PATCH.""" - - -class SpecificFunctionShellParam(TypedDict, total=False): - """Specific shell tool choice. - - :ivar type: The tool to call. Always ``shell``. Required. SHELL. - :vartype type: Literal["shell"] - """ - - type: Required[Literal["shell"]] - """The tool to call. Always ``shell``. Required. SHELL.""" - - -class SpecificProgrammaticToolCallingParam(TypedDict, total=False): - """SpecificProgrammaticToolCallingParam. - - :ivar type: The tool to call. Always ``programmatic_tool_calling``. Required. - PROGRAMMATIC_TOOL_CALLING. - :vartype type: Literal["programmatic_tool_calling"] - """ - - type: Required[Literal["programmatic_tool_calling"]] - """The tool to call. Always ``programmatic_tool_calling``. Required. PROGRAMMATIC_TOOL_CALLING.""" - - -class StructuredOutputDefinition(TypedDict, total=False): - """A structured output that can be produced by the agent. - - :ivar name: The name of the structured output. Required. - :vartype name: str - :ivar description: A description of the output to emit. Used by the model to determine when to - emit the output. Required. - :vartype description: str - :ivar schema: The JSON schema for the structured output. Required. - :vartype schema: dict[str, Any] - :ivar strict: Whether to enforce strict validation. Default ``true``. Required. - :vartype strict: bool - """ - - name: Required[str] - """The name of the structured output. Required.""" - description: Required[str] - """A description of the output to emit. Used by the model to determine when to emit the output. - Required.""" - schema: Required[dict[str, Any]] - """The JSON schema for the structured output. Required.""" - strict: Required[Optional[bool]] - """Whether to enforce strict validation. Default ``true``. Required.""" - - -class StructuredOutputsOutputItem(TypedDict, total=False): - """StructuredOutputsOutputItem. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. STRUCTURED_OUTPUTS. - :vartype type: Literal["structured_outputs"] - :ivar output: The structured output captured during the response. Required. - :vartype output: Any - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["structured_outputs"]] - """Required. STRUCTURED_OUTPUTS.""" - output: Required[Any] - """The structured output captured during the response. Required.""" - id: Required[str] - """Required.""" - - -class SummaryTextContent(TypedDict, total=False): - """Summary text. - - :ivar type: The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT. - :vartype type: Literal["summary_text"] - :ivar text: A summary of the reasoning output from the model so far. Required. - :vartype text: str - """ - - type: Required[Literal["summary_text"]] - """The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT.""" - text: Required[str] - """A summary of the reasoning output from the model so far. Required.""" - - -class TextContent(TypedDict, total=False): - """Text Content. - - :ivar type: Required. TEXT. - :vartype type: Literal["text"] - :ivar text: Required. - :vartype text: str - """ - - type: Required[Literal["text"]] - """Required. TEXT.""" - text: Required[str] - """Required.""" - - -class TextResponseFormatConfigurationResponseFormatJsonObject(TypedDict, total=False): # pylint: disable=name-too-long - """JSON object. - - :ivar type: The type of response format being defined. Always ``json_object``. Required. - JSON_OBJECT. - :vartype type: Literal["json_object"] - """ - - type: Required[Literal["json_object"]] - """The type of response format being defined. Always ``json_object``. Required. JSON_OBJECT.""" - - -class TextResponseFormatConfigurationResponseFormatText(TypedDict, total=False): # pylint: disable=name-too-long - """Text. - - :ivar type: The type of response format being defined. Always ``text``. Required. TEXT. - :vartype type: Literal["text"] - """ - - type: Required[Literal["text"]] - """The type of response format being defined. Always ``text``. Required. TEXT.""" - - -class TextResponseFormatJsonSchema(TypedDict, total=False): - """JSON schema. - - :ivar type: The type of response format being defined. Always ``json_schema``. Required. - JSON_SCHEMA. - :vartype type: Literal["json_schema"] - :ivar description: A description of what the response format is for, used by the model to - determine how to respond in the format. - :vartype description: str - :ivar name: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and - dashes, with a maximum length of 64. Required. - :vartype name: str - :ivar schema: Required. - :vartype schema: "ResponseFormatJsonSchemaSchema" - :ivar strict: - :vartype strict: bool - """ - - type: Required[Literal["json_schema"]] - """The type of response format being defined. Always ``json_schema``. Required. JSON_SCHEMA.""" - description: str - """A description of what the response format is for, used by the model to determine how to respond - in the format.""" - name: Required[str] - """The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with - a maximum length of 64. Required.""" - schema: Required["ResponseFormatJsonSchemaSchema"] - """Required.""" - strict: Optional[bool] - - -class ToolChoiceAllowed(TypedDict, total=False): - """Allowed tools. - - :ivar type: Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS. - :vartype type: Literal["allowed_tools"] - :ivar mode: Constrains the tools available to the model to a pre-defined set. ``auto`` allows - the model to pick from among the allowed tools and generate a message. ``required`` requires - the model to call one or more of the allowed tools. Required. Is either a Literal["auto"] type - or a Literal["required"] type. - :vartype mode: Literal["auto", "required"] - :ivar tools: Required. A list of tool definitions that the model should be allowed to call. For - the Responses API, the list of tool definitions might look like: - - .. code-block:: json - - [ - { "type": "function", "name": "get_weather" }, - { "type": "mcp", "server_label": "deepwiki" }, - { "type": "image_generation" } + """Type of ResponseStreamEventType.""" + + SearchContentType = Literal["text", "image"] + """Type of SearchContentType.""" + + SearchContextSize = Literal["low", "medium", "high"] + """Type of SearchContextSize.""" + + ServiceTierEnum = Literal["auto", "default", "fast", "flex", "priority"] + """Type of ServiceTierEnum.""" + + TextResponseFormatConfigurationType = Literal["text", "json_schema", "json_object"] + """Type of TextResponseFormatConfigurationType.""" + + ToolCallCallerParamType = Literal["direct", "program"] + """Type of ToolCallCallerParamType.""" + + ToolCallCallerType = Literal["direct", "program"] + """Type of ToolCallCallerType.""" + + ToolCallStatus = Literal["in_progress", "completed", "incomplete", "failed"] + """The status of a tool call.""" + + ToolChoiceOptions = Literal["none", "auto", "required"] + """Tool choice mode.""" + + ToolChoiceParamType = Literal[ + "allowed_tools", + "function", + "mcp", + "custom", + "programmatic_tool_calling", + "apply_patch", + "shell", + "file_search", + "web_search_preview", + "computer_use_preview", + "web_search_preview_2025_03_11", + "image_generation", + "code_interpreter", + "computer", + "computer_use", + ] + """Type of ToolChoiceParamType.""" + + ToolSearchExecutionType = Literal["server", "client"] + """Type of ToolSearchExecutionType.""" + + ToolType = Literal[ + "function", + "file_search", + "computer", + "computer_use_preview", + "web_search", + "mcp", + "code_interpreter", + "programmatic_tool_calling", + "image_generation", + "local_shell", + "shell", + "custom", + "namespace", + "tool_search", + "web_search_preview", + "apply_patch", + "a2a_preview", + "bing_custom_search_preview", + "browser_automation_preview", + "fabric_dataagent_preview", + "sharepoint_grounding_preview", + "memory_search_preview", + "work_iq_preview", + "azure_ai_search", + "azure_function", + "bing_grounding", + "capture_structured_outputs", + "openapi", + ] + """Type of ToolType.""" + + + class A2APreviewTool(TypedDict, total=False): + """An agent implementing the A2A protocol. + + :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2_A_PREVIEW. + :vartype type: Literal["a2a_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar base_url: Base URL of the agent. + :vartype base_url: str + :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not + provided, defaults to ``/.well-known/agent-card.json``. + :vartype agent_card_path: str + :ivar project_connection_id: The connection ID in the project for the A2A server. The + connection stores authentication and other connection details needed to connect to the A2A + server. + :vartype project_connection_id: str + """ + + type: Required[Literal["a2a_preview"]] + """The type of the tool. Always ``\"a2a_preview``. Required. A2_A_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + base_url: str + """Base URL of the agent.""" + agent_card_path: str + """The path to the agent card relative to the ``base_url``. If not provided, defaults to + ``/.well-known/agent-card.json``.""" + project_connection_id: str + """The connection ID in the project for the A2A server. The connection stores authentication and + other connection details needed to connect to the A2A server.""" + + + class A2AToolCall(TypedDict, total=False): + """An A2A (Agent-to-Agent) tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2_A_PREVIEW_CALL. + :vartype type: Literal["a2a_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["a2a_preview_call"]] + """Required. A2_A_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the A2A agent card being called. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class A2AToolCallOutput(TypedDict, total=False): + """The output of an A2A (Agent-to-Agent) tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2_A_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["a2a_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card that was called. Required. + :vartype name: str + :ivar output: The output from the A2A tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["a2a_preview_call_output"]] + """Required. A2_A_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the A2A agent card that was called. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the A2A tool call. Is one of the following types: {str: Any}, str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class AdditionalToolsItemParam(TypedDict, total=False): + """AdditionalToolsItemParam. + + :ivar id: + :vartype id: str + :ivar type: The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. + :vartype type: Literal["additional_tools"] + :ivar role: The role that provided the additional tools. Only ``developer`` is supported. + Required. Default value is "developer". + :vartype role: Literal["developer"] + :ivar tools: A list of additional tools made available at this item. Required. + :vartype tools: list["Tool"] + """ + + id: Optional[str] + type: Required[Literal["additional_tools"]] + """The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.""" + role: Required[Literal["developer"]] + """The role that provided the additional tools. Only ``developer`` is supported. Required. Default + value is \"developer\".""" + tools: Required[list["Tool"]] + """A list of additional tools made available at this item. Required.""" + + + class AgentReference(TypedDict, total=False): + """AgentReference. + + :ivar type: Required. Default value is "agent_reference". + :vartype type: Literal["agent_reference"] + :ivar name: The name of the agent. Required. + :vartype name: str + :ivar version: The version identifier of the agent. + :vartype version: str + """ + + type: Required[Literal["agent_reference"]] + """Required. Default value is \"agent_reference\".""" + name: Required[str] + """The name of the agent. Required.""" + version: str + """The version identifier of the agent.""" + + + class AISearchIndexResource(TypedDict, total=False): + """A AI Search Index resource. + + :ivar project_connection_id: An index connection ID in an IndexResource attached to this agent. + :vartype project_connection_id: str + :ivar index_name: The name of an index in an IndexResource attached to this agent. + :vartype index_name: str + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar query_type: Type of query in an AIIndexResource attached to this agent. Known values are: + "simple", "semantic", "vector", "vector_simple_hybrid", and "vector_semantic_hybrid". + :vartype query_type: AzureAISearchQueryType + :ivar top_k: Number of documents to retrieve from search and present to the model. + :vartype top_k: int + :ivar filter: filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters. + :vartype filter: str + :ivar index_asset_id: Index asset id for search resource. + :vartype index_asset_id: str + """ + + project_connection_id: str + """An index connection ID in an IndexResource attached to this agent.""" + index_name: str + """The name of an index in an IndexResource attached to this agent.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + query_type: AzureAISearchQueryType + """Type of query in an AIIndexResource attached to this agent. Known values are: \"simple\", + \"semantic\", \"vector\", \"vector_simple_hybrid\", and \"vector_semantic_hybrid\".""" + top_k: int + """Number of documents to retrieve from search and present to the model.""" + filter: str + """filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters.""" + index_asset_id: str + """Index asset id for search resource.""" + + + class ApiErrorResponse(TypedDict, total=False): + """Error response for API failures. + + :ivar error: Required. + :vartype error: "Error" + """ + + error: Required["Error"] + """Required.""" + + + class ApplyPatchCreateFileOperation(TypedDict, total=False): + """Apply patch create file operation. + + :ivar type: Create a new file with the provided diff. Required. CREATE_FILE. + :vartype type: Literal["create_file"] + :ivar path: Path of the file to create. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + + type: Required[Literal["create_file"]] + """Create a new file with the provided diff. Required. CREATE_FILE.""" + path: Required[str] + """Path of the file to create. Required.""" + diff: Required[str] + """Diff to apply. Required.""" + + + class ApplyPatchCreateFileOperationParam(TypedDict, total=False): + """Apply patch create file operation. + + :ivar type: The operation type. Always ``create_file``. Required. CREATE_FILE. + :vartype type: Literal["create_file"] + :ivar path: Path of the file to create relative to the workspace root. Required. + :vartype path: str + :ivar diff: Unified diff content to apply when creating the file. Required. + :vartype diff: str + """ + + type: Required[Literal["create_file"]] + """The operation type. Always ``create_file``. Required. CREATE_FILE.""" + path: Required[str] + """Path of the file to create relative to the workspace root. Required.""" + diff: Required[str] + """Unified diff content to apply when creating the file. Required.""" + + + class ApplyPatchDeleteFileOperation(TypedDict, total=False): + """Apply patch delete file operation. + + :ivar type: Delete the specified file. Required. DELETE_FILE. + :vartype type: Literal["delete_file"] + :ivar path: Path of the file to delete. Required. + :vartype path: str + """ + + type: Required[Literal["delete_file"]] + """Delete the specified file. Required. DELETE_FILE.""" + path: Required[str] + """Path of the file to delete. Required.""" + + + class ApplyPatchDeleteFileOperationParam(TypedDict, total=False): + """Apply patch delete file operation. + + :ivar type: The operation type. Always ``delete_file``. Required. DELETE_FILE. + :vartype type: Literal["delete_file"] + :ivar path: Path of the file to delete relative to the workspace root. Required. + :vartype path: str + """ + + type: Required[Literal["delete_file"]] + """The operation type. Always ``delete_file``. Required. DELETE_FILE.""" + path: Required[str] + """Path of the file to delete relative to the workspace root. Required.""" + + + class ApplyPatchToolCallItemParam(TypedDict, total=False): + """Apply patch tool call. + + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: Literal["apply_patch_call"] + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: ApplyPatchCallStatusParam + :ivar operation: The specific create, delete, or update instruction for the apply_patch tool + call. Required. + :vartype operation: "ApplyPatchOperationParam" + """ + + type: Required[Literal["apply_patch_call"]] + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: Optional[str] + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + caller: Optional["ToolCallCallerParam"] + status: Required[ApplyPatchCallStatusParam] + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: Required["ApplyPatchOperationParam"] + """The specific create, delete, or update instruction for the apply_patch tool call. Required.""" + + + class ApplyPatchToolCallOutputItemParam(TypedDict, total=False): + """Apply patch tool call output. + + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: Literal["apply_patch_call_output"] + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: ApplyPatchCallOutputStatusParam + :ivar output: + :vartype output: str + """ + + type: Required[Literal["apply_patch_call_output"]] + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: Optional[str] + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + caller: Optional["ToolCallCallerParam"] + status: Required[ApplyPatchCallOutputStatusParam] + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] + + + class ApplyPatchToolParam(TypedDict, total=False): + """Apply patch tool. + + :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: Literal["apply_patch"] + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + + type: Required[Literal["apply_patch"]] + """The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.""" + allowed_callers: Optional[list[CallableToolAllowedCaller]] + + + class ApplyPatchUpdateFileOperation(TypedDict, total=False): + """Apply patch update file operation. + + :ivar type: Update an existing file with the provided diff. Required. UPDATE_FILE. + :vartype type: Literal["update_file"] + :ivar path: Path of the file to update. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + + type: Required[Literal["update_file"]] + """Update an existing file with the provided diff. Required. UPDATE_FILE.""" + path: Required[str] + """Path of the file to update. Required.""" + diff: Required[str] + """Diff to apply. Required.""" + + + class ApplyPatchUpdateFileOperationParam(TypedDict, total=False): + """Apply patch update file operation. + + :ivar type: The operation type. Always ``update_file``. Required. UPDATE_FILE. + :vartype type: Literal["update_file"] + :ivar path: Path of the file to update relative to the workspace root. Required. + :vartype path: str + :ivar diff: Unified diff content to apply to the existing file. Required. + :vartype diff: str + """ + + type: Required[Literal["update_file"]] + """The operation type. Always ``update_file``. Required. UPDATE_FILE.""" + path: Required[str] + """Path of the file to update relative to the workspace root. Required.""" + diff: Required[str] + """Unified diff content to apply to the existing file. Required.""" + + + class ApproximateLocation(TypedDict, total=False): + """ApproximateLocation. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: Literal["approximate"] + :ivar country: + :vartype country: str + :ivar region: + :vartype region: str + :ivar city: + :vartype city: str + :ivar timezone: + :vartype timezone: str + """ + + type: Required[Literal["approximate"]] + """The type of location approximation. Always ``approximate``. Required. Default value is + \"approximate\".""" + country: Optional[str] + region: Optional[str] + city: Optional[str] + timezone: Optional[str] + + + class AutoCodeInterpreterToolParam(TypedDict, total=False): + """Automatic Code Interpreter Tool Parameters. + + :ivar type: Always ``auto``. Required. Default value is "auto". + :vartype type: Literal["auto"] + :ivar file_ids: An optional list of uploaded files to make available to your code. + :vartype file_ids: list[str] + :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". + :vartype memory_limit: ContainerMemoryLimit + :ivar network_policy: + :vartype network_policy: "ContainerNetworkPolicyParam" + """ + + type: Required[Literal["auto"]] + """Always ``auto``. Required. Default value is \"auto\".""" + file_ids: list[str] + """An optional list of uploaded files to make available to your code.""" + memory_limit: Optional[ContainerMemoryLimit] + """Known values are: \"1g\", \"4g\", \"16g\", and \"64g\".""" + network_policy: "ContainerNetworkPolicyParam" + + + class AzureAISearchTool(TypedDict, total=False): + """The input definition information for an Azure AI search tool as used to configure an agent. + + :ivar type: The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH. + :vartype type: Literal["azure_ai_search"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar azure_ai_search: The azure ai search index resource. Required. + :vartype azure_ai_search: "AzureAISearchToolResource" + """ + + type: Required[Literal["azure_ai_search"]] + """The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + azure_ai_search: Required["AzureAISearchToolResource"] + """The azure ai search index resource. Required.""" + + + class AzureAISearchToolCall(TypedDict, total=False): + """An Azure AI Search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL. + :vartype type: Literal["azure_ai_search_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["azure_ai_search_call"]] + """Required. AZURE_AI_SEARCH_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class AzureAISearchToolCallOutput(TypedDict, total=False): + """The output of an Azure AI Search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL_OUTPUT. + :vartype type: Literal["azure_ai_search_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Azure AI Search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["azure_ai_search_call_output"]] + """Required. AZURE_AI_SEARCH_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Azure AI Search tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class AzureAISearchToolResource(TypedDict, total=False): + """A set of index resources used by the ``azure_ai_search`` tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar indexes: The indices attached to this agent. There can be a maximum of 1 index resource + attached to the agent. Required. + :vartype indexes: list["AISearchIndexResource"] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + indexes: Required[list["AISearchIndexResource"]] + """The indices attached to this agent. There can be a maximum of 1 index resource attached to the + agent. Required.""" + + + class AzureFunctionBinding(TypedDict, total=False): + """The structure for keeping storage queue name and URI. + + :ivar type: The type of binding, which is always 'storage_queue'. Required. Default value is + "storage_queue". + :vartype type: Literal["storage_queue"] + :ivar storage_queue: Storage queue. Required. + :vartype storage_queue: "AzureFunctionStorageQueue" + """ + + type: Required[Literal["storage_queue"]] + """The type of binding, which is always 'storage_queue'. Required. Default value is + \"storage_queue\".""" + storage_queue: Required["AzureFunctionStorageQueue"] + """Storage queue. Required.""" + + + class AzureFunctionDefinition(TypedDict, total=False): + """The definition of Azure function. + + :ivar function: The definition of azure function and its parameters. Required. + :vartype function: "AzureFunctionDefinitionFunction" + :ivar input_binding: Input storage queue. The queue storage trigger runs a function as messages + are added to it. Required. + :vartype input_binding: "AzureFunctionBinding" + :ivar output_binding: Output storage queue. The function writes output to this queue when the + input items are processed. Required. + :vartype output_binding: "AzureFunctionBinding" + """ + + function: Required["AzureFunctionDefinitionFunction"] + """The definition of azure function and its parameters. Required.""" + input_binding: Required["AzureFunctionBinding"] + """Input storage queue. The queue storage trigger runs a function as messages are added to it. + Required.""" + output_binding: Required["AzureFunctionBinding"] + """Output storage queue. The function writes output to this queue when the input items are + processed. Required.""" + + + class AzureFunctionDefinitionFunction(TypedDict, total=False): + """AzureFunctionDefinitionFunction. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, Any] + """ + + name: Required[str] + """The name of the function to be called. Required.""" + description: str + """A description of what the function does, used by the model to choose when and how to call the + function.""" + parameters: Required[dict[str, Any]] + """The parameters the functions accepts, described as a JSON Schema object. Required.""" + + + class AzureFunctionStorageQueue(TypedDict, total=False): + """The structure for keeping storage queue name and URI. + + :ivar queue_service_endpoint: URI to the Azure Storage Queue service allowing you to manipulate + a queue. Required. + :vartype queue_service_endpoint: str + :ivar queue_name: The name of an Azure function storage queue. Required. + :vartype queue_name: str + """ + + queue_service_endpoint: Required[str] + """URI to the Azure Storage Queue service allowing you to manipulate a queue. Required.""" + queue_name: Required[str] + """The name of an Azure function storage queue. Required.""" + + + class AzureFunctionTool(TypedDict, total=False): + """The input definition information for an Azure Function Tool, as used to configure an Agent. + + :ivar type: The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION. + :vartype type: Literal["azure_function"] + :ivar azure_function: The Azure Function Tool definition. Required. + :vartype azure_function: "AzureFunctionDefinition" + """ + + type: Required[Literal["azure_function"]] + """The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION.""" + azure_function: Required["AzureFunctionDefinition"] + """The Azure Function Tool definition. Required.""" + + + class AzureFunctionToolCall(TypedDict, total=False): + """An Azure Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL. + :vartype type: Literal["azure_function_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["azure_function_call"]] + """Required. AZURE_FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the Azure Function being called. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class AzureFunctionToolCallOutput(TypedDict, total=False): + """The output of an Azure Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL_OUTPUT. + :vartype type: Literal["azure_function_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function that was called. Required. + :vartype name: str + :ivar output: The output from the Azure Function tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["azure_function_call_output"]] + """Required. AZURE_FUNCTION_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the Azure Function that was called. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Azure Function tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BingCustomSearchConfiguration(TypedDict, total=False): + """A bing custom search configuration. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar instance_name: Name of the custom configuration instance given to config. Required. + :vartype instance_name: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str + :ivar count: The number of search results to return in the bing api response. + :vartype count: int + :ivar freshness: Filter search results by a specific time range. See `accepted values here + `_. + :vartype freshness: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """Project connection id for grounding with bing search. Required.""" + instance_name: Required[str] + """Name of the custom configuration instance given to config. Required.""" + market: str + """The market where the results come from.""" + set_lang: str + """The language to use for user interface strings when calling Bing API.""" + count: int + """The number of search results to return in the bing api response.""" + freshness: str + """Filter search results by a specific time range. See `accepted values here + `_.""" + + + class BingCustomSearchPreviewTool(TypedDict, total=False): + """The input definition information for a Bing custom search tool as used to configure an agent. + + :ivar type: The object type, which is always 'bing_custom_search_preview'. Required. + BING_CUSTOM_SEARCH_PREVIEW. + :vartype type: Literal["bing_custom_search_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. + :vartype bing_custom_search_preview: "BingCustomSearchToolParameters" + """ + + type: Required[Literal["bing_custom_search_preview"]] + """The object type, which is always 'bing_custom_search_preview'. Required. + BING_CUSTOM_SEARCH_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + bing_custom_search_preview: Required["BingCustomSearchToolParameters"] + """The bing custom search tool parameters. Required.""" + + + class BingCustomSearchToolCall(TypedDict, total=False): + """A Bing custom search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL. + :vartype type: Literal["bing_custom_search_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["bing_custom_search_preview_call"]] + """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BingCustomSearchToolCallOutput(TypedDict, total=False): + """The output of a Bing custom search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["bing_custom_search_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing custom search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["bing_custom_search_preview_call_output"]] + """Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Bing custom search tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BingCustomSearchToolParameters(TypedDict, total=False): + """The bing custom search tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar search_configurations: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. Required. + :vartype search_configurations: list["BingCustomSearchConfiguration"] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + search_configurations: Required[list["BingCustomSearchConfiguration"]] + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool. Required.""" + + + class BingGroundingSearchConfiguration(TypedDict, total=False): + """Search configuration for Bing Grounding. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str + :ivar count: The number of search results to return in the bing api response. + :vartype count: int + :ivar freshness: Filter search results by a specific time range. See `accepted values here + `_. + :vartype freshness: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """Project connection id for grounding with bing search. Required.""" + market: str + """The market where the results come from.""" + set_lang: str + """The language to use for user interface strings when calling Bing API.""" + count: int + """The number of search results to return in the bing api response.""" + freshness: str + """Filter search results by a specific time range. See `accepted values here + `_.""" + + + class BingGroundingSearchToolParameters(TypedDict, total=False): + """The bing grounding search tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar search_configurations: The search configurations attached to this tool. There can be a + maximum of 1 search configuration resource attached to the tool. Required. + :vartype search_configurations: list["BingGroundingSearchConfiguration"] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + search_configurations: Required[list["BingGroundingSearchConfiguration"]] + """The search configurations attached to this tool. There can be a maximum of 1 search + configuration resource attached to the tool. Required.""" + + + class BingGroundingTool(TypedDict, total=False): + """The input definition information for a bing grounding search tool as used to configure an + agent. + + :ivar type: The object type, which is always 'bing_grounding'. Required. BING_GROUNDING. + :vartype type: Literal["bing_grounding"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar bing_grounding: The bing grounding search tool parameters. Required. + :vartype bing_grounding: "BingGroundingSearchToolParameters" + """ + + type: Required[Literal["bing_grounding"]] + """The object type, which is always 'bing_grounding'. Required. BING_GROUNDING.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + bing_grounding: Required["BingGroundingSearchToolParameters"] + """The bing grounding search tool parameters. Required.""" + + + class BingGroundingToolCall(TypedDict, total=False): + """A Bing grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL. + :vartype type: Literal["bing_grounding_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["bing_grounding_call"]] + """Required. BING_GROUNDING_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BingGroundingToolCallOutput(TypedDict, total=False): + """The output of a Bing grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL_OUTPUT. + :vartype type: Literal["bing_grounding_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing grounding tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["bing_grounding_call_output"]] + """Required. BING_GROUNDING_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Bing grounding tool call. Is one of the following types: {str: Any}, str, + [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BrowserAutomationPreviewTool(TypedDict, total=False): + """The input definition information for a Browser Automation Tool, as used to configure an Agent. + + :ivar type: The object type, which is always 'browser_automation_preview'. Required. + BROWSER_AUTOMATION_PREVIEW. + :vartype type: Literal["browser_automation_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. + :vartype browser_automation_preview: "BrowserAutomationToolParameters" + """ + + type: Required[Literal["browser_automation_preview"]] + """The object type, which is always 'browser_automation_preview'. Required. + BROWSER_AUTOMATION_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + browser_automation_preview: Required["BrowserAutomationToolParameters"] + """The Browser Automation Tool parameters. Required.""" + + + class BrowserAutomationToolCall(TypedDict, total=False): + """A browser automation tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL. + :vartype type: Literal["browser_automation_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["browser_automation_preview_call"]] + """Required. BROWSER_AUTOMATION_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BrowserAutomationToolCallOutput(TypedDict, total=False): + """The output of a browser automation tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["browser_automation_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the browser automation tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["browser_automation_preview_call_output"]] + """Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the browser automation tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class BrowserAutomationToolConnectionParameters(TypedDict, total=False): # pylint: disable=name-too-long + """Definition of input parameters for the connection used by the Browser Automation Tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: The ID of the project connection to your Azure Playwright + resource. Required. + :vartype project_connection_id: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """The ID of the project connection to your Azure Playwright resource. Required.""" + + + class BrowserAutomationToolParameters(TypedDict, total=False): + """Definition of input parameters for the Browser Automation Tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar connection: The project connection parameters associated with the Browser Automation + Tool. Required. + :vartype connection: "BrowserAutomationToolConnectionParameters" + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + connection: Required["BrowserAutomationToolConnectionParameters"] + """The project connection parameters associated with the Browser Automation Tool. Required.""" + + + class CaptureStructuredOutputsTool(TypedDict, total=False): + """A tool for capturing structured outputs. + + :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required. + CAPTURE_STRUCTURED_OUTPUTS. + :vartype type: Literal["capture_structured_outputs"] + :ivar outputs: The structured outputs to capture from the model. Required. + :vartype outputs: "StructuredOutputDefinition" + """ + + type: Required[Literal["capture_structured_outputs"]] + """The type of the tool. Always ``capture_structured_outputs``. Required. + CAPTURE_STRUCTURED_OUTPUTS.""" + outputs: Required["StructuredOutputDefinition"] + """The structured outputs to capture from the model. Required.""" + + + class ChatSummaryMemoryItem(TypedDict, total=False): + """A memory item containing a summary extracted from conversations. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: int + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. Summary of chat conversations. + :vartype kind: Literal["chat_summary"] + """ + + memory_id: Required[str] + """The unique ID of the memory item. Required.""" + updated_at: Required[int] + """The last update time of the memory item. Required.""" + scope: Required[str] + """The namespace that logically groups and isolates memories, such as a user ID. Required.""" + content: Required[str] + """The content of the memory. Required.""" + kind: Required[Literal["chat_summary"]] + """The kind of the memory item. Required. Summary of chat conversations.""" + + + class ClickParam(TypedDict, total=False): + """Click. + + :ivar type: Specifies the event type. For a click action, this property is always ``click``. + Required. CLICK. + :vartype type: Literal["click"] + :ivar button: Indicates which mouse button was pressed during the click. One of ``left``, + ``right``, ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right", + "wheel", "back", and "forward". + :vartype button: ClickButtonType + :ivar x: The x-coordinate where the click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the click occurred. Required. + :vartype y: int + :ivar keys: + :vartype keys: list[str] + """ + + type: Required[Literal["click"]] + """Specifies the event type. For a click action, this property is always ``click``. Required. + CLICK.""" + button: Required[ClickButtonType] + """Indicates which mouse button was pressed during the click. One of ``left``, ``right``, + ``wheel``, ``back``, or ``forward``. Required. Known values are: \"left\", \"right\", + \"wheel\", \"back\", and \"forward\".""" + x: Required[int] + """The x-coordinate where the click occurred. Required.""" + y: Required[int] + """The y-coordinate where the click occurred. Required.""" + keys: Optional[list[str]] + + + class CodeInterpreterOutputImage(TypedDict, total=False): + """Code interpreter output image. + + :ivar type: The type of the output. Always ``image``. Required. Default value is "image". + :vartype type: Literal["image"] + :ivar url: The URL of the image output from the code interpreter. Required. + :vartype url: str + """ + + type: Required[Literal["image"]] + """The type of the output. Always ``image``. Required. Default value is \"image\".""" + url: Required[str] + """The URL of the image output from the code interpreter. Required.""" + + + class CodeInterpreterOutputLogs(TypedDict, total=False): + """Code interpreter output logs. + + :ivar type: The type of the output. Always ``logs``. Required. Default value is "logs". + :vartype type: Literal["logs"] + :ivar logs: The logs output from the code interpreter. Required. + :vartype logs: str + """ + + type: Required[Literal["logs"]] + """The type of the output. Always ``logs``. Required. Default value is \"logs\".""" + logs: Required[str] + """The logs output from the code interpreter. Required.""" + + + class CodeInterpreterTool(TypedDict, total=False): + """Code interpreter. + + :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required. + CODE_INTERPRETER. + :vartype type: Literal["code_interpreter"] + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar container: The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an optional + ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a + AutoCodeInterpreterToolParam type. + :vartype container: Union[str, "AutoCodeInterpreterToolParam"] + """ + + type: Required[Literal["code_interpreter"]] + """The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER.""" + allowed_callers: Optional[list[CallableToolAllowedCaller]] + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + container: Union[str, "AutoCodeInterpreterToolParam"] + """The code interpreter container. Can be a container ID or an object that specifies uploaded file + IDs to make available to your code, along with an optional ``memory_limit`` setting. If not + provided, the service assumes auto. Is either a str type or a AutoCodeInterpreterToolParam + type.""" + + + class CompactionSummaryItemParam(TypedDict, total=False): + """Compaction item. + + :ivar id: + :vartype id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: Literal["compaction"] + :ivar encrypted_content: The encrypted content of the compaction summary. Required. + :vartype encrypted_content: str + """ + + id: Optional[str] + type: Required[Literal["compaction"]] + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + encrypted_content: Required[str] + """The encrypted content of the compaction summary. Required.""" + + + class CompactResource(TypedDict, total=False): + """The compacted response object. + + :ivar id: The unique identifier for the compacted response. Required. + :vartype id: str + :ivar object: The object type. Always ``response.compaction``. Required. Default value is + "response.compaction". + :vartype object: Literal["response.compaction"] + :ivar output: The compacted list of output items. Required. + :vartype output: list["ItemField"] + :ivar created_at: Unix timestamp (in seconds) when the compacted conversation was created. + Required. + :vartype created_at: int + :ivar usage: Token accounting for the compaction pass, including cached, reasoning, and total + tokens. Required. + :vartype usage: "ResponseUsage" + """ + + id: Required[str] + """The unique identifier for the compacted response. Required.""" + object: Required[Literal["response.compaction"]] + """The object type. Always ``response.compaction``. Required. Default value is + \"response.compaction\".""" + output: Required[list["ItemField"]] + """The compacted list of output items. Required.""" + created_at: Required[int] + """Unix timestamp (in seconds) when the compacted conversation was created. Required.""" + usage: Required["ResponseUsage"] + """Token accounting for the compaction pass, including cached, reasoning, and total tokens. + Required.""" + + + class ComparisonFilter(TypedDict, total=False): + """Comparison Filter. + + :ivar type: Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, + ``lte``, ``in``, ``nin``. + + * `eq`: equals + * `ne`: not equal + * `gt`: greater than + * `gte`: greater than or equal + * `lt`: less than + * `lte`: less than or equal + * `in`: in + * `nin`: not in. Required. Is one of the following types: Literal["eq"], Literal["ne"], + Literal["gt"], Literal["gte"], Literal["lt"], Literal["lte"], Literal["in"], Literal["nin"] + :vartype type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"] + :ivar key: The key to compare against the value. Required. + :vartype key: str + :ivar value: The value to compare against the attribute key; supports string, number, or + boolean types. Required. Is one of the following types: str, float, bool, [Union[str, float]] + :vartype value: Union[str, float, bool, list[Union[str, float]]] + """ + + type: Required[Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]] + """Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, ``lte``, ``in``, + ``nin``. + + * `eq`: equals + * `ne`: not equal + * `gt`: greater than + * `gte`: greater than or equal + * `lt`: less than + * `lte`: less than or equal + * `in`: in + * `nin`: not in. Required. Is one of the following types: Literal[\"eq\"], + Literal[\"ne\"], Literal[\"gt\"], Literal[\"gte\"], Literal[\"lt\"], Literal[\"lte\"], + Literal[\"in\"], Literal[\"nin\"]""" + key: Required[str] + """The key to compare against the value. Required.""" + value: Required[Union[str, float, bool, list[Union[str, float]]]] + """The value to compare against the attribute key; supports string, number, or boolean types. + Required. Is one of the following types: str, float, bool, [Union[str, float]]""" + + + class CompoundFilter(TypedDict, total=False): + """Compound Filter. + + :ivar type: Type of operation: ``and`` or ``or``. Required. Is either a Literal["and"] type or + a Literal["or"] type. + :vartype type: Literal["and", "or"] + :ivar filters: Array of filters to combine. Items can be ``ComparisonFilter`` or + ``CompoundFilter``. Required. + :vartype filters: list[Union["ComparisonFilter", Any]] + """ + + type: Required[Literal["and", "or"]] + """Type of operation: ``and`` or ``or``. Required. Is either a Literal[\"and\"] type or a + Literal[\"or\"] type.""" + filters: Required[list[Union["ComparisonFilter", Any]]] + """Array of filters to combine. Items can be ``ComparisonFilter`` or ``CompoundFilter``. Required.""" + + + class ComputerCallOutputItemParam(TypedDict, total=False): + """Computer tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: Literal["computer_call_output"] + :ivar output: Required. + :vartype output: "ComputerScreenshotImage" + :ivar acknowledged_safety_checks: + :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + + id: Optional[str] + call_id: Required[str] + """The ID of the computer tool call that produced the output. Required.""" + type: Required[Literal["computer_call_output"]] + """The type of the computer tool call output. Always ``computer_call_output``. Required. + COMPUTER_CALL_OUTPUT.""" + output: Required["ComputerScreenshotImage"] + """Required.""" + acknowledged_safety_checks: Optional[list["ComputerCallSafetyCheckParam"]] + status: Optional[FunctionCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + + + class ComputerCallSafetyCheckParam(TypedDict, total=False): + """A pending safety check for the computer call. + + :ivar id: The ID of the pending safety check. Required. + :vartype id: str + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + + id: Required[str] + """The ID of the pending safety check. Required.""" + code: Optional[str] + message: Optional[str] + + + class ComputerScreenshotContent(TypedDict, total=False): + """Computer screenshot. + + :ivar type: Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. COMPUTER_SCREENSHOT. + :vartype type: Literal["computer_screenshot"] + :ivar image_url: Required. + :vartype image_url: str + :ivar file_id: Required. + :vartype file_id: str + :ivar detail: The detail level of the screenshot image to be sent to the model. One of + ``high``, ``low``, ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: + "low", "high", "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["computer_screenshot"]] + """Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. COMPUTER_SCREENSHOT.""" + image_url: Required[Optional[str]] + """Required.""" + file_id: Required[Optional[str]] + """Required.""" + detail: Required[ImageDetail] + """The detail level of the screenshot image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", + \"auto\", and \"original\".""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class ComputerScreenshotImage(TypedDict, total=False): + """A computer screenshot image used with the computer use tool. + + :ivar type: Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. Default value is "computer_screenshot". + :vartype type: Literal["computer_screenshot"] + :ivar image_url: The URL of the screenshot image. + :vartype image_url: str + :ivar file_id: The identifier of an uploaded file that contains the screenshot. + :vartype file_id: str + """ + + type: Required[Literal["computer_screenshot"]] + """Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. Default value is \"computer_screenshot\".""" + image_url: str + """The URL of the screenshot image.""" + file_id: str + """The identifier of an uploaded file that contains the screenshot.""" + + + class ComputerTool(TypedDict, total=False): + """Computer. + + :ivar type: The type of the computer tool. Always ``computer``. Required. COMPUTER. + :vartype type: Literal["computer"] + """ + + type: Required[Literal["computer"]] + """The type of the computer tool. Always ``computer``. Required. COMPUTER.""" + + + class ComputerUsePreviewTool(TypedDict, total=False): + """Computer use preview. + + :ivar type: The type of the computer use tool. Always ``computer_use_preview``. Required. + COMPUTER_USE_PREVIEW. + :vartype type: Literal["computer_use_preview"] + :ivar environment: The type of computer environment to control. Required. Known values are: + "windows", "mac", "linux", "ubuntu", and "browser". + :vartype environment: ComputerEnvironment + :ivar display_width: The width of the computer display. Required. + :vartype display_width: int + :ivar display_height: The height of the computer display. Required. + :vartype display_height: int + """ + + type: Required[Literal["computer_use_preview"]] + """The type of the computer use tool. Always ``computer_use_preview``. Required. + COMPUTER_USE_PREVIEW.""" + environment: Required[ComputerEnvironment] + """The type of computer environment to control. Required. Known values are: \"windows\", \"mac\", + \"linux\", \"ubuntu\", and \"browser\".""" + display_width: Required[int] + """The width of the computer display. Required.""" + display_height: Required[int] + """The height of the computer display. Required.""" + + + class ContainerAutoParam(TypedDict, total=False): + """ContainerAutoParam. + + :ivar type: Automatically creates a container for this request. Required. CONTAINER_AUTO. + :vartype type: Literal["container_auto"] + :ivar file_ids: An optional list of uploaded files to make available to your code. + :vartype file_ids: list[str] + :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". + :vartype memory_limit: ContainerMemoryLimit + :ivar skills: An optional list of skills referenced by id or inline data. + :vartype skills: list["ContainerSkill"] + :ivar network_policy: + :vartype network_policy: "ContainerNetworkPolicyParam" + """ + + type: Required[Literal["container_auto"]] + """Automatically creates a container for this request. Required. CONTAINER_AUTO.""" + file_ids: list[str] + """An optional list of uploaded files to make available to your code.""" + memory_limit: Optional[ContainerMemoryLimit] + """Known values are: \"1g\", \"4g\", \"16g\", and \"64g\".""" + skills: list["ContainerSkill"] + """An optional list of skills referenced by id or inline data.""" + network_policy: "ContainerNetworkPolicyParam" + + + class ContainerFileCitationBody(TypedDict, total=False): + """Container file citation. + + :ivar type: The type of the container file citation. Always ``container_file_citation``. + Required. CONTAINER_FILE_CITATION. + :vartype type: Literal["container_file_citation"] + :ivar container_id: The ID of the container file. Required. + :vartype container_id: str + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar start_index: The index of the first character of the container file citation in the + message. Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the container file citation in the message. + Required. + :vartype end_index: int + :ivar filename: The filename of the container file cited. Required. + :vartype filename: str + """ + + type: Required[Literal["container_file_citation"]] + """The type of the container file citation. Always ``container_file_citation``. Required. + CONTAINER_FILE_CITATION.""" + container_id: Required[str] + """The ID of the container file. Required.""" + file_id: Required[str] + """The ID of the file. Required.""" + start_index: Required[int] + """The index of the first character of the container file citation in the message. Required.""" + end_index: Required[int] + """The index of the last character of the container file citation in the message. Required.""" + filename: Required[str] + """The filename of the container file cited. Required.""" + + + class ContainerNetworkPolicyAllowlistParam(TypedDict, total=False): + """ContainerNetworkPolicyAllowlistParam. + + :ivar type: Allow outbound network access only to specified domains. Always ``allowlist``. + Required. ALLOWLIST. + :vartype type: Literal["allowlist"] + :ivar allowed_domains: A list of allowed domains when type is ``allowlist``. Required. + :vartype allowed_domains: list[str] + :ivar domain_secrets: Optional domain-scoped secrets for allowlisted domains. + :vartype domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"] + """ + + type: Required[Literal["allowlist"]] + """Allow outbound network access only to specified domains. Always ``allowlist``. Required. + ALLOWLIST.""" + allowed_domains: Required[list[str]] + """A list of allowed domains when type is ``allowlist``. Required.""" + domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"] + """Optional domain-scoped secrets for allowlisted domains.""" + + + class ContainerNetworkPolicyDisabledParam(TypedDict, total=False): + """ContainerNetworkPolicyDisabledParam. + + :ivar type: Disable outbound network access. Always ``disabled``. Required. DISABLED. + :vartype type: Literal["disabled"] + """ + + type: Required[Literal["disabled"]] + """Disable outbound network access. Always ``disabled``. Required. DISABLED.""" + + + class ContainerNetworkPolicyDomainSecretParam(TypedDict, total=False): + """ContainerNetworkPolicyDomainSecretParam. + + :ivar domain: The domain associated with the secret. Required. + :vartype domain: str + :ivar name: The name of the secret to inject for the domain. Required. + :vartype name: str + :ivar value: The secret value to inject for the domain. Required. + :vartype value: str + """ + + domain: Required[str] + """The domain associated with the secret. Required.""" + name: Required[str] + """The name of the secret to inject for the domain. Required.""" + value: Required[str] + """The secret value to inject for the domain. Required.""" + + + class ContainerReferenceResource(TypedDict, total=False): + """Container Reference. + + :ivar type: The environment type. Always ``container_reference``. Required. + CONTAINER_REFERENCE. + :vartype type: Literal["container_reference"] + :ivar container_id: Required. + :vartype container_id: str + """ + + type: Required[Literal["container_reference"]] + """The environment type. Always ``container_reference``. Required. CONTAINER_REFERENCE.""" + container_id: Required[str] + """Required.""" + + + class ContextManagementParam(TypedDict, total=False): + """ContextManagementParam. + + :ivar type: The context management entry type. Currently only 'compaction' is supported. + Required. + :vartype type: str + :ivar compact_threshold: + :vartype compact_threshold: int + """ + + type: Required[str] + """The context management entry type. Currently only 'compaction' is supported. Required.""" + compact_threshold: Optional[int] + + + class ConversationParam_2(TypedDict, total=False): + """Conversation object. + + :ivar id: The unique ID of the conversation. Required. + :vartype id: str + """ + + id: Required[str] + """The unique ID of the conversation. Required.""" + + + class ConversationReference(TypedDict, total=False): + """Conversation. + + :ivar id: The unique ID of the conversation that this response was associated with. Required. + :vartype id: str + """ + + id: Required[str] + """The unique ID of the conversation that this response was associated with. Required.""" + + + class CoordParam(TypedDict, total=False): + """Coordinate. + + :ivar x: The x-coordinate. Required. + :vartype x: int + :ivar y: The y-coordinate. Required. + :vartype y: int + """ + + x: Required[int] + """The x-coordinate. Required.""" + y: Required[int] + """The y-coordinate. Required.""" + + + class CreateResponse(TypedDict, total=False): + """CreateResponse. + + :ivar metadata: + :vartype metadata: "Metadata" + :ivar top_logprobs: + :vartype top_logprobs: int + :ivar temperature: + :vartype temperature: float + :ivar top_p: + :vartype top_p: float + :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers. + :vartype user: str + :ivar safety_identifier: + :vartype safety_identifier: str + :ivar prompt_cache_key: + :vartype prompt_cache_key: str + :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type. + :vartype prompt_cache_retention: Literal["in_memory", "24h"] + :ivar prompt_cache_options: + :vartype prompt_cache_options: "PromptCacheOptionsParam" + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar model: The model deployment to use for the creation of this response. + :vartype model: str + :ivar background: + :vartype background: bool + :ivar max_tool_calls: + :vartype max_tool_calls: int + :ivar text: + :vartype text: "ResponseTextParam" + :ivar tools: + :vartype tools: list["Tool"] + :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. + :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + :ivar prompt: + :vartype prompt: "Prompt" + :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"] + :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast", + "ultrafast"] + :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. + :vartype truncation: Literal["auto", "disabled"] + :ivar reasoning: + :vartype reasoning: "Reasoning" + :ivar input: Is either a str type or a [Item] type. + :vartype input: "_unions.InputParam" + :ivar include: + :vartype include: list[IncludeEnum] + :ivar parallel_tool_calls: + :vartype parallel_tool_calls: bool + :ivar store: + :vartype store: bool + :ivar instructions: + :vartype instructions: str + :ivar moderation: + :vartype moderation: "ModerationParam" + :ivar stream: + :vartype stream: bool + :ivar stream_options: + :vartype stream_options: "ResponseStreamOptions" + :ivar conversation: Is either a str type or a ConversationParam_2 type. + :vartype conversation: "_unions.ConversationParam" + :ivar context_management: Context management configuration for this request. + :vartype context_management: list["ContextManagementParam"] + :ivar max_output_tokens: + :vartype max_output_tokens: int + :ivar agent_reference: The agent to use for generating the response. + :vartype agent_reference: "AgentReference" + :ivar structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. + :vartype structured_inputs: dict[str, Any] + """ + + metadata: Optional["Metadata"] + top_logprobs: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + user: str + """This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.""" + safety_identifier: Optional[str] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[Literal["in_memory", "24h"]] + """Is either a Literal[\"in_memory\"] type or a Literal[\"24h\"] type.""" + prompt_cache_options: "PromptCacheOptionsParam" + previous_response_id: Optional[str] + model: str + """The model deployment to use for the creation of this response.""" + background: Optional[bool] + max_tool_calls: Optional[int] + text: "ResponseTextParam" + tools: list["Tool"] + tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + """Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.""" + prompt: "Prompt" + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast", "ultrafast"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"default\"], Literal[\"flex\"], + Literal[\"scale\"], Literal[\"priority\"], Literal[\"fast\"], Literal[\"ultrafast\"]""" + truncation: Optional[Literal["auto", "disabled"]] + """Is either a Literal[\"auto\"] type or a Literal[\"disabled\"] type.""" + reasoning: Optional["Reasoning"] + input: "_unions.InputParam" + """Is either a str type or a [Item] type.""" + include: Optional[list[IncludeEnum]] + parallel_tool_calls: Optional[bool] + store: Optional[bool] + instructions: Optional[str] + moderation: Optional["ModerationParam"] + stream: Optional[bool] + stream_options: Optional["ResponseStreamOptions"] + conversation: Optional["_unions.ConversationParam"] + """Is either a str type or a ConversationParam_2 type.""" + context_management: Optional[list["ContextManagementParam"]] + """Context management configuration for this request.""" + max_output_tokens: Optional[int] + agent_reference: "AgentReference" + """The agent to use for generating the response.""" + structured_inputs: dict[str, Any] + """The structured inputs to the response that can participate in prompt template substitution or + tool argument bindings.""" + + + class CustomGrammarFormatParam(TypedDict, total=False): + """Grammar format. + + :ivar type: Grammar format. Always ``grammar``. Required. GRAMMAR. + :vartype type: Literal["grammar"] + :ivar syntax: The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. + Known values are: "lark" and "regex". + :vartype syntax: GrammarSyntax1 + :ivar definition: The grammar definition. Required. + :vartype definition: str + """ + + type: Required[Literal["grammar"]] + """Grammar format. Always ``grammar``. Required. GRAMMAR.""" + syntax: Required[GrammarSyntax1] + """The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. Known values are: + \"lark\" and \"regex\".""" + definition: Required[str] + """The grammar definition. Required.""" + + + class CustomTextFormatParam(TypedDict, total=False): + """Text format. + + :ivar type: Unconstrained text format. Always ``text``. Required. TEXT. + :vartype type: Literal["text"] + """ + + type: Required[Literal["text"]] + """Unconstrained text format. Always ``text``. Required. TEXT.""" + + + class CustomToolCallOutputResource(TypedDict, total=False): + """ResponseCustomToolCallOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: Literal["custom_tool_call_output"] + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: FunctionCallOutputStatusEnum + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["custom_tool_call_output"]] + """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. + CUSTOM_TOOL_CALL_OUTPUT.""" + id: str + """The unique ID of the custom tool call output in the OpenAI platform.""" + call_id: Required[str] + """The call ID, used to map this custom tool call output to a custom tool call. Required.""" + caller: Optional["ToolCallCallerParam"] + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the custom tool call generated by your code. Can be a string or an list of + output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + status: Required[FunctionCallOutputStatusEnum] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Known values are: \"in_progress\", \"completed\", + and \"incomplete\".""" + created_by: str + """The identifier of the actor that created the item.""" + + + class CustomToolCallResource(TypedDict, total=False): + """ResponseCustomToolCallItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: Literal["custom_tool_call"] + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the custom tool being called. + :vartype namespace: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: FunctionCallStatus + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["custom_tool_call"]] + """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" + id: str + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: Required[str] + """An identifier used to map this custom tool call to a tool call output. Required.""" + caller: Optional["ToolCallCaller"] + namespace: str + """The namespace of the custom tool being called.""" + name: Required[str] + """The name of the custom tool being called. Required.""" + input: Required[str] + """The input for the custom tool call generated by the model. Required.""" + status: Required[FunctionCallStatus] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Known values are: \"in_progress\", \"completed\", + and \"incomplete\".""" + created_by: str + """The identifier of the actor that created the item.""" + + + class CustomToolParam(TypedDict, total=False): + """Custom tool. + + :ivar type: The type of the custom tool. Always ``custom``. Required. CUSTOM. + :vartype type: Literal["custom"] + :ivar name: The name of the custom tool, used to identify it in tool calls. Required. + :vartype name: str + :ivar description: Optional description of the custom tool, used to provide more context. + :vartype description: str + :ivar format: The input format for the custom tool. Default is unconstrained text. + :vartype format: "CustomToolParamFormat" + :ivar defer_loading: Whether this tool should be deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + + type: Required[Literal["custom"]] + """The type of the custom tool. Always ``custom``. Required. CUSTOM.""" + name: Required[str] + """The name of the custom tool, used to identify it in tool calls. Required.""" + description: str + """Optional description of the custom tool, used to provide more context.""" + format: "CustomToolParamFormat" + """The input format for the custom tool. Default is unconstrained text.""" + defer_loading: bool + """Whether this tool should be deferred and discovered via tool search.""" + allowed_callers: Optional[list[CallableToolAllowedCaller]] + + + class DeleteResponseResult(TypedDict, total=False): + """The result of a delete response operation. + + :ivar id: The operation ID. Required. + :vartype id: str + :ivar deleted: Always return true. Required. Default value is True. + :vartype deleted: Literal[True] + :ivar object: Required. Default value is "response". + :vartype object: Literal["response"] + """ + + id: Required[str] + """The operation ID. Required.""" + deleted: Required[Literal[True]] + """Always return true. Required. Default value is True.""" + object: Required[Literal["response"]] + """Required. Default value is \"response\".""" + + + class DirectToolCallCaller(TypedDict, total=False): + """DirectToolCallCaller. + + :ivar type: Required. DIRECT. + :vartype type: Literal["direct"] + """ + + type: Required[Literal["direct"]] + """Required. DIRECT.""" + + + class DirectToolCallCallerParam(TypedDict, total=False): + """DirectToolCallCallerParam. + + :ivar type: The caller type. Always ``direct``. Required. DIRECT. + :vartype type: Literal["direct"] + """ + + type: Required[Literal["direct"]] + """The caller type. Always ``direct``. Required. DIRECT.""" + + + class DoubleClickAction(TypedDict, total=False): + """DoubleClick. + + :ivar type: Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK. + :vartype type: Literal["double_click"] + :ivar x: The x-coordinate where the double click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the double click occurred. Required. + :vartype y: int + :ivar keys: Required. + :vartype keys: list[str] + """ + + type: Required[Literal["double_click"]] + """Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK.""" + x: Required[int] + """The x-coordinate where the double click occurred. Required.""" + y: Required[int] + """The y-coordinate where the double click occurred. Required.""" + keys: Required[Optional[list[str]]] + """Required.""" + + + class DragParam(TypedDict, total=False): + """Drag. + + :ivar type: Specifies the event type. For a drag action, this property is always set to + ``drag``. Required. DRAG. + :vartype type: Literal["drag"] + :ivar path: Required. An array of coordinates representing the path of the drag action. + Coordinates will appear as an array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + :vartype path: list["CoordParam"] + :ivar keys: + :vartype keys: list[str] + """ + + type: Required[Literal["drag"]] + """Specifies the event type. For a drag action, this property is always set to ``drag``. Required. + DRAG.""" + path: Required[list["CoordParam"]] + """Required. An array of coordinates representing the path of the drag action. Coordinates will + appear as an array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ]""" + keys: Optional[list[str]] + + + class EmptyModelParam(TypedDict, total=False): + """EmptyModelParam.""" + + + class Error(TypedDict, total=False): + """Error. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar param: + :vartype param: str + :ivar type: + :vartype type: str + :ivar details: + :vartype details: list["Error"] + :ivar additionalInfo: + :vartype additionalInfo: dict[str, Any] + :ivar debugInfo: + :vartype debugInfo: dict[str, Any] + """ + + code: Required[Optional[str]] + """Required.""" + message: Required[str] + """Required.""" + param: Optional[str] + type: str + details: list["Error"] + additionalInfo: dict[str, Any] + debugInfo: dict[str, Any] + + + class FabricDataAgentToolCall(TypedDict, total=False): + """A Fabric data agent tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL. + :vartype type: Literal["fabric_dataagent_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["fabric_dataagent_preview_call"]] + """Required. FABRIC_DATAAGENT_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class FabricDataAgentToolCallOutput(TypedDict, total=False): + """The output of a Fabric data agent tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["fabric_dataagent_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Fabric data agent tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["fabric_dataagent_preview_call_output"]] + """Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the Fabric data agent tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class FabricDataAgentToolParameters(TypedDict, total=False): + """The fabric data agent tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: list["ToolProjectConnection"] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connections: list["ToolProjectConnection"] + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + + class FileCitationBody(TypedDict, total=False): + """File citation. + + :ivar type: The type of the file citation. Always ``file_citation``. Required. FILE_CITATION. + :vartype type: Literal["file_citation"] + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + :ivar filename: The filename of the file cited. Required. + :vartype filename: str + """ + + type: Required[Literal["file_citation"]] + """The type of the file citation. Always ``file_citation``. Required. FILE_CITATION.""" + file_id: Required[str] + """The ID of the file. Required.""" + index: Required[int] + """The index of the file in the list of files. Required.""" + filename: Required[str] + """The filename of the file cited. Required.""" + + + class FilePath(TypedDict, total=False): + """File path. + + :ivar type: The type of the file path. Always ``file_path``. Required. FILE_PATH. + :vartype type: Literal["file_path"] + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + """ + + type: Required[Literal["file_path"]] + """The type of the file path. Always ``file_path``. Required. FILE_PATH.""" + file_id: Required[str] + """The ID of the file. Required.""" + index: Required[int] + """The index of the file in the list of files. Required.""" + + + class FileSearchTool(TypedDict, total=False): + """File search. + + :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. + :vartype type: Literal["file_search"] + :ivar vector_store_ids: The IDs of the vector stores to search. Required. + :vartype vector_store_ids: list[str] + :ivar max_num_results: The maximum number of results to return. This number should be between 1 + and 50 inclusive. + :vartype max_num_results: int + :ivar ranking_options: Ranking options for search. + :vartype ranking_options: "RankingOptions" + :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. + :vartype filters: "_unions.Filters" + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal["file_search"]] + """The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.""" + vector_store_ids: Required[list[str]] + """The IDs of the vector stores to search. Required.""" + max_num_results: int + """The maximum number of results to return. This number should be between 1 and 50 inclusive.""" + ranking_options: "RankingOptions" + """Ranking options for search.""" + filters: Optional["_unions.Filters"] + """Is either a ComparisonFilter type or a CompoundFilter type.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + + class FileSearchToolCallResults(TypedDict, total=False): + """FileSearchToolCallResults. + + :ivar file_id: + :vartype file_id: str + :ivar text: + :vartype text: str + :ivar filename: + :vartype filename: str + :ivar attributes: + :vartype attributes: "VectorStoreFileAttributes" + :ivar score: + :vartype score: float + """ + + file_id: str + text: str + filename: str + attributes: Optional["VectorStoreFileAttributes"] + score: float + + + class FunctionAndCustomToolCallOutputInputFileContent(TypedDict, total=False): # pylint: disable=name-too-long + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + """ + + type: Required[Literal["input_file"]] + """The type of the input item. Always ``input_file``. Required. INPUT_FILE.""" + file_id: Optional[str] + filename: str + """The name of the file to be sent to the model.""" + file_data: str + """The content of the file to be sent to the model.""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + file_url: str + """The URL of the file to be sent to the model.""" + detail: FileInputDetail + """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the + detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may + increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the + file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and + \"high\".""" + + + class FunctionAndCustomToolCallOutputInputImageContent(TypedDict, total=False): # pylint: disable=name-too-long + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", + "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["input_image"]] + """The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.""" + image_url: Optional[str] + file_id: Optional[str] + detail: Required[ImageDetail] + """The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or + ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", \"auto\", + and \"original\".""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class FunctionAndCustomToolCallOutputInputTextContent(TypedDict, total=False): # pylint: disable=name-too-long + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["input_text"]] + """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" + text: Required[str] + """The text input to the model. Required.""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class FunctionCallOutputItemParam(TypedDict, total=False): + """Function tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: + :vartype call_id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: Literal["function_call_output"] + :ivar output: Text, image, or file output of the function tool call. Required. Is either a str + type or a [Union["_types.InputTextContentParam", "_types.InputImageContentParamAutoParam", + "_types.InputFileContentParam"]] type. + :vartype output: Union[str, list[Union["InputTextContentParam", + "InputImageContentParamAutoParam", "InputFileContentParam"]]] + :ivar name: + :vartype name: str + :ivar namespace: + :vartype namespace: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + + id: Optional[str] + call_id: Optional[str] + type: Required[Literal["function_call_output"]] + """The type of the function tool call output. Always ``function_call_output``. Required. + FUNCTION_CALL_OUTPUT.""" + output: Required[ + Union[str, list[Union["InputTextContentParam", "InputImageContentParamAutoParam", "InputFileContentParam"]]] ] - :vartype tools: list[dict[str, Any]] - """ + """Text, image, or file output of the function tool call. Required. Is either a str type or a + [Union[\"_types.InputTextContentParam\", \"_types.InputImageContentParamAutoParam\", + \"_types.InputFileContentParam\"]] type.""" + name: Optional[str] + namespace: Optional[str] + caller: Optional["ToolCallCallerParam"] + status: Optional[FunctionCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + + + class FunctionShellAction(TypedDict, total=False): + """Shell exec action. + + :ivar commands: Required. + :vartype commands: list[str] + :ivar timeout_ms: Required. + :vartype timeout_ms: int + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + + commands: Required[list[str]] + """Required.""" + timeout_ms: Required[Optional[int]] + """Required.""" + max_output_length: Required[Optional[int]] + """Required.""" + + + class FunctionShellActionParam(TypedDict, total=False): + """Shell action. + + :ivar commands: Ordered shell commands for the execution environment to run. Required. + :vartype commands: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar max_output_length: + :vartype max_output_length: int + """ + + commands: Required[list[str]] + """Ordered shell commands for the execution environment to run. Required.""" + timeout_ms: Optional[int] + max_output_length: Optional[int] + + + class FunctionShellCallItemParam(TypedDict, total=False): + """Shell tool call. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: Literal["shell_call"] + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: "FunctionShellActionParam" + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallItemStatus + :ivar environment: + :vartype environment: "FunctionShellCallItemParamEnvironment" + """ + + id: Optional[str] + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + caller: Optional["ToolCallCallerParam"] + type: Required[Literal["shell_call"]] + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + action: Required["FunctionShellActionParam"] + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Optional[FunctionShellCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: Optional["FunctionShellCallItemParamEnvironment"] + + + class FunctionShellCallItemParamEnvironmentContainerReferenceParam( + TypedDict, total=False + ): # pylint: disable=name-too-long + """FunctionShellCallItemParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: Literal["container_reference"] + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + + type: Required[Literal["container_reference"]] + """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" + container_id: Required[str] + """The ID of the referenced container. Required.""" + + + class FunctionShellCallItemParamEnvironmentLocalEnvironmentParam( + TypedDict, total=False + ): # pylint: disable=name-too-long + """FunctionShellCallItemParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: Literal["local"] + :ivar skills: An optional list of skills. + :vartype skills: list["LocalSkillParam"] + """ + + type: Required[Literal["local"]] + """Use a local computer environment. Required. LOCAL.""" + skills: list["LocalSkillParam"] + """An optional list of skills.""" + + + class FunctionShellCallOutputContent(TypedDict, total=False): + """Shell call output content. + + :ivar stdout: The standard output that was captured. Required. + :vartype stdout: str + :ivar stderr: The standard error output that was captured. Required. + :vartype stderr: str + :ivar outcome: Shell call outcome. Required. + :vartype outcome: "FunctionShellCallOutputOutcome" + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + stdout: Required[str] + """The standard output that was captured. Required.""" + stderr: Required[str] + """The standard error output that was captured. Required.""" + outcome: Required["FunctionShellCallOutputOutcome"] + """Shell call outcome. Required.""" + created_by: str + """The identifier of the actor that created the item.""" + + + class FunctionShellCallOutputContentParam(TypedDict, total=False): + """Shell output content. + + :ivar stdout: Captured stdout output for the shell call. Required. + :vartype stdout: str + :ivar stderr: Captured stderr output for the shell call. Required. + :vartype stderr: str + :ivar outcome: The exit or timeout outcome associated with this shell call. Required. + :vartype outcome: "FunctionShellCallOutputOutcomeParam" + """ + + stdout: Required[str] + """Captured stdout output for the shell call. Required.""" + stderr: Required[str] + """Captured stderr output for the shell call. Required.""" + outcome: Required["FunctionShellCallOutputOutcomeParam"] + """The exit or timeout outcome associated with this shell call. Required.""" + + + class FunctionShellCallOutputExitOutcome(TypedDict, total=False): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: Literal["exit"] + :ivar exit_code: Exit code from the shell process. Required. + :vartype exit_code: int + """ + + type: Required[Literal["exit"]] + """The outcome type. Always ``exit``. Required. EXIT.""" + exit_code: Required[int] + """Exit code from the shell process. Required.""" + + + class FunctionShellCallOutputExitOutcomeParam(TypedDict, total=False): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: Literal["exit"] + :ivar exit_code: The exit code returned by the shell process. Required. + :vartype exit_code: int + """ + + type: Required[Literal["exit"]] + """The outcome type. Always ``exit``. Required. EXIT.""" + exit_code: Required[int] + """The exit code returned by the shell process. Required.""" + + + class FunctionShellCallOutputItemParam(TypedDict, total=False): + """Shell tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar type: The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT. + :vartype type: Literal["shell_call_output"] + :ivar output: Captured chunks of stdout and stderr output, along with their associated + outcomes. Required. + :vartype output: list["FunctionShellCallOutputContentParam"] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallItemStatus + :ivar max_output_length: + :vartype max_output_length: int + """ + + id: Optional[str] + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + caller: Optional["ToolCallCallerParam"] + type: Required[Literal["shell_call_output"]] + """The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + output: Required[list["FunctionShellCallOutputContentParam"]] + """Captured chunks of stdout and stderr output, along with their associated outcomes. Required.""" + status: Optional[FunctionShellCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + max_output_length: Optional[int] + + + class FunctionShellCallOutputTimeoutOutcome(TypedDict, total=False): + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: Literal["timeout"] + """ + + type: Required[Literal["timeout"]] + """The outcome type. Always ``timeout``. Required. TIMEOUT.""" + + + class FunctionShellCallOutputTimeoutOutcomeParam(TypedDict, total=False): # pylint: disable=name-too-long + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: Literal["timeout"] + """ + + type: Required[Literal["timeout"]] + """The outcome type. Always ``timeout``. Required. TIMEOUT.""" + + + class FunctionShellToolParam(TypedDict, total=False): + """Shell tool. + + :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. + :vartype type: Literal["shell"] + :ivar environment: + :vartype environment: "FunctionShellToolParamEnvironment" + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal["shell"]] + """The type of the shell tool. Always ``shell``. Required. SHELL.""" + environment: Optional["FunctionShellToolParamEnvironment"] + allowed_callers: Optional[list[CallableToolAllowedCaller]] + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + + class FunctionShellToolParamEnvironmentContainerReferenceParam(TypedDict, total=False): # pylint: disable=name-too-long + """FunctionShellToolParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: Literal["container_reference"] + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + + type: Required[Literal["container_reference"]] + """References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.""" + container_id: Required[str] + """The ID of the referenced container. Required.""" + + + class FunctionShellToolParamEnvironmentLocalEnvironmentParam(TypedDict, total=False): # pylint: disable=name-too-long + """FunctionShellToolParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: Literal["local"] + :ivar skills: An optional list of skills. + :vartype skills: list["LocalSkillParam"] + """ + + type: Required[Literal["local"]] + """Use a local computer environment. Required. LOCAL.""" + skills: list["LocalSkillParam"] + """An optional list of skills.""" + + + class FunctionTool(TypedDict, total=False): + """Function. + + :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. + :vartype type: Literal["function"] + :ivar name: The name of the function to call. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar parameters: Required. + :vartype parameters: dict[str, Any] + :ivar output_schema: + :vartype output_schema: dict[str, Any] + :ivar strict: Required. + :vartype strict: bool + :ivar defer_loading: Whether this function is deferred and loaded via tool search. + :vartype defer_loading: bool + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + + type: Required[Literal["function"]] + """The type of the function tool. Always ``function``. Required. FUNCTION.""" + name: Required[str] + """The name of the function to call. Required.""" + description: Optional[str] + parameters: Required[Optional[dict[str, Any]]] + """Required.""" + output_schema: Optional[dict[str, Any]] + strict: Required[Optional[bool]] + """Required.""" + defer_loading: bool + """Whether this function is deferred and loaded via tool search.""" + allowed_callers: Optional[list[CallableToolAllowedCaller]] + + + class FunctionToolParam(TypedDict, total=False): + """FunctionToolParam. + + :ivar name: Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar parameters: + :vartype parameters: "EmptyModelParam" + :ivar strict: + :vartype strict: bool + :ivar type: Required. Default value is "function". + :vartype type: Literal["function"] + :ivar output_schema: + :vartype output_schema: dict[str, Any] + :ivar defer_loading: Whether this function should be deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + + name: Required[str] + """Required.""" + description: Optional[str] + parameters: Optional["EmptyModelParam"] + strict: Optional[bool] + type: Required[Literal["function"]] + """Required. Default value is \"function\".""" + output_schema: Optional[dict[str, Any]] + defer_loading: bool + """Whether this function should be deferred and discovered via tool search.""" + allowed_callers: Optional[list[CallableToolAllowedCaller]] + + + class HybridSearchOptions(TypedDict, total=False): + """HybridSearchOptions. + + :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required. + :vartype embedding_weight: float + :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required. + :vartype text_weight: float + """ + + embedding_weight: Required[float] + """The weight of the embedding in the reciprocal ranking fusion. Required.""" + text_weight: Required[float] + """The weight of the text in the reciprocal ranking fusion. Required.""" + + + class ImageGenTool(TypedDict, total=False): + """Image generation tool. + + :ivar type: The type of the image generation tool. Always ``image_generation``. Required. + IMAGE_GENERATION. + :vartype type: Literal["image_generation"] + :ivar model: Is one of the following types: Literal["gpt-image-1"], + Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str + :vartype model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], + Literal["gpt-image-1.5"], str] + :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or + ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"], Literal["auto"] + :vartype quality: Literal["low", "medium", "high", "auto"] + :ivar size: The size of the generated images. For ``gpt-image-2`` and + ``gpt-image-2-2026-04-21``, arbitrary resolutions are supported as ``WIDTHxHEIGHT`` strings, + for example ``1536x864``. Width and height must both be divisible by 16 and the requested + aspect ratio must be between 1:3 and 3:1. Resolutions above ``2560x1440`` are experimental, and + the maximum supported resolution is ``3840x2160``. The requested size must also satisfy the + model's current pixel and edge limits. The standard sizes ``1024x1024``, ``1536x1024``, and + ``1024x1536`` are supported by the GPT image models; ``auto`` is supported for models that + allow automatic sizing. For ``dall-e-2``, use one of ``256x256``, ``512x512``, or + ``1024x1024``. For ``dall-e-3``, use one of ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is + one of the following types: Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], + Literal["auto"], str + :vartype size: Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], + Literal["auto"], str] + :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or + ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"], + Literal["jpeg"] + :vartype output_format: Literal["png", "webp", "jpeg"] + :ivar output_compression: Compression level for the output image. Default: 100. + :vartype output_compression: int + :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a + Literal["auto"] type or a Literal["low"] type. + :vartype moderation: Literal["auto", "low"] + :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``, + or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"], + Literal["opaque"], Literal["auto"] + :vartype background: Literal["transparent", "opaque", "auto"] + :ivar input_fidelity: Known values are: "high" and "low". + :vartype input_fidelity: InputFidelity + :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional) + and ``file_id`` (string, optional). + :vartype input_image_mask: "ImageGenToolInputImageMask" + :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default + value) to 3. + :vartype partial_images: int + :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. + Known values are: "generate", "edit", and "auto". + :vartype action: ImageGenActionEnum + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal["image_generation"]] + """The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION.""" + model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str] + """Is one of the following types: Literal[\"gpt-image-1\"], Literal[\"gpt-image-1-mini\"], + Literal[\"gpt-image-1.5\"], str""" + quality: Literal["low", "medium", "high", "auto"] + """The quality of the generated image. One of ``low``, ``medium``, ``high``, or ``auto``. Default: + ``auto``. Is one of the following types: Literal[\"low\"], Literal[\"medium\"], + Literal[\"high\"], Literal[\"auto\"]""" + size: Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"], str] + """The size of the generated images. For ``gpt-image-2`` and ``gpt-image-2-2026-04-21``, arbitrary + resolutions are supported as ``WIDTHxHEIGHT`` strings, for example ``1536x864``. Width and + height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. + Resolutions above ``2560x1440`` are experimental, and the maximum supported resolution is + ``3840x2160``. The requested size must also satisfy the model's current pixel and edge limits. + The standard sizes ``1024x1024``, ``1536x1024``, and ``1024x1536`` are supported by the GPT + image models; ``auto`` is supported for models that allow automatic sizing. For ``dall-e-2``, + use one of ``256x256``, ``512x512``, or ``1024x1024``. For ``dall-e-3``, use one of + ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is one of the following types: + Literal[\"1024x1024\"], Literal[\"1024x1536\"], Literal[\"1536x1024\"], Literal[\"auto\"], str""" + output_format: Literal["png", "webp", "jpeg"] + """The output format of the generated image. One of ``png``, ``webp``, or ``jpeg``. Default: + ``png``. Is one of the following types: Literal[\"png\"], Literal[\"webp\"], Literal[\"jpeg\"]""" + output_compression: int + """Compression level for the output image. Default: 100.""" + moderation: Literal["auto", "low"] + """Moderation level for the generated image. Default: ``auto``. Is either a Literal[\"auto\"] type + or a Literal[\"low\"] type.""" + background: Literal["transparent", "opaque", "auto"] + """Background type for the generated image. One of ``transparent``, ``opaque``, or ``auto``. + Default: ``auto``. Is one of the following types: Literal[\"transparent\"], + Literal[\"opaque\"], Literal[\"auto\"]""" + input_fidelity: Optional[InputFidelity] + """Known values are: \"high\" and \"low\".""" + input_image_mask: "ImageGenToolInputImageMask" + """Optional mask for inpainting. Contains ``image_url`` (string, optional) and ``file_id`` + (string, optional).""" + partial_images: int + """Number of partial images to generate in streaming mode, from 0 (default value) to 3.""" + action: ImageGenActionEnum + """Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are: + \"generate\", \"edit\", and \"auto\".""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + + class ImageGenToolInputImageMask(TypedDict, total=False): + """ImageGenToolInputImageMask. + + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + """ + + image_url: str + file_id: str + + + class InlineSkillParam(TypedDict, total=False): + """InlineSkillParam. + + :ivar type: Defines an inline skill for this request. Required. INLINE. + :vartype type: Literal["inline"] + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar source: Inline skill payload. Required. + :vartype source: "InlineSkillSourceParam" + """ + + type: Required[Literal["inline"]] + """Defines an inline skill for this request. Required. INLINE.""" + name: Required[str] + """The name of the skill. Required.""" + description: Required[str] + """The description of the skill. Required.""" + source: Required["InlineSkillSourceParam"] + """Inline skill payload. Required.""" + + + class InlineSkillSourceParam(TypedDict, total=False): + """Inline skill payload. + + :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is + "base64". + :vartype type: Literal["base64"] + :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``. + Required. Default value is "application/zip". + :vartype media_type: Literal["application/zip"] + :ivar data: Base64-encoded skill zip bundle. Required. + :vartype data: str + """ + + type: Required[Literal["base64"]] + """The type of the inline skill source. Must be ``base64``. Required. Default value is \"base64\".""" + media_type: Required[Literal["application/zip"]] + """The media type of the inline skill payload. Must be ``application/zip``. Required. Default + value is \"application/zip\".""" + data: Required[str] + """Base64-encoded skill zip bundle. Required.""" + + + class InputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. Default value is + "input_file". + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + """ + + type: Required[Literal["input_file"]] + """The type of the input item. Always ``input_file``. Required. Default value is \"input_file\".""" + file_id: Optional[str] + filename: str + """The name of the file to be sent to the model.""" + file_data: str + """The content of the file to be sent to the model.""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + file_url: str + """The URL of the file to be sent to the model.""" + detail: FileInputDetail + """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the + detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may + increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the + file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and + \"high\".""" + + + class InputFileContentParam(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. Default value is + "input_file". + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: + :vartype filename: str + :ivar file_data: + :vartype file_data: str + :ivar file_url: + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" + """ + + type: Required[Literal["input_file"]] + """The type of the input item. Always ``input_file``. Required. Default value is \"input_file\".""" + file_id: Optional[str] + filename: Optional[str] + file_data: Optional[str] + file_url: Optional[str] + detail: FileInputDetail + """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the + detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may + increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the + file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and + \"high\".""" + prompt_cache_breakpoint: Optional["PromptCacheBreakpointParam"] + + + class InputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. Default value is + "input_image". + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", + "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["input_image"]] + """The type of the input item. Always ``input_image``. Required. Default value is \"input_image\".""" + image_url: Optional[str] + file_id: Optional[str] + detail: Required[ImageDetail] + """The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or + ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", \"auto\", + and \"original\".""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class InputImageContentParamAutoParam(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. Default value is + "input_image". + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: Known values are: "low", "high", "auto", and "original". + :vartype detail: DetailEnum + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" + """ + + type: Required[Literal["input_image"]] + """The type of the input item. Always ``input_image``. Required. Default value is \"input_image\".""" + image_url: Optional[str] + file_id: Optional[str] + detail: Optional[DetailEnum] + """Known values are: \"low\", \"high\", \"auto\", and \"original\".""" + prompt_cache_breakpoint: Optional["PromptCacheBreakpointParam"] + + + class InputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. Default value is + "input_text". + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["input_text"]] + """The type of the input item. Always ``input_text``. Required. Default value is \"input_text\".""" + text: Required[str] + """The text input to the model. Required.""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class InputTextContentParam(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. Default value is + "input_text". + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" + """ + + type: Required[Literal["input_text"]] + """The type of the input item. Always ``input_text``. Required. Default value is \"input_text\".""" + text: Required[str] + """The text input to the model. Required.""" + prompt_cache_breakpoint: Optional["PromptCacheBreakpointParam"] + + + class ItemCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. Default value is "code_interpreter_call". + :vartype type: Literal["code_interpreter_call"] + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] + """ + + type: Required[Literal["code_interpreter_call"]] + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. Default + value is \"code_interpreter_call\".""" + id: Required[str] + """The unique ID of the code interpreter tool call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: Required[str] + """The ID of the container used to run the code. Required.""" + code: Required[Optional[str]] + """Required.""" + outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] + """Required.""" + + + class ItemComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar type: The type of the computer call. Always ``computer_call``. Required. Default value is + "computer_call". + :vartype type: Literal["computer_call"] + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: + :vartype action: "ComputerAction" + :ivar actions: + :vartype actions: list["ComputerAction"] + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["computer_call"]] + """The type of the computer call. Always ``computer_call``. Required. Default value is + \"computer_call\".""" + id: Required[str] + """The unique ID of the computer call. Required.""" + call_id: Required[str] + """An identifier used when responding to the tool call with output. Required.""" + action: "ComputerAction" + actions: list["ComputerAction"] + pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] + """The pending safety checks for the computer call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. Default + value is "custom_tool_call". + :vartype type: Literal["custom_tool_call"] + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the custom tool being called. + :vartype namespace: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + + type: Required[Literal["custom_tool_call"]] + """The type of the custom tool call. Always ``custom_tool_call``. Required. Default value is + \"custom_tool_call\".""" + id: str + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: Required[str] + """An identifier used to map this custom tool call to a tool call output. Required.""" + caller: Optional["ToolCallCaller"] + namespace: str + """The namespace of the custom tool being called.""" + name: Required[str] + """The name of the custom tool being called. Required.""" + input: Required[str] + """The input for the custom tool call generated by the model. Required.""" + + + class ItemCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. Default value is "custom_tool_call_output". + :vartype type: Literal["custom_tool_call_output"] + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + """ + + type: Required[Literal["custom_tool_call_output"]] + """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. Default + value is \"custom_tool_call_output\".""" + id: str + """The unique ID of the custom tool call output in the OpenAI platform.""" + call_id: Required[str] + """The call ID, used to map this custom tool call output to a custom tool call. Required.""" + caller: Optional["ToolCallCallerParam"] + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the custom tool call generated by your code. Can be a string or an list of + output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + + + class ItemFieldAdditionalTools(TypedDict, total=False): + """ItemFieldAdditionalTools. + + :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. + :vartype type: Literal["additional_tools"] + :ivar id: The unique ID of the additional tools item. Required. + :vartype id: str + :ivar role: The role that provided the additional tools. Required. Known values are: "unknown", + "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar tools: The additional tool definitions made available at this item. Required. + :vartype tools: list["Tool"] + """ + + type: Required[Literal["additional_tools"]] + """The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.""" + id: Required[str] + """The unique ID of the additional tools item. Required.""" + role: Required[MessageRole] + """The role that provided the additional tools. Required. Known values are: \"unknown\", \"user\", + \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and \"tool\".""" + tools: Required[list["Tool"]] + """The additional tool definitions made available at this item. Required.""" + + + class ItemFieldApplyPatchToolCall(TypedDict, total=False): + """Apply patch tool call. + + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: Literal["apply_patch_call"] + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: "ApplyPatchFileOperation" + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str + """ + + type: Required[Literal["apply_patch_call"]] + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: Required[str] + """The unique ID of the apply patch tool call. Populated when this item is returned via API. + Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + status: Required[ApplyPatchCallStatus] + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: Required["ApplyPatchFileOperation"] + """Apply patch operation. Required.""" + created_by: str + """The ID of the entity that created this tool call.""" + + + class ItemFieldApplyPatchToolCallOutput(TypedDict, total=False): + """Apply patch tool call output. + + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: Literal["apply_patch_call_output"] + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + :ivar created_by: The ID of the entity that created this tool call output. + :vartype created_by: str + """ + + type: Required[Literal["apply_patch_call_output"]] + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the apply patch tool call output. Populated when this item is returned via + API. Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + status: Required[ApplyPatchCallOutputStatus] + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] + created_by: str + """The ID of the entity that created this tool call output.""" + + + class ItemFieldCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: Literal["code_interpreter_call"] + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] + """ + + type: Required[Literal["code_interpreter_call"]] + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. + CODE_INTERPRETER_CALL.""" + id: Required[str] + """The unique ID of the code interpreter tool call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: Required[str] + """The ID of the container used to run the code. Required.""" + code: Required[Optional[str]] + """Required.""" + outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] + """Required.""" + + + class ItemFieldCompactionBody(TypedDict, total=False): + """Compaction item. + + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: Literal["compaction"] + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + type: Required[Literal["compaction"]] + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + id: Required[str] + """The unique ID of the compaction item. Required.""" + encrypted_content: Required[str] + """The encrypted content that was produced by compaction. Required.""" + created_by: str + """The identifier of the actor that created the item.""" + + + class ItemFieldComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: Literal["computer_call"] + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: + :vartype action: "ComputerAction" + :ivar actions: + :vartype actions: list["ComputerAction"] + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["computer_call"]] + """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" + id: Required[str] + """The unique ID of the computer call. Required.""" + call_id: Required[str] + """An identifier used when responding to the tool call with output. Required.""" + action: "ComputerAction" + actions: list["ComputerAction"] + pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] + """The pending safety checks for the computer call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemFieldComputerToolCallOutput(TypedDict, total=False): + """Computer tool call output. + + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: Literal["computer_call_output"] + :ivar id: The ID of the computer tool call output. Required. + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar acknowledged_safety_checks: The safety checks reported by the API that have been + acknowledged by the developer. + :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar output: Required. + :vartype output: "ComputerScreenshotImage" + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["computer_call_output"]] + """The type of the computer tool call output. Always ``computer_call_output``. Required. + COMPUTER_CALL_OUTPUT.""" + id: Required[str] + """The ID of the computer tool call output. Required.""" + call_id: Required[str] + """The ID of the computer tool call that produced the output. Required.""" + acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + """The safety checks reported by the API that have been acknowledged by the developer.""" + output: Required["ComputerScreenshotImage"] + """Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemFieldCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: Literal["custom_tool_call"] + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the custom tool being called. + :vartype namespace: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + + type: Required[Literal["custom_tool_call"]] + """The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.""" + id: str + """The unique ID of the custom tool call in the OpenAI platform.""" + call_id: Required[str] + """An identifier used to map this custom tool call to a tool call output. Required.""" + caller: Optional["ToolCallCaller"] + namespace: str + """The namespace of the custom tool being called.""" + name: Required[str] + """The name of the custom tool being called. Required.""" + input: Required[str] + """The input for the custom tool call generated by the model. Required.""" + + + class ItemFieldCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: Literal["custom_tool_call_output"] + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + """ + + type: Required[Literal["custom_tool_call_output"]] + """The type of the custom tool call output. Always ``custom_tool_call_output``. Required. + CUSTOM_TOOL_CALL_OUTPUT.""" + id: str + """The unique ID of the custom tool call output in the OpenAI platform.""" + call_id: Required[str] + """The call ID, used to map this custom tool call output to a custom tool call. Required.""" + caller: Optional["ToolCallCallerParam"] + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the custom tool call generated by your code. Can be a string or an list of + output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + + + class ItemFieldFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: Literal["file_search_call"] + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list["FileSearchToolCallResults"] + """ + + id: Required[str] + """The unique ID of the file search tool call. Required.""" + type: Required[Literal["file_search_call"]] + """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: Required[list[str]] + """The queries used to search for files. Required.""" + results: Optional[list["FileSearchToolCallResults"]] + + + class ItemFieldFunctionShellCall(TypedDict, total=False): + """Shell tool call. + + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: Literal["shell_call"] + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: "FunctionShellAction" + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallStatus + :ivar environment: Required. + :vartype environment: "FunctionShellCallEnvironment" + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str + """ + + type: Required[Literal["shell_call"]] + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + id: Required[str] + """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + action: Required["FunctionShellAction"] + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Required[FunctionShellCallStatus] + """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: Required[Optional["FunctionShellCallEnvironment"]] + """Required.""" + created_by: str + """The ID of the entity that created this tool call.""" + + + class ItemFieldFunctionShellCallOutput(TypedDict, total=False): + """Shell call output. + + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: Literal["shell_call_output"] + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: list["FunctionShellCallOutputContent"] + :ivar max_output_length: Required. + :vartype max_output_length: int + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + type: Required[Literal["shell_call_output"]] + """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + status: Required[FunctionShellCallOutputStatusEnum] + """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + output: Required[list["FunctionShellCallOutputContent"]] + """An array of shell call output contents. Required.""" + max_output_length: Required[Optional[int]] + """Required.""" + created_by: str + """The identifier of the actor that created the item.""" + + + class ItemFieldFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar id: The unique ID of the function tool call. Required. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: Literal["function_call"] + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the function to run. + :vartype namespace: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + id: Required[str] + """The unique ID of the function tool call. Required.""" + type: Required[Literal["function_call"]] + """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + namespace: str + """The namespace of the function to run.""" + name: Required[str] + """The name of the function to run. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the function. Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemFieldFunctionToolCallOutput(TypedDict, total=False): + """Function tool call output. + + :ivar id: The unique ID of the function tool call output. Populated when this item is returned + via API. Required. + :vartype id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: Literal["function_call_output"] + :ivar call_id: The unique ID of the function tool call generated by the model. + :vartype call_id: str + :ivar name: The name of the tool that produced the output. + :vartype name: str + :ivar namespace: The namespace of the tool that produced the output. + :vartype namespace: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the function call generated by your code. Can be a string or an + list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] + type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + id: Required[str] + """The unique ID of the function tool call output. Populated when this item is returned via API. + Required.""" + type: Required[Literal["function_call_output"]] + """The type of the function tool call output. Always ``function_call_output``. Required. + FUNCTION_CALL_OUTPUT.""" + call_id: str + """The unique ID of the function tool call generated by the model.""" + name: str + """The name of the tool that produced the output.""" + namespace: str + """The namespace of the tool that produced the output.""" + caller: Optional["ToolCallCallerParam"] + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the function call generated by your code. Can be a string or an list of output + content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemFieldImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: Literal["image_generation_call"] + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "generating", "failed"] + :ivar result: Required. + :vartype result: str + """ + + type: Required[Literal["image_generation_call"]] + """The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL.""" + id: Required[str] + """The unique ID of the image generation call. Required.""" + status: Required[Literal["in_progress", "completed", "generating", "failed"]] + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: Required[Optional[str]] + """Required.""" + + + class ItemFieldLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: Literal["local_shell_call"] + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: "LocalShellExecAction" + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["local_shell_call"]] + """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" + id: Required[str] + """The unique ID of the local shell call. Required.""" + call_id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + action: Required["LocalShellExecAction"] + """Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemFieldLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: Literal["local_shell_call_output"] + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["local_shell_call_output"]] + """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. + LOCAL_SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + output: Required[str] + """A JSON string of the output of the local shell tool call. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] + """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], + Literal[\"incomplete\"]""" + + + class ItemFieldMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: Literal["mcp_approval_request"] + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + + type: Required[Literal["mcp_approval_request"]] + """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" + id: Required[str] + """The unique ID of the approval request. Required.""" + server_label: Required[str] + """The label of the MCP server making the request. Required.""" + name: Required[str] + """The name of the tool to run. Required.""" + arguments: Required[str] + """A JSON string of arguments for the tool. Required.""" + + + class ItemFieldMcpApprovalResponseResource(TypedDict, total=False): + """MCP approval response. + + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: Literal["mcp_approval_response"] + :ivar id: The unique ID of the approval response. Required. + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + + type: Required[Literal["mcp_approval_response"]] + """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" + id: Required[str] + """The unique ID of the approval response. Required.""" + approval_request_id: Required[str] + """The ID of the approval request being answered. Required.""" + approve: Required[bool] + """Whether the request was approved. Required.""" + reason: Optional[str] + + + class ItemFieldMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: Literal["mcp_list_tools"] + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list["MCPListToolsTool"] + :ivar error: + :vartype error: "RealtimeMCPError" + """ + + type: Required[Literal["mcp_list_tools"]] + """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" + id: Required[str] + """The unique ID of the list. Required.""" + server_label: Required[str] + """The label of the MCP server. Required.""" + tools: Required[list["MCPListToolsTool"]] + """The tools available on the server. Required.""" + error: "RealtimeMCPError" + + + class ItemFieldMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: Literal["mcp_call"] + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: The error from the tool call, if any. + :vartype error: dict[str, Any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + type: Required[Literal["mcp_call"]] + """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" + id: Required[str] + """The unique ID of the tool call. Required.""" + server_label: Required[str] + """The label of the MCP server running the tool. Required.""" + name: Required[str] + """The name of the tool that was run. Required.""" + arguments: Required[str] + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] + error: dict[str, Any] + """The error from the tool call, if any.""" + status: MCPToolCallStatus + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] + + + class ItemFieldMessage(TypedDict, total=False): + """Message. + + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: Literal["message"] + :ivar id: The unique ID of the message. Required. + :vartype id: str + :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: MessageStatus + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar content: The content of the message. Required. + :vartype content: list["MessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + """ + + type: Required[Literal["message"]] + """The type of the message. Always set to ``message``. Required. MESSAGE.""" + id: Required[str] + """The unique ID of the message. Required.""" + status: Required[MessageStatus] + """The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when + items are returned via API. Required. Known values are: \"in_progress\", \"completed\", and + \"incomplete\".""" + role: Required[MessageRole] + """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, + ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", + \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and + \"tool\".""" + content: Required[list["MessageContent"]] + """The content of the message. Required.""" + phase: Optional[MessagePhase] + """Known values are: \"commentary\" and \"final_answer\".""" + + + class ItemFieldProgram(TypedDict, total=False): + """ItemFieldProgram. + + :ivar type: The type of the item. Always ``program``. Required. PROGRAM. + :vartype type: Literal["program"] + :ivar id: The unique ID of the program item. Required. + :vartype id: str + :ivar call_id: The stable call ID of the program item. Required. + :vartype call_id: str + :ivar code: The JavaScript source executed by programmatic tool calling. Required. + :vartype code: str + :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. + :vartype fingerprint: str + """ + + type: Required[Literal["program"]] + """The type of the item. Always ``program``. Required. PROGRAM.""" + id: Required[str] + """The unique ID of the program item. Required.""" + call_id: Required[str] + """The stable call ID of the program item. Required.""" + code: Required[str] + """The JavaScript source executed by programmatic tool calling. Required.""" + fingerprint: Required[str] + """Opaque program replay fingerprint that must be round-tripped. Required.""" + + + class ItemFieldProgramOutput(TypedDict, total=False): + """ItemFieldProgramOutput. + + :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT. + :vartype type: Literal["program_output"] + :ivar id: The unique ID of the program output item. Required. + :vartype id: str + :ivar call_id: The call ID of the program item. Required. + :vartype call_id: str + :ivar result: The result produced by the program item. Required. + :vartype result: str + :ivar status: The terminal status of the program output item. Required. Known values are: + "completed" and "incomplete". + :vartype status: ProgramOutputStatus + """ + + type: Required[Literal["program_output"]] + """The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.""" + id: Required[str] + """The unique ID of the program output item. Required.""" + call_id: Required[str] + """The call ID of the program item. Required.""" + result: Required[str] + """The result produced by the program item. Required.""" + status: Required[ProgramOutputStatus] + """The terminal status of the program output item. Required. Known values are: \"completed\" and + \"incomplete\".""" + + + class ItemFieldReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: Literal["reasoning"] + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list["SummaryTextContent"] + :ivar content: Reasoning text content. + :vartype content: list["ReasoningTextContent"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["reasoning"]] + """The type of the object. Always ``reasoning``. Required. REASONING.""" + id: Required[str] + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] + summary: Required[list["SummaryTextContent"]] + """Reasoning summary content. Required.""" + content: list["ReasoningTextContent"] + """Reasoning text content.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemFieldToolSearchCall(TypedDict, total=False): + """ItemFieldToolSearchCall. + + :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. + :vartype type: Literal["tool_search_call"] + :ivar id: The unique ID of the tool search call item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar arguments: Arguments used for the tool search call. Required. + :vartype arguments: Any + :ivar status: The status of the tool search call item that was recorded. Required. Known values + are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallStatus + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + type: Required[Literal["tool_search_call"]] + """The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.""" + id: Required[str] + """The unique ID of the tool search call item. Required.""" + call_id: Required[Optional[str]] + """Required.""" + execution: Required[ToolSearchExecutionType] + """Whether tool search was executed by the server or by the client. Required. Known values are: + \"server\" and \"client\".""" + arguments: Required[Any] + """Arguments used for the tool search call. Required.""" + status: Required[FunctionCallStatus] + """The status of the tool search call item that was recorded. Required. Known values are: + \"in_progress\", \"completed\", and \"incomplete\".""" + created_by: str + """The identifier of the actor that created the item.""" + + + class ItemFieldToolSearchOutput(TypedDict, total=False): + """ItemFieldToolSearchOutput. + + :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. + :vartype type: Literal["tool_search_output"] + :ivar id: The unique ID of the tool search output item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar tools: The loaded tool definitions returned by tool search. Required. + :vartype tools: list["Tool"] + :ivar status: The status of the tool search output item that was recorded. Required. Known + values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallOutputStatusEnum + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + type: Required[Literal["tool_search_output"]] + """The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.""" + id: Required[str] + """The unique ID of the tool search output item. Required.""" + call_id: Required[Optional[str]] + """Required.""" + execution: Required[ToolSearchExecutionType] + """Whether tool search was executed by the server or by the client. Required. Known values are: + \"server\" and \"client\".""" + tools: Required[list["Tool"]] + """The loaded tool definitions returned by tool search. Required.""" + status: Required[FunctionCallOutputStatusEnum] + """The status of the tool search output item that was recorded. Required. Known values are: + \"in_progress\", \"completed\", and \"incomplete\".""" + created_by: str + """The identifier of the actor that created the item.""" + + + class ItemFieldWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: Literal["web_search_call"] + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", + "WebSearchActionFind"] + """ + + id: Required[str] + """The unique ID of the web search tool call. Required.""" + type: Required[Literal["web_search_call"]] + """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "failed", "incomplete"]] + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"], + Literal[\"incomplete\"]""" + action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" + + + class ItemFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + Default value is "file_search_call". + :vartype type: Literal["file_search_call"] + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list["FileSearchToolCallResults"] + """ + + id: Required[str] + """The unique ID of the file search tool call. Required.""" + type: Required[Literal["file_search_call"]] + """The type of the file search tool call. Always ``file_search_call``. Required. Default value is + \"file_search_call\".""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: Required[list[str]] + """The queries used to search for files. Required.""" + results: Optional[list["FileSearchToolCallResults"]] + + + class ItemFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar type: The type of the function tool call. Always ``function_call``. Required. Default + value is "function_call". + :vartype type: Literal["function_call"] + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the function to run. + :vartype namespace: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["function_call"]] + """The type of the function tool call. Always ``function_call``. Required. Default value is + \"function_call\".""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + namespace: str + """The namespace of the function to run.""" + name: Required[str] + """The name of the function to run. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the function. Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + Default value is "image_generation_call". + :vartype type: Literal["image_generation_call"] + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "generating", "failed"] + :ivar result: Required. + :vartype result: str + """ + + type: Required[Literal["image_generation_call"]] + """The type of the image generation call. Always ``image_generation_call``. Required. Default + value is \"image_generation_call\".""" + id: Required[str] + """The unique ID of the image generation call. Required.""" + status: Required[Literal["in_progress", "completed", "generating", "failed"]] + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: Required[Optional[str]] + """Required.""" + + + class ItemLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. Default + value is "local_shell_call". + :vartype type: Literal["local_shell_call"] + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: "LocalShellExecAction" + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["local_shell_call"]] + """The type of the local shell call. Always ``local_shell_call``. Required. Default value is + \"local_shell_call\".""" + id: Required[str] + """The unique ID of the local shell call. Required.""" + call_id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + action: Required["LocalShellExecAction"] + """Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. Default value is "local_shell_call_output". + :vartype type: Literal["local_shell_call_output"] + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["local_shell_call_output"]] + """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. + Default value is \"local_shell_call_output\".""" + id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + output: Required[str] + """A JSON string of the output of the local shell tool call. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] + """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], + Literal[\"incomplete\"]""" + + + class ItemMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. Default value is + "mcp_approval_request". + :vartype type: Literal["mcp_approval_request"] + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + + type: Required[Literal["mcp_approval_request"]] + """The type of the item. Always ``mcp_approval_request``. Required. Default value is + \"mcp_approval_request\".""" + id: Required[str] + """The unique ID of the approval request. Required.""" + server_label: Required[str] + """The label of the MCP server making the request. Required.""" + name: Required[str] + """The name of the tool to run. Required.""" + arguments: Required[str] + """A JSON string of arguments for the tool. Required.""" + + + class ItemMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. Default value is + "mcp_list_tools". + :vartype type: Literal["mcp_list_tools"] + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list["MCPListToolsTool"] + :ivar error: + :vartype error: "RealtimeMCPError" + """ + + type: Required[Literal["mcp_list_tools"]] + """The type of the item. Always ``mcp_list_tools``. Required. Default value is \"mcp_list_tools\".""" + id: Required[str] + """The unique ID of the list. Required.""" + server_label: Required[str] + """The label of the MCP server. Required.""" + tools: Required[list["MCPListToolsTool"]] + """The tools available on the server. Required.""" + error: "RealtimeMCPError" + + + class ItemMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar type: The type of the item. Always ``mcp_call``. Required. Default value is "mcp_call". + :vartype type: Literal["mcp_call"] + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: The error from the tool call, if any. + :vartype error: dict[str, Any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + type: Required[Literal["mcp_call"]] + """The type of the item. Always ``mcp_call``. Required. Default value is \"mcp_call\".""" + id: Required[str] + """The unique ID of the tool call. Required.""" + server_label: Required[str] + """The label of the MCP server running the tool. Required.""" + name: Required[str] + """The name of the tool that was run. Required.""" + arguments: Required[str] + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] + error: dict[str, Any] + """The error from the tool call, if any.""" + status: MCPToolCallStatus + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] + + + class ItemMessage(TypedDict, total=False): + """Message. + + :ivar type: The type of the message. Always set to ``message``. Required. Default value is + "message". + :vartype type: Literal["message"] + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + :ivar content: Required. Is either a str type or a [MessageContent] type. + :vartype content: Union[str, list["MessageContent"]] + """ + + type: Required[Literal["message"]] + """The type of the message. Always set to ``message``. Required. Default value is \"message\".""" + role: Required[MessageRole] + """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, + ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", + \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and + \"tool\".""" + phase: Optional[MessagePhase] + """Known values are: \"commentary\" and \"final_answer\".""" + content: Required[Union[str, list["MessageContent"]]] + """Required. Is either a str type or a [MessageContent] type.""" + + + class ItemOutputMessage(TypedDict, total=False): + """Output message. + + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. Default value is + "output_message". + :vartype type: Literal["output_message"] + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: Literal["assistant"] + :ivar content: The content of the output message. Required. + :vartype content: list["OutputMessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + id: Required[str] + """The unique ID of the output message. Required.""" + type: Required[Literal["output_message"]] + """The type of the output message. Always ``message``. Required. Default value is + \"output_message\".""" + role: Required[Literal["assistant"]] + """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" + content: Required[list["OutputMessageContent"]] + """The content of the output message. Required.""" + phase: Optional[MessagePhase] + """Known values are: \"commentary\" and \"final_answer\".""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemProgram(TypedDict, total=False): + """ItemProgram. + + :ivar type: The type of the item. Always ``program``. Required. Default value is "program". + :vartype type: Literal["program"] + :ivar id: The unique ID of the program item. Required. + :vartype id: str + :ivar call_id: The stable call ID of the program item. Required. + :vartype call_id: str + :ivar code: The JavaScript source executed by programmatic tool calling. Required. + :vartype code: str + :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. + :vartype fingerprint: str + """ + + type: Required[Literal["program"]] + """The type of the item. Always ``program``. Required. Default value is \"program\".""" + id: Required[str] + """The unique ID of the program item. Required.""" + call_id: Required[str] + """The stable call ID of the program item. Required.""" + code: Required[str] + """The JavaScript source executed by programmatic tool calling. Required.""" + fingerprint: Required[str] + """Opaque program replay fingerprint that must be round-tripped. Required.""" + + + class ItemProgramOutput(TypedDict, total=False): + """ItemProgramOutput. + + :ivar type: The type of the item. Always ``program_output``. Required. Default value is + "program_output". + :vartype type: Literal["program_output"] + :ivar id: The unique ID of the program output item. Required. + :vartype id: str + :ivar call_id: The call ID of the program item. Required. + :vartype call_id: str + :ivar result: The result produced by the program item. Required. + :vartype result: str + :ivar status: The terminal status of the program output item. Required. Known values are: + "completed" and "incomplete". + :vartype status: ProgramOutputStatus + """ + + type: Required[Literal["program_output"]] + """The type of the item. Always ``program_output``. Required. Default value is \"program_output\".""" + id: Required[str] + """The unique ID of the program output item. Required.""" + call_id: Required[str] + """The call ID of the program item. Required.""" + result: Required[str] + """The result produced by the program item. Required.""" + status: Required[ProgramOutputStatus] + """The terminal status of the program output item. Required. Known values are: \"completed\" and + \"incomplete\".""" + + + class ItemReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar type: The type of the object. Always ``reasoning``. Required. Default value is + "reasoning". + :vartype type: Literal["reasoning"] + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list["SummaryTextContent"] + :ivar content: Reasoning text content. + :vartype content: list["ReasoningTextContent"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + type: Required[Literal["reasoning"]] + """The type of the object. Always ``reasoning``. Required. Default value is \"reasoning\".""" + id: Required[str] + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] + summary: Required[list["SummaryTextContent"]] + """Reasoning summary content. Required.""" + content: list["ReasoningTextContent"] + """Reasoning text content.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class ItemReferenceParam(TypedDict, total=False): + """Item reference. + + :ivar type: The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE. + :vartype type: Literal["item_reference"] + :ivar id: The ID of the item to reference. Required. + :vartype id: str + """ + + type: Required[Literal["item_reference"]] + """The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE.""" + id: Required[str] + """The ID of the item to reference. Required.""" + + + class ItemWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. Default + value is "web_search_call". + :vartype type: Literal["web_search_call"] + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", + "WebSearchActionFind"] + """ + + id: Required[str] + """The unique ID of the web search tool call. Required.""" + type: Required[Literal["web_search_call"]] + """The type of the web search tool call. Always ``web_search_call``. Required. Default value is + \"web_search_call\".""" + status: Required[Literal["in_progress", "searching", "completed", "failed", "incomplete"]] + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"], + Literal[\"incomplete\"]""" + action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" + + + class KeyPressAction(TypedDict, total=False): + """KeyPress. + + :ivar type: Specifies the event type. For a keypress action, this property is always set to + ``keypress``. Required. KEYPRESS. + :vartype type: Literal["keypress"] + :ivar keys: The combination of keys the model is requesting to be pressed. This is an array of + strings, each representing a key. Required. + :vartype keys: list[str] + """ + + type: Required[Literal["keypress"]] + """Specifies the event type. For a keypress action, this property is always set to ``keypress``. + Required. KEYPRESS.""" + keys: Required[list[str]] + """The combination of keys the model is requesting to be pressed. This is an array of strings, + each representing a key. Required.""" + + + class LocalEnvironmentResource(TypedDict, total=False): + """Local Environment. + + :ivar type: The environment type. Always ``local``. Required. LOCAL. + :vartype type: Literal["local"] + """ + + type: Required[Literal["local"]] + """The environment type. Always ``local``. Required. LOCAL.""" + + + class LocalShellExecAction(TypedDict, total=False): + """Local shell exec action. + + :ivar type: The type of the local shell action. Always ``exec``. Required. Default value is + "exec". + :vartype type: Literal["exec"] + :ivar command: The command to run. Required. + :vartype command: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar working_directory: + :vartype working_directory: str + :ivar env: Environment variables to set for the command. Required. + :vartype env: dict[str, str] + :ivar user: + :vartype user: str + """ + + type: Required[Literal["exec"]] + """The type of the local shell action. Always ``exec``. Required. Default value is \"exec\".""" + command: Required[list[str]] + """The command to run. Required.""" + timeout_ms: Optional[int] + working_directory: Optional[str] + env: Required[dict[str, str]] + """Environment variables to set for the command. Required.""" + user: Optional[str] + + + class LocalShellToolParam(TypedDict, total=False): + """Local shell tool. + + :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. + :vartype type: Literal["local_shell"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + + type: Required[Literal["local_shell"]] + """The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + + + class LocalSkillParam(TypedDict, total=False): + """LocalSkillParam. + + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar path: The path to the directory containing the skill. Required. + :vartype path: str + """ + + name: Required[str] + """The name of the skill. Required.""" + description: Required[str] + """The description of the skill. Required.""" + path: Required[str] + """The path to the directory containing the skill. Required.""" + + + class LogProb(TypedDict, total=False): + """Log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: float + :ivar bytes: Required. + :vartype bytes: list[int] + :ivar top_logprobs: Required. + :vartype top_logprobs: list["TopLogProb"] + """ + + token: Required[str] + """Required.""" + logprob: Required[float] + """Required.""" + bytes: Required[list[int]] + """Required.""" + top_logprobs: Required[list["TopLogProb"]] + """Required.""" + + + class MCPApprovalResponse(TypedDict, total=False): + """MCP approval response. + + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: Literal["mcp_approval_response"] + :ivar id: + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + + type: Required[Literal["mcp_approval_response"]] + """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" + id: Optional[str] + approval_request_id: Required[str] + """The ID of the approval request being answered. Required.""" + approve: Required[bool] + """Whether the request was approved. Required.""" + reason: Optional[str] + + + class MCPListToolsTool(TypedDict, total=False): + """MCP list tools tool. + + :ivar name: The name of the tool. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar input_schema: The JSON schema describing the tool's input. Required. + :vartype input_schema: "MCPListToolsToolInputSchema" + :ivar annotations: + :vartype annotations: "MCPListToolsToolAnnotations" + """ + + name: Required[str] + """The name of the tool. Required.""" + description: Optional[str] + input_schema: Required["MCPListToolsToolInputSchema"] + """The JSON schema describing the tool's input. Required.""" + annotations: Optional["MCPListToolsToolAnnotations"] + + + class MCPListToolsToolAnnotations(TypedDict, total=False): + """MCPListToolsToolAnnotations.""" + + + class MCPListToolsToolInputSchema(TypedDict, total=False): + """MCPListToolsToolInputSchema.""" + + + class MCPTool(TypedDict, total=False): + """MCP tool. + + :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. + :vartype type: Literal["mcp"] + :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. + :vartype server_label: str + :ivar server_url: The URL for the MCP server. One of ``server_url``, ``connector_id``, or + ``tunnel_id`` must be provided. + :vartype server_url: str + :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of + ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service + connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported + ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], + Literal["connector_googledrive"], Literal["connector_microsoftteams"], + Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], + Literal["connector_sharepoint"] + :vartype connector_id: Literal["connector_dropbox", "connector_gmail", + "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", + "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"] + :ivar tunnel_id: The Secure MCP Tunnel ID to use instead of a direct server URL. One of + ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. + :vartype tunnel_id: str + :ivar authorization: An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application must handle the OAuth + authorization flow and provide the token here. + :vartype authorization: str + :ivar server_description: Optional description of the MCP server, used to provide more context. + :vartype server_description: str + :ivar headers: + :vartype headers: dict[str, str] + :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. + :vartype allowed_tools: Union[list[str], "MCPToolFilter"] + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + :ivar require_approval: Is one of the following types: MCPToolRequireApproval, + Literal["always"], Literal["never"] + :vartype require_approval: Union["MCPToolRequireApproval", Literal["always"], Literal["never"]] + :ivar defer_loading: Whether this MCP tool is deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar project_connection_id: The connection ID in the project for the MCP server. The + connection stores authentication and other connection details needed to connect to the MCP + server. + :vartype project_connection_id: str + """ + + type: Required[Literal["mcp"]] + """The type of the MCP tool. Always ``mcp``. Required. MCP.""" + server_label: Required[str] + """A label for this MCP server, used to identify it in tool calls. Required.""" + server_url: str + """The URL for the MCP server. One of ``server_url``, ``connector_id``, or ``tunnel_id`` must be + provided.""" + connector_id: Literal[ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint", + ] + """Identifier for service connectors, like those available in ChatGPT. One of ``server_url``, + ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal[\"connector_dropbox\"], Literal[\"connector_gmail\"], + Literal[\"connector_googlecalendar\"], Literal[\"connector_googledrive\"], + Literal[\"connector_microsoftteams\"], Literal[\"connector_outlookcalendar\"], + Literal[\"connector_outlookemail\"], Literal[\"connector_sharepoint\"]""" + tunnel_id: str + """The Secure MCP Tunnel ID to use instead of a direct server URL. One of ``server_url``, + ``connector_id``, or ``tunnel_id`` must be provided.""" + authorization: str + """An OAuth access token that can be used with a remote MCP server, either with a custom MCP + server URL or a service connector. Your application must handle the OAuth authorization flow + and provide the token here.""" + server_description: str + """Optional description of the MCP server, used to provide more context.""" + headers: Optional[dict[str, str]] + allowed_tools: Optional[Union[list[str], "MCPToolFilter"]] + """Is either a [str] type or a MCPToolFilter type.""" + allowed_callers: Optional[list[CallableToolAllowedCaller]] + require_approval: Optional[Union["MCPToolRequireApproval", Literal["always"], Literal["never"]]] + """Is one of the following types: MCPToolRequireApproval, Literal[\"always\"], Literal[\"never\"]""" + defer_loading: bool + """Whether this MCP tool is deferred and discovered via tool search.""" + project_connection_id: str + """The connection ID in the project for the MCP server. The connection stores authentication and + other connection details needed to connect to the MCP server.""" + + + class MCPToolFilter(TypedDict, total=False): + """MCP tool filter. + + :ivar tool_names: MCP allowed tools. + :vartype tool_names: list[str] + :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP + server is `annotated with `readOnlyHint` + `_, + it will match this filter. + :vartype read_only: bool + """ + + tool_names: list[str] + """MCP allowed tools.""" + read_only: bool + """Indicates whether or not a tool modifies data or is read-only. If an MCP server is `annotated + with `readOnlyHint` + `_, + it will match this filter.""" + + + class MCPToolRequireApproval(TypedDict, total=False): + """MCPToolRequireApproval. + + :ivar always: + :vartype always: "MCPToolFilter" + :ivar never: + :vartype never: "MCPToolFilter" + """ + + always: "MCPToolFilter" + never: "MCPToolFilter" + + + class MemorySearchItem(TypedDict, total=False): + """A retrieved memory item from memory search. + + :ivar memory_item: Retrieved memory item. Required. + :vartype memory_item: "MemoryItem" + """ + + memory_item: Required["MemoryItem"] + """Retrieved memory item. Required.""" + + + class MemorySearchOptions(TypedDict, total=False): + """Memory search options. + + :ivar max_memories: Maximum number of memory items to return. + :vartype max_memories: int + """ + + max_memories: int + """Maximum number of memory items to return.""" + + + class MemorySearchPreviewTool(TypedDict, total=False): + """A tool for integrating memories into the agent. + + :ivar type: The type of the tool. Always ``memory_search_preview``. Required. + MEMORY_SEARCH_PREVIEW. + :vartype type: Literal["memory_search_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar memory_store_name: The name of the memory store to use. Required. + :vartype memory_store_name: str + :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which + memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to + the current signed-in user. Required. + :vartype scope: str + :ivar search_options: Options for searching the memory store. + :vartype search_options: "MemorySearchOptions" + :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default + 300. + :vartype update_delay: int + """ + + type: Required[Literal["memory_search_preview"]] + """The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + memory_store_name: Required[str] + """The name of the memory store to use. Required.""" + scope: Required[str] + """The namespace used to group and isolate memories, such as a user ID. Limits which memories can + be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current + signed-in user. Required.""" + search_options: "MemorySearchOptions" + """Options for searching the memory store.""" + update_delay: int + """Time to wait before updating memories after inactivity (seconds). Default 300.""" + + + class MemorySearchToolCallItemParam(TypedDict, total=False): + """MemorySearchToolCallItemParam. + + :ivar type: Required. Default value is "memory_search_call". + :vartype type: Literal["memory_search_call"] + :ivar results: The results returned from the memory search. + :vartype results: list["MemorySearchItem"] + """ + + type: Required[Literal["memory_search_call"]] + """Required. Default value is \"memory_search_call\".""" + results: Optional[list["MemorySearchItem"]] + """The results returned from the memory search.""" + + + class MemorySearchToolCallItemResource(TypedDict, total=False): + """MemorySearchToolCallItemResource. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. MEMORY_SEARCH_CALL. + :vartype type: Literal["memory_search_call"] + :ivar status: The status of the memory search tool call. One of ``in_progress``, ``searching``, + ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["incomplete"], + Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar results: The results returned from the memory search. + :vartype results: list["MemorySearchItem"] + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["memory_search_call"]] + """Required. MEMORY_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the memory search tool call. One of ``in_progress``, ``searching``, + ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], + Literal[\"incomplete\"], Literal[\"failed\"]""" + results: Optional[list["MemorySearchItem"]] + """The results returned from the memory search.""" + id: Required[str] + """Required.""" + + + class MessageContentInputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + """ + + type: Required[Literal["input_file"]] + """The type of the input item. Always ``input_file``. Required. INPUT_FILE.""" + file_id: Optional[str] + filename: str + """The name of the file to be sent to the model.""" + file_data: str + """The content of the file to be sent to the model.""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + file_url: str + """The URL of the file to be sent to the model.""" + detail: FileInputDetail + """The detail level of the file to be sent to the model. Use ``auto`` to let the system select the + detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may + increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the + file at higher quality. Defaults to ``auto``. Known values are: \"auto\", \"low\", and + \"high\".""" + + + class MessageContentInputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", + "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["input_image"]] + """The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.""" + image_url: Optional[str] + file_id: Optional[str] + detail: Required[ImageDetail] + """The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or + ``original``. Defaults to ``auto``. Required. Known values are: \"low\", \"high\", \"auto\", + and \"original\".""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class MessageContentInputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + + type: Required[Literal["input_text"]] + """The type of the input item. Always ``input_text``. Required. INPUT_TEXT.""" + text: Required[str] + """The text input to the model. Required.""" + prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + + + class MessageContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: Literal["output_text"] + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. + :vartype annotations: list["Annotation"] + :ivar logprobs: + :vartype logprobs: list["LogProb"] + """ + + type: Required[Literal["output_text"]] + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: Required[str] + """The text output from the model. Required.""" + annotations: list["Annotation"] + """The annotations of the text output.""" + logprobs: list["LogProb"] + + + class MessageContentReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. + REASONING_TEXT. + :vartype type: Literal["reasoning_text"] + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Required[Literal["reasoning_text"]] + """The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.""" + text: Required[str] + """The reasoning text from the model. Required.""" + + + class MessageContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: Literal["refusal"] + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + + type: Required[Literal["refusal"]] + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: Required[str] + """The refusal explanation from the model. Required.""" + + + class Metadata(TypedDict, total=False): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters. + + """ + + + class MicrosoftFabricPreviewTool(TypedDict, total=False): + """The input definition information for a Microsoft Fabric tool as used to configure an agent. + + :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW. + :vartype type: Literal["fabric_dataagent_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. + :vartype fabric_dataagent_preview: "FabricDataAgentToolParameters" + """ + + type: Required[Literal["fabric_dataagent_preview"]] + """The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + fabric_dataagent_preview: Required["FabricDataAgentToolParameters"] + """The fabric data agent tool parameters. Required.""" + + + class Moderation(TypedDict, total=False): + """Moderation. + + :ivar input: Moderation for the response input. Required. + :vartype input: "ModerationEntry" + :ivar output: Moderation for the response output. Required. + :vartype output: "ModerationEntry" + """ + + input: Required["ModerationEntry"] + """Moderation for the response input. Required.""" + output: Required["ModerationEntry"] + """Moderation for the response output. Required.""" + + + class ModerationConfigParam(TypedDict, total=False): + """The moderation policy for the response input. + + :ivar mode: Required. Known values are: "score" and "block". + :vartype mode: ModerationMode + """ + + mode: Required[ModerationMode] + """Required. Known values are: \"score\" and \"block\".""" + + + class ModerationErrorBody(TypedDict, total=False): + """Moderation error. + + :ivar type: The object type, which was always ``error`` for moderation failures. Required. + ERROR. + :vartype type: Literal["error"] + :ivar code: The error code. Required. + :vartype code: str + :ivar message: The error message. Required. + :vartype message: str + """ + + type: Required[Literal["error"]] + """The object type, which was always ``error`` for moderation failures. Required. ERROR.""" + code: Required[str] + """The error code. Required.""" + message: Required[str] + """The error message. Required.""" + + + class ModerationParam(TypedDict, total=False): + """Configuration for running moderation on the input and output of this response. + + :ivar model: The moderation model to use for moderated completions, e.g. + 'omni-moderation-latest'. Required. + :vartype model: str + :ivar policy: + :vartype policy: "ModerationPolicyParam" + """ + + model: Required[str] + """The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'. Required.""" + policy: Optional["ModerationPolicyParam"] + + + class ModerationPolicyParam(TypedDict, total=False): + """The policy to apply to moderated response input and output. + + :ivar input: + :vartype input: "ModerationConfigParam" + :ivar output: + :vartype output: "ModerationConfigParam" + """ + + input: Optional["ModerationConfigParam"] + output: Optional["ModerationConfigParam"] + + + class ModerationResultBody(TypedDict, total=False): + """Moderation result. + + :ivar type: The object type, which was always ``moderation_result`` for successful moderation + results. Required. MODERATION_RESULT. + :vartype type: Literal["moderation_result"] + :ivar model: The moderation model that produced this result. Required. + :vartype model: str + :ivar flagged: A boolean indicating whether the content was flagged by any category. Required. + :vartype flagged: bool + :ivar categories: A dictionary of moderation categories to booleans, True if the input is + flagged under this category. Required. + :vartype categories: dict[str, bool] + :ivar category_scores: A dictionary of moderation categories to scores. Required. + :vartype category_scores: dict[str, float] + :ivar category_applied_input_types: Which modalities of input are reflected by the score for + each category. Required. + :vartype category_applied_input_types: dict[str, list[ModerationInputType]] + """ + + type: Required[Literal["moderation_result"]] + """The object type, which was always ``moderation_result`` for successful moderation results. + Required. MODERATION_RESULT.""" + model: Required[str] + """The moderation model that produced this result. Required.""" + flagged: Required[bool] + """A boolean indicating whether the content was flagged by any category. Required.""" + categories: Required[dict[str, bool]] + """A dictionary of moderation categories to booleans, True if the input is flagged under this + category. Required.""" + category_scores: Required[dict[str, float]] + """A dictionary of moderation categories to scores. Required.""" + category_applied_input_types: Required[dict[str, list[ModerationInputType]]] + """Which modalities of input are reflected by the score for each category. Required.""" + + + class MoveParam(TypedDict, total=False): + """Move. + + :ivar type: Specifies the event type. For a move action, this property is always set to + ``move``. Required. MOVE. + :vartype type: Literal["move"] + :ivar x: The x-coordinate to move to. Required. + :vartype x: int + :ivar y: The y-coordinate to move to. Required. + :vartype y: int + :ivar keys: + :vartype keys: list[str] + """ + + type: Required[Literal["move"]] + """Specifies the event type. For a move action, this property is always set to ``move``. Required. + MOVE.""" + x: Required[int] + """The x-coordinate to move to. Required.""" + y: Required[int] + """The y-coordinate to move to. Required.""" + keys: Optional[list[str]] + + + class NamespaceToolParam(TypedDict, total=False): + """Namespace. + + :ivar type: The type of the tool. Always ``namespace``. Required. NAMESPACE. + :vartype type: Literal["namespace"] + :ivar name: The namespace name used in tool calls (for example, ``crm``). Required. + :vartype name: str + :ivar description: A description of the namespace shown to the model. Required. + :vartype description: str + :ivar tools: The function/custom tools available inside this namespace. Required. + :vartype tools: list[Union["FunctionToolParam", "CustomToolParam"]] + """ + + type: Required[Literal["namespace"]] + """The type of the tool. Always ``namespace``. Required. NAMESPACE.""" + name: Required[str] + """The namespace name used in tool calls (for example, ``crm``). Required.""" + description: Required[str] + """A description of the namespace shown to the model. Required.""" + tools: Required[list[Union["FunctionToolParam", "CustomToolParam"]]] + """The function/custom tools available inside this namespace. Required.""" + + + class OAuthConsentRequestOutputItem(TypedDict, total=False): + """Request from the service for the user to perform OAuth consent. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: Required. + :vartype id: str + :ivar type: Required. OAUTH_CONSENT_REQUEST. + :vartype type: Literal["oauth_consent_request"] + :ivar consent_link: The link the user can use to perform OAuth consent. Required. + :vartype consent_link: str + :ivar server_label: The server label for the OAuth consent request. Required. + :vartype server_label: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """Required.""" + type: Required[Literal["oauth_consent_request"]] + """Required. OAUTH_CONSENT_REQUEST.""" + consent_link: Required[str] + """The link the user can use to perform OAuth consent. Required.""" + server_label: Required[str] + """The server label for the OAuth consent request. Required.""" + + + class OpenApiAnonymousAuthDetails(TypedDict, total=False): + """Security details for OpenApi anonymous authentication. + + :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. + :vartype type: Literal["anonymous"] + """ + + type: Required[Literal["anonymous"]] + """The object type, which is always 'anonymous'. Required. ANONYMOUS.""" + + + class OpenApiFunctionDefinition(TypedDict, total=False): + """The input definition information for an openapi function. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar spec: The openapi function shape, described as a JSON Schema object. Required. + :vartype spec: dict[str, Any] + :ivar auth: Open API authentication details. Required. + :vartype auth: "OpenApiAuthDetails" + :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults. + :vartype default_params: list[str] + :ivar functions: List of function definitions used by OpenApi tool. + :vartype functions: list["OpenApiFunctionDefinitionFunction"] + """ + + name: Required[str] + """The name of the function to be called. Required.""" + description: str + """A description of what the function does, used by the model to choose when and how to call the + function.""" + spec: Required[dict[str, Any]] + """The openapi function shape, described as a JSON Schema object. Required.""" + auth: Required["OpenApiAuthDetails"] + """Open API authentication details. Required.""" + default_params: list[str] + """List of OpenAPI spec parameters that will use user-provided defaults.""" + functions: list["OpenApiFunctionDefinitionFunction"] + """List of function definitions used by OpenApi tool.""" + + + class OpenApiFunctionDefinitionFunction(TypedDict, total=False): + """OpenApiFunctionDefinitionFunction. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, Any] + """ + + name: Required[str] + """The name of the function to be called. Required.""" + description: str + """A description of what the function does, used by the model to choose when and how to call the + function.""" + parameters: Required[dict[str, Any]] + """The parameters the functions accepts, described as a JSON Schema object. Required.""" + + + class OpenApiManagedAuthDetails(TypedDict, total=False): + """Security details for OpenApi managed_identity authentication. + + :ivar type: The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY. + :vartype type: Literal["managed_identity"] + :ivar security_scheme: Connection auth security details. Required. + :vartype security_scheme: "OpenApiManagedSecurityScheme" + """ + + type: Required[Literal["managed_identity"]] + """The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY.""" + security_scheme: Required["OpenApiManagedSecurityScheme"] + """Connection auth security details. Required.""" + + + class OpenApiManagedSecurityScheme(TypedDict, total=False): + """Security scheme for OpenApi managed_identity authentication. + + :ivar audience: Authentication scope for managed_identity auth type. Required. + :vartype audience: str + """ + + audience: Required[str] + """Authentication scope for managed_identity auth type. Required.""" + + + class OpenApiProjectConnectionAuthDetails(TypedDict, total=False): + """Security details for OpenApi project connection authentication. + + :ivar type: The object type, which is always 'project_connection'. Required. + PROJECT_CONNECTION. + :vartype type: Literal["project_connection"] + :ivar security_scheme: Project connection auth security details. Required. + :vartype security_scheme: "OpenApiProjectConnectionSecurityScheme" + """ + + type: Required[Literal["project_connection"]] + """The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION.""" + security_scheme: Required["OpenApiProjectConnectionSecurityScheme"] + """Project connection auth security details. Required.""" + + + class OpenApiProjectConnectionSecurityScheme(TypedDict, total=False): + """Security scheme for OpenApi managed_identity authentication. + + :ivar project_connection_id: Project connection id for Project Connection auth type. Required. + :vartype project_connection_id: str + """ + + project_connection_id: Required[str] + """Project connection id for Project Connection auth type. Required.""" + + + class OpenApiTool(TypedDict, total=False): + """The input definition information for an OpenAPI tool as used to configure an agent. + + :ivar type: The object type, which is always 'openapi'. Required. OPENAPI. + :vartype type: Literal["openapi"] + :ivar openapi: The openapi function definition. Required. + :vartype openapi: "OpenApiFunctionDefinition" + """ + + type: Required[Literal["openapi"]] + """The object type, which is always 'openapi'. Required. OPENAPI.""" + openapi: Required["OpenApiFunctionDefinition"] + """The openapi function definition. Required.""" + + + class OpenApiToolCall(TypedDict, total=False): + """An OpenAPI tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL. + :vartype type: Literal["openapi_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["openapi_call"]] + """Required. OPENAPI_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the OpenAPI operation being called. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class OpenApiToolCallOutput(TypedDict, total=False): + """The output of an OpenAPI tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL_OUTPUT. + :vartype type: Literal["openapi_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation that was called. Required. + :vartype name: str + :ivar output: The output from the OpenAPI tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["openapi_call_output"]] + """Required. OPENAPI_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + name: Required[str] + """The name of the OpenAPI operation that was called. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the OpenAPI tool call. Is one of the following types: {str: Any}, str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class OutputContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: Literal["output_text"] + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. + :vartype annotations: list["Annotation"] + :ivar logprobs: + :vartype logprobs: list["LogProb"] + """ + + type: Required[Literal["output_text"]] + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: Required[str] + """The text output from the model. Required.""" + annotations: list["Annotation"] + """The annotations of the text output.""" + logprobs: list["LogProb"] + + + class OutputContentReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. + REASONING_TEXT. + :vartype type: Literal["reasoning_text"] + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Required[Literal["reasoning_text"]] + """The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.""" + text: Required[str] + """The reasoning text from the model. Required.""" + + + class OutputContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: Literal["refusal"] + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + + type: Required[Literal["refusal"]] + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: Required[str] + """The refusal explanation from the model. Required.""" + + + class OutputItemAdditionalTools(TypedDict, total=False): + """OutputItemAdditionalTools. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. + :vartype type: Literal["additional_tools"] + :ivar id: The unique ID of the additional tools item. Required. + :vartype id: str + :ivar role: The role that provided the additional tools. Required. Known values are: "unknown", + "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar tools: The additional tool definitions made available at this item. Required. + :vartype tools: list["Tool"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["additional_tools"]] + """The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.""" + id: Required[str] + """The unique ID of the additional tools item. Required.""" + role: Required[MessageRole] + """The role that provided the additional tools. Required. Known values are: \"unknown\", \"user\", + \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and \"tool\".""" + tools: Required[list["Tool"]] + """The additional tool definitions made available at this item. Required.""" + + + class OutputItemApplyPatchToolCall(TypedDict, total=False): + """Apply patch tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: Literal["apply_patch_call"] + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: "ApplyPatchFileOperation" + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["apply_patch_call"]] + """The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.""" + id: Required[str] + """The unique ID of the apply patch tool call. Populated when this item is returned via API. + Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + status: Required[ApplyPatchCallStatus] + """The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required. + Known values are: \"in_progress\" and \"completed\".""" + operation: Required["ApplyPatchFileOperation"] + """Apply patch operation. Required.""" + + + class OutputItemApplyPatchToolCallOutput(TypedDict, total=False): + """Apply patch tool call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: Literal["apply_patch_call_output"] + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["apply_patch_call_output"]] + """The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the apply patch tool call output. Populated when this item is returned via + API. Required.""" + call_id: Required[str] + """The unique ID of the apply patch tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + status: Required[ApplyPatchCallOutputStatus] + """The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required. + Known values are: \"completed\" and \"failed\".""" + output: Optional[str] + + + class OutputItemCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: Literal["code_interpreter_call"] + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["code_interpreter_call"]] + """The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. + CODE_INTERPRETER_CALL.""" + id: Required[str] + """The unique ID of the code interpreter tool call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]] + """The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``, + ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"], + Literal[\"interpreting\"], Literal[\"failed\"]""" + container_id: Required[str] + """The ID of the container used to run the code. Required.""" + code: Required[Optional[str]] + """Required.""" + outputs: Required[Optional[list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]]] + """Required.""" + + + class OutputItemCompactionBody(TypedDict, total=False): + """Compaction item. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: Literal["compaction"] + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["compaction"]] + """The type of the item. Always ``compaction``. Required. COMPACTION.""" + id: Required[str] + """The unique ID of the compaction item. Required.""" + encrypted_content: Required[str] + """The encrypted content that was produced by compaction. Required.""" + + + class OutputItemComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: Literal["computer_call"] + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: + :vartype action: "ComputerAction" + :ivar actions: + :vartype actions: list["ComputerAction"] + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["computer_call"]] + """The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.""" + id: Required[str] + """The unique ID of the computer call. Required.""" + call_id: Required[str] + """An identifier used when responding to the tool call with output. Required.""" + action: "ComputerAction" + actions: list["ComputerAction"] + pending_safety_checks: Required[list["ComputerCallSafetyCheckParam"]] + """The pending safety checks for the computer call. Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemComputerToolCallOutput(TypedDict, total=False): + """Computer tool call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: Literal["computer_call_output"] + :ivar id: The ID of the computer tool call output. Required. + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar acknowledged_safety_checks: The safety checks reported by the API that have been + acknowledged by the developer. + :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar output: Required. + :vartype output: "ComputerScreenshotImage" + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["computer_call_output"]] + """The type of the computer tool call output. Always ``computer_call_output``. Required. + COMPUTER_CALL_OUTPUT.""" + id: Required[str] + """The ID of the computer tool call output. Required.""" + call_id: Required[str] + """The ID of the computer tool call that produced the output. Required.""" + acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + """The safety checks reported by the API that have been acknowledged by the developer.""" + output: Required["ComputerScreenshotImage"] + """Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: Literal["file_search_call"] + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list["FileSearchToolCallResults"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the file search tool call. Required.""" + type: Required[Literal["file_search_call"]] + """The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "incomplete", "failed"]] + """The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete`` + or ``failed``,. Required. Is one of the following types: Literal[\"in_progress\"], + Literal[\"searching\"], Literal[\"completed\"], Literal[\"incomplete\"], Literal[\"failed\"]""" + queries: Required[list[str]] + """The queries used to search for files. Required.""" + results: Optional[list["FileSearchToolCallResults"]] + + + class OutputItemFunctionShellCall(TypedDict, total=False): + """Shell tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: Literal["shell_call"] + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: "FunctionShellAction" + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallStatus + :ivar environment: Required. + :vartype environment: "FunctionShellCallEnvironment" + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["shell_call"]] + """The type of the item. Always ``shell_call``. Required. SHELL_CALL.""" + id: Required[str] + """The unique ID of the shell tool call. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + action: Required["FunctionShellAction"] + """The shell commands and limits that describe how to run the tool call. Required.""" + status: Required[FunctionShellCallStatus] + """The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + environment: Required[Optional["FunctionShellCallEnvironment"]] + """Required.""" + + + class OutputItemFunctionShellCallOutput(TypedDict, total=False): + """Shell call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: Literal["shell_call_output"] + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: list["FunctionShellCallOutputContent"] + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["shell_call_output"]] + """The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the shell call output. Populated when this item is returned via API. Required.""" + call_id: Required[str] + """The unique ID of the shell tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + status: Required[FunctionShellCallOutputStatusEnum] + """The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``. + Required. Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + output: Required[list["FunctionShellCallOutputContent"]] + """An array of shell call output contents. Required.""" + max_output_length: Required[Optional[int]] + """Required.""" + + + class OutputItemFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call. Required. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: Literal["function_call"] + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the function to run. + :vartype namespace: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the function tool call. Required.""" + type: Required[Literal["function_call"]] + """The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.""" + call_id: Required[str] + """The unique ID of the function tool call generated by the model. Required.""" + caller: Optional["ToolCallCaller"] + namespace: str + """The namespace of the function to run.""" + name: Required[str] + """The name of the function to run. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the function. Required.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemFunctionToolCallOutput(TypedDict, total=False): + """Function tool call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call output. Populated when this item is returned + via API. Required. + :vartype id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: Literal["function_call_output"] + :ivar call_id: The unique ID of the function tool call generated by the model. + :vartype call_id: str + :ivar name: The name of the tool that produced the output. + :vartype name: str + :ivar namespace: The namespace of the tool that produced the output. + :vartype namespace: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the function call generated by your code. Can be a string or an + list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] + type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the function tool call output. Populated when this item is returned via API. + Required.""" + type: Required[Literal["function_call_output"]] + """The type of the function tool call output. Always ``function_call_output``. Required. + FUNCTION_CALL_OUTPUT.""" + call_id: str + """The unique ID of the function tool call generated by the model.""" + name: str + """The name of the tool that produced the output.""" + namespace: str + """The namespace of the tool that produced the output.""" + caller: Optional["ToolCallCallerParam"] + output: Required[Union[str, list["FunctionAndCustomToolCallOutput"]]] + """The output from the function call generated by your code. Can be a string or an list of output + content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: Literal["image_generation_call"] + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "generating", "failed"] + :ivar result: Required. + :vartype result: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["image_generation_call"]] + """The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL.""" + id: Required[str] + """The unique ID of the image generation call. Required.""" + status: Required[Literal["in_progress", "completed", "generating", "failed"]] + """The status of the image generation call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"generating\"], Literal[\"failed\"]""" + result: Required[Optional[str]] + """Required.""" + + + class OutputItemLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: Literal["local_shell_call"] + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: "LocalShellExecAction" + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["local_shell_call"]] + """The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.""" + id: Required[str] + """The unique ID of the local shell call. Required.""" + call_id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + action: Required["LocalShellExecAction"] + """Required.""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the local shell call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: Literal["local_shell_call_output"] + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["local_shell_call_output"]] + """The type of the local shell tool call output. Always ``local_shell_call_output``. Required. + LOCAL_SHELL_CALL_OUTPUT.""" + id: Required[str] + """The unique ID of the local shell tool call generated by the model. Required.""" + output: Required[str] + """A JSON string of the output of the local shell tool call. Required.""" + status: Optional[Literal["in_progress", "completed", "incomplete"]] + """Is one of the following types: Literal[\"in_progress\"], Literal[\"completed\"], + Literal[\"incomplete\"]""" + + + class OutputItemMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: Literal["mcp_approval_request"] + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["mcp_approval_request"]] + """The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.""" + id: Required[str] + """The unique ID of the approval request. Required.""" + server_label: Required[str] + """The label of the MCP server making the request. Required.""" + name: Required[str] + """The name of the tool to run. Required.""" + arguments: Required[str] + """A JSON string of arguments for the tool. Required.""" + + + class OutputItemMcpApprovalResponseResource(TypedDict, total=False): + """MCP approval response. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: Literal["mcp_approval_response"] + :ivar id: The unique ID of the approval response. Required. + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["mcp_approval_response"]] + """The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.""" + id: Required[str] + """The unique ID of the approval response. Required.""" + approval_request_id: Required[str] + """The ID of the approval request being answered. Required.""" + approve: Required[bool] + """Whether the request was approved. Required.""" + reason: Optional[str] + + + class OutputItemMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: Literal["mcp_list_tools"] + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list["MCPListToolsTool"] + :ivar error: + :vartype error: "RealtimeMCPError" + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["mcp_list_tools"]] + """The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.""" + id: Required[str] + """The unique ID of the list. Required.""" + server_label: Required[str] + """The label of the MCP server. Required.""" + tools: Required[list["MCPListToolsTool"]] + """The tools available on the server. Required.""" + error: "RealtimeMCPError" + + + class OutputItemMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: Literal["mcp_call"] + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: The error from the tool call, if any. + :vartype error: dict[str, Any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["mcp_call"]] + """The type of the item. Always ``mcp_call``. Required. MCP_CALL.""" + id: Required[str] + """The unique ID of the tool call. Required.""" + server_label: Required[str] + """The label of the MCP server running the tool. Required.""" + name: Required[str] + """The name of the tool that was run. Required.""" + arguments: Required[str] + """A JSON string of the arguments passed to the tool. Required.""" + output: Optional[str] + error: dict[str, Any] + """The error from the tool call, if any.""" + status: MCPToolCallStatus + """The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``, + ``calling``, or ``failed``. Known values are: \"in_progress\", \"completed\", \"incomplete\", + \"calling\", and \"failed\".""" + approval_request_id: Optional[str] + + + class OutputItemMessage(TypedDict, total=False): + """Message. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: Literal["message"] + :ivar id: The unique ID of the message. Required. + :vartype id: str + :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: MessageStatus + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar content: The content of the message. Required. + :vartype content: list["MessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["message"]] + """The type of the message. Always set to ``message``. Required. MESSAGE.""" + id: Required[str] + """The unique ID of the message. Required.""" + status: Required[MessageStatus] + """The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when + items are returned via API. Required. Known values are: \"in_progress\", \"completed\", and + \"incomplete\".""" + role: Required[MessageRole] + """The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``, + ``discriminator``, ``developer``, or ``tool``. Required. Known values are: \"unknown\", + \"user\", \"assistant\", \"system\", \"critic\", \"discriminator\", \"developer\", and + \"tool\".""" + content: Required[list["MessageContent"]] + """The content of the message. Required.""" + phase: Optional[MessagePhase] + """Known values are: \"commentary\" and \"final_answer\".""" + + + class OutputItemOutputMessage(TypedDict, total=False): + """Output message. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE. + :vartype type: Literal["output_message"] + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: Literal["assistant"] + :ivar content: The content of the output message. Required. + :vartype content: list["OutputMessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the output message. Required.""" + type: Required[Literal["output_message"]] + """The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.""" + role: Required[Literal["assistant"]] + """The role of the output message. Always ``assistant``. Required. Default value is \"assistant\".""" + content: Required[list["OutputMessageContent"]] + """The content of the output message. Required.""" + phase: Optional[MessagePhase] + """Known values are: \"commentary\" and \"final_answer\".""" + status: Required[Literal["in_progress", "completed", "incomplete"]] + """The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when input items are returned via API. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemProgram(TypedDict, total=False): + """OutputItemProgram. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``program``. Required. PROGRAM. + :vartype type: Literal["program"] + :ivar id: The unique ID of the program item. Required. + :vartype id: str + :ivar call_id: The stable call ID of the program item. Required. + :vartype call_id: str + :ivar code: The JavaScript source executed by programmatic tool calling. Required. + :vartype code: str + :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. + :vartype fingerprint: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["program"]] + """The type of the item. Always ``program``. Required. PROGRAM.""" + id: Required[str] + """The unique ID of the program item. Required.""" + call_id: Required[str] + """The stable call ID of the program item. Required.""" + code: Required[str] + """The JavaScript source executed by programmatic tool calling. Required.""" + fingerprint: Required[str] + """Opaque program replay fingerprint that must be round-tripped. Required.""" + + + class OutputItemProgramOutput(TypedDict, total=False): + """OutputItemProgramOutput. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT. + :vartype type: Literal["program_output"] + :ivar id: The unique ID of the program output item. Required. + :vartype id: str + :ivar call_id: The call ID of the program item. Required. + :vartype call_id: str + :ivar result: The result produced by the program item. Required. + :vartype result: str + :ivar status: The terminal status of the program output item. Required. Known values are: + "completed" and "incomplete". + :vartype status: ProgramOutputStatus + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["program_output"]] + """The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.""" + id: Required[str] + """The unique ID of the program output item. Required.""" + call_id: Required[str] + """The call ID of the program item. Required.""" + result: Required[str] + """The result produced by the program item. Required.""" + status: Required[ProgramOutputStatus] + """The terminal status of the program output item. Required. Known values are: \"completed\" and + \"incomplete\".""" + + + class OutputItemReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: Literal["reasoning"] + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list["SummaryTextContent"] + :ivar content: Reasoning text content. + :vartype content: list["ReasoningTextContent"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["reasoning"]] + """The type of the object. Always ``reasoning``. Required. REASONING.""" + id: Required[str] + """The unique identifier of the reasoning content. Required.""" + encrypted_content: Optional[str] + summary: Required[list["SummaryTextContent"]] + """Reasoning summary content. Required.""" + content: list["ReasoningTextContent"] + """Reasoning text content.""" + status: Literal["in_progress", "completed", "incomplete"] + """The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated + when items are returned via API. Is one of the following types: Literal[\"in_progress\"], + Literal[\"completed\"], Literal[\"incomplete\"]""" + + + class OutputItemToolSearchCall(TypedDict, total=False): + """OutputItemToolSearchCall. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. + :vartype type: Literal["tool_search_call"] + :ivar id: The unique ID of the tool search call item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar arguments: Arguments used for the tool search call. Required. + :vartype arguments: Any + :ivar status: The status of the tool search call item that was recorded. Required. Known values + are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallStatus + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["tool_search_call"]] + """The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.""" + id: Required[str] + """The unique ID of the tool search call item. Required.""" + call_id: Required[Optional[str]] + """Required.""" + execution: Required[ToolSearchExecutionType] + """Whether tool search was executed by the server or by the client. Required. Known values are: + \"server\" and \"client\".""" + arguments: Required[Any] + """Arguments used for the tool search call. Required.""" + status: Required[FunctionCallStatus] + """The status of the tool search call item that was recorded. Required. Known values are: + \"in_progress\", \"completed\", and \"incomplete\".""" + created_by: str + """The identifier of the actor that created the item.""" + + + class OutputItemToolSearchOutput(TypedDict, total=False): + """OutputItemToolSearchOutput. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. + :vartype type: Literal["tool_search_output"] + :ivar id: The unique ID of the tool search output item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar tools: The loaded tool definitions returned by tool search. Required. + :vartype tools: list["Tool"] + :ivar status: The status of the tool search output item that was recorded. Required. Known + values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallOutputStatusEnum + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["tool_search_output"]] + """The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.""" + id: Required[str] + """The unique ID of the tool search output item. Required.""" + call_id: Required[Optional[str]] + """Required.""" + execution: Required[ToolSearchExecutionType] + """Whether tool search was executed by the server or by the client. Required. Known values are: + \"server\" and \"client\".""" + tools: Required[list["Tool"]] + """The loaded tool definitions returned by tool search. Required.""" + status: Required[FunctionCallOutputStatusEnum] + """The status of the tool search output item that was recorded. Required. Known values are: + \"in_progress\", \"completed\", and \"incomplete\".""" + created_by: str + """The identifier of the actor that created the item.""" + + + class OutputItemWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: Literal["web_search_call"] + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", + "WebSearchActionFind"] + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + id: Required[str] + """The unique ID of the web search tool call. Required.""" + type: Required[Literal["web_search_call"]] + """The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.""" + status: Required[Literal["in_progress", "searching", "completed", "failed", "incomplete"]] + """The status of the web search tool call. Required. Is one of the following types: + Literal[\"in_progress\"], Literal[\"searching\"], Literal[\"completed\"], Literal[\"failed\"], + Literal[\"incomplete\"]""" + action: Required[Union["WebSearchActionSearch", "WebSearchActionOpenPage", "WebSearchActionFind"]] + """An object describing the specific action taken in this web search call. Includes details on how + the model used the web (search, open_page, find_in_page). Required. Is one of the following + types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind""" + + + class OutputMessageContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: Literal["output_text"] + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. + :vartype annotations: list["Annotation"] + :ivar logprobs: + :vartype logprobs: list["LogProb"] + """ + + type: Required[Literal["output_text"]] + """The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.""" + text: Required[str] + """The text output from the model. Required.""" + annotations: list["Annotation"] + """The annotations of the text output.""" + logprobs: list["LogProb"] + + + class OutputMessageContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: Literal["refusal"] + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + + type: Required[Literal["refusal"]] + """The type of the refusal. Always ``refusal``. Required. REFUSAL.""" + refusal: Required[str] + """The refusal explanation from the model. Required.""" + + + class ProgrammaticToolCallingParam(TypedDict, total=False): + """ProgrammaticToolCallingParam. + + :ivar type: The type of the tool. Always ``programmatic_tool_calling``. Required. + PROGRAMMATIC_TOOL_CALLING. + :vartype type: Literal["programmatic_tool_calling"] + """ + + type: Required[Literal["programmatic_tool_calling"]] + """The type of the tool. Always ``programmatic_tool_calling``. Required. + PROGRAMMATIC_TOOL_CALLING.""" + + + class ProgramToolCallCaller(TypedDict, total=False): + """ProgramToolCallCaller. + + :ivar type: Required. PROGRAM. + :vartype type: Literal["program"] + :ivar caller_id: The call ID of the program item that produced this tool call. Required. + :vartype caller_id: str + """ + + type: Required[Literal["program"]] + """Required. PROGRAM.""" + caller_id: Required[str] + """The call ID of the program item that produced this tool call. Required.""" + + + class ProgramToolCallCallerParam(TypedDict, total=False): + """ProgramToolCallCallerParam. + + :ivar type: The caller type. Always ``program``. Required. PROGRAM. + :vartype type: Literal["program"] + :ivar caller_id: The call ID of the program item that produced this tool call. Required. + :vartype caller_id: str + """ + + type: Required[Literal["program"]] + """The caller type. Always ``program``. Required. PROGRAM.""" + caller_id: Required[str] + """The call ID of the program item that produced this tool call. Required.""" + + + class Prompt(TypedDict, total=False): + """Reference to a prompt template and its variables. Learn more: /docs/guides/text?api-mode=responses#reusable-prompts. + + :ivar id: The unique identifier of the prompt template to use. Required. + :vartype id: str + :ivar version: + :vartype version: str + :ivar variables: + :vartype variables: "ResponsePromptVariables" + """ + + id: Required[str] + """The unique identifier of the prompt template to use. Required.""" + version: Optional[str] + variables: Optional["ResponsePromptVariables"] + + + class PromptCacheBreakpointConfig(TypedDict, total=False): + """Prompt cache breakpoint. + + :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit". + :vartype mode: Literal["explicit"] + """ + + mode: Required[Literal["explicit"]] + """The breakpoint mode. Always ``explicit``. Required. Default value is \"explicit\".""" + + + class PromptCacheBreakpointParam(TypedDict, total=False): + """Prompt cache breakpoint. + + :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit". + :vartype mode: Literal["explicit"] + """ + + mode: Required[Literal["explicit"]] + """The breakpoint mode. Always ``explicit``. Required. Default value is \"explicit\".""" + + + class PromptCacheOptions(TypedDict, total=False): + """Prompt cache options. + + :ivar ttl: The minimum lifetime applied to each cache breakpoint. Required. "30m" + :vartype ttl: PromptCacheTTLEnum + :ivar mode: Whether implicit prompt-cache breakpoints were enabled. Required. Known values are: + "implicit" and "explicit". + :vartype mode: PromptCacheModeEnum + """ + + ttl: Required[PromptCacheTTLEnum] + """The minimum lifetime applied to each cache breakpoint. Required. \"30m\"""" + mode: Required[PromptCacheModeEnum] + """Whether implicit prompt-cache breakpoints were enabled. Required. Known values are: + \"implicit\" and \"explicit\".""" + + + class PromptCacheOptionsParam(TypedDict, total=False): + """Prompt cache options. + + :ivar ttl: The minimum lifetime applied to every implicit and explicit cache breakpoint written + by the request. Defaults to ``30m``, which is currently the only supported value. The backend + may retain cache entries for longer. "30m" + :vartype ttl: PromptCacheTTLEnum + :ivar mode: Controls whether OpenAI automatically creates an implicit cache breakpoint. + Defaults to ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes + up to the latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not + create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there + are no explicit breakpoints, the request does not use prompt caching. Known values are: + "implicit" and "explicit". + :vartype mode: PromptCacheModeEnum + """ + + ttl: PromptCacheTTLEnum + """The minimum lifetime applied to every implicit and explicit cache breakpoint written by the + request. Defaults to ``30m``, which is currently the only supported value. The backend may + retain cache entries for longer. \"30m\"""" + mode: PromptCacheModeEnum + """Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to + ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes up to the + latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not create an + implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no + explicit breakpoints, the request does not use prompt caching. Known values are: \"implicit\" + and \"explicit\".""" + + + class RankingOptions(TypedDict, total=False): + """RankingOptions. + + :ivar ranker: The ranker to use for the file search. Known values are: "auto" and + "default-2024-11-15". + :vartype ranker: RankerVersionType + :ivar score_threshold: The score threshold for the file search, a number between 0 and 1. + Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer + results. + :vartype score_threshold: float + :ivar hybrid_search: Weights that control how reciprocal rank fusion balances semantic + embedding matches versus sparse keyword matches when hybrid search is enabled. + :vartype hybrid_search: "HybridSearchOptions" + """ + + ranker: RankerVersionType + """The ranker to use for the file search. Known values are: \"auto\" and \"default-2024-11-15\".""" + score_threshold: float + """The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will + attempt to return only the most relevant results, but may return fewer results.""" + hybrid_search: "HybridSearchOptions" + """Weights that control how reciprocal rank fusion balances semantic embedding matches versus + sparse keyword matches when hybrid search is enabled.""" + + + class RealtimeMCPHTTPError(TypedDict, total=False): + """Realtime MCP HTTP error. + + :ivar type: Required. HTTP_ERROR. + :vartype type: Literal["http_error"] + :ivar code: Required. + :vartype code: int + :ivar message: Required. + :vartype message: str + """ + + type: Required[Literal["http_error"]] + """Required. HTTP_ERROR.""" + code: Required[int] + """Required.""" + message: Required[str] + """Required.""" + + + class RealtimeMCPProtocolError(TypedDict, total=False): + """Realtime MCP protocol error. + + :ivar type: Required. PROTOCOL_ERROR. + :vartype type: Literal["protocol_error"] + :ivar code: Required. + :vartype code: int + :ivar message: Required. + :vartype message: str + """ + + type: Required[Literal["protocol_error"]] + """Required. PROTOCOL_ERROR.""" + code: Required[int] + """Required.""" + message: Required[str] + """Required.""" + + + class RealtimeMCPToolExecutionError(TypedDict, total=False): + """Realtime MCP tool execution error. + + :ivar type: Required. TOOL_EXECUTION_ERROR. + :vartype type: Literal["tool_execution_error"] + :ivar message: Required. + :vartype message: str + """ + + type: Required[Literal["tool_execution_error"]] + """Required. TOOL_EXECUTION_ERROR.""" + message: Required[str] + """Required.""" + + + class Reasoning(TypedDict, total=False): + """Reasoning. + + :ivar mode: Controls the reasoning execution mode for the request. When returned on a response, + this is the effective execution mode. Known values are: "standard" and "pro". + :vartype mode: ReasoningModeEnum + :ivar effort: Known values are: "none", "minimal", "low", "medium", "high", "xhigh", and "max". + :vartype effort: ReasoningEffort + :ivar summary: Is one of the following types: Literal["auto"], Literal["concise"], + Literal["detailed"] + :vartype summary: Literal["auto", "concise", "detailed"] + :ivar context: Is one of the following types: Literal["auto"], Literal["current_turn"], + Literal["all_turns"] + :vartype context: Literal["auto", "current_turn", "all_turns"] + :ivar generate_summary: Is one of the following types: Literal["auto"], Literal["concise"], + Literal["detailed"] + :vartype generate_summary: Literal["auto", "concise", "detailed"] + """ + + mode: ReasoningModeEnum + """Controls the reasoning execution mode for the request. When returned on a response, this is the + effective execution mode. Known values are: \"standard\" and \"pro\".""" + effort: Optional[ReasoningEffort] + """Known values are: \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", and \"max\".""" + summary: Optional[Literal["auto", "concise", "detailed"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"concise\"], Literal[\"detailed\"]""" + context: Optional[Literal["auto", "current_turn", "all_turns"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"current_turn\"], + Literal[\"all_turns\"]""" + generate_summary: Optional[Literal["auto", "concise", "detailed"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"concise\"], Literal[\"detailed\"]""" + + + class ReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. Default value + is "reasoning_text". + :vartype type: Literal["reasoning_text"] + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + + type: Required[Literal["reasoning_text"]] + """The type of the reasoning text. Always ``reasoning_text``. Required. Default value is + \"reasoning_text\".""" + text: Required[str] + """The reasoning text from the model. Required.""" + + + class ResponseAudioDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial audio response. + + :ivar type: The type of the event. Always ``response.audio.delta``. Required. + RESPONSE_AUDIO_DELTA. + :vartype type: Literal["response.audio.delta"] + :ivar sequence_number: A sequence number for this chunk of the stream response. Required. + :vartype sequence_number: int + :ivar delta: A chunk of Base64 encoded response audio bytes. Required. + :vartype delta: str + """ + + type: Required[Literal["response.audio.delta"]] + """The type of the event. Always ``response.audio.delta``. Required. RESPONSE_AUDIO_DELTA.""" + sequence_number: Required[int] + """A sequence number for this chunk of the stream response. Required.""" + delta: Required[str] + """A chunk of Base64 encoded response audio bytes. Required.""" + + + class ResponseAudioDoneEvent(TypedDict, total=False): + """Emitted when the audio response is complete. + + :ivar type: The type of the event. Always ``response.audio.done``. Required. + RESPONSE_AUDIO_DONE. + :vartype type: Literal["response.audio.done"] + :ivar sequence_number: The sequence number of the delta. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.audio.done"]] + """The type of the event. Always ``response.audio.done``. Required. RESPONSE_AUDIO_DONE.""" + sequence_number: Required[int] + """The sequence number of the delta. Required.""" + + + class ResponseAudioTranscriptDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial transcript of audio. + + :ivar type: The type of the event. Always ``response.audio.transcript.delta``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DELTA. + :vartype type: Literal["response.audio.transcript.delta"] + :ivar delta: The partial transcript of the audio response. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.audio.transcript.delta"]] + """The type of the event. Always ``response.audio.transcript.delta``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DELTA.""" + delta: Required[str] + """The partial transcript of the audio response. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseAudioTranscriptDoneEvent(TypedDict, total=False): + """Emitted when the full audio transcript is completed. + + :ivar type: The type of the event. Always ``response.audio.transcript.done``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DONE. + :vartype type: Literal["response.audio.transcript.done"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.audio.transcript.done"]] + """The type of the event. Always ``response.audio.transcript.done``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DONE.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseCodeInterpreterCallCodeDeltaEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when a partial code snippet is streamed by the code interpreter. + + :ivar type: The type of the event. Always ``response.code_interpreter_call_code.delta``. + Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA. + :vartype type: Literal["response.code_interpreter_call_code.delta"] + :ivar output_index: The index of the output item in the response for which the code is being + streamed. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar delta: The partial code snippet being streamed by the code interpreter. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.code_interpreter_call_code.delta"]] + """The type of the event. Always ``response.code_interpreter_call_code.delta``. Required. + RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA.""" + output_index: Required[int] + """The index of the output item in the response for which the code is being streamed. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + delta: Required[str] + """The partial code snippet being streamed by the code interpreter. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + + class ResponseCodeInterpreterCallCodeDoneEvent(TypedDict, total=False): + """Emitted when the code snippet is finalized by the code interpreter. + + :ivar type: The type of the event. Always ``response.code_interpreter_call_code.done``. + Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE. + :vartype type: Literal["response.code_interpreter_call_code.done"] + :ivar output_index: The index of the output item in the response for which the code is + finalized. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar code: The final code snippet output by the code interpreter. Required. + :vartype code: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.code_interpreter_call_code.done"]] + """The type of the event. Always ``response.code_interpreter_call_code.done``. Required. + RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE.""" + output_index: Required[int] + """The index of the output item in the response for which the code is finalized. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + code: Required[str] + """The final code snippet output by the code interpreter. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + + class ResponseCodeInterpreterCallCompletedEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when the code interpreter call is completed. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.completed``. + Required. RESPONSE_CODE_INTERPRETER_CALL_COMPLETED. + :vartype type: Literal["response.code_interpreter_call.completed"] + :ivar output_index: The index of the output item in the response for which the code interpreter + call is completed. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.code_interpreter_call.completed"]] + """The type of the event. Always ``response.code_interpreter_call.completed``. Required. + RESPONSE_CODE_INTERPRETER_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item in the response for which the code interpreter call is completed. + Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + + class ResponseCodeInterpreterCallInProgressEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when a code interpreter call is in progress. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.in_progress``. + Required. RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS. + :vartype type: Literal["response.code_interpreter_call.in_progress"] + :ivar output_index: The index of the output item in the response for which the code interpreter + call is in progress. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.code_interpreter_call.in_progress"]] + """The type of the event. Always ``response.code_interpreter_call.in_progress``. Required. + RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item in the response for which the code interpreter call is in + progress. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + + class ResponseCodeInterpreterCallInterpretingEvent(TypedDict, total=False): # pylint: disable=name-too-long + """Emitted when the code interpreter is actively interpreting the code snippet. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.interpreting``. + Required. RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING. + :vartype type: Literal["response.code_interpreter_call.interpreting"] + :ivar output_index: The index of the output item in the response for which the code interpreter + is interpreting code. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.code_interpreter_call.interpreting"]] + """The type of the event. Always ``response.code_interpreter_call.interpreting``. Required. + RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING.""" + output_index: Required[int] + """The index of the output item in the response for which the code interpreter is interpreting + code. Required.""" + item_id: Required[str] + """The unique identifier of the code interpreter tool call item. Required.""" + sequence_number: Required[int] + """The sequence number of this event, used to order streaming events. Required.""" + + + class ResponseCompletedEvent(TypedDict, total=False): + """Emitted when the model response is complete. + + :ivar type: The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED. + :vartype type: Literal["response.completed"] + :ivar response: Properties of the completed response. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.completed"]] + """The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED.""" + response: Required["ResponseObject"] + """Properties of the completed response. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + + + class ResponseContentPartAddedEvent(TypedDict, total=False): + """Emitted when a new content part is added. + + :ivar type: The type of the event. Always ``response.content_part.added``. Required. + RESPONSE_CONTENT_PART_ADDED. + :vartype type: Literal["response.content_part.added"] + :ivar item_id: The ID of the output item that the content part was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the content part was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that was added. Required. + :vartype content_index: int + :ivar part: The content part that was added. Required. + :vartype part: "OutputContent" + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.content_part.added"]] + """The type of the event. Always ``response.content_part.added``. Required. + RESPONSE_CONTENT_PART_ADDED.""" + item_id: Required[str] + """The ID of the output item that the content part was added to. Required.""" + output_index: Required[int] + """The index of the output item that the content part was added to. Required.""" + content_index: Required[int] + """The index of the content part that was added. Required.""" + part: Required["OutputContent"] + """The content part that was added. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseContentPartDoneEvent(TypedDict, total=False): + """Emitted when a content part is done. + + :ivar type: The type of the event. Always ``response.content_part.done``. Required. + RESPONSE_CONTENT_PART_DONE. + :vartype type: Literal["response.content_part.done"] + :ivar item_id: The ID of the output item that the content part was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the content part was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that is done. Required. + :vartype content_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The content part that is done. Required. + :vartype part: "OutputContent" + """ + + type: Required[Literal["response.content_part.done"]] + """The type of the event. Always ``response.content_part.done``. Required. + RESPONSE_CONTENT_PART_DONE.""" + item_id: Required[str] + """The ID of the output item that the content part was added to. Required.""" + output_index: Required[int] + """The index of the output item that the content part was added to. Required.""" + content_index: Required[int] + """The index of the content part that is done. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + part: Required["OutputContent"] + """The content part that is done. Required.""" + + + class ResponseCreatedEvent(TypedDict, total=False): + """An event that is emitted when a response is created. + + :ivar type: The type of the event. Always ``response.created``. Required. RESPONSE_CREATED. + :vartype type: Literal["response.created"] + :ivar response: The response that was created. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.created"]] + """The type of the event. Always ``response.created``. Required. RESPONSE_CREATED.""" + response: Required["ResponseObject"] + """The response that was created. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + + + class ResponseCustomToolCallInputDeltaEvent(TypedDict, total=False): + """ResponseCustomToolCallInputDelta. + + :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA. + :vartype type: Literal["response.custom_tool_call_input.delta"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output this delta applies to. Required. + :vartype output_index: int + :ivar item_id: Unique identifier for the API item associated with this event. Required. + :vartype item_id: str + :ivar delta: The incremental input data (delta) for the custom tool call. Required. + :vartype delta: str + """ + + type: Required[Literal["response.custom_tool_call_input.delta"]] + """The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + output_index: Required[int] + """The index of the output this delta applies to. Required.""" + item_id: Required[str] + """Unique identifier for the API item associated with this event. Required.""" + delta: Required[str] + """The incremental input data (delta) for the custom tool call. Required.""" + + + class ResponseCustomToolCallInputDoneEvent(TypedDict, total=False): + """ResponseCustomToolCallInputDone. + + :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE. + :vartype type: Literal["response.custom_tool_call_input.done"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output this event applies to. Required. + :vartype output_index: int + :ivar item_id: Unique identifier for the API item associated with this event. Required. + :vartype item_id: str + :ivar input: The complete input data for the custom tool call. Required. + :vartype input: str + """ + + type: Required[Literal["response.custom_tool_call_input.done"]] + """The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + output_index: Required[int] + """The index of the output this event applies to. Required.""" + item_id: Required[str] + """Unique identifier for the API item associated with this event. Required.""" + input: Required[str] + """The complete input data for the custom tool call. Required.""" + + + class ResponseErrorEvent(TypedDict, total=False): + """Emitted when an error occurs. + + :ivar type: The type of the event. Always ``error``. Required. ERROR. + :vartype type: Literal["error"] + :ivar code: Required. + :vartype code: str + :ivar message: The error message. Required. + :vartype message: str + :ivar param: Required. + :vartype param: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["error"]] + """The type of the event. Always ``error``. Required. ERROR.""" + code: Required[Optional[str]] + """Required.""" + message: Required[str] + """The error message. Required.""" + param: Required[Optional[str]] + """Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseErrorInfo(TypedDict, total=False): + """An error object returned when the model fails to generate a Response. + + :ivar code: Required. Known values are: "server_error", "rate_limit_exceeded", + "invalid_prompt", "data_residency_mismatch", "bio_policy", "vector_store_timeout", + "invalid_image", "invalid_image_format", "invalid_base64_image", "invalid_image_url", + "image_too_large", "image_too_small", "image_parse_error", "image_content_policy_violation", + "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type", + "empty_image_file", "failed_to_download_image", and "image_file_not_found". + :vartype code: ResponseErrorCode + :ivar message: A human-readable description of the error. Required. + :vartype message: str + """ + + code: Required[ResponseErrorCode] + """Required. Known values are: \"server_error\", \"rate_limit_exceeded\", \"invalid_prompt\", + \"data_residency_mismatch\", \"bio_policy\", \"vector_store_timeout\", \"invalid_image\", + \"invalid_image_format\", \"invalid_base64_image\", \"invalid_image_url\", \"image_too_large\", + \"image_too_small\", \"image_parse_error\", \"image_content_policy_violation\", + \"invalid_image_mode\", \"image_file_too_large\", \"unsupported_image_media_type\", + \"empty_image_file\", \"failed_to_download_image\", and \"image_file_not_found\".""" + message: Required[str] + """A human-readable description of the error. Required.""" + + + class ResponseFailedEvent(TypedDict, total=False): + """An event that is emitted when a response fails. + + :ivar type: The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED. + :vartype type: Literal["response.failed"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar response: The response that failed. Required. + :vartype response: "ResponseObject" + """ + + type: Required[Literal["response.failed"]] + """The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + response: Required["ResponseObject"] + """The response that failed. Required.""" + + + class ResponseFileSearchCallCompletedEvent(TypedDict, total=False): + """Emitted when a file search call is completed (results found). + + :ivar type: The type of the event. Always ``response.file_search_call.completed``. Required. + RESPONSE_FILE_SEARCH_CALL_COMPLETED. + :vartype type: Literal["response.file_search_call.completed"] + :ivar output_index: The index of the output item that the file search call is initiated. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.file_search_call.completed"]] + """The type of the event. Always ``response.file_search_call.completed``. Required. + RESPONSE_FILE_SEARCH_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item that the file search call is initiated. Required.""" + item_id: Required[str] + """The ID of the output item that the file search call is initiated. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseFileSearchCallInProgressEvent(TypedDict, total=False): + """Emitted when a file search call is initiated. + + :ivar type: The type of the event. Always ``response.file_search_call.in_progress``. Required. + RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS. + :vartype type: Literal["response.file_search_call.in_progress"] + :ivar output_index: The index of the output item that the file search call is initiated. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.file_search_call.in_progress"]] + """The type of the event. Always ``response.file_search_call.in_progress``. Required. + RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item that the file search call is initiated. Required.""" + item_id: Required[str] + """The ID of the output item that the file search call is initiated. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseFileSearchCallSearchingEvent(TypedDict, total=False): + """Emitted when a file search is currently searching. + + :ivar type: The type of the event. Always ``response.file_search_call.searching``. Required. + RESPONSE_FILE_SEARCH_CALL_SEARCHING. + :vartype type: Literal["response.file_search_call.searching"] + :ivar output_index: The index of the output item that the file search call is searching. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.file_search_call.searching"]] + """The type of the event. Always ``response.file_search_call.searching``. Required. + RESPONSE_FILE_SEARCH_CALL_SEARCHING.""" + output_index: Required[int] + """The index of the output item that the file search call is searching. Required.""" + item_id: Required[str] + """The ID of the output item that the file search call is initiated. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseFormatJsonSchemaSchema(TypedDict, total=False): + """JSON schema.""" + + + class ResponseFunctionCallArgumentsDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial function-call arguments delta. + + :ivar type: The type of the event. Always ``response.function_call_arguments.delta``. Required. + RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA. + :vartype type: Literal["response.function_call_arguments.delta"] + :ivar item_id: The ID of the output item that the function-call arguments delta is added to. + Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the function-call arguments delta is + added to. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar delta: The function-call arguments delta that is added. Required. + :vartype delta: str + """ + + type: Required[Literal["response.function_call_arguments.delta"]] + """The type of the event. Always ``response.function_call_arguments.delta``. Required. + RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA.""" + item_id: Required[str] + """The ID of the output item that the function-call arguments delta is added to. Required.""" + output_index: Required[int] + """The index of the output item that the function-call arguments delta is added to. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + delta: Required[str] + """The function-call arguments delta that is added. Required.""" + + + class ResponseFunctionCallArgumentsDoneEvent(TypedDict, total=False): + """Emitted when function-call arguments are finalized. + + :ivar type: Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE. + :vartype type: Literal["response.function_call_arguments.done"] + :ivar item_id: The ID of the item. Required. + :vartype item_id: str + :ivar name: The name of the function that was called. Required. + :vartype name: str + :ivar output_index: The index of the output item. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar arguments: The function-call arguments. Required. + :vartype arguments: str + """ + + type: Required[Literal["response.function_call_arguments.done"]] + """Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE.""" + item_id: Required[str] + """The ID of the item. Required.""" + name: Required[str] + """The name of the function that was called. Required.""" + output_index: Required[int] + """The index of the output item. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + arguments: Required[str] + """The function-call arguments. Required.""" + + + class ResponseImageGenCallCompletedEvent(TypedDict, total=False): + """ResponseImageGenCallCompletedEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.completed'. Required. + RESPONSE_IMAGE_GENERATION_CALL_COMPLETED. + :vartype type: Literal["response.image_generation_call.completed"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + """ + + type: Required[Literal["response.image_generation_call.completed"]] + """The type of the event. Always 'response.image_generation_call.completed'. Required. + RESPONSE_IMAGE_GENERATION_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + + + class ResponseImageGenCallGeneratingEvent(TypedDict, total=False): + """ResponseImageGenCallGeneratingEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.generating'. + Required. RESPONSE_IMAGE_GENERATION_CALL_GENERATING. + :vartype type: Literal["response.image_generation_call.generating"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.image_generation_call.generating"]] + """The type of the event. Always 'response.image_generation_call.generating'. Required. + RESPONSE_IMAGE_GENERATION_CALL_GENERATING.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + sequence_number: Required[int] + """The sequence number of the image generation item being processed. Required.""" + + + class ResponseImageGenCallInProgressEvent(TypedDict, total=False): + """ResponseImageGenCallInProgressEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.in_progress'. + Required. RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS. + :vartype type: Literal["response.image_generation_call.in_progress"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.image_generation_call.in_progress"]] + """The type of the event. Always 'response.image_generation_call.in_progress'. Required. + RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + sequence_number: Required[int] + """The sequence number of the image generation item being processed. Required.""" + + + class ResponseImageGenCallPartialImageEvent(TypedDict, total=False): + """ResponseImageGenCallPartialImageEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.partial_image'. + Required. RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE. + :vartype type: Literal["response.image_generation_call.partial_image"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + :ivar partial_image_index: 0-based index for the partial image (backend is 1-based, but this is + 0-based for the user). Required. + :vartype partial_image_index: int + :ivar partial_image_b64: Base64-encoded partial image data, suitable for rendering as an image. + Required. + :vartype partial_image_b64: str + :ivar size: The image size that was used. + :vartype size: str + :ivar quality: The image quality that was used. + :vartype quality: str + :ivar background: The background setting that was used. + :vartype background: str + :ivar output_format: The output format that was used. + :vartype output_format: str + """ + + type: Required[Literal["response.image_generation_call.partial_image"]] + """The type of the event. Always 'response.image_generation_call.partial_image'. Required. + RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the image generation item being processed. Required.""" + sequence_number: Required[int] + """The sequence number of the image generation item being processed. Required.""" + partial_image_index: Required[int] + """0-based index for the partial image (backend is 1-based, but this is 0-based for the user). + Required.""" + partial_image_b64: Required[str] + """Base64-encoded partial image data, suitable for rendering as an image. Required.""" + size: str + """The image size that was used.""" + quality: str + """The image quality that was used.""" + background: str + """The background setting that was used.""" + output_format: str + """The output format that was used.""" + + + class ResponseIncompleteDetails(TypedDict, total=False): + """ResponseIncompleteDetails. + + :ivar reason: Is either a Literal["max_output_tokens"] type or a Literal["content_filter"] + type. + :vartype reason: Literal["max_output_tokens", "content_filter"] + """ + + reason: Literal["max_output_tokens", "content_filter"] + """Is either a Literal[\"max_output_tokens\"] type or a Literal[\"content_filter\"] type.""" + + + class ResponseIncompleteEvent(TypedDict, total=False): + """An event that is emitted when a response finishes as incomplete. + + :ivar type: The type of the event. Always ``response.incomplete``. Required. + RESPONSE_INCOMPLETE. + :vartype type: Literal["response.incomplete"] + :ivar response: The response that was incomplete. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.incomplete"]] + """The type of the event. Always ``response.incomplete``. Required. RESPONSE_INCOMPLETE.""" + response: Required["ResponseObject"] + """The response that was incomplete. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseInProgressEvent(TypedDict, total=False): + """Emitted when the response is in progress. + + :ivar type: The type of the event. Always ``response.in_progress``. Required. + RESPONSE_IN_PROGRESS. + :vartype type: Literal["response.in_progress"] + :ivar response: The response that is in progress. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.in_progress"]] + """The type of the event. Always ``response.in_progress``. Required. RESPONSE_IN_PROGRESS.""" + response: Required["ResponseObject"] + """The response that is in progress. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseLogProb(TypedDict, total=False): + """A logprob is the logarithmic probability that the model assigns to producing a particular token + at a given position in the sequence. Less-negative (higher) logprob values indicate greater + model confidence in that token choice. + + :ivar token: A possible text token. Required. + :vartype token: str + :ivar logprob: The log probability of this token. Required. + :vartype logprob: float + :ivar top_logprobs: The log probabilities of up to 20 of the most likely tokens. + :vartype top_logprobs: list["ResponseLogProbTopLogprobs"] + """ + + token: Required[str] + """A possible text token. Required.""" + logprob: Required[float] + """The log probability of this token. Required.""" + top_logprobs: list["ResponseLogProbTopLogprobs"] + """The log probabilities of up to 20 of the most likely tokens.""" + + + class ResponseLogProbTopLogprobs(TypedDict, total=False): + """ResponseLogProbTopLogprobs. + + :ivar token: + :vartype token: str + :ivar logprob: + :vartype logprob: float + """ + + token: str + logprob: float + + + class ResponseMCPCallArgumentsDeltaEvent(TypedDict, total=False): + """ResponseMCPCallArgumentsDeltaEvent. + + :ivar type: The type of the event. Always 'response.mcp_call_arguments.delta'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DELTA. + :vartype type: Literal["response.mcp_call_arguments.delta"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + :ivar delta: A JSON string containing the partial update to the arguments for the MCP tool + call. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_call_arguments.delta"]] + """The type of the event. Always 'response.mcp_call_arguments.delta'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DELTA.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the MCP tool call item being processed. Required.""" + delta: Required[str] + """A JSON string containing the partial update to the arguments for the MCP tool call. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseMCPCallArgumentsDoneEvent(TypedDict, total=False): + """ResponseMCPCallArgumentsDoneEvent. + + :ivar type: The type of the event. Always 'response.mcp_call_arguments.done'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DONE. + :vartype type: Literal["response.mcp_call_arguments.done"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + :ivar arguments: A JSON string containing the finalized arguments for the MCP tool call. + Required. + :vartype arguments: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_call_arguments.done"]] + """The type of the event. Always 'response.mcp_call_arguments.done'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DONE.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the MCP tool call item being processed. Required.""" + arguments: Required[str] + """A JSON string containing the finalized arguments for the MCP tool call. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseMCPCallCompletedEvent(TypedDict, total=False): + """ResponseMCPCallCompletedEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.completed'. Required. + RESPONSE_MCP_CALL_COMPLETED. + :vartype type: Literal["response.mcp_call.completed"] + :ivar item_id: The ID of the MCP tool call item that completed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that completed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_call.completed"]] + """The type of the event. Always 'response.mcp_call.completed'. Required. + RESPONSE_MCP_CALL_COMPLETED.""" + item_id: Required[str] + """The ID of the MCP tool call item that completed. Required.""" + output_index: Required[int] + """The index of the output item that completed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseMCPCallFailedEvent(TypedDict, total=False): + """ResponseMCPCallFailedEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.failed'. Required. + RESPONSE_MCP_CALL_FAILED. + :vartype type: Literal["response.mcp_call.failed"] + :ivar item_id: The ID of the MCP tool call item that failed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that failed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_call.failed"]] + """The type of the event. Always 'response.mcp_call.failed'. Required. RESPONSE_MCP_CALL_FAILED.""" + item_id: Required[str] + """The ID of the MCP tool call item that failed. Required.""" + output_index: Required[int] + """The index of the output item that failed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseMCPCallInProgressEvent(TypedDict, total=False): + """ResponseMCPCallInProgressEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.in_progress'. Required. + RESPONSE_MCP_CALL_IN_PROGRESS. + :vartype type: Literal["response.mcp_call.in_progress"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + """ + + type: Required[Literal["response.mcp_call.in_progress"]] + """The type of the event. Always 'response.mcp_call.in_progress'. Required. + RESPONSE_MCP_CALL_IN_PROGRESS.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + item_id: Required[str] + """The unique identifier of the MCP tool call item being processed. Required.""" + + + class ResponseMCPListToolsCompletedEvent(TypedDict, total=False): + """ResponseMCPListToolsCompletedEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.completed'. Required. + RESPONSE_MCP_LIST_TOOLS_COMPLETED. + :vartype type: Literal["response.mcp_list_tools.completed"] + :ivar item_id: The ID of the MCP tool call item that produced this output. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that was processed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_list_tools.completed"]] + """The type of the event. Always 'response.mcp_list_tools.completed'. Required. + RESPONSE_MCP_LIST_TOOLS_COMPLETED.""" + item_id: Required[str] + """The ID of the MCP tool call item that produced this output. Required.""" + output_index: Required[int] + """The index of the output item that was processed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseMCPListToolsFailedEvent(TypedDict, total=False): + """ResponseMCPListToolsFailedEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.failed'. Required. + RESPONSE_MCP_LIST_TOOLS_FAILED. + :vartype type: Literal["response.mcp_list_tools.failed"] + :ivar item_id: The ID of the MCP tool call item that failed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that failed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_list_tools.failed"]] + """The type of the event. Always 'response.mcp_list_tools.failed'. Required. + RESPONSE_MCP_LIST_TOOLS_FAILED.""" + item_id: Required[str] + """The ID of the MCP tool call item that failed. Required.""" + output_index: Required[int] + """The index of the output item that failed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseMCPListToolsInProgressEvent(TypedDict, total=False): + """ResponseMCPListToolsInProgressEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. + RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS. + :vartype type: Literal["response.mcp_list_tools.in_progress"] + :ivar item_id: The ID of the MCP tool call item that is being processed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that is being processed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.mcp_list_tools.in_progress"]] + """The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. + RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS.""" + item_id: Required[str] + """The ID of the MCP tool call item that is being processed. Required.""" + output_index: Required[int] + """The index of the output item that is being processed. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseObject(TypedDict, total=False): + """The response object. + + :ivar metadata: + :vartype metadata: "Metadata" + :ivar top_logprobs: + :vartype top_logprobs: int + :ivar temperature: + :vartype temperature: float + :ivar top_p: + :vartype top_p: float + :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers. + :vartype user: str + :ivar safety_identifier: + :vartype safety_identifier: str + :ivar prompt_cache_key: + :vartype prompt_cache_key: str + :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type. + :vartype prompt_cache_retention: Literal["in_memory", "24h"] + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar model: The model deployment to use for the creation of this response. + :vartype model: str + :ivar background: + :vartype background: bool + :ivar max_tool_calls: + :vartype max_tool_calls: int + :ivar text: + :vartype text: "ResponseTextParam" + :ivar tools: + :vartype tools: list["Tool"] + :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. + :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + :ivar prompt: + :vartype prompt: "Prompt" + :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"] + :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast", + "ultrafast"] + :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. + :vartype truncation: Literal["auto", "disabled"] + :ivar id: Unique identifier for this Response. Required. + :vartype id: str + :ivar object: The object type of this resource - always set to ``response``. Required. Default + value is "response". + :vartype object: Literal["response"] + :ivar status: The status of the response generation. One of ``completed``, ``failed``, + ``in_progress``, ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: + Literal["completed"], Literal["failed"], Literal["in_progress"], Literal["cancelled"], + Literal["queued"], Literal["incomplete"] + :vartype status: Literal["completed", "failed", "in_progress", "cancelled", "queued", + "incomplete"] + :ivar created_at: Unix timestamp (in seconds) of when this Response was created. Required. + :vartype created_at: int + :ivar completed_at: + :vartype completed_at: int + :ivar error: Required. + :vartype error: "ResponseErrorInfo" + :ivar incomplete_details: Required. + :vartype incomplete_details: "ResponseIncompleteDetails" + :ivar output: An array of content items generated by the model. The length and order of items + depends on the model response. Use the output_text property instead of assuming the first item + is an assistant message. Required. + :vartype output: list["OutputItem"] + :ivar reasoning: + :vartype reasoning: "Reasoning" + :ivar instructions: Required. Is either a str type or a [Item] type. + :vartype instructions: Union[str, list["Item"]] + :ivar output_text: + :vartype output_text: str + :ivar usage: + :vartype usage: "ResponseUsage" + :ivar prompt_cache_options: + :vartype prompt_cache_options: "PromptCacheOptions" + :ivar moderation: + :vartype moderation: "Moderation" + :ivar parallel_tool_calls: Whether to allow the model to run tool calls in parallel. Required. + :vartype parallel_tool_calls: bool + :ivar conversation: + :vartype conversation: "ConversationReference" + :ivar max_output_tokens: + :vartype max_output_tokens: int + :ivar agent_reference: The agent used for this response. Required. + :vartype agent_reference: "AgentReference" + """ + + metadata: Optional["Metadata"] + top_logprobs: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + user: str + """This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.""" + safety_identifier: Optional[str] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[Literal["in_memory", "24h"]] + """Is either a Literal[\"in_memory\"] type or a Literal[\"24h\"] type.""" + previous_response_id: Optional[str] + model: str + """The model deployment to use for the creation of this response.""" + background: Optional[bool] + max_tool_calls: Optional[int] + text: "ResponseTextParam" + tools: list["Tool"] + tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + """Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.""" + prompt: "Prompt" + service_tier: Optional[Literal["auto", "default", "flex", "scale", "priority", "fast", "ultrafast"]] + """Is one of the following types: Literal[\"auto\"], Literal[\"default\"], Literal[\"flex\"], + Literal[\"scale\"], Literal[\"priority\"], Literal[\"fast\"], Literal[\"ultrafast\"]""" + truncation: Optional[Literal["auto", "disabled"]] + """Is either a Literal[\"auto\"] type or a Literal[\"disabled\"] type.""" + id: Required[str] + """Unique identifier for this Response. Required.""" + object: Required[Literal["response"]] + """The object type of this resource - always set to ``response``. Required. Default value is + \"response\".""" + status: Literal["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"] + """The status of the response generation. One of ``completed``, ``failed``, ``in_progress``, + ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: + Literal[\"completed\"], Literal[\"failed\"], Literal[\"in_progress\"], Literal[\"cancelled\"], + Literal[\"queued\"], Literal[\"incomplete\"]""" + created_at: Required[int] + """Unix timestamp (in seconds) of when this Response was created. Required.""" + completed_at: Optional[int] + error: Required[Optional["ResponseErrorInfo"]] + """Required.""" + incomplete_details: Required[Optional["ResponseIncompleteDetails"]] + """Required.""" + output: Required[list["OutputItem"]] + """An array of content items generated by the model. The length and order of items depends on the + model response. Use the output_text property instead of assuming the first item is an assistant + message. Required.""" + reasoning: Optional["Reasoning"] + instructions: Required[Optional[Union[str, list["Item"]]]] + """Required. Is either a str type or a [Item] type.""" + output_text: Optional[str] + usage: "ResponseUsage" + prompt_cache_options: "PromptCacheOptions" + moderation: Optional["Moderation"] + parallel_tool_calls: Required[bool] + """Whether to allow the model to run tool calls in parallel. Required.""" + conversation: Optional["ConversationReference"] + max_output_tokens: Optional[int] + agent_reference: Required[Optional["AgentReference"]] + """The agent used for this response. Required.""" + + + class ResponseOutputItemAddedEvent(TypedDict, total=False): + """Emitted when a new output item is added. + + :ivar type: The type of the event. Always ``response.output_item.added``. Required. + RESPONSE_OUTPUT_ITEM_ADDED. + :vartype type: Literal["response.output_item.added"] + :ivar output_index: The index of the output item that was added. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item: The output item that was added. For reasoning items, ``encrypted_content`` may be + incomplete while the item is in progress. Use the reasoning item from the corresponding + ``response.output_item.done`` event when passing it as input to a subsequent request. Required. + :vartype item: "OutputItem" + """ + + type: Required[Literal["response.output_item.added"]] + """The type of the event. Always ``response.output_item.added``. Required. + RESPONSE_OUTPUT_ITEM_ADDED.""" + output_index: Required[int] + """The index of the output item that was added. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + item: Required["OutputItem"] + """The output item that was added. For reasoning items, ``encrypted_content`` may be incomplete + while the item is in progress. Use the reasoning item from the corresponding + ``response.output_item.done`` event when passing it as input to a subsequent request. Required.""" + + + class ResponseOutputItemDoneEvent(TypedDict, total=False): + """Emitted when an output item is marked done. + + :ivar type: The type of the event. Always ``response.output_item.done``. Required. + RESPONSE_OUTPUT_ITEM_DONE. + :vartype type: Literal["response.output_item.done"] + :ivar output_index: The index of the output item that was marked done. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item: The output item that was marked done. Required. + :vartype item: "OutputItem" + """ + + type: Required[Literal["response.output_item.done"]] + """The type of the event. Always ``response.output_item.done``. Required. + RESPONSE_OUTPUT_ITEM_DONE.""" + output_index: Required[int] + """The index of the output item that was marked done. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + item: Required["OutputItem"] + """The output item that was marked done. Required.""" + + + class ResponseOutputTextAnnotationAddedEvent(TypedDict, total=False): + """ResponseOutputTextAnnotationAddedEvent. + + :ivar type: The type of the event. Always 'response.output_text.annotation.added'. Required. + RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED. + :vartype type: Literal["response.output_text.annotation.added"] + :ivar item_id: The unique identifier of the item to which the annotation is being added. + Required. + :vartype item_id: str + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar content_index: The index of the content part within the output item. Required. + :vartype content_index: int + :ivar annotation_index: The index of the annotation within the content part. Required. + :vartype annotation_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar annotation: The annotation object being added. (See annotation schema for details.). + Required. + :vartype annotation: "Annotation" + """ + + type: Required[Literal["response.output_text.annotation.added"]] + """The type of the event. Always 'response.output_text.annotation.added'. Required. + RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED.""" + item_id: Required[str] + """The unique identifier of the item to which the annotation is being added. Required.""" + output_index: Required[int] + """The index of the output item in the response's output array. Required.""" + content_index: Required[int] + """The index of the content part within the output item. Required.""" + annotation_index: Required[int] + """The index of the annotation within the content part. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + annotation: Required["Annotation"] + """The annotation object being added. (See annotation schema for details.). Required.""" + + + class ResponsePromptVariables(TypedDict, total=False): + """Prompt Variables.""" + + + class ResponseQueuedEvent(TypedDict, total=False): + """ResponseQueuedEvent. + + :ivar type: The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED. + :vartype type: Literal["response.queued"] + :ivar response: The full response object that is queued. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.queued"]] + """The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED.""" + response: Required["ResponseObject"] + """The full response object that is queued. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + + + class ResponseReasoningSummaryPartAddedEvent(TypedDict, total=False): + """Emitted when a new reasoning summary part is added. + + :ivar type: The type of the event. Always ``response.reasoning_summary_part.added``. Required. + RESPONSE_REASONING_SUMMARY_PART_ADDED. + :vartype type: Literal["response.reasoning_summary_part.added"] + :ivar item_id: The ID of the item this summary part is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary part is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The summary part that was added. Required. + :vartype part: "ResponseReasoningSummaryPartAddedEventPart" + """ + + type: Required[Literal["response.reasoning_summary_part.added"]] + """The type of the event. Always ``response.reasoning_summary_part.added``. Required. + RESPONSE_REASONING_SUMMARY_PART_ADDED.""" + item_id: Required[str] + """The ID of the item this summary part is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary part is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + part: Required["ResponseReasoningSummaryPartAddedEventPart"] + """The summary part that was added. Required.""" + + + class ResponseReasoningSummaryPartAddedEventPart(TypedDict, total=False): # pylint: disable=name-too-long + """ResponseReasoningSummaryPartAddedEventPart. + + :ivar type: Required. Default value is "summary_text". + :vartype type: Literal["summary_text"] + :ivar text: Required. + :vartype text: str + """ + + type: Required[Literal["summary_text"]] + """Required. Default value is \"summary_text\".""" + text: Required[str] + """Required.""" + + + class ResponseReasoningSummaryPartDoneEvent(TypedDict, total=False): + """Emitted when a reasoning summary part is completed. + + :ivar type: The type of the event. Always ``response.reasoning_summary_part.done``. Required. + RESPONSE_REASONING_SUMMARY_PART_DONE. + :vartype type: Literal["response.reasoning_summary_part.done"] + :ivar item_id: The ID of the item this summary part is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary part is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar status: The completion status of the summary part. Omitted when the part completed + normally and set to ``incomplete`` when generation was interrupted. Default value is + "incomplete". + :vartype status: Literal["incomplete"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The completed summary part. Required. + :vartype part: "ResponseReasoningSummaryPartDoneEventPart" + """ + + type: Required[Literal["response.reasoning_summary_part.done"]] + """The type of the event. Always ``response.reasoning_summary_part.done``. Required. + RESPONSE_REASONING_SUMMARY_PART_DONE.""" + item_id: Required[str] + """The ID of the item this summary part is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary part is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + status: Literal["incomplete"] + """The completion status of the summary part. Omitted when the part completed normally and set to + ``incomplete`` when generation was interrupted. Default value is \"incomplete\".""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + part: Required["ResponseReasoningSummaryPartDoneEventPart"] + """The completed summary part. Required.""" + + + class ResponseReasoningSummaryPartDoneEventPart(TypedDict, total=False): # pylint: disable=name-too-long + """ResponseReasoningSummaryPartDoneEventPart. + + :ivar type: Required. Default value is "summary_text". + :vartype type: Literal["summary_text"] + :ivar text: Required. + :vartype text: str + """ + + type: Required[Literal["summary_text"]] + """Required. Default value is \"summary_text\".""" + text: Required[str] + """Required.""" + + + class ResponseReasoningSummaryTextDeltaEvent(TypedDict, total=False): + """Emitted when a delta is added to a reasoning summary text. + + :ivar type: The type of the event. Always ``response.reasoning_summary_text.delta``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DELTA. + :vartype type: Literal["response.reasoning_summary_text.delta"] + :ivar item_id: The ID of the item this summary text delta is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary text delta is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar delta: The text delta that was added to the summary. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.reasoning_summary_text.delta"]] + """The type of the event. Always ``response.reasoning_summary_text.delta``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DELTA.""" + item_id: Required[str] + """The ID of the item this summary text delta is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary text delta is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + delta: Required[str] + """The text delta that was added to the summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseReasoningSummaryTextDoneEvent(TypedDict, total=False): + """Emitted when a reasoning summary text is completed. + + :ivar type: The type of the event. Always ``response.reasoning_summary_text.done``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DONE. + :vartype type: Literal["response.reasoning_summary_text.done"] + :ivar item_id: The ID of the item this summary text is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary text is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar text: The full text of the completed reasoning summary. Required. + :vartype text: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.reasoning_summary_text.done"]] + """The type of the event. Always ``response.reasoning_summary_text.done``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DONE.""" + item_id: Required[str] + """The ID of the item this summary text is associated with. Required.""" + output_index: Required[int] + """The index of the output item this summary text is associated with. Required.""" + summary_index: Required[int] + """The index of the summary part within the reasoning summary. Required.""" + text: Required[str] + """The full text of the completed reasoning summary. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseReasoningTextDeltaEvent(TypedDict, total=False): + """Emitted when a delta is added to a reasoning text. + + :ivar type: The type of the event. Always ``response.reasoning_text.delta``. Required. + RESPONSE_REASONING_TEXT_DELTA. + :vartype type: Literal["response.reasoning_text.delta"] + :ivar item_id: The ID of the item this reasoning text delta is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this reasoning text delta is associated with. + Required. + :vartype output_index: int + :ivar content_index: The index of the reasoning content part this delta is associated with. + Required. + :vartype content_index: int + :ivar delta: The text delta that was added to the reasoning content. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.reasoning_text.delta"]] + """The type of the event. Always ``response.reasoning_text.delta``. Required. + RESPONSE_REASONING_TEXT_DELTA.""" + item_id: Required[str] + """The ID of the item this reasoning text delta is associated with. Required.""" + output_index: Required[int] + """The index of the output item this reasoning text delta is associated with. Required.""" + content_index: Required[int] + """The index of the reasoning content part this delta is associated with. Required.""" + delta: Required[str] + """The text delta that was added to the reasoning content. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseReasoningTextDoneEvent(TypedDict, total=False): + """Emitted when a reasoning text is completed. + + :ivar type: The type of the event. Always ``response.reasoning_text.done``. Required. + RESPONSE_REASONING_TEXT_DONE. + :vartype type: Literal["response.reasoning_text.done"] + :ivar item_id: The ID of the item this reasoning text is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this reasoning text is associated with. + Required. + :vartype output_index: int + :ivar content_index: The index of the reasoning content part. Required. + :vartype content_index: int + :ivar text: The full text of the completed reasoning content. Required. + :vartype text: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.reasoning_text.done"]] + """The type of the event. Always ``response.reasoning_text.done``. Required. + RESPONSE_REASONING_TEXT_DONE.""" + item_id: Required[str] + """The ID of the item this reasoning text is associated with. Required.""" + output_index: Required[int] + """The index of the output item this reasoning text is associated with. Required.""" + content_index: Required[int] + """The index of the reasoning content part. Required.""" + text: Required[str] + """The full text of the completed reasoning content. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseRefusalDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial refusal text. + + :ivar type: The type of the event. Always ``response.refusal.delta``. Required. + RESPONSE_REFUSAL_DELTA. + :vartype type: Literal["response.refusal.delta"] + :ivar item_id: The ID of the output item that the refusal text is added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the refusal text is added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the refusal text is added to. Required. + :vartype content_index: int + :ivar delta: The refusal text that is added. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.refusal.delta"]] + """The type of the event. Always ``response.refusal.delta``. Required. RESPONSE_REFUSAL_DELTA.""" + item_id: Required[str] + """The ID of the output item that the refusal text is added to. Required.""" + output_index: Required[int] + """The index of the output item that the refusal text is added to. Required.""" + content_index: Required[int] + """The index of the content part that the refusal text is added to. Required.""" + delta: Required[str] + """The refusal text that is added. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseRefusalDoneEvent(TypedDict, total=False): + """Emitted when refusal text is finalized. + + :ivar type: The type of the event. Always ``response.refusal.done``. Required. + RESPONSE_REFUSAL_DONE. + :vartype type: Literal["response.refusal.done"] + :ivar item_id: The ID of the output item that the refusal text is finalized. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the refusal text is finalized. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the refusal text is finalized. + Required. + :vartype content_index: int + :ivar refusal: The refusal text that is finalized. Required. + :vartype refusal: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.refusal.done"]] + """The type of the event. Always ``response.refusal.done``. Required. RESPONSE_REFUSAL_DONE.""" + item_id: Required[str] + """The ID of the output item that the refusal text is finalized. Required.""" + output_index: Required[int] + """The index of the output item that the refusal text is finalized. Required.""" + content_index: Required[int] + """The index of the content part that the refusal text is finalized. Required.""" + refusal: Required[str] + """The refusal text that is finalized. Required.""" + sequence_number: Required[int] + """The sequence number of this event. Required.""" + + + class ResponseStreamOptions(TypedDict, total=False): + """Options for streaming responses. Only set this when you set ``stream: true``. + + :ivar include_obfuscation: When true, stream obfuscation will be enabled. Stream obfuscation + adds random characters to an ``obfuscation`` field on streaming delta events to normalize + payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are + included by default, but add a small amount of overhead to the data stream. You can set + ``include_obfuscation`` to false to optimize for bandwidth if you trust the network links + between your application and the OpenAI API. + :vartype include_obfuscation: bool + """ + + include_obfuscation: bool + """When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an + ``obfuscation`` field on streaming delta events to normalize payload sizes as a mitigation to + certain side-channel attacks. These obfuscation fields are included by default, but add a small + amount of overhead to the data stream. You can set ``include_obfuscation`` to false to optimize + for bandwidth if you trust the network links between your application and the OpenAI API.""" + + + class ResponseTextDeltaEvent(TypedDict, total=False): + """Emitted when there is an additional text delta. + + :ivar type: The type of the event. Always ``response.output_text.delta``. Required. + RESPONSE_OUTPUT_TEXT_DELTA. + :vartype type: Literal["response.output_text.delta"] + :ivar item_id: The ID of the output item that the text delta was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the text delta was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the text delta was added to. Required. + :vartype content_index: int + :ivar delta: The text delta that was added. Required. + :vartype delta: str + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + :ivar logprobs: The log probabilities of the tokens in the delta. Required. + :vartype logprobs: list["ResponseLogProb"] + """ + + type: Required[Literal["response.output_text.delta"]] + """The type of the event. Always ``response.output_text.delta``. Required. + RESPONSE_OUTPUT_TEXT_DELTA.""" + item_id: Required[str] + """The ID of the output item that the text delta was added to. Required.""" + output_index: Required[int] + """The index of the output item that the text delta was added to. Required.""" + content_index: Required[int] + """The index of the content part that the text delta was added to. Required.""" + delta: Required[str] + """The text delta that was added. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + logprobs: Required[list["ResponseLogProb"]] + """The log probabilities of the tokens in the delta. Required.""" + + + class ResponseTextDoneEvent(TypedDict, total=False): + """Emitted when text content is finalized. + + :ivar type: The type of the event. Always ``response.output_text.done``. Required. + RESPONSE_OUTPUT_TEXT_DONE. + :vartype type: Literal["response.output_text.done"] + :ivar item_id: The ID of the output item that the text content is finalized. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the text content is finalized. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the text content is finalized. + Required. + :vartype content_index: int + :ivar text: The text content that is finalized. Required. + :vartype text: str + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + :ivar logprobs: The log probabilities of the tokens in the delta. Required. + :vartype logprobs: list["ResponseLogProb"] + """ + + type: Required[Literal["response.output_text.done"]] + """The type of the event. Always ``response.output_text.done``. Required. + RESPONSE_OUTPUT_TEXT_DONE.""" + item_id: Required[str] + """The ID of the output item that the text content is finalized. Required.""" + output_index: Required[int] + """The index of the output item that the text content is finalized. Required.""" + content_index: Required[int] + """The index of the content part that the text content is finalized. Required.""" + text: Required[str] + """The text content that is finalized. Required.""" + sequence_number: Required[int] + """The sequence number for this event. Required.""" + logprobs: Required[list["ResponseLogProb"]] + """The log probabilities of the tokens in the delta. Required.""" + + + class ResponseTextParam(TypedDict, total=False): + """Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + + * [Text inputs and outputs](/docs/guides/text) + * [Structured Outputs](/docs/guides/structured-outputs). + + :ivar format: + :vartype format: "TextResponseFormatConfiguration" + :ivar verbosity: Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"] + :vartype verbosity: Literal["low", "medium", "high"] + """ + + format: "TextResponseFormatConfiguration" + verbosity: Optional[Literal["low", "medium", "high"]] + """Is one of the following types: Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" + + + class ResponseUsage(TypedDict, total=False): + """Represents token usage details including input tokens, output tokens, a breakdown of output + tokens, and the total tokens used. + + :ivar input_tokens: The number of input tokens. Required. + :vartype input_tokens: int + :ivar input_tokens_details: A detailed breakdown of the input tokens. Required. + :vartype input_tokens_details: "ResponseUsageInputTokensDetails" + :ivar output_tokens: The number of output tokens. Required. + :vartype output_tokens: int + :ivar output_tokens_details: A detailed breakdown of the output tokens. Required. + :vartype output_tokens_details: "ResponseUsageOutputTokensDetails" + :ivar total_tokens: The total number of tokens used. Required. + :vartype total_tokens: int + """ + + input_tokens: Required[int] + """The number of input tokens. Required.""" + input_tokens_details: Required["ResponseUsageInputTokensDetails"] + """A detailed breakdown of the input tokens. Required.""" + output_tokens: Required[int] + """The number of output tokens. Required.""" + output_tokens_details: Required["ResponseUsageOutputTokensDetails"] + """A detailed breakdown of the output tokens. Required.""" + total_tokens: Required[int] + """The total number of tokens used. Required.""" + + + class ResponseUsageInputTokensDetails(TypedDict, total=False): + """ResponseUsageInputTokensDetails. + + :ivar cached_tokens: Required. + :vartype cached_tokens: int + :ivar cache_write_tokens: Required. + :vartype cache_write_tokens: int + """ + + cached_tokens: Required[int] + """Required.""" + cache_write_tokens: Required[int] + """Required.""" + + + class ResponseUsageOutputTokensDetails(TypedDict, total=False): + """ResponseUsageOutputTokensDetails. + + :ivar reasoning_tokens: Required. + :vartype reasoning_tokens: int + """ + + reasoning_tokens: Required[int] + """Required.""" + + + class ResponseWebSearchCallCompletedEvent(TypedDict, total=False): + """Emitted when a web search call is completed. + + :ivar type: The type of the event. Always ``response.web_search_call.completed``. Required. + RESPONSE_WEB_SEARCH_CALL_COMPLETED. + :vartype type: Literal["response.web_search_call.completed"] + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.web_search_call.completed"]] + """The type of the event. Always ``response.web_search_call.completed``. Required. + RESPONSE_WEB_SEARCH_CALL_COMPLETED.""" + output_index: Required[int] + """The index of the output item that the web search call is associated with. Required.""" + item_id: Required[str] + """Unique ID for the output item associated with the web search call. Required.""" + sequence_number: Required[int] + """The sequence number of the web search call being processed. Required.""" + + + class ResponseWebSearchCallInProgressEvent(TypedDict, total=False): + """Emitted when a web search call is initiated. + + :ivar type: The type of the event. Always ``response.web_search_call.in_progress``. Required. + RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS. + :vartype type: Literal["response.web_search_call.in_progress"] + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.web_search_call.in_progress"]] + """The type of the event. Always ``response.web_search_call.in_progress``. Required. + RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS.""" + output_index: Required[int] + """The index of the output item that the web search call is associated with. Required.""" + item_id: Required[str] + """Unique ID for the output item associated with the web search call. Required.""" + sequence_number: Required[int] + """The sequence number of the web search call being processed. Required.""" + + + class ResponseWebSearchCallSearchingEvent(TypedDict, total=False): + """Emitted when a web search call is executing. + + :ivar type: The type of the event. Always ``response.web_search_call.searching``. Required. + RESPONSE_WEB_SEARCH_CALL_SEARCHING. + :vartype type: Literal["response.web_search_call.searching"] + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + + type: Required[Literal["response.web_search_call.searching"]] + """The type of the event. Always ``response.web_search_call.searching``. Required. + RESPONSE_WEB_SEARCH_CALL_SEARCHING.""" + output_index: Required[int] + """The index of the output item that the web search call is associated with. Required.""" + item_id: Required[str] + """Unique ID for the output item associated with the web search call. Required.""" + sequence_number: Required[int] + """The sequence number of the web search call being processed. Required.""" + + + class ScreenshotParam(TypedDict, total=False): + """Screenshot. + + :ivar type: Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT. + :vartype type: Literal["screenshot"] + """ + + type: Required[Literal["screenshot"]] + """Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT.""" + + + class ScrollParam(TypedDict, total=False): + """Scroll. + + :ivar type: Specifies the event type. For a scroll action, this property is always set to + ``scroll``. Required. SCROLL. + :vartype type: Literal["scroll"] + :ivar x: The x-coordinate where the scroll occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the scroll occurred. Required. + :vartype y: int + :ivar scroll_x: The horizontal scroll distance. Required. + :vartype scroll_x: int + :ivar scroll_y: The vertical scroll distance. Required. + :vartype scroll_y: int + :ivar keys: + :vartype keys: list[str] + """ + + type: Required[Literal["scroll"]] + """Specifies the event type. For a scroll action, this property is always set to ``scroll``. + Required. SCROLL.""" + x: Required[int] + """The x-coordinate where the scroll occurred. Required.""" + y: Required[int] + """The y-coordinate where the scroll occurred. Required.""" + scroll_x: Required[int] + """The horizontal scroll distance. Required.""" + scroll_y: Required[int] + """The vertical scroll distance. Required.""" + keys: Optional[list[str]] + + + class SharepointGroundingToolCall(TypedDict, total=False): + """A SharePoint grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL. + :vartype type: Literal["sharepoint_grounding_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["sharepoint_grounding_preview_call"]] + """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + arguments: Required[str] + """A JSON string of the arguments to pass to the tool. Required.""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class SharepointGroundingToolCallOutput(TypedDict, total=False): + """The output of a SharePoint grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["sharepoint_grounding_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the SharePoint grounding tool call. Is one of the following + types: {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["sharepoint_grounding_preview_call_output"]] + """Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.""" + call_id: Required[str] + """The unique ID of the tool call generated by the model. Required.""" + output: "_unions.ToolCallOutputContent" + """The output from the SharePoint grounding tool call. Is one of the following types: {str: Any}, + str, [Any]""" + status: Required[ToolCallStatus] + """The status of the tool call. Required. Known values are: \"in_progress\", \"completed\", + \"incomplete\", and \"failed\".""" + id: Required[str] + """Required.""" + + + class SharepointGroundingToolParameters(TypedDict, total=False): + """The sharepoint grounding tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: list["ToolProjectConnection"] + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connections: list["ToolProjectConnection"] + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + + class SharepointPreviewTool(TypedDict, total=False): + """The input definition information for a sharepoint tool as used to configure an agent. + + :ivar type: The object type, which is always 'sharepoint_grounding_preview'. Required. + SHAREPOINT_GROUNDING_PREVIEW. + :vartype type: Literal["sharepoint_grounding_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. + :vartype sharepoint_grounding_preview: "SharepointGroundingToolParameters" + """ + + type: Required[Literal["sharepoint_grounding_preview"]] + """The object type, which is always 'sharepoint_grounding_preview'. Required. + SHAREPOINT_GROUNDING_PREVIEW.""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + sharepoint_grounding_preview: Required["SharepointGroundingToolParameters"] + """The sharepoint grounding tool parameters. Required.""" + + + class SkillReferenceParam(TypedDict, total=False): + """SkillReferenceParam. + + :ivar type: References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE. + :vartype type: Literal["skill_reference"] + :ivar skill_id: The ID of the referenced skill. Required. + :vartype skill_id: str + :ivar version: Optional skill version. Use a positive integer or 'latest'. Omit for default. + :vartype version: str + """ + + type: Required[Literal["skill_reference"]] + """References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE.""" + skill_id: Required[str] + """The ID of the referenced skill. Required.""" + version: str + """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" + + + class SpecificApplyPatchParam(TypedDict, total=False): + """Specific apply patch tool choice. + + :ivar type: The tool to call. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: Literal["apply_patch"] + """ + + type: Required[Literal["apply_patch"]] + """The tool to call. Always ``apply_patch``. Required. APPLY_PATCH.""" + + + class SpecificFunctionShellParam(TypedDict, total=False): + """Specific shell tool choice. + + :ivar type: The tool to call. Always ``shell``. Required. SHELL. + :vartype type: Literal["shell"] + """ + + type: Required[Literal["shell"]] + """The tool to call. Always ``shell``. Required. SHELL.""" + + + class SpecificProgrammaticToolCallingParam(TypedDict, total=False): + """SpecificProgrammaticToolCallingParam. + + :ivar type: The tool to call. Always ``programmatic_tool_calling``. Required. + PROGRAMMATIC_TOOL_CALLING. + :vartype type: Literal["programmatic_tool_calling"] + """ + + type: Required[Literal["programmatic_tool_calling"]] + """The tool to call. Always ``programmatic_tool_calling``. Required. PROGRAMMATIC_TOOL_CALLING.""" + + + class StructuredOutputDefinition(TypedDict, total=False): + """A structured output that can be produced by the agent. + + :ivar name: The name of the structured output. Required. + :vartype name: str + :ivar description: A description of the output to emit. Used by the model to determine when to + emit the output. Required. + :vartype description: str + :ivar schema: The JSON schema for the structured output. Required. + :vartype schema: dict[str, Any] + :ivar strict: Whether to enforce strict validation. Default ``true``. Required. + :vartype strict: bool + """ + + name: Required[str] + """The name of the structured output. Required.""" + description: Required[str] + """A description of the output to emit. Used by the model to determine when to emit the output. + Required.""" + schema: Required[dict[str, Any]] + """The JSON schema for the structured output. Required.""" + strict: Required[Optional[bool]] + """Whether to enforce strict validation. Default ``true``. Required.""" + + + class StructuredOutputsOutputItem(TypedDict, total=False): + """StructuredOutputsOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. STRUCTURED_OUTPUTS. + :vartype type: Literal["structured_outputs"] + :ivar output: The structured output captured during the response. Required. + :vartype output: Any + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["structured_outputs"]] + """Required. STRUCTURED_OUTPUTS.""" + output: Required[Any] + """The structured output captured during the response. Required.""" + id: Required[str] + """Required.""" + + + class SummaryTextContent(TypedDict, total=False): + """Summary text. + + :ivar type: The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT. + :vartype type: Literal["summary_text"] + :ivar text: A summary of the reasoning output from the model so far. Required. + :vartype text: str + """ + + type: Required[Literal["summary_text"]] + """The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT.""" + text: Required[str] + """A summary of the reasoning output from the model so far. Required.""" + + + class TextContent(TypedDict, total=False): + """Text Content. + + :ivar type: Required. TEXT. + :vartype type: Literal["text"] + :ivar text: Required. + :vartype text: str + """ + + type: Required[Literal["text"]] + """Required. TEXT.""" + text: Required[str] + """Required.""" + + + class TextResponseFormatConfigurationResponseFormatJsonObject(TypedDict, total=False): # pylint: disable=name-too-long + """JSON object. + + :ivar type: The type of response format being defined. Always ``json_object``. Required. + JSON_OBJECT. + :vartype type: Literal["json_object"] + """ + + type: Required[Literal["json_object"]] + """The type of response format being defined. Always ``json_object``. Required. JSON_OBJECT.""" + + + class TextResponseFormatConfigurationResponseFormatText(TypedDict, total=False): # pylint: disable=name-too-long + """Text. + + :ivar type: The type of response format being defined. Always ``text``. Required. TEXT. + :vartype type: Literal["text"] + """ + + type: Required[Literal["text"]] + """The type of response format being defined. Always ``text``. Required. TEXT.""" + + + class TextResponseFormatJsonSchema(TypedDict, total=False): + """JSON schema. + + :ivar type: The type of response format being defined. Always ``json_schema``. Required. + JSON_SCHEMA. + :vartype type: Literal["json_schema"] + :ivar description: A description of what the response format is for, used by the model to + determine how to respond in the format. + :vartype description: str + :ivar name: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and + dashes, with a maximum length of 64. Required. + :vartype name: str + :ivar schema: Required. + :vartype schema: "ResponseFormatJsonSchemaSchema" + :ivar strict: + :vartype strict: bool + """ + + type: Required[Literal["json_schema"]] + """The type of response format being defined. Always ``json_schema``. Required. JSON_SCHEMA.""" + description: str + """A description of what the response format is for, used by the model to determine how to respond + in the format.""" + name: Required[str] + """The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with + a maximum length of 64. Required.""" + schema: Required["ResponseFormatJsonSchemaSchema"] + """Required.""" + strict: Optional[bool] + + + class ToolChoiceAllowed(TypedDict, total=False): + """Allowed tools. + + :ivar type: Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS. + :vartype type: Literal["allowed_tools"] + :ivar mode: Constrains the tools available to the model to a pre-defined set. ``auto`` allows + the model to pick from among the allowed tools and generate a message. ``required`` requires + the model to call one or more of the allowed tools. Required. Is either a Literal["auto"] type + or a Literal["required"] type. + :vartype mode: Literal["auto", "required"] + :ivar tools: Required. A list of tool definitions that the model should be allowed to call. For + the Responses API, the list of tool definitions might look like: + + .. code-block:: json + + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + :vartype tools: list[dict[str, Any]] + """ + + type: Required[Literal["allowed_tools"]] + """Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS.""" + mode: Required[Literal["auto", "required"]] + """Constrains the tools available to the model to a pre-defined set. ``auto`` allows the model to + pick from among the allowed tools and generate a message. ``required`` requires the model to + call one or more of the allowed tools. Required. Is either a Literal[\"auto\"] type or a + Literal[\"required\"] type.""" + tools: Required[list[dict[str, Any]]] + """Required. A list of tool definitions that the model should be allowed to call. For the + Responses API, the list of tool definitions might look like: + + .. code-block:: json + + [ + { \"type\": \"function\", \"name\": \"get_weather\" }, + { \"type\": \"mcp\", \"server_label\": \"deepwiki\" }, + { \"type\": \"image_generation\" } + ]""" + + + class ToolChoiceCodeInterpreter(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. CODE_INTERPRETER. + :vartype type: Literal["code_interpreter"] + """ + + type: Required[Literal["code_interpreter"]] + """Required. CODE_INTERPRETER.""" + + + class ToolChoiceComputer(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. COMPUTER. + :vartype type: Literal["computer"] + """ + + type: Required[Literal["computer"]] + """Required. COMPUTER.""" + + + class ToolChoiceComputerUse(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. COMPUTER_USE. + :vartype type: Literal["computer_use"] + """ + + type: Required[Literal["computer_use"]] + """Required. COMPUTER_USE.""" + + + class ToolChoiceComputerUsePreview(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. COMPUTER_USE_PREVIEW. + :vartype type: Literal["computer_use_preview"] + """ + + type: Required[Literal["computer_use_preview"]] + """Required. COMPUTER_USE_PREVIEW.""" + + + class ToolChoiceCustom(TypedDict, total=False): + """Custom tool. + + :ivar type: For custom tool calling, the type is always ``custom``. Required. CUSTOM. + :vartype type: Literal["custom"] + :ivar name: The name of the custom tool to call. Required. + :vartype name: str + """ + + type: Required[Literal["custom"]] + """For custom tool calling, the type is always ``custom``. Required. CUSTOM.""" + name: Required[str] + """The name of the custom tool to call. Required.""" + + + class ToolChoiceFileSearch(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. FILE_SEARCH. + :vartype type: Literal["file_search"] + """ + + type: Required[Literal["file_search"]] + """Required. FILE_SEARCH.""" + + + class ToolChoiceFunction(TypedDict, total=False): + """Function tool. + + :ivar type: For function calling, the type is always ``function``. Required. FUNCTION. + :vartype type: Literal["function"] + :ivar name: The name of the function to call. Required. + :vartype name: str + """ + + type: Required[Literal["function"]] + """For function calling, the type is always ``function``. Required. FUNCTION.""" + name: Required[str] + """The name of the function to call. Required.""" + + + class ToolChoiceImageGeneration(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. IMAGE_GENERATION. + :vartype type: Literal["image_generation"] + """ + + type: Required[Literal["image_generation"]] + """Required. IMAGE_GENERATION.""" + + + class ToolChoiceMCP(TypedDict, total=False): + """MCP tool. + + :ivar type: For MCP tools, the type is always ``mcp``. Required. MCP. + :vartype type: Literal["mcp"] + :ivar server_label: The label of the MCP server to use. Required. + :vartype server_label: str + :ivar name: + :vartype name: str + """ + + type: Required[Literal["mcp"]] + """For MCP tools, the type is always ``mcp``. Required. MCP.""" + server_label: Required[str] + """The label of the MCP server to use. Required.""" + name: Optional[str] + + + class ToolChoiceWebSearchPreview(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. WEB_SEARCH_PREVIEW. + :vartype type: Literal["web_search_preview"] + """ + + type: Required[Literal["web_search_preview"]] + """Required. WEB_SEARCH_PREVIEW.""" + + + class ToolChoiceWebSearchPreview20250311(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. WEB_SEARCH_PREVIEW2025_03_11. + :vartype type: Literal["web_search_preview_2025_03_11"] + """ + + type: Required[Literal["web_search_preview_2025_03_11"]] + """Required. WEB_SEARCH_PREVIEW2025_03_11.""" + + + class ToolProjectConnection(TypedDict, total=False): + """A project connection resource. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: A project connection in a ToolProjectConnectionList attached to + this tool. Required. + :vartype project_connection_id: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """A project connection in a ToolProjectConnectionList attached to this tool. Required.""" + + + class ToolSearchCallItemParam(TypedDict, total=False): + """ToolSearchCallItemParam. + + :ivar id: + :vartype id: str + :ivar call_id: + :vartype call_id: str + :ivar type: The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. + :vartype type: Literal["tool_search_call"] + :ivar execution: Whether tool search was executed by the server or by the client. Known values + are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar arguments: The arguments supplied to the tool search call. Required. + :vartype arguments: "EmptyModelParam" + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + + id: Optional[str] + call_id: Optional[str] + type: Required[Literal["tool_search_call"]] + """The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.""" + execution: ToolSearchExecutionType + """Whether tool search was executed by the server or by the client. Known values are: \"server\" + and \"client\".""" + arguments: Required["EmptyModelParam"] + """The arguments supplied to the tool search call. Required.""" + status: Optional[FunctionCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + + + class ToolSearchOutputItemParam(TypedDict, total=False): + """ToolSearchOutputItemParam. + + :ivar id: + :vartype id: str + :ivar call_id: + :vartype call_id: str + :ivar type: The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. + :vartype type: Literal["tool_search_output"] + :ivar execution: Whether tool search was executed by the server or by the client. Known values + are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar tools: The loaded tool definitions returned by the tool search output. Required. + :vartype tools: list["Tool"] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + + id: Optional[str] + call_id: Optional[str] + type: Required[Literal["tool_search_output"]] + """The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.""" + execution: ToolSearchExecutionType + """Whether tool search was executed by the server or by the client. Known values are: \"server\" + and \"client\".""" + tools: Required[list["Tool"]] + """The loaded tool definitions returned by the tool search output. Required.""" + status: Optional[FunctionCallItemStatus] + """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" + + + class ToolSearchToolParam(TypedDict, total=False): + """Tool search tool. + + :ivar type: The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH. + :vartype type: Literal["tool_search"] + :ivar execution: Whether tool search is executed by the server or by the client. Known values + are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar description: + :vartype description: str + :ivar parameters: + :vartype parameters: "EmptyModelParam" + """ + + type: Required[Literal["tool_search"]] + """The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH.""" + execution: ToolSearchExecutionType + """Whether tool search is executed by the server or by the client. Known values are: \"server\" + and \"client\".""" + description: Optional[str] + parameters: Optional["EmptyModelParam"] + + + class TopLogProb(TypedDict, total=False): + """Top log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: float + :ivar bytes: Required. + :vartype bytes: list[int] + """ + + token: Required[str] + """Required.""" + logprob: Required[float] + """Required.""" + bytes: Required[list[int]] + """Required.""" + + + class TypeParam(TypedDict, total=False): + """Type. + + :ivar type: Specifies the event type. For a type action, this property is always set to + ``type``. Required. TYPE. + :vartype type: Literal["type"] + :ivar text: The text to type. Required. + :vartype text: str + """ + + type: Required[Literal["type"]] + """Specifies the event type. For a type action, this property is always set to ``type``. Required. + TYPE.""" + text: Required[str] + """The text to type. Required.""" + + + class UrlCitationBody(TypedDict, total=False): + """URL citation. + + :ivar type: The type of the URL citation. Always ``url_citation``. Required. URL_CITATION. + :vartype type: Literal["url_citation"] + :ivar url: The URL of the web resource. Required. + :vartype url: str + :ivar start_index: The index of the first character of the URL citation in the message. + Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the URL citation in the message. Required. + :vartype end_index: int + :ivar title: The title of the web resource. Required. + :vartype title: str + """ + + type: Required[Literal["url_citation"]] + """The type of the URL citation. Always ``url_citation``. Required. URL_CITATION.""" + url: Required[str] + """The URL of the web resource. Required.""" + start_index: Required[int] + """The index of the first character of the URL citation in the message. Required.""" + end_index: Required[int] + """The index of the last character of the URL citation in the message. Required.""" + title: Required[str] + """The title of the web resource. Required.""" + + + class UserProfileMemoryItem(TypedDict, total=False): + """A memory item specifically containing user profile information extracted from conversations, + such as preferences, interests, and personal details. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: int + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. User profile information extracted from + conversations. + :vartype kind: Literal["user_profile"] + """ + + memory_id: Required[str] + """The unique ID of the memory item. Required.""" + updated_at: Required[int] + """The last update time of the memory item. Required.""" + scope: Required[str] + """The namespace that logically groups and isolates memories, such as a user ID. Required.""" + content: Required[str] + """The content of the memory. Required.""" + kind: Required[Literal["user_profile"]] + """The kind of the memory item. Required. User profile information extracted from conversations.""" + + + class VectorStoreFileAttributes(TypedDict, total=False): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters, booleans, or numbers. + + """ + + + class WaitParam(TypedDict, total=False): + """Wait. + + :ivar type: Specifies the event type. For a wait action, this property is always set to + ``wait``. Required. WAIT. + :vartype type: Literal["wait"] + """ + + type: Required[Literal["wait"]] + """Specifies the event type. For a wait action, this property is always set to ``wait``. Required. + WAIT.""" + + + class WebSearchActionFind(TypedDict, total=False): + """Find action. + + :ivar type: The action type. Required. Default value is "find_in_page". + :vartype type: Literal["find_in_page"] + :ivar url: The URL of the page searched for the pattern. Required. + :vartype url: str + :ivar pattern: The pattern or text to search for within the page. Required. + :vartype pattern: str + """ + + type: Required[Literal["find_in_page"]] + """The action type. Required. Default value is \"find_in_page\".""" + url: Required[str] + """The URL of the page searched for the pattern. Required.""" + pattern: Required[str] + """The pattern or text to search for within the page. Required.""" + + + class WebSearchActionOpenPage(TypedDict, total=False): + """Open page action. + + :ivar type: The action type. Required. Default value is "open_page". + :vartype type: Literal["open_page"] + :ivar url: The URL opened by the model. + :vartype url: str + """ + + type: Required[Literal["open_page"]] + """The action type. Required. Default value is \"open_page\".""" + url: Optional[str] + """The URL opened by the model.""" + + + class WebSearchActionSearch(TypedDict, total=False): + """Search action. + + :ivar type: The action type. Required. Default value is "search". + :vartype type: Literal["search"] + :ivar query: The search query. + :vartype query: str + :ivar queries: Search queries. + :vartype queries: list[str] + :ivar sources: Web search sources. + :vartype sources: list["WebSearchActionSearchSources"] + """ + + type: Required[Literal["search"]] + """The action type. Required. Default value is \"search\".""" + query: str + """The search query.""" + queries: list[str] + """Search queries.""" + sources: list["WebSearchActionSearchSources"] + """Web search sources.""" + + + class WebSearchActionSearchSources(TypedDict, total=False): + """WebSearchActionSearchSources. + + :ivar type: Required. Default value is "url". + :vartype type: Literal["url"] + :ivar url: Required. + :vartype url: str + """ + + type: Required[Literal["url"]] + """Required. Default value is \"url\".""" + url: Required[str] + """Required.""" + + + class WebSearchApproximateLocation(TypedDict, total=False): + """Web search approximate location. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: Literal["approximate"] + :ivar country: + :vartype country: str + :ivar region: + :vartype region: str + :ivar city: + :vartype city: str + :ivar timezone: + :vartype timezone: str + """ + + type: Required[Literal["approximate"]] + """The type of location approximation. Always ``approximate``. Required. Default value is + \"approximate\".""" + country: Optional[str] + region: Optional[str] + city: Optional[str] + timezone: Optional[str] + + + class WebSearchConfiguration(TypedDict, total=False): + """A web search configuration for bing custom search. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing custom search. + Required. + :vartype project_connection_id: str + :ivar instance_name: Name of the custom configuration instance given to config. Required. + :vartype instance_name: str + """ + + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + project_connection_id: Required[str] + """Project connection id for grounding with bing custom search. Required.""" + instance_name: Required[str] + """Name of the custom configuration instance given to config. Required.""" + + + class WebSearchPreviewTool(TypedDict, total=False): + """Web search preview. + + :ivar type: The type of the web search tool. One of ``web_search_preview`` or + ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW. + :vartype type: Literal["web_search_preview"] + :ivar user_location: + :vartype user_location: "ApproximateLocation" + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Known + values are: "low", "medium", and "high". + :vartype search_context_size: SearchContextSize + :ivar search_content_types: + :vartype search_content_types: list[SearchContentType] + """ + + type: Required[Literal["web_search_preview"]] + """The type of the web search tool. One of ``web_search_preview`` or + ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW.""" + user_location: Optional["ApproximateLocation"] + search_context_size: SearchContextSize + """High level guidance for the amount of context window space to use for the search. One of + ``low``, ``medium``, or ``high``. ``medium`` is the default. Known values are: \"low\", + \"medium\", and \"high\".""" + search_content_types: list[SearchContentType] + + + class WebSearchTool(TypedDict, total=False): + """Web search. + + :ivar type: The type of the web search tool. One of ``web_search`` or + ``web_search_2025_08_26``. Required. WEB_SEARCH. + :vartype type: Literal["web_search"] + :ivar external_web_access: Allow live internet access for web search. Defaults to true when + omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new + external content. + :vartype external_web_access: bool + :ivar filters: + :vartype filters: "WebSearchToolFilters" + :ivar user_location: + :vartype user_location: "WebSearchApproximateLocation" + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of + the following types: Literal["low"], Literal["medium"], Literal["high"] + :vartype search_context_size: Literal["low", "medium", "high"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar custom_search_configuration: The project connections attached to this tool. There can be + a maximum of 1 connection resource attached to the tool. + :vartype custom_search_configuration: "WebSearchConfiguration" + """ + + type: Required[Literal["web_search"]] + """The type of the web search tool. One of ``web_search`` or ``web_search_2025_08_26``. Required. + WEB_SEARCH.""" + external_web_access: bool + """Allow live internet access for web search. Defaults to true when omitted. When false, the web + search tool runs in offline/cache-only mode and will not fetch new external content.""" + filters: Optional["WebSearchToolFilters"] + user_location: Optional["WebSearchApproximateLocation"] + search_context_size: Literal["low", "medium", "high"] + """High level guidance for the amount of context window space to use for the search. One of + ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types: + Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" + name: str + """Optional user-defined name for this tool or configuration.""" + description: str + """Optional user-defined description for this tool or configuration.""" + custom_search_configuration: "WebSearchConfiguration" + """The project connections attached to this tool. There can be a maximum of 1 connection resource + attached to the tool.""" + + + class WebSearchToolFilters(TypedDict, total=False): + """WebSearchToolFilters. + + :ivar allowed_domains: + :vartype allowed_domains: list[str] + """ + + allowed_domains: Optional[list[str]] + + + class WorkflowActionOutputItem(TypedDict, total=False): + """WorkflowActionOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. WORKFLOW_ACTION. + :vartype type: Literal["workflow_action"] + :ivar kind: The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required. + :vartype kind: str + :ivar action_id: Unique identifier for the action. Required. + :vartype action_id: str + :ivar parent_action_id: ID of the parent action if this is a nested action. + :vartype parent_action_id: str + :ivar previous_action_id: ID of the previous action if this action follows another. + :vartype previous_action_id: str + :ivar status: Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). + Required. Is one of the following types: Literal["completed"], Literal["failed"], + Literal["in_progress"], Literal["cancelled"] + :vartype status: Literal["completed", "failed", "in_progress", "cancelled"] + :ivar id: Required. + :vartype id: str + """ + + agent_reference: "AgentReference" + """The agent that created the item.""" + response_id: str + """The response on which the item is created.""" + type: Required[Literal["workflow_action"]] + """Required. WORKFLOW_ACTION.""" + kind: Required[str] + """The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required.""" + action_id: Required[str] + """Unique identifier for the action. Required.""" + parent_action_id: str + """ID of the parent action if this is a nested action.""" + previous_action_id: str + """ID of the previous action if this action follows another.""" + status: Required[Literal["completed", "failed", "in_progress", "cancelled"]] + """Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). Required. Is + one of the following types: Literal[\"completed\"], Literal[\"failed\"], + Literal[\"in_progress\"], Literal[\"cancelled\"]""" + id: Required[str] + """Required.""" + + + class WorkIQPreviewTool(TypedDict, total=False): + """A WorkIQ server-side tool. + + :ivar type: The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW. + :vartype type: Literal["work_iq_preview"] + :ivar work_iq_preview: The WorkIQ tool parameters. Required. + :vartype work_iq_preview: "WorkIQPreviewToolParameters" + """ + + type: Required[Literal["work_iq_preview"]] + """The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW.""" + work_iq_preview: Required["WorkIQPreviewToolParameters"] + """The WorkIQ tool parameters. Required.""" + + + class WorkIQPreviewToolParameters(TypedDict, total=False): + """The WorkIQ tool parameters. + + :ivar project_connection_id: The ID of the WorkIQ project connection. Required. + :vartype project_connection_id: str + """ + + project_connection_id: Required[str] + """The ID of the WorkIQ project connection. Required.""" + + + class CompactResponseMethodPublicBody(TypedDict, total=False): + """CompactResponseMethodPublicBody. + + :ivar model: Required. Known values are: "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", + "gpt-5.5", "gpt-5.5-2026-04-23", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", + "gpt-5.4-mini-2026-03-17", "gpt-5.4-nano-2026-03-17", "gpt-5.3-chat-latest", "gpt-5.2", + "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", + "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", "gpt-5.1-mini", "gpt-5.1-chat-latest", + "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", + "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4.1-nano-2025-04-14", "o4-mini", + "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", + "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", + "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", + "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", + "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", + "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", + "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", + "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5.5-pro", + "gpt-5.5-pro-2026-04-23", "gpt-5-codex", "gpt-5-pro", "gpt-5-pro-2025-10-06", + "gpt-5.1-codex-max", "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest", and + "gpt-5.6-cyber". + :vartype model: ModelIdsCompaction + :ivar input: Is either a str type or a [Item] type. + :vartype input: Union[str, list["Item"]] + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar instructions: + :vartype instructions: str + :ivar prompt_cache_key: + :vartype prompt_cache_key: str + :ivar prompt_cache_retention: Known values are: "in_memory" and "24h". + :vartype prompt_cache_retention: PromptCacheRetentionEnum + :ivar prompt_cache_options: + :vartype prompt_cache_options: "PromptCacheOptionsParam" + :ivar service_tier: Known values are: "auto", "default", "fast", "flex", and "priority". + :vartype service_tier: ServiceTierEnum + """ + + model: Required[Optional[ModelIdsCompaction]] + """Required. Known values are: \"gpt-5.6-sol\", \"gpt-5.6-terra\", \"gpt-5.6-luna\", \"gpt-5.5\", + \"gpt-5.5-2026-04-23\", \"gpt-5.4\", \"gpt-5.4-mini\", \"gpt-5.4-nano\", + \"gpt-5.4-mini-2026-03-17\", \"gpt-5.4-nano-2026-03-17\", \"gpt-5.3-chat-latest\", \"gpt-5.2\", + \"gpt-5.2-2025-12-11\", \"gpt-5.2-chat-latest\", \"gpt-5.2-pro\", \"gpt-5.2-pro-2025-12-11\", + \"gpt-5.1\", \"gpt-5.1-2025-11-13\", \"gpt-5.1-codex\", \"gpt-5.1-mini\", + \"gpt-5.1-chat-latest\", \"gpt-5\", \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5-2025-08-07\", + \"gpt-5-mini-2025-08-07\", \"gpt-5-nano-2025-08-07\", \"gpt-5-chat-latest\", \"gpt-4.1\", + \"gpt-4.1-mini\", \"gpt-4.1-nano\", \"gpt-4.1-2025-04-14\", \"gpt-4.1-mini-2025-04-14\", + \"gpt-4.1-nano-2025-04-14\", \"o4-mini\", \"o4-mini-2025-04-16\", \"o3\", \"o3-2025-04-16\", + \"o3-mini\", \"o3-mini-2025-01-31\", \"o1\", \"o1-2024-12-17\", \"o1-preview\", + \"o1-preview-2024-09-12\", \"o1-mini\", \"o1-mini-2024-09-12\", \"gpt-4o\", + \"gpt-4o-2024-11-20\", \"gpt-4o-2024-08-06\", \"gpt-4o-2024-05-13\", \"gpt-4o-audio-preview\", + \"gpt-4o-audio-preview-2024-10-01\", \"gpt-4o-audio-preview-2024-12-17\", + \"gpt-4o-audio-preview-2025-06-03\", \"gpt-4o-mini-audio-preview\", + \"gpt-4o-mini-audio-preview-2024-12-17\", \"gpt-4o-search-preview\", + \"gpt-4o-mini-search-preview\", \"gpt-4o-search-preview-2025-03-11\", + \"gpt-4o-mini-search-preview-2025-03-11\", \"chatgpt-4o-latest\", \"codex-mini-latest\", + \"gpt-4o-mini\", \"gpt-4o-mini-2024-07-18\", \"gpt-4-turbo\", \"gpt-4-turbo-2024-04-09\", + \"gpt-4-0125-preview\", \"gpt-4-turbo-preview\", \"gpt-4-1106-preview\", + \"gpt-4-vision-preview\", \"gpt-4\", \"gpt-4-0314\", \"gpt-4-0613\", \"gpt-4-32k\", + \"gpt-4-32k-0314\", \"gpt-4-32k-0613\", \"gpt-3.5-turbo\", \"gpt-3.5-turbo-16k\", + \"gpt-3.5-turbo-0301\", \"gpt-3.5-turbo-0613\", \"gpt-3.5-turbo-1106\", \"gpt-3.5-turbo-0125\", + \"gpt-3.5-turbo-16k-0613\", \"o1-pro\", \"o1-pro-2025-03-19\", \"o3-pro\", + \"o3-pro-2025-06-10\", \"o3-deep-research\", \"o3-deep-research-2025-06-26\", + \"o4-mini-deep-research\", \"o4-mini-deep-research-2025-06-26\", \"computer-use-preview\", + \"computer-use-preview-2025-03-11\", \"gpt-5.5-pro\", \"gpt-5.5-pro-2026-04-23\", + \"gpt-5-codex\", \"gpt-5-pro\", \"gpt-5-pro-2025-10-06\", \"gpt-5.1-codex-max\", + \"gpt-daybreak-blue-latest\", \"gpt-daybreak-red-latest\", and \"gpt-5.6-cyber\".""" + input: Optional[Union[str, list["Item"]]] + """Is either a str type or a [Item] type.""" + previous_response_id: Optional[str] + instructions: Optional[str] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[PromptCacheRetentionEnum] + """Known values are: \"in_memory\" and \"24h\".""" + prompt_cache_options: Optional["PromptCacheOptionsParam"] + service_tier: Optional[ServiceTierEnum] + """Known values are: \"auto\", \"default\", \"fast\", \"flex\", and \"priority\".""" + + + Tool = Union[ + A2APreviewTool, + ApplyPatchToolParam, + AzureAISearchTool, + AzureFunctionTool, + BingCustomSearchPreviewTool, + BingGroundingTool, + BrowserAutomationPreviewTool, + CaptureStructuredOutputsTool, + CodeInterpreterTool, + ComputerTool, + ComputerUsePreviewTool, + CustomToolParam, + MicrosoftFabricPreviewTool, + FileSearchTool, + FunctionTool, + ImageGenTool, + LocalShellToolParam, + MCPTool, + MemorySearchPreviewTool, + NamespaceToolParam, + OpenApiTool, + ProgrammaticToolCallingParam, + SharepointPreviewTool, + FunctionShellToolParam, + ToolSearchToolParam, + WebSearchTool, + WebSearchPreviewTool, + WorkIQPreviewTool, + ] + OutputItem = Union[ + A2AToolCall, + A2AToolCallOutput, + OutputItemAdditionalTools, + OutputItemApplyPatchToolCall, + OutputItemApplyPatchToolCallOutput, + AzureAISearchToolCall, + AzureAISearchToolCallOutput, + AzureFunctionToolCall, + AzureFunctionToolCallOutput, + BingCustomSearchToolCall, + BingCustomSearchToolCallOutput, + BingGroundingToolCall, + BingGroundingToolCallOutput, + BrowserAutomationToolCall, + BrowserAutomationToolCallOutput, + OutputItemCodeInterpreterToolCall, + OutputItemCompactionBody, + OutputItemComputerToolCall, + OutputItemComputerToolCallOutput, + CustomToolCallResource, + CustomToolCallOutputResource, + FabricDataAgentToolCall, + FabricDataAgentToolCallOutput, + OutputItemFileSearchToolCall, + OutputItemFunctionToolCall, + OutputItemFunctionToolCallOutput, + OutputItemImageGenToolCall, + OutputItemLocalShellToolCall, + OutputItemLocalShellToolCallOutput, + OutputItemMcpApprovalRequest, + OutputItemMcpApprovalResponseResource, + OutputItemMcpToolCall, + OutputItemMcpListTools, + MemorySearchToolCallItemResource, + OutputItemMessage, + OAuthConsentRequestOutputItem, + OpenApiToolCall, + OpenApiToolCallOutput, + OutputItemOutputMessage, + OutputItemProgram, + OutputItemProgramOutput, + OutputItemReasoningItem, + SharepointGroundingToolCall, + SharepointGroundingToolCallOutput, + OutputItemFunctionShellCall, + OutputItemFunctionShellCallOutput, + StructuredOutputsOutputItem, + OutputItemToolSearchCall, + OutputItemToolSearchOutput, + OutputItemWebSearchToolCall, + WorkflowActionOutputItem, + ] + Item = Union[ + AdditionalToolsItemParam, + ApplyPatchToolCallItemParam, + ApplyPatchToolCallOutputItemParam, + ItemCodeInterpreterToolCall, + CompactionSummaryItemParam, + ItemComputerToolCall, + ComputerCallOutputItemParam, + ItemCustomToolCall, + ItemCustomToolCallOutput, + ItemFileSearchToolCall, + ItemFunctionToolCall, + FunctionCallOutputItemParam, + ItemImageGenToolCall, + ItemReferenceParam, + ItemLocalShellToolCall, + ItemLocalShellToolCallOutput, + ItemMcpApprovalRequest, + MCPApprovalResponse, + ItemMcpToolCall, + ItemMcpListTools, + MemorySearchToolCallItemParam, + ItemMessage, + ItemOutputMessage, + ItemProgram, + ItemProgramOutput, + ItemReasoningItem, + FunctionShellCallItemParam, + FunctionShellCallOutputItemParam, + ToolSearchCallItemParam, + ToolSearchOutputItemParam, + ItemWebSearchToolCall, + ] + Annotation = Union[ContainerFileCitationBody, FileCitationBody, FilePath, UrlCitationBody] + ApplyPatchFileOperation = Union[ + ApplyPatchCreateFileOperation, ApplyPatchDeleteFileOperation, ApplyPatchUpdateFileOperation + ] + ApplyPatchOperationParam = Union[ + ApplyPatchCreateFileOperationParam, ApplyPatchDeleteFileOperationParam, ApplyPatchUpdateFileOperationParam + ] + MemoryItem = Union[ChatSummaryMemoryItem, UserProfileMemoryItem] + ComputerAction = Union[ + ClickParam, + DoubleClickAction, + DragParam, + KeyPressAction, + MoveParam, + ScreenshotParam, + ScrollParam, + TypeParam, + WaitParam, + ] + MessageContent = Union[ + ComputerScreenshotContent, + MessageContentInputFileContent, + MessageContentInputImageContent, + MessageContentInputTextContent, + MessageContentOutputTextContent, + MessageContentReasoningTextContent, + MessageContentRefusalContent, + SummaryTextContent, + TextContent, + ] + FunctionShellToolParamEnvironment = Union[ + ContainerAutoParam, + FunctionShellToolParamEnvironmentContainerReferenceParam, + FunctionShellToolParamEnvironmentLocalEnvironmentParam, + ] + ContainerNetworkPolicyParam = Union[ContainerNetworkPolicyAllowlistParam, ContainerNetworkPolicyDisabledParam] + FunctionShellCallEnvironment = Union[ContainerReferenceResource, LocalEnvironmentResource] + ContainerSkill = Union[InlineSkillParam, SkillReferenceParam] + CustomToolParamFormat = Union[CustomGrammarFormatParam, CustomTextFormatParam] + ToolCallCaller = Union[DirectToolCallCaller, ProgramToolCallCaller] + ToolCallCallerParam = Union[DirectToolCallCallerParam, ProgramToolCallCallerParam] + FunctionAndCustomToolCallOutput = Union[ + FunctionAndCustomToolCallOutputInputFileContent, + FunctionAndCustomToolCallOutputInputImageContent, + FunctionAndCustomToolCallOutputInputTextContent, + ] + FunctionShellCallItemParamEnvironment = Union[ + FunctionShellCallItemParamEnvironmentContainerReferenceParam, + FunctionShellCallItemParamEnvironmentLocalEnvironmentParam, + ] + FunctionShellCallOutputOutcome = Union[FunctionShellCallOutputExitOutcome, FunctionShellCallOutputTimeoutOutcome] + FunctionShellCallOutputOutcomeParam = Union[ + FunctionShellCallOutputExitOutcomeParam, FunctionShellCallOutputTimeoutOutcomeParam + ] + ItemField = Union[ + ItemFieldAdditionalTools, + ItemFieldApplyPatchToolCall, + ItemFieldApplyPatchToolCallOutput, + ItemFieldCodeInterpreterToolCall, + ItemFieldCompactionBody, + ItemFieldComputerToolCall, + ItemFieldComputerToolCallOutput, + ItemFieldCustomToolCall, + ItemFieldCustomToolCallOutput, + ItemFieldFileSearchToolCall, + ItemFieldFunctionToolCall, + ItemFieldFunctionToolCallOutput, + ItemFieldImageGenToolCall, + ItemFieldLocalShellToolCall, + ItemFieldLocalShellToolCallOutput, + ItemFieldMcpApprovalRequest, + ItemFieldMcpApprovalResponseResource, + ItemFieldMcpToolCall, + ItemFieldMcpListTools, + ItemFieldMessage, + ItemFieldProgram, + ItemFieldProgramOutput, + ItemFieldReasoningItem, + ItemFieldFunctionShellCall, + ItemFieldFunctionShellCallOutput, + ItemFieldToolSearchCall, + ItemFieldToolSearchOutput, + ItemFieldWebSearchToolCall, + ] + ModerationEntry = Union[ModerationErrorBody, ModerationResultBody] + OpenApiAuthDetails = Union[OpenApiAnonymousAuthDetails, OpenApiManagedAuthDetails, OpenApiProjectConnectionAuthDetails] + OutputContent = Union[OutputContentOutputTextContent, OutputContentReasoningTextContent, OutputContentRefusalContent] + OutputMessageContent = Union[OutputMessageContentOutputTextContent, OutputMessageContentRefusalContent] + RealtimeMCPError = Union[RealtimeMCPHTTPError, RealtimeMCPProtocolError, RealtimeMCPToolExecutionError] + ResponseStreamEvent = Union[ + ResponseErrorEvent, + ResponseAudioDeltaEvent, + ResponseAudioDoneEvent, + ResponseAudioTranscriptDeltaEvent, + ResponseAudioTranscriptDoneEvent, + ResponseCodeInterpreterCallCompletedEvent, + ResponseCodeInterpreterCallInProgressEvent, + ResponseCodeInterpreterCallInterpretingEvent, + ResponseCodeInterpreterCallCodeDeltaEvent, + ResponseCodeInterpreterCallCodeDoneEvent, + ResponseCompletedEvent, + ResponseContentPartAddedEvent, + ResponseContentPartDoneEvent, + ResponseCreatedEvent, + ResponseCustomToolCallInputDeltaEvent, + ResponseCustomToolCallInputDoneEvent, + ResponseFailedEvent, + ResponseFileSearchCallCompletedEvent, + ResponseFileSearchCallInProgressEvent, + ResponseFileSearchCallSearchingEvent, + ResponseFunctionCallArgumentsDeltaEvent, + ResponseFunctionCallArgumentsDoneEvent, + ResponseImageGenCallCompletedEvent, + ResponseImageGenCallGeneratingEvent, + ResponseImageGenCallInProgressEvent, + ResponseImageGenCallPartialImageEvent, + ResponseInProgressEvent, + ResponseIncompleteEvent, + ResponseMCPCallCompletedEvent, + ResponseMCPCallFailedEvent, + ResponseMCPCallInProgressEvent, + ResponseMCPCallArgumentsDeltaEvent, + ResponseMCPCallArgumentsDoneEvent, + ResponseMCPListToolsCompletedEvent, + ResponseMCPListToolsFailedEvent, + ResponseMCPListToolsInProgressEvent, + ResponseOutputItemAddedEvent, + ResponseOutputItemDoneEvent, + ResponseOutputTextAnnotationAddedEvent, + ResponseTextDeltaEvent, + ResponseTextDoneEvent, + ResponseQueuedEvent, + ResponseReasoningSummaryPartAddedEvent, + ResponseReasoningSummaryPartDoneEvent, + ResponseReasoningSummaryTextDeltaEvent, + ResponseReasoningSummaryTextDoneEvent, + ResponseReasoningTextDeltaEvent, + ResponseReasoningTextDoneEvent, + ResponseRefusalDeltaEvent, + ResponseRefusalDoneEvent, + ResponseWebSearchCallCompletedEvent, + ResponseWebSearchCallInProgressEvent, + ResponseWebSearchCallSearchingEvent, + ] + ToolChoiceParam = Union[ + ToolChoiceAllowed, + SpecificApplyPatchParam, + ToolChoiceCodeInterpreter, + ToolChoiceComputer, + ToolChoiceComputerUse, + ToolChoiceComputerUsePreview, + ToolChoiceCustom, + ToolChoiceFileSearch, + ToolChoiceFunction, + ToolChoiceImageGeneration, + ToolChoiceMCP, + SpecificProgrammaticToolCallingParam, + SpecificFunctionShellParam, + ToolChoiceWebSearchPreview, + ToolChoiceWebSearchPreview20250311, + ] + TextResponseFormatConfiguration = Union[ + TextResponseFormatConfigurationResponseFormatJsonObject, + TextResponseFormatJsonSchema, + TextResponseFormatConfigurationResponseFormatText, + ] +# END CANONICAL EMITTER CONTRACT +else: + from typing import Any, Literal, Optional, TYPE_CHECKING, Union + from typing_extensions import Required, TypedDict + from importlib import import_module as _import_module + from sys import version_info as _version_info + from .._lazy_models import load_model as _load_model + _types = _import_module('.types', __package__) + _unions = _import_module('._unions', __package__) + + def _make_AnnotationType(): + return Literal['file_citation', 'url_citation', 'container_file_citation', 'file_path'] + + def _make_ApplyPatchCallOutputStatus(): + return Literal['completed', 'failed'] + + def _make_ApplyPatchCallOutputStatusParam(): + return Literal['completed', 'failed'] + + def _make_ApplyPatchCallStatus(): + return Literal['in_progress', 'completed'] + + def _make_ApplyPatchCallStatusParam(): + return Literal['in_progress', 'completed'] + + def _make_ApplyPatchFileOperationType(): + return Literal['create_file', 'delete_file', 'update_file'] + + def _make_ApplyPatchOperationParamType(): + return Literal['create_file', 'delete_file', 'update_file'] + + def _make_AzureAISearchQueryType(): + return Literal['simple', 'semantic', 'vector', 'vector_simple_hybrid', 'vector_semantic_hybrid'] + + def _make_CallableToolAllowedCaller(): + return Literal['direct', 'programmatic'] + + def _make_ClickButtonType(): + return Literal['left', 'right', 'wheel', 'back', 'forward'] + + def _make_ComputerActionType(): + return Literal['click', 'double_click', 'drag', 'keypress', 'move', 'screenshot', 'scroll', 'type', 'wait'] + + def _make_ComputerEnvironment(): + return Literal['windows', 'mac', 'linux', 'ubuntu', 'browser'] + + def _make_ContainerMemoryLimit(): + return Literal['1g', '4g', '16g', '64g'] + + def _make_ContainerNetworkPolicyParamType(): + return Literal['disabled', 'allowlist'] + + def _make_ContainerSkillType(): + return Literal['skill_reference', 'inline'] + + def _make_CustomToolParamFormatType(): + return Literal['text', 'grammar'] + + def _make_DetailEnum(): + return Literal['low', 'high', 'auto', 'original'] + + def _make_FileInputDetail(): + return Literal['auto', 'low', 'high'] - type: Required[Literal["allowed_tools"]] - """Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS.""" - mode: Required[Literal["auto", "required"]] - """Constrains the tools available to the model to a pre-defined set. ``auto`` allows the model to - pick from among the allowed tools and generate a message. ``required`` requires the model to - call one or more of the allowed tools. Required. Is either a Literal[\"auto\"] type or a - Literal[\"required\"] type.""" - tools: Required[list[dict[str, Any]]] - """Required. A list of tool definitions that the model should be allowed to call. For the - Responses API, the list of tool definitions might look like: + def _make_FunctionAndCustomToolCallOutputType(): + return Literal['input_text', 'input_image', 'input_file'] - .. code-block:: json + def _make_FunctionCallItemStatus(): + return Literal['in_progress', 'completed', 'incomplete'] - [ - { \"type\": \"function\", \"name\": \"get_weather\" }, - { \"type\": \"mcp\", \"server_label\": \"deepwiki\" }, - { \"type\": \"image_generation\" } - ]""" + def _make_FunctionCallOutputStatusEnum(): + return Literal['in_progress', 'completed', 'incomplete'] + def _make_FunctionCallStatus(): + return Literal['in_progress', 'completed', 'incomplete'] -class ToolChoiceCodeInterpreter(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_FunctionShellCallEnvironmentType(): + return Literal['local', 'container_reference'] - :ivar type: Required. CODE_INTERPRETER. - :vartype type: Literal["code_interpreter"] - """ + def _make_FunctionShellCallItemParamEnvironmentType(): + return Literal['local', 'container_reference'] - type: Required[Literal["code_interpreter"]] - """Required. CODE_INTERPRETER.""" + def _make_FunctionShellCallItemStatus(): + return Literal['in_progress', 'completed', 'incomplete'] + def _make_FunctionShellCallOutputOutcomeParamType(): + return Literal['timeout', 'exit'] -class ToolChoiceComputer(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_FunctionShellCallOutputOutcomeType(): + return Literal['timeout', 'exit'] - :ivar type: Required. COMPUTER. - :vartype type: Literal["computer"] - """ + def _make_FunctionShellCallOutputStatusEnum(): + return Literal['in_progress', 'completed', 'incomplete'] - type: Required[Literal["computer"]] - """Required. COMPUTER.""" + def _make_FunctionShellCallStatus(): + return Literal['in_progress', 'completed', 'incomplete'] + def _make_FunctionShellToolParamEnvironmentType(): + return Literal['container_auto', 'local', 'container_reference'] -class ToolChoiceComputerUse(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_GrammarSyntax1(): + return Literal['lark', 'regex'] - :ivar type: Required. COMPUTER_USE. - :vartype type: Literal["computer_use"] - """ + def _make_ImageDetail(): + return Literal['low', 'high', 'auto', 'original'] - type: Required[Literal["computer_use"]] - """Required. COMPUTER_USE.""" + def _make_ImageGenActionEnum(): + return Literal['generate', 'edit', 'auto'] + def _make_IncludeEnum(): + return Literal['file_search_call.results', 'web_search_call.results', 'web_search_call.action.sources', 'message.input_image.image_url', 'computer_call_output.output.image_url', 'code_interpreter_call.outputs', 'reasoning.encrypted_content', 'message.output_text.logprobs', 'memory_search_call.results'] -class ToolChoiceComputerUsePreview(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_InputFidelity(): + return Literal['high', 'low'] - :ivar type: Required. COMPUTER_USE_PREVIEW. - :vartype type: Literal["computer_use_preview"] - """ + def _make_ItemFieldType(): + return Literal['message', 'program', 'program_output', 'function_call', 'tool_search_call', 'tool_search_output', 'additional_tools', 'function_call_output', 'file_search_call', 'web_search_call', 'image_generation_call', 'computer_call', 'computer_call_output', 'reasoning', 'compaction', 'code_interpreter_call', 'local_shell_call', 'local_shell_call_output', 'shell_call', 'shell_call_output', 'apply_patch_call', 'apply_patch_call_output', 'mcp_list_tools', 'mcp_approval_request', 'mcp_approval_response', 'mcp_call', 'custom_tool_call', 'custom_tool_call_output'] - type: Required[Literal["computer_use_preview"]] - """Required. COMPUTER_USE_PREVIEW.""" + def _make_ItemType(): + return Literal['message', 'output_message', 'file_search_call', 'computer_call', 'computer_call_output', 'web_search_call', 'function_call', 'function_call_output', 'tool_search_call', 'tool_search_output', 'additional_tools', 'reasoning', 'compaction', 'image_generation_call', 'code_interpreter_call', 'local_shell_call', 'local_shell_call_output', 'shell_call', 'shell_call_output', 'apply_patch_call', 'apply_patch_call_output', 'mcp_list_tools', 'mcp_approval_request', 'mcp_approval_response', 'mcp_call', 'custom_tool_call_output', 'custom_tool_call', 'item_reference', 'structured_outputs', 'oauth_consent_request', 'memory_search_call', 'workflow_action', 'a2a_preview_call', 'a2a_preview_call_output', 'bing_grounding_call', 'bing_grounding_call_output', 'sharepoint_grounding_preview_call', 'sharepoint_grounding_preview_call_output', 'azure_ai_search_call', 'azure_ai_search_call_output', 'bing_custom_search_preview_call', 'bing_custom_search_preview_call_output', 'openapi_call', 'openapi_call_output', 'browser_automation_preview_call', 'browser_automation_preview_call_output', 'fabric_dataagent_preview_call', 'fabric_dataagent_preview_call_output', 'azure_function_call', 'azure_function_call_output'] + def _make_MCPToolCallStatus(): + return Literal['in_progress', 'completed', 'incomplete', 'calling', 'failed'] -class ToolChoiceCustom(TypedDict, total=False): - """Custom tool. + def _make_MemoryItemKind(): + return Literal['user_profile', 'chat_summary'] - :ivar type: For custom tool calling, the type is always ``custom``. Required. CUSTOM. - :vartype type: Literal["custom"] - :ivar name: The name of the custom tool to call. Required. - :vartype name: str - """ + def _make_MessageContentType(): + return Literal['input_text', 'output_text', 'text', 'summary_text', 'reasoning_text', 'refusal', 'input_image', 'computer_screenshot', 'input_file'] - type: Required[Literal["custom"]] - """For custom tool calling, the type is always ``custom``. Required. CUSTOM.""" - name: Required[str] - """The name of the custom tool to call. Required.""" + def _make_MessagePhase(): + return Literal['commentary', 'final_answer'] + def _make_MessageRole(): + return Literal['unknown', 'user', 'assistant', 'system', 'critic', 'discriminator', 'developer', 'tool'] -class ToolChoiceFileSearch(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_MessageStatus(): + return Literal['in_progress', 'completed', 'incomplete'] - :ivar type: Required. FILE_SEARCH. - :vartype type: Literal["file_search"] - """ + def _make_ModelIdsCompaction(): + return Literal['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.5', 'gpt-5.5-2026-04-23', 'gpt-5.4', 'gpt-5.4-mini', 'gpt-5.4-nano', 'gpt-5.4-mini-2026-03-17', 'gpt-5.4-nano-2026-03-17', 'gpt-5.3-chat-latest', 'gpt-5.2', 'gpt-5.2-2025-12-11', 'gpt-5.2-chat-latest', 'gpt-5.2-pro', 'gpt-5.2-pro-2025-12-11', 'gpt-5.1', 'gpt-5.1-2025-11-13', 'gpt-5.1-codex', 'gpt-5.1-mini', 'gpt-5.1-chat-latest', 'gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-5-2025-08-07', 'gpt-5-mini-2025-08-07', 'gpt-5-nano-2025-08-07', 'gpt-5-chat-latest', 'gpt-4.1', 'gpt-4.1-mini', 'gpt-4.1-nano', 'gpt-4.1-2025-04-14', 'gpt-4.1-mini-2025-04-14', 'gpt-4.1-nano-2025-04-14', 'o4-mini', 'o4-mini-2025-04-16', 'o3', 'o3-2025-04-16', 'o3-mini', 'o3-mini-2025-01-31', 'o1', 'o1-2024-12-17', 'o1-preview', 'o1-preview-2024-09-12', 'o1-mini', 'o1-mini-2024-09-12', 'gpt-4o', 'gpt-4o-2024-11-20', 'gpt-4o-2024-08-06', 'gpt-4o-2024-05-13', 'gpt-4o-audio-preview', 'gpt-4o-audio-preview-2024-10-01', 'gpt-4o-audio-preview-2024-12-17', 'gpt-4o-audio-preview-2025-06-03', 'gpt-4o-mini-audio-preview', 'gpt-4o-mini-audio-preview-2024-12-17', 'gpt-4o-search-preview', 'gpt-4o-mini-search-preview', 'gpt-4o-search-preview-2025-03-11', 'gpt-4o-mini-search-preview-2025-03-11', 'chatgpt-4o-latest', 'codex-mini-latest', 'gpt-4o-mini', 'gpt-4o-mini-2024-07-18', 'gpt-4-turbo', 'gpt-4-turbo-2024-04-09', 'gpt-4-0125-preview', 'gpt-4-turbo-preview', 'gpt-4-1106-preview', 'gpt-4-vision-preview', 'gpt-4', 'gpt-4-0314', 'gpt-4-0613', 'gpt-4-32k', 'gpt-4-32k-0314', 'gpt-4-32k-0613', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0301', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-1106', 'gpt-3.5-turbo-0125', 'gpt-3.5-turbo-16k-0613', 'o1-pro', 'o1-pro-2025-03-19', 'o3-pro', 'o3-pro-2025-06-10', 'o3-deep-research', 'o3-deep-research-2025-06-26', 'o4-mini-deep-research', 'o4-mini-deep-research-2025-06-26', 'computer-use-preview', 'computer-use-preview-2025-03-11', 'gpt-5.5-pro', 'gpt-5.5-pro-2026-04-23', 'gpt-5-codex', 'gpt-5-pro', 'gpt-5-pro-2025-10-06', 'gpt-5.1-codex-max', 'gpt-daybreak-blue-latest', 'gpt-daybreak-red-latest', 'gpt-5.6-cyber'] - type: Required[Literal["file_search"]] - """Required. FILE_SEARCH.""" + def _make_ModerationEntryType(): + return Literal['moderation_result', 'error'] + def _make_ModerationInputType(): + return Literal['text', 'image'] -class ToolChoiceFunction(TypedDict, total=False): - """Function tool. + def _make_ModerationMode(): + return Literal['score', 'block'] - :ivar type: For function calling, the type is always ``function``. Required. FUNCTION. - :vartype type: Literal["function"] - :ivar name: The name of the function to call. Required. - :vartype name: str - """ + def _make_OpenApiAuthType(): + return Literal['anonymous', 'project_connection', 'managed_identity'] - type: Required[Literal["function"]] - """For function calling, the type is always ``function``. Required. FUNCTION.""" - name: Required[str] - """The name of the function to call. Required.""" + def _make_OutputContentType(): + return Literal['output_text', 'refusal', 'reasoning_text'] + def _make_OutputItemType(): + return Literal['output_message', 'file_search_call', 'function_call', 'function_call_output', 'web_search_call', 'computer_call', 'computer_call_output', 'reasoning', 'program', 'program_output', 'tool_search_call', 'tool_search_output', 'additional_tools', 'compaction', 'image_generation_call', 'code_interpreter_call', 'local_shell_call', 'local_shell_call_output', 'shell_call', 'shell_call_output', 'apply_patch_call', 'apply_patch_call_output', 'mcp_call', 'mcp_list_tools', 'mcp_approval_request', 'mcp_approval_response', 'custom_tool_call', 'custom_tool_call_output', 'message', 'structured_outputs', 'oauth_consent_request', 'memory_search_call', 'workflow_action', 'a2a_preview_call', 'a2a_preview_call_output', 'bing_grounding_call', 'bing_grounding_call_output', 'sharepoint_grounding_preview_call', 'sharepoint_grounding_preview_call_output', 'azure_ai_search_call', 'azure_ai_search_call_output', 'bing_custom_search_preview_call', 'bing_custom_search_preview_call_output', 'openapi_call', 'openapi_call_output', 'browser_automation_preview_call', 'browser_automation_preview_call_output', 'fabric_dataagent_preview_call', 'fabric_dataagent_preview_call_output', 'azure_function_call', 'azure_function_call_output'] -class ToolChoiceImageGeneration(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_OutputMessageContentType(): + return Literal['output_text', 'refusal'] - :ivar type: Required. IMAGE_GENERATION. - :vartype type: Literal["image_generation"] - """ + def _make_PageOrder(): + return Literal['asc', 'desc'] - type: Required[Literal["image_generation"]] - """Required. IMAGE_GENERATION.""" + def _make_ProgramOutputStatus(): + return Literal['completed', 'incomplete'] + def _make_PromptCacheModeEnum(): + return Literal['implicit', 'explicit'] -class ToolChoiceMCP(TypedDict, total=False): - """MCP tool. + def _make_PromptCacheRetentionEnum(): + return Literal['in_memory', '24h'] - :ivar type: For MCP tools, the type is always ``mcp``. Required. MCP. - :vartype type: Literal["mcp"] - :ivar server_label: The label of the MCP server to use. Required. - :vartype server_label: str - :ivar name: - :vartype name: str - """ + def _make_PromptCacheTTLEnum(): + return Literal['30m'] - type: Required[Literal["mcp"]] - """For MCP tools, the type is always ``mcp``. Required. MCP.""" - server_label: Required[str] - """The label of the MCP server to use. Required.""" - name: Optional[str] + def _make_RankerVersionType(): + return Literal['auto', 'default-2024-11-15'] + def _make_RealtimeMcpErrorType(): + return Literal['protocol_error', 'tool_execution_error', 'http_error'] -class ToolChoiceWebSearchPreview(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + def _make_ReasoningEffort(): + return Literal['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'] - :ivar type: Required. WEB_SEARCH_PREVIEW. - :vartype type: Literal["web_search_preview"] - """ + def _make_ReasoningModeEnum(): + return Literal['standard', 'pro'] - type: Required[Literal["web_search_preview"]] - """Required. WEB_SEARCH_PREVIEW.""" - - -class ToolChoiceWebSearchPreview20250311(TypedDict, total=False): - """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. - - :ivar type: Required. WEB_SEARCH_PREVIEW2025_03_11. - :vartype type: Literal["web_search_preview_2025_03_11"] - """ - - type: Required[Literal["web_search_preview_2025_03_11"]] - """Required. WEB_SEARCH_PREVIEW2025_03_11.""" - - -class ToolProjectConnection(TypedDict, total=False): - """A project connection resource. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connection_id: A project connection in a ToolProjectConnectionList attached to - this tool. Required. - :vartype project_connection_id: str - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connection_id: Required[str] - """A project connection in a ToolProjectConnectionList attached to this tool. Required.""" - - -class ToolSearchCallItemParam(TypedDict, total=False): - """ToolSearchCallItemParam. - - :ivar id: - :vartype id: str - :ivar call_id: - :vartype call_id: str - :ivar type: The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. - :vartype type: Literal["tool_search_call"] - :ivar execution: Whether tool search was executed by the server or by the client. Known values - are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar arguments: The arguments supplied to the tool search call. Required. - :vartype arguments: "EmptyModelParam" - :ivar status: Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallItemStatus - """ - - id: Optional[str] - call_id: Optional[str] - type: Required[Literal["tool_search_call"]] - """The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.""" - execution: ToolSearchExecutionType - """Whether tool search was executed by the server or by the client. Known values are: \"server\" - and \"client\".""" - arguments: Required["EmptyModelParam"] - """The arguments supplied to the tool search call. Required.""" - status: Optional[FunctionCallItemStatus] - """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - - -class ToolSearchOutputItemParam(TypedDict, total=False): - """ToolSearchOutputItemParam. - - :ivar id: - :vartype id: str - :ivar call_id: - :vartype call_id: str - :ivar type: The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. - :vartype type: Literal["tool_search_output"] - :ivar execution: Whether tool search was executed by the server or by the client. Known values - are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar tools: The loaded tool definitions returned by the tool search output. Required. - :vartype tools: list["Tool"] - :ivar status: Known values are: "in_progress", "completed", and "incomplete". - :vartype status: FunctionCallItemStatus - """ - - id: Optional[str] - call_id: Optional[str] - type: Required[Literal["tool_search_output"]] - """The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.""" - execution: ToolSearchExecutionType - """Whether tool search was executed by the server or by the client. Known values are: \"server\" - and \"client\".""" - tools: Required[list["Tool"]] - """The loaded tool definitions returned by the tool search output. Required.""" - status: Optional[FunctionCallItemStatus] - """Known values are: \"in_progress\", \"completed\", and \"incomplete\".""" - - -class ToolSearchToolParam(TypedDict, total=False): - """Tool search tool. - - :ivar type: The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH. - :vartype type: Literal["tool_search"] - :ivar execution: Whether tool search is executed by the server or by the client. Known values - are: "server" and "client". - :vartype execution: ToolSearchExecutionType - :ivar description: - :vartype description: str - :ivar parameters: - :vartype parameters: "EmptyModelParam" - """ - - type: Required[Literal["tool_search"]] - """The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH.""" - execution: ToolSearchExecutionType - """Whether tool search is executed by the server or by the client. Known values are: \"server\" - and \"client\".""" - description: Optional[str] - parameters: Optional["EmptyModelParam"] - - -class TopLogProb(TypedDict, total=False): - """Top log probability. - - :ivar token: Required. - :vartype token: str - :ivar logprob: Required. - :vartype logprob: float - :ivar bytes: Required. - :vartype bytes: list[int] - """ - - token: Required[str] - """Required.""" - logprob: Required[float] - """Required.""" - bytes: Required[list[int]] - """Required.""" - - -class TypeParam(TypedDict, total=False): - """Type. - - :ivar type: Specifies the event type. For a type action, this property is always set to - ``type``. Required. TYPE. - :vartype type: Literal["type"] - :ivar text: The text to type. Required. - :vartype text: str - """ - - type: Required[Literal["type"]] - """Specifies the event type. For a type action, this property is always set to ``type``. Required. - TYPE.""" - text: Required[str] - """The text to type. Required.""" - - -class UrlCitationBody(TypedDict, total=False): - """URL citation. - - :ivar type: The type of the URL citation. Always ``url_citation``. Required. URL_CITATION. - :vartype type: Literal["url_citation"] - :ivar url: The URL of the web resource. Required. - :vartype url: str - :ivar start_index: The index of the first character of the URL citation in the message. - Required. - :vartype start_index: int - :ivar end_index: The index of the last character of the URL citation in the message. Required. - :vartype end_index: int - :ivar title: The title of the web resource. Required. - :vartype title: str - """ - - type: Required[Literal["url_citation"]] - """The type of the URL citation. Always ``url_citation``. Required. URL_CITATION.""" - url: Required[str] - """The URL of the web resource. Required.""" - start_index: Required[int] - """The index of the first character of the URL citation in the message. Required.""" - end_index: Required[int] - """The index of the last character of the URL citation in the message. Required.""" - title: Required[str] - """The title of the web resource. Required.""" - - -class UserProfileMemoryItem(TypedDict, total=False): - """A memory item specifically containing user profile information extracted from conversations, - such as preferences, interests, and personal details. - - :ivar memory_id: The unique ID of the memory item. Required. - :vartype memory_id: str - :ivar updated_at: The last update time of the memory item. Required. - :vartype updated_at: int - :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. - Required. - :vartype scope: str - :ivar content: The content of the memory. Required. - :vartype content: str - :ivar kind: The kind of the memory item. Required. User profile information extracted from - conversations. - :vartype kind: Literal["user_profile"] - """ - - memory_id: Required[str] - """The unique ID of the memory item. Required.""" - updated_at: Required[int] - """The last update time of the memory item. Required.""" - scope: Required[str] - """The namespace that logically groups and isolates memories, such as a user ID. Required.""" - content: Required[str] - """The content of the memory. Required.""" - kind: Required[Literal["user_profile"]] - """The kind of the memory item. Required. User profile information extracted from conversations.""" - - -class VectorStoreFileAttributes(TypedDict, total=False): - """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing - additional information about the object in a structured format, and querying for objects via - API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are - strings with a maximum length of 512 characters, booleans, or numbers. - - """ - - -class WaitParam(TypedDict, total=False): - """Wait. - - :ivar type: Specifies the event type. For a wait action, this property is always set to - ``wait``. Required. WAIT. - :vartype type: Literal["wait"] - """ - - type: Required[Literal["wait"]] - """Specifies the event type. For a wait action, this property is always set to ``wait``. Required. - WAIT.""" - - -class WebSearchActionFind(TypedDict, total=False): - """Find action. - - :ivar type: The action type. Required. Default value is "find_in_page". - :vartype type: Literal["find_in_page"] - :ivar url: The URL of the page searched for the pattern. Required. - :vartype url: str - :ivar pattern: The pattern or text to search for within the page. Required. - :vartype pattern: str - """ - - type: Required[Literal["find_in_page"]] - """The action type. Required. Default value is \"find_in_page\".""" - url: Required[str] - """The URL of the page searched for the pattern. Required.""" - pattern: Required[str] - """The pattern or text to search for within the page. Required.""" - - -class WebSearchActionOpenPage(TypedDict, total=False): - """Open page action. - - :ivar type: The action type. Required. Default value is "open_page". - :vartype type: Literal["open_page"] - :ivar url: The URL opened by the model. - :vartype url: str - """ - - type: Required[Literal["open_page"]] - """The action type. Required. Default value is \"open_page\".""" - url: Optional[str] - """The URL opened by the model.""" - - -class WebSearchActionSearch(TypedDict, total=False): - """Search action. - - :ivar type: The action type. Required. Default value is "search". - :vartype type: Literal["search"] - :ivar query: The search query. - :vartype query: str - :ivar queries: Search queries. - :vartype queries: list[str] - :ivar sources: Web search sources. - :vartype sources: list["WebSearchActionSearchSources"] - """ - - type: Required[Literal["search"]] - """The action type. Required. Default value is \"search\".""" - query: str - """The search query.""" - queries: list[str] - """Search queries.""" - sources: list["WebSearchActionSearchSources"] - """Web search sources.""" - - -class WebSearchActionSearchSources(TypedDict, total=False): - """WebSearchActionSearchSources. - - :ivar type: Required. Default value is "url". - :vartype type: Literal["url"] - :ivar url: Required. - :vartype url: str - """ - - type: Required[Literal["url"]] - """Required. Default value is \"url\".""" - url: Required[str] - """Required.""" - - -class WebSearchApproximateLocation(TypedDict, total=False): - """Web search approximate location. - - :ivar type: The type of location approximation. Always ``approximate``. Required. Default value - is "approximate". - :vartype type: Literal["approximate"] - :ivar country: - :vartype country: str - :ivar region: - :vartype region: str - :ivar city: - :vartype city: str - :ivar timezone: - :vartype timezone: str - """ - - type: Required[Literal["approximate"]] - """The type of location approximation. Always ``approximate``. Required. Default value is - \"approximate\".""" - country: Optional[str] - region: Optional[str] - city: Optional[str] - timezone: Optional[str] - - -class WebSearchConfiguration(TypedDict, total=False): - """A web search configuration for bing custom search. - - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar project_connection_id: Project connection id for grounding with bing custom search. - Required. - :vartype project_connection_id: str - :ivar instance_name: Name of the custom configuration instance given to config. Required. - :vartype instance_name: str - """ - - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - project_connection_id: Required[str] - """Project connection id for grounding with bing custom search. Required.""" - instance_name: Required[str] - """Name of the custom configuration instance given to config. Required.""" - - -class WebSearchPreviewTool(TypedDict, total=False): - """Web search preview. - - :ivar type: The type of the web search tool. One of ``web_search_preview`` or - ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW. - :vartype type: Literal["web_search_preview"] - :ivar user_location: - :vartype user_location: "ApproximateLocation" - :ivar search_context_size: High level guidance for the amount of context window space to use - for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Known - values are: "low", "medium", and "high". - :vartype search_context_size: SearchContextSize - :ivar search_content_types: - :vartype search_content_types: list[SearchContentType] - """ - - type: Required[Literal["web_search_preview"]] - """The type of the web search tool. One of ``web_search_preview`` or - ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW.""" - user_location: Optional["ApproximateLocation"] - search_context_size: SearchContextSize - """High level guidance for the amount of context window space to use for the search. One of - ``low``, ``medium``, or ``high``. ``medium`` is the default. Known values are: \"low\", - \"medium\", and \"high\".""" - search_content_types: list[SearchContentType] - - -class WebSearchTool(TypedDict, total=False): - """Web search. - - :ivar type: The type of the web search tool. One of ``web_search`` or - ``web_search_2025_08_26``. Required. WEB_SEARCH. - :vartype type: Literal["web_search"] - :ivar external_web_access: Allow live internet access for web search. Defaults to true when - omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new - external content. - :vartype external_web_access: bool - :ivar filters: - :vartype filters: "WebSearchToolFilters" - :ivar user_location: - :vartype user_location: "WebSearchApproximateLocation" - :ivar search_context_size: High level guidance for the amount of context window space to use - for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of - the following types: Literal["low"], Literal["medium"], Literal["high"] - :vartype search_context_size: Literal["low", "medium", "high"] - :ivar name: Optional user-defined name for this tool or configuration. - :vartype name: str - :ivar description: Optional user-defined description for this tool or configuration. - :vartype description: str - :ivar custom_search_configuration: The project connections attached to this tool. There can be - a maximum of 1 connection resource attached to the tool. - :vartype custom_search_configuration: "WebSearchConfiguration" - """ - - type: Required[Literal["web_search"]] - """The type of the web search tool. One of ``web_search`` or ``web_search_2025_08_26``. Required. - WEB_SEARCH.""" - external_web_access: bool - """Allow live internet access for web search. Defaults to true when omitted. When false, the web - search tool runs in offline/cache-only mode and will not fetch new external content.""" - filters: Optional["WebSearchToolFilters"] - user_location: Optional["WebSearchApproximateLocation"] - search_context_size: Literal["low", "medium", "high"] - """High level guidance for the amount of context window space to use for the search. One of - ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types: - Literal[\"low\"], Literal[\"medium\"], Literal[\"high\"]""" - name: str - """Optional user-defined name for this tool or configuration.""" - description: str - """Optional user-defined description for this tool or configuration.""" - custom_search_configuration: "WebSearchConfiguration" - """The project connections attached to this tool. There can be a maximum of 1 connection resource - attached to the tool.""" - - -class WebSearchToolFilters(TypedDict, total=False): - """WebSearchToolFilters. - - :ivar allowed_domains: - :vartype allowed_domains: list[str] - """ - - allowed_domains: Optional[list[str]] - - -class WorkflowActionOutputItem(TypedDict, total=False): - """WorkflowActionOutputItem. - - :ivar agent_reference: The agent that created the item. - :vartype agent_reference: "AgentReference" - :ivar response_id: The response on which the item is created. - :vartype response_id: str - :ivar type: Required. WORKFLOW_ACTION. - :vartype type: Literal["workflow_action"] - :ivar kind: The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required. - :vartype kind: str - :ivar action_id: Unique identifier for the action. Required. - :vartype action_id: str - :ivar parent_action_id: ID of the parent action if this is a nested action. - :vartype parent_action_id: str - :ivar previous_action_id: ID of the previous action if this action follows another. - :vartype previous_action_id: str - :ivar status: Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). - Required. Is one of the following types: Literal["completed"], Literal["failed"], - Literal["in_progress"], Literal["cancelled"] - :vartype status: Literal["completed", "failed", "in_progress", "cancelled"] - :ivar id: Required. - :vartype id: str - """ - - agent_reference: "AgentReference" - """The agent that created the item.""" - response_id: str - """The response on which the item is created.""" - type: Required[Literal["workflow_action"]] - """Required. WORKFLOW_ACTION.""" - kind: Required[str] - """The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required.""" - action_id: Required[str] - """Unique identifier for the action. Required.""" - parent_action_id: str - """ID of the parent action if this is a nested action.""" - previous_action_id: str - """ID of the previous action if this action follows another.""" - status: Required[Literal["completed", "failed", "in_progress", "cancelled"]] - """Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). Required. Is - one of the following types: Literal[\"completed\"], Literal[\"failed\"], - Literal[\"in_progress\"], Literal[\"cancelled\"]""" - id: Required[str] - """Required.""" - - -class WorkIQPreviewTool(TypedDict, total=False): - """A WorkIQ server-side tool. - - :ivar type: The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW. - :vartype type: Literal["work_iq_preview"] - :ivar work_iq_preview: The WorkIQ tool parameters. Required. - :vartype work_iq_preview: "WorkIQPreviewToolParameters" - """ - - type: Required[Literal["work_iq_preview"]] - """The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW.""" - work_iq_preview: Required["WorkIQPreviewToolParameters"] - """The WorkIQ tool parameters. Required.""" - - -class WorkIQPreviewToolParameters(TypedDict, total=False): - """The WorkIQ tool parameters. - - :ivar project_connection_id: The ID of the WorkIQ project connection. Required. - :vartype project_connection_id: str - """ - - project_connection_id: Required[str] - """The ID of the WorkIQ project connection. Required.""" - - -class CompactResponseMethodPublicBody(TypedDict, total=False): - """CompactResponseMethodPublicBody. - - :ivar model: Required. Known values are: "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", - "gpt-5.5", "gpt-5.5-2026-04-23", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", - "gpt-5.4-mini-2026-03-17", "gpt-5.4-nano-2026-03-17", "gpt-5.3-chat-latest", "gpt-5.2", - "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", - "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", "gpt-5.1-mini", "gpt-5.1-chat-latest", - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", - "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", - "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4.1-nano-2025-04-14", "o4-mini", - "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", - "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", - "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", - "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", - "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", - "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", - "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", - "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", - "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", - "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", - "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", - "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", - "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", - "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", - "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5.5-pro", - "gpt-5.5-pro-2026-04-23", "gpt-5-codex", "gpt-5-pro", "gpt-5-pro-2025-10-06", - "gpt-5.1-codex-max", "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest", and - "gpt-5.6-cyber". - :vartype model: ModelIdsCompaction - :ivar input: Is either a str type or a [Item] type. - :vartype input: Union[str, list["Item"]] - :ivar previous_response_id: - :vartype previous_response_id: str - :ivar instructions: - :vartype instructions: str - :ivar prompt_cache_key: - :vartype prompt_cache_key: str - :ivar prompt_cache_retention: Known values are: "in_memory" and "24h". - :vartype prompt_cache_retention: PromptCacheRetentionEnum - :ivar prompt_cache_options: - :vartype prompt_cache_options: "PromptCacheOptionsParam" - :ivar service_tier: Known values are: "auto", "default", "fast", "flex", and "priority". - :vartype service_tier: ServiceTierEnum - """ - - model: Required[Optional[ModelIdsCompaction]] - """Required. Known values are: \"gpt-5.6-sol\", \"gpt-5.6-terra\", \"gpt-5.6-luna\", \"gpt-5.5\", - \"gpt-5.5-2026-04-23\", \"gpt-5.4\", \"gpt-5.4-mini\", \"gpt-5.4-nano\", - \"gpt-5.4-mini-2026-03-17\", \"gpt-5.4-nano-2026-03-17\", \"gpt-5.3-chat-latest\", \"gpt-5.2\", - \"gpt-5.2-2025-12-11\", \"gpt-5.2-chat-latest\", \"gpt-5.2-pro\", \"gpt-5.2-pro-2025-12-11\", - \"gpt-5.1\", \"gpt-5.1-2025-11-13\", \"gpt-5.1-codex\", \"gpt-5.1-mini\", - \"gpt-5.1-chat-latest\", \"gpt-5\", \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5-2025-08-07\", - \"gpt-5-mini-2025-08-07\", \"gpt-5-nano-2025-08-07\", \"gpt-5-chat-latest\", \"gpt-4.1\", - \"gpt-4.1-mini\", \"gpt-4.1-nano\", \"gpt-4.1-2025-04-14\", \"gpt-4.1-mini-2025-04-14\", - \"gpt-4.1-nano-2025-04-14\", \"o4-mini\", \"o4-mini-2025-04-16\", \"o3\", \"o3-2025-04-16\", - \"o3-mini\", \"o3-mini-2025-01-31\", \"o1\", \"o1-2024-12-17\", \"o1-preview\", - \"o1-preview-2024-09-12\", \"o1-mini\", \"o1-mini-2024-09-12\", \"gpt-4o\", - \"gpt-4o-2024-11-20\", \"gpt-4o-2024-08-06\", \"gpt-4o-2024-05-13\", \"gpt-4o-audio-preview\", - \"gpt-4o-audio-preview-2024-10-01\", \"gpt-4o-audio-preview-2024-12-17\", - \"gpt-4o-audio-preview-2025-06-03\", \"gpt-4o-mini-audio-preview\", - \"gpt-4o-mini-audio-preview-2024-12-17\", \"gpt-4o-search-preview\", - \"gpt-4o-mini-search-preview\", \"gpt-4o-search-preview-2025-03-11\", - \"gpt-4o-mini-search-preview-2025-03-11\", \"chatgpt-4o-latest\", \"codex-mini-latest\", - \"gpt-4o-mini\", \"gpt-4o-mini-2024-07-18\", \"gpt-4-turbo\", \"gpt-4-turbo-2024-04-09\", - \"gpt-4-0125-preview\", \"gpt-4-turbo-preview\", \"gpt-4-1106-preview\", - \"gpt-4-vision-preview\", \"gpt-4\", \"gpt-4-0314\", \"gpt-4-0613\", \"gpt-4-32k\", - \"gpt-4-32k-0314\", \"gpt-4-32k-0613\", \"gpt-3.5-turbo\", \"gpt-3.5-turbo-16k\", - \"gpt-3.5-turbo-0301\", \"gpt-3.5-turbo-0613\", \"gpt-3.5-turbo-1106\", \"gpt-3.5-turbo-0125\", - \"gpt-3.5-turbo-16k-0613\", \"o1-pro\", \"o1-pro-2025-03-19\", \"o3-pro\", - \"o3-pro-2025-06-10\", \"o3-deep-research\", \"o3-deep-research-2025-06-26\", - \"o4-mini-deep-research\", \"o4-mini-deep-research-2025-06-26\", \"computer-use-preview\", - \"computer-use-preview-2025-03-11\", \"gpt-5.5-pro\", \"gpt-5.5-pro-2026-04-23\", - \"gpt-5-codex\", \"gpt-5-pro\", \"gpt-5-pro-2025-10-06\", \"gpt-5.1-codex-max\", - \"gpt-daybreak-blue-latest\", \"gpt-daybreak-red-latest\", and \"gpt-5.6-cyber\".""" - input: Optional[Union[str, list["Item"]]] - """Is either a str type or a [Item] type.""" - previous_response_id: Optional[str] - instructions: Optional[str] - prompt_cache_key: Optional[str] - prompt_cache_retention: Optional[PromptCacheRetentionEnum] - """Known values are: \"in_memory\" and \"24h\".""" - prompt_cache_options: Optional["PromptCacheOptionsParam"] - service_tier: Optional[ServiceTierEnum] - """Known values are: \"auto\", \"default\", \"fast\", \"flex\", and \"priority\".""" - - -Tool = Union[ - A2APreviewTool, - ApplyPatchToolParam, - AzureAISearchTool, - AzureFunctionTool, - BingCustomSearchPreviewTool, - BingGroundingTool, - BrowserAutomationPreviewTool, - CaptureStructuredOutputsTool, - CodeInterpreterTool, - ComputerTool, - ComputerUsePreviewTool, - CustomToolParam, - MicrosoftFabricPreviewTool, - FileSearchTool, - FunctionTool, - ImageGenTool, - LocalShellToolParam, - MCPTool, - MemorySearchPreviewTool, - NamespaceToolParam, - OpenApiTool, - ProgrammaticToolCallingParam, - SharepointPreviewTool, - FunctionShellToolParam, - ToolSearchToolParam, - WebSearchTool, - WebSearchPreviewTool, - WorkIQPreviewTool, -] -OutputItem = Union[ - A2AToolCall, - A2AToolCallOutput, - OutputItemAdditionalTools, - OutputItemApplyPatchToolCall, - OutputItemApplyPatchToolCallOutput, - AzureAISearchToolCall, - AzureAISearchToolCallOutput, - AzureFunctionToolCall, - AzureFunctionToolCallOutput, - BingCustomSearchToolCall, - BingCustomSearchToolCallOutput, - BingGroundingToolCall, - BingGroundingToolCallOutput, - BrowserAutomationToolCall, - BrowserAutomationToolCallOutput, - OutputItemCodeInterpreterToolCall, - OutputItemCompactionBody, - OutputItemComputerToolCall, - OutputItemComputerToolCallOutput, - CustomToolCallResource, - CustomToolCallOutputResource, - FabricDataAgentToolCall, - FabricDataAgentToolCallOutput, - OutputItemFileSearchToolCall, - OutputItemFunctionToolCall, - OutputItemFunctionToolCallOutput, - OutputItemImageGenToolCall, - OutputItemLocalShellToolCall, - OutputItemLocalShellToolCallOutput, - OutputItemMcpApprovalRequest, - OutputItemMcpApprovalResponseResource, - OutputItemMcpToolCall, - OutputItemMcpListTools, - MemorySearchToolCallItemResource, - OutputItemMessage, - OAuthConsentRequestOutputItem, - OpenApiToolCall, - OpenApiToolCallOutput, - OutputItemOutputMessage, - OutputItemProgram, - OutputItemProgramOutput, - OutputItemReasoningItem, - SharepointGroundingToolCall, - SharepointGroundingToolCallOutput, - OutputItemFunctionShellCall, - OutputItemFunctionShellCallOutput, - StructuredOutputsOutputItem, - OutputItemToolSearchCall, - OutputItemToolSearchOutput, - OutputItemWebSearchToolCall, - WorkflowActionOutputItem, -] -Item = Union[ - AdditionalToolsItemParam, - ApplyPatchToolCallItemParam, - ApplyPatchToolCallOutputItemParam, - ItemCodeInterpreterToolCall, - CompactionSummaryItemParam, - ItemComputerToolCall, - ComputerCallOutputItemParam, - ItemCustomToolCall, - ItemCustomToolCallOutput, - ItemFileSearchToolCall, - ItemFunctionToolCall, - FunctionCallOutputItemParam, - ItemImageGenToolCall, - ItemReferenceParam, - ItemLocalShellToolCall, - ItemLocalShellToolCallOutput, - ItemMcpApprovalRequest, - MCPApprovalResponse, - ItemMcpToolCall, - ItemMcpListTools, - MemorySearchToolCallItemParam, - ItemMessage, - ItemOutputMessage, - ItemProgram, - ItemProgramOutput, - ItemReasoningItem, - FunctionShellCallItemParam, - FunctionShellCallOutputItemParam, - ToolSearchCallItemParam, - ToolSearchOutputItemParam, - ItemWebSearchToolCall, -] -Annotation = Union[ContainerFileCitationBody, FileCitationBody, FilePath, UrlCitationBody] -ApplyPatchFileOperation = Union[ - ApplyPatchCreateFileOperation, ApplyPatchDeleteFileOperation, ApplyPatchUpdateFileOperation -] -ApplyPatchOperationParam = Union[ - ApplyPatchCreateFileOperationParam, ApplyPatchDeleteFileOperationParam, ApplyPatchUpdateFileOperationParam -] -MemoryItem = Union[ChatSummaryMemoryItem, UserProfileMemoryItem] -ComputerAction = Union[ - ClickParam, - DoubleClickAction, - DragParam, - KeyPressAction, - MoveParam, - ScreenshotParam, - ScrollParam, - TypeParam, - WaitParam, -] -MessageContent = Union[ - ComputerScreenshotContent, - MessageContentInputFileContent, - MessageContentInputImageContent, - MessageContentInputTextContent, - MessageContentOutputTextContent, - MessageContentReasoningTextContent, - MessageContentRefusalContent, - SummaryTextContent, - TextContent, -] -FunctionShellToolParamEnvironment = Union[ - ContainerAutoParam, - FunctionShellToolParamEnvironmentContainerReferenceParam, - FunctionShellToolParamEnvironmentLocalEnvironmentParam, -] -ContainerNetworkPolicyParam = Union[ContainerNetworkPolicyAllowlistParam, ContainerNetworkPolicyDisabledParam] -FunctionShellCallEnvironment = Union[ContainerReferenceResource, LocalEnvironmentResource] -ContainerSkill = Union[InlineSkillParam, SkillReferenceParam] -CustomToolParamFormat = Union[CustomGrammarFormatParam, CustomTextFormatParam] -ToolCallCaller = Union[DirectToolCallCaller, ProgramToolCallCaller] -ToolCallCallerParam = Union[DirectToolCallCallerParam, ProgramToolCallCallerParam] -FunctionAndCustomToolCallOutput = Union[ - FunctionAndCustomToolCallOutputInputFileContent, - FunctionAndCustomToolCallOutputInputImageContent, - FunctionAndCustomToolCallOutputInputTextContent, -] -FunctionShellCallItemParamEnvironment = Union[ - FunctionShellCallItemParamEnvironmentContainerReferenceParam, - FunctionShellCallItemParamEnvironmentLocalEnvironmentParam, -] -FunctionShellCallOutputOutcome = Union[FunctionShellCallOutputExitOutcome, FunctionShellCallOutputTimeoutOutcome] -FunctionShellCallOutputOutcomeParam = Union[ - FunctionShellCallOutputExitOutcomeParam, FunctionShellCallOutputTimeoutOutcomeParam -] -ItemField = Union[ - ItemFieldAdditionalTools, - ItemFieldApplyPatchToolCall, - ItemFieldApplyPatchToolCallOutput, - ItemFieldCodeInterpreterToolCall, - ItemFieldCompactionBody, - ItemFieldComputerToolCall, - ItemFieldComputerToolCallOutput, - ItemFieldCustomToolCall, - ItemFieldCustomToolCallOutput, - ItemFieldFileSearchToolCall, - ItemFieldFunctionToolCall, - ItemFieldFunctionToolCallOutput, - ItemFieldImageGenToolCall, - ItemFieldLocalShellToolCall, - ItemFieldLocalShellToolCallOutput, - ItemFieldMcpApprovalRequest, - ItemFieldMcpApprovalResponseResource, - ItemFieldMcpToolCall, - ItemFieldMcpListTools, - ItemFieldMessage, - ItemFieldProgram, - ItemFieldProgramOutput, - ItemFieldReasoningItem, - ItemFieldFunctionShellCall, - ItemFieldFunctionShellCallOutput, - ItemFieldToolSearchCall, - ItemFieldToolSearchOutput, - ItemFieldWebSearchToolCall, -] -ModerationEntry = Union[ModerationErrorBody, ModerationResultBody] -OpenApiAuthDetails = Union[OpenApiAnonymousAuthDetails, OpenApiManagedAuthDetails, OpenApiProjectConnectionAuthDetails] -OutputContent = Union[OutputContentOutputTextContent, OutputContentReasoningTextContent, OutputContentRefusalContent] -OutputMessageContent = Union[OutputMessageContentOutputTextContent, OutputMessageContentRefusalContent] -RealtimeMCPError = Union[RealtimeMCPHTTPError, RealtimeMCPProtocolError, RealtimeMCPToolExecutionError] -ResponseStreamEvent = Union[ - ResponseErrorEvent, - ResponseAudioDeltaEvent, - ResponseAudioDoneEvent, - ResponseAudioTranscriptDeltaEvent, - ResponseAudioTranscriptDoneEvent, - ResponseCodeInterpreterCallCompletedEvent, - ResponseCodeInterpreterCallInProgressEvent, - ResponseCodeInterpreterCallInterpretingEvent, - ResponseCodeInterpreterCallCodeDeltaEvent, - ResponseCodeInterpreterCallCodeDoneEvent, - ResponseCompletedEvent, - ResponseContentPartAddedEvent, - ResponseContentPartDoneEvent, - ResponseCreatedEvent, - ResponseCustomToolCallInputDeltaEvent, - ResponseCustomToolCallInputDoneEvent, - ResponseFailedEvent, - ResponseFileSearchCallCompletedEvent, - ResponseFileSearchCallInProgressEvent, - ResponseFileSearchCallSearchingEvent, - ResponseFunctionCallArgumentsDeltaEvent, - ResponseFunctionCallArgumentsDoneEvent, - ResponseImageGenCallCompletedEvent, - ResponseImageGenCallGeneratingEvent, - ResponseImageGenCallInProgressEvent, - ResponseImageGenCallPartialImageEvent, - ResponseInProgressEvent, - ResponseIncompleteEvent, - ResponseMCPCallCompletedEvent, - ResponseMCPCallFailedEvent, - ResponseMCPCallInProgressEvent, - ResponseMCPCallArgumentsDeltaEvent, - ResponseMCPCallArgumentsDoneEvent, - ResponseMCPListToolsCompletedEvent, - ResponseMCPListToolsFailedEvent, - ResponseMCPListToolsInProgressEvent, - ResponseOutputItemAddedEvent, - ResponseOutputItemDoneEvent, - ResponseOutputTextAnnotationAddedEvent, - ResponseTextDeltaEvent, - ResponseTextDoneEvent, - ResponseQueuedEvent, - ResponseReasoningSummaryPartAddedEvent, - ResponseReasoningSummaryPartDoneEvent, - ResponseReasoningSummaryTextDeltaEvent, - ResponseReasoningSummaryTextDoneEvent, - ResponseReasoningTextDeltaEvent, - ResponseReasoningTextDoneEvent, - ResponseRefusalDeltaEvent, - ResponseRefusalDoneEvent, - ResponseWebSearchCallCompletedEvent, - ResponseWebSearchCallInProgressEvent, - ResponseWebSearchCallSearchingEvent, -] -ToolChoiceParam = Union[ - ToolChoiceAllowed, - SpecificApplyPatchParam, - ToolChoiceCodeInterpreter, - ToolChoiceComputer, - ToolChoiceComputerUse, - ToolChoiceComputerUsePreview, - ToolChoiceCustom, - ToolChoiceFileSearch, - ToolChoiceFunction, - ToolChoiceImageGeneration, - ToolChoiceMCP, - SpecificProgrammaticToolCallingParam, - SpecificFunctionShellParam, - ToolChoiceWebSearchPreview, - ToolChoiceWebSearchPreview20250311, -] -TextResponseFormatConfiguration = Union[ - TextResponseFormatConfigurationResponseFormatJsonObject, - TextResponseFormatJsonSchema, - TextResponseFormatConfigurationResponseFormatText, -] + def _make_ResponseErrorCode(): + return Literal['server_error', 'rate_limit_exceeded', 'invalid_prompt', 'data_residency_mismatch', 'bio_policy', 'vector_store_timeout', 'invalid_image', 'invalid_image_format', 'invalid_base64_image', 'invalid_image_url', 'image_too_large', 'image_too_small', 'image_parse_error', 'image_content_policy_violation', 'invalid_image_mode', 'image_file_too_large', 'unsupported_image_media_type', 'empty_image_file', 'failed_to_download_image', 'image_file_not_found'] + + def _make_ResponseStreamEventType(): + return Literal['response.audio.delta', 'response.audio.done', 'response.audio.transcript.delta', 'response.audio.transcript.done', 'response.code_interpreter_call_code.delta', 'response.code_interpreter_call_code.done', 'response.code_interpreter_call.completed', 'response.code_interpreter_call.in_progress', 'response.code_interpreter_call.interpreting', 'response.completed', 'response.content_part.added', 'response.content_part.done', 'response.created', 'error', 'response.file_search_call.completed', 'response.file_search_call.in_progress', 'response.file_search_call.searching', 'response.function_call_arguments.delta', 'response.function_call_arguments.done', 'response.shell_call_command.added', 'response.shell_call_command.delta', 'response.shell_call_command.done', 'response.shell_call_output_content.delta', 'response.shell_call_output_content.done', 'response.in_progress', 'response.failed', 'response.incomplete', 'response.output_item.added', 'response.output_item.done', 'response.reasoning_summary_part.added', 'response.reasoning_summary_part.done', 'response.reasoning_summary_text.delta', 'response.reasoning_summary_text.done', 'response.reasoning_text.delta', 'response.reasoning_text.done', 'response.refusal.delta', 'response.refusal.done', 'response.output_text.delta', 'response.output_text.done', 'response.web_search_call.completed', 'response.web_search_call.in_progress', 'response.web_search_call.searching', 'response.image_generation_call.completed', 'response.image_generation_call.generating', 'response.image_generation_call.in_progress', 'response.image_generation_call.partial_image', 'response.mcp_call_arguments.delta', 'response.mcp_call_arguments.done', 'response.mcp_call.completed', 'response.mcp_call.failed', 'response.mcp_call.in_progress', 'response.mcp_list_tools.completed', 'response.mcp_list_tools.failed', 'response.mcp_list_tools.in_progress', 'response.output_text.annotation.added', 'response.queued', 'response.custom_tool_call_input.delta', 'response.custom_tool_call_input.done'] + + def _make_SearchContentType(): + return Literal['text', 'image'] + + def _make_SearchContextSize(): + return Literal['low', 'medium', 'high'] + + def _make_ServiceTierEnum(): + return Literal['auto', 'default', 'fast', 'flex', 'priority'] + + def _make_TextResponseFormatConfigurationType(): + return Literal['text', 'json_schema', 'json_object'] + + def _make_ToolCallCallerParamType(): + return Literal['direct', 'program'] + + def _make_ToolCallCallerType(): + return Literal['direct', 'program'] + + def _make_ToolCallStatus(): + return Literal['in_progress', 'completed', 'incomplete', 'failed'] + + def _make_ToolChoiceOptions(): + return Literal['none', 'auto', 'required'] + + def _make_ToolChoiceParamType(): + return Literal['allowed_tools', 'function', 'mcp', 'custom', 'programmatic_tool_calling', 'apply_patch', 'shell', 'file_search', 'web_search_preview', 'computer_use_preview', 'web_search_preview_2025_03_11', 'image_generation', 'code_interpreter', 'computer', 'computer_use'] + + def _make_ToolSearchExecutionType(): + return Literal['server', 'client'] + + def _make_ToolType(): + return Literal['function', 'file_search', 'computer', 'computer_use_preview', 'web_search', 'mcp', 'code_interpreter', 'programmatic_tool_calling', 'image_generation', 'local_shell', 'shell', 'custom', 'namespace', 'tool_search', 'web_search_preview', 'apply_patch', 'a2a_preview', 'bing_custom_search_preview', 'browser_automation_preview', 'fabric_dataagent_preview', 'sharepoint_grounding_preview', 'memory_search_preview', 'work_iq_preview', 'azure_ai_search', 'azure_function', 'bing_grounding', 'capture_structured_outputs', 'openapi'] + + def _make_A2APreviewTool(): + class A2APreviewTool(TypedDict, total=False): + """An agent implementing the A2A protocol. + + :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2_A_PREVIEW. + :vartype type: Literal["a2a_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar base_url: Base URL of the agent. + :vartype base_url: str + :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not + provided, defaults to ``/.well-known/agent-card.json``. + :vartype agent_card_path: str + :ivar project_connection_id: The connection ID in the project for the A2A server. The + connection stores authentication and other connection details needed to connect to the A2A + server. + :vartype project_connection_id: str + """ + type: Required[Literal['a2a_preview']] + 'The type of the tool. Always ``"a2a_preview``. Required. A2_A_PREVIEW.' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + base_url: str + 'Base URL of the agent.' + agent_card_path: str + 'The path to the agent card relative to the ``base_url``. If not provided, defaults to\n ``/.well-known/agent-card.json``.' + project_connection_id: str + 'The connection ID in the project for the A2A server. The connection stores authentication and\n other connection details needed to connect to the A2A server.' + A2APreviewTool.__qualname__ = 'A2APreviewTool' + if _version_info < (3, 13): + A2APreviewTool.__doc__ = 'An agent implementing the A2A protocol.\n\n :ivar type: The type of the tool. Always ``"a2a_preview``. Required. A2_A_PREVIEW.\n :vartype type: Literal["a2a_preview"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar base_url: Base URL of the agent.\n :vartype base_url: str\n :ivar agent_card_path: The path to the agent card relative to the ``base_url``. If not\n provided, defaults to ``/.well-known/agent-card.json``.\n :vartype agent_card_path: str\n :ivar project_connection_id: The connection ID in the project for the A2A server. The\n connection stores authentication and other connection details needed to connect to the A2A\n server.\n :vartype project_connection_id: str\n ' + return A2APreviewTool + + def _make_A2AToolCall(): + class A2AToolCall(TypedDict, total=False): + """An A2A (Agent-to-Agent) tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2_A_PREVIEW_CALL. + :vartype type: Literal["a2a_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['a2a_preview_call']] + 'Required. A2_A_PREVIEW_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + name: Required[str] + 'The name of the A2A agent card being called. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + A2AToolCall.__qualname__ = 'A2AToolCall' + if _version_info < (3, 13): + A2AToolCall.__doc__ = 'An A2A (Agent-to-Agent) tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. A2_A_PREVIEW_CALL.\n :vartype type: Literal["a2a_preview_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar name: The name of the A2A agent card being called. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return A2AToolCall + + def _make_A2AToolCallOutput(): + class A2AToolCallOutput(TypedDict, total=False): + """The output of an A2A (Agent-to-Agent) tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. A2_A_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["a2a_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the A2A agent card that was called. Required. + :vartype name: str + :ivar output: The output from the A2A tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['a2a_preview_call_output']] + 'Required. A2_A_PREVIEW_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + name: Required[str] + 'The name of the A2A agent card that was called. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the A2A tool call. Is one of the following types: {str: Any}, str, [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + A2AToolCallOutput.__qualname__ = 'A2AToolCallOutput' + if _version_info < (3, 13): + A2AToolCallOutput.__doc__ = 'The output of an A2A (Agent-to-Agent) tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. A2_A_PREVIEW_CALL_OUTPUT.\n :vartype type: Literal["a2a_preview_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar name: The name of the A2A agent card that was called. Required.\n :vartype name: str\n :ivar output: The output from the A2A tool call. Is one of the following types: {str: Any},\n str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return A2AToolCallOutput + + def _make_AdditionalToolsItemParam(): + class AdditionalToolsItemParam(TypedDict, total=False): + """AdditionalToolsItemParam. + + :ivar id: + :vartype id: str + :ivar type: The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. + :vartype type: Literal["additional_tools"] + :ivar role: The role that provided the additional tools. Only ``developer`` is supported. + Required. Default value is "developer". + :vartype role: Literal["developer"] + :ivar tools: A list of additional tools made available at this item. Required. + :vartype tools: list["Tool"] + """ + id: Optional[str] + type: Required[Literal['additional_tools']] + 'The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.' + role: Required[Literal['developer']] + 'The role that provided the additional tools. Only ``developer`` is supported. Required. Default\n value is "developer".' + tools: Required[list['_types.Tool']] + 'A list of additional tools made available at this item. Required.' + AdditionalToolsItemParam.__qualname__ = 'AdditionalToolsItemParam' + if _version_info < (3, 13): + AdditionalToolsItemParam.__doc__ = 'AdditionalToolsItemParam.\n\n :ivar id:\n :vartype id: str\n :ivar type: The item type. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.\n :vartype type: Literal["additional_tools"]\n :ivar role: The role that provided the additional tools. Only ``developer`` is supported.\n Required. Default value is "developer".\n :vartype role: Literal["developer"]\n :ivar tools: A list of additional tools made available at this item. Required.\n :vartype tools: list["Tool"]\n ' + return AdditionalToolsItemParam + + def _make_AgentReference(): + class AgentReference(TypedDict, total=False): + """AgentReference. + + :ivar type: Required. Default value is "agent_reference". + :vartype type: Literal["agent_reference"] + :ivar name: The name of the agent. Required. + :vartype name: str + :ivar version: The version identifier of the agent. + :vartype version: str + """ + type: Required[Literal['agent_reference']] + 'Required. Default value is "agent_reference".' + name: Required[str] + 'The name of the agent. Required.' + version: str + 'The version identifier of the agent.' + AgentReference.__qualname__ = 'AgentReference' + if _version_info < (3, 13): + AgentReference.__doc__ = 'AgentReference.\n\n :ivar type: Required. Default value is "agent_reference".\n :vartype type: Literal["agent_reference"]\n :ivar name: The name of the agent. Required.\n :vartype name: str\n :ivar version: The version identifier of the agent.\n :vartype version: str\n ' + return AgentReference + + def _make_AISearchIndexResource(): + class AISearchIndexResource(TypedDict, total=False): + """A AI Search Index resource. + + :ivar project_connection_id: An index connection ID in an IndexResource attached to this agent. + :vartype project_connection_id: str + :ivar index_name: The name of an index in an IndexResource attached to this agent. + :vartype index_name: str + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar query_type: Type of query in an AIIndexResource attached to this agent. Known values are: + "simple", "semantic", "vector", "vector_simple_hybrid", and "vector_semantic_hybrid". + :vartype query_type: AzureAISearchQueryType + :ivar top_k: Number of documents to retrieve from search and present to the model. + :vartype top_k: int + :ivar filter: filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters. + :vartype filter: str + :ivar index_asset_id: Index asset id for search resource. + :vartype index_asset_id: str + """ + project_connection_id: str + 'An index connection ID in an IndexResource attached to this agent.' + index_name: str + 'The name of an index in an IndexResource attached to this agent.' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + query_type: _resolve('AzureAISearchQueryType') + 'Type of query in an AIIndexResource attached to this agent. Known values are: "simple",\n "semantic", "vector", "vector_simple_hybrid", and "vector_semantic_hybrid".' + top_k: int + 'Number of documents to retrieve from search and present to the model.' + filter: str + 'filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters.' + index_asset_id: str + 'Index asset id for search resource.' + AISearchIndexResource.__qualname__ = 'AISearchIndexResource' + if _version_info < (3, 13): + AISearchIndexResource.__doc__ = 'A AI Search Index resource.\n\n :ivar project_connection_id: An index connection ID in an IndexResource attached to this agent.\n :vartype project_connection_id: str\n :ivar index_name: The name of an index in an IndexResource attached to this agent.\n :vartype index_name: str\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar query_type: Type of query in an AIIndexResource attached to this agent. Known values are:\n "simple", "semantic", "vector", "vector_simple_hybrid", and "vector_semantic_hybrid".\n :vartype query_type: AzureAISearchQueryType\n :ivar top_k: Number of documents to retrieve from search and present to the model.\n :vartype top_k: int\n :ivar filter: filter string for search resource. Learn more: https://learn.microsoft.com/azure/search/search-filters.\n :vartype filter: str\n :ivar index_asset_id: Index asset id for search resource.\n :vartype index_asset_id: str\n ' + return AISearchIndexResource + + def _make_ApiErrorResponse(): + class ApiErrorResponse(TypedDict, total=False): + """Error response for API failures. + + :ivar error: Required. + :vartype error: "Error" + """ + error: Required['_types.Error'] + 'Required.' + ApiErrorResponse.__qualname__ = 'ApiErrorResponse' + if _version_info < (3, 13): + ApiErrorResponse.__doc__ = 'Error response for API failures.\n\n :ivar error: Required.\n :vartype error: "Error"\n ' + return ApiErrorResponse + + def _make_ApplyPatchCreateFileOperation(): + class ApplyPatchCreateFileOperation(TypedDict, total=False): + """Apply patch create file operation. + + :ivar type: Create a new file with the provided diff. Required. CREATE_FILE. + :vartype type: Literal["create_file"] + :ivar path: Path of the file to create. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + type: Required[Literal['create_file']] + 'Create a new file with the provided diff. Required. CREATE_FILE.' + path: Required[str] + 'Path of the file to create. Required.' + diff: Required[str] + 'Diff to apply. Required.' + ApplyPatchCreateFileOperation.__qualname__ = 'ApplyPatchCreateFileOperation' + if _version_info < (3, 13): + ApplyPatchCreateFileOperation.__doc__ = 'Apply patch create file operation.\n\n :ivar type: Create a new file with the provided diff. Required. CREATE_FILE.\n :vartype type: Literal["create_file"]\n :ivar path: Path of the file to create. Required.\n :vartype path: str\n :ivar diff: Diff to apply. Required.\n :vartype diff: str\n ' + return ApplyPatchCreateFileOperation + + def _make_ApplyPatchCreateFileOperationParam(): + class ApplyPatchCreateFileOperationParam(TypedDict, total=False): + """Apply patch create file operation. + + :ivar type: The operation type. Always ``create_file``. Required. CREATE_FILE. + :vartype type: Literal["create_file"] + :ivar path: Path of the file to create relative to the workspace root. Required. + :vartype path: str + :ivar diff: Unified diff content to apply when creating the file. Required. + :vartype diff: str + """ + type: Required[Literal['create_file']] + 'The operation type. Always ``create_file``. Required. CREATE_FILE.' + path: Required[str] + 'Path of the file to create relative to the workspace root. Required.' + diff: Required[str] + 'Unified diff content to apply when creating the file. Required.' + ApplyPatchCreateFileOperationParam.__qualname__ = 'ApplyPatchCreateFileOperationParam' + if _version_info < (3, 13): + ApplyPatchCreateFileOperationParam.__doc__ = 'Apply patch create file operation.\n\n :ivar type: The operation type. Always ``create_file``. Required. CREATE_FILE.\n :vartype type: Literal["create_file"]\n :ivar path: Path of the file to create relative to the workspace root. Required.\n :vartype path: str\n :ivar diff: Unified diff content to apply when creating the file. Required.\n :vartype diff: str\n ' + return ApplyPatchCreateFileOperationParam + + def _make_ApplyPatchDeleteFileOperation(): + class ApplyPatchDeleteFileOperation(TypedDict, total=False): + """Apply patch delete file operation. + + :ivar type: Delete the specified file. Required. DELETE_FILE. + :vartype type: Literal["delete_file"] + :ivar path: Path of the file to delete. Required. + :vartype path: str + """ + type: Required[Literal['delete_file']] + 'Delete the specified file. Required. DELETE_FILE.' + path: Required[str] + 'Path of the file to delete. Required.' + ApplyPatchDeleteFileOperation.__qualname__ = 'ApplyPatchDeleteFileOperation' + if _version_info < (3, 13): + ApplyPatchDeleteFileOperation.__doc__ = 'Apply patch delete file operation.\n\n :ivar type: Delete the specified file. Required. DELETE_FILE.\n :vartype type: Literal["delete_file"]\n :ivar path: Path of the file to delete. Required.\n :vartype path: str\n ' + return ApplyPatchDeleteFileOperation + + def _make_ApplyPatchDeleteFileOperationParam(): + class ApplyPatchDeleteFileOperationParam(TypedDict, total=False): + """Apply patch delete file operation. + + :ivar type: The operation type. Always ``delete_file``. Required. DELETE_FILE. + :vartype type: Literal["delete_file"] + :ivar path: Path of the file to delete relative to the workspace root. Required. + :vartype path: str + """ + type: Required[Literal['delete_file']] + 'The operation type. Always ``delete_file``. Required. DELETE_FILE.' + path: Required[str] + 'Path of the file to delete relative to the workspace root. Required.' + ApplyPatchDeleteFileOperationParam.__qualname__ = 'ApplyPatchDeleteFileOperationParam' + if _version_info < (3, 13): + ApplyPatchDeleteFileOperationParam.__doc__ = 'Apply patch delete file operation.\n\n :ivar type: The operation type. Always ``delete_file``. Required. DELETE_FILE.\n :vartype type: Literal["delete_file"]\n :ivar path: Path of the file to delete relative to the workspace root. Required.\n :vartype path: str\n ' + return ApplyPatchDeleteFileOperationParam + + def _make_ApplyPatchToolCallItemParam(): + class ApplyPatchToolCallItemParam(TypedDict, total=False): + """Apply patch tool call. + + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: Literal["apply_patch_call"] + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: ApplyPatchCallStatusParam + :ivar operation: The specific create, delete, or update instruction for the apply_patch tool + call. Required. + :vartype operation: "ApplyPatchOperationParam" + """ + type: Required[Literal['apply_patch_call']] + 'The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.' + id: Optional[str] + call_id: Required[str] + 'The unique ID of the apply patch tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCallerParam'] + status: Required[_resolve('ApplyPatchCallStatusParam')] + 'The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required.\n Known values are: "in_progress" and "completed".' + operation: Required['_types.ApplyPatchOperationParam'] + 'The specific create, delete, or update instruction for the apply_patch tool call. Required.' + ApplyPatchToolCallItemParam.__qualname__ = 'ApplyPatchToolCallItemParam' + if _version_info < (3, 13): + ApplyPatchToolCallItemParam.__doc__ = 'Apply patch tool call.\n\n :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.\n :vartype type: Literal["apply_patch_call"]\n :ivar id:\n :vartype id: str\n :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``.\n Required. Known values are: "in_progress" and "completed".\n :vartype status: ApplyPatchCallStatusParam\n :ivar operation: The specific create, delete, or update instruction for the apply_patch tool\n call. Required.\n :vartype operation: "ApplyPatchOperationParam"\n ' + return ApplyPatchToolCallItemParam + + def _make_ApplyPatchToolCallOutputItemParam(): + class ApplyPatchToolCallOutputItemParam(TypedDict, total=False): + """Apply patch tool call output. + + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: Literal["apply_patch_call_output"] + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: ApplyPatchCallOutputStatusParam + :ivar output: + :vartype output: str + """ + type: Required[Literal['apply_patch_call_output']] + 'The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.' + id: Optional[str] + call_id: Required[str] + 'The unique ID of the apply patch tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCallerParam'] + status: Required[_resolve('ApplyPatchCallOutputStatusParam')] + 'The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required.\n Known values are: "completed" and "failed".' + output: Optional[str] + ApplyPatchToolCallOutputItemParam.__qualname__ = 'ApplyPatchToolCallOutputItemParam' + if _version_info < (3, 13): + ApplyPatchToolCallOutputItemParam.__doc__ = 'Apply patch tool call output.\n\n :ivar type: The type of the item. Always ``apply_patch_call_output``. Required.\n APPLY_PATCH_CALL_OUTPUT.\n :vartype type: Literal["apply_patch_call_output"]\n :ivar id:\n :vartype id: str\n :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar status: The status of the apply patch tool call output. One of ``completed`` or\n ``failed``. Required. Known values are: "completed" and "failed".\n :vartype status: ApplyPatchCallOutputStatusParam\n :ivar output:\n :vartype output: str\n ' + return ApplyPatchToolCallOutputItemParam + + def _make_ApplyPatchToolParam(): + class ApplyPatchToolParam(TypedDict, total=False): + """Apply patch tool. + + :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: Literal["apply_patch"] + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + type: Required[Literal['apply_patch']] + 'The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.' + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + ApplyPatchToolParam.__qualname__ = 'ApplyPatchToolParam' + if _version_info < (3, 13): + ApplyPatchToolParam.__doc__ = 'Apply patch tool.\n\n :ivar type: The type of the tool. Always ``apply_patch``. Required. APPLY_PATCH.\n :vartype type: Literal["apply_patch"]\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n ' + return ApplyPatchToolParam + + def _make_ApplyPatchUpdateFileOperation(): + class ApplyPatchUpdateFileOperation(TypedDict, total=False): + """Apply patch update file operation. + + :ivar type: Update an existing file with the provided diff. Required. UPDATE_FILE. + :vartype type: Literal["update_file"] + :ivar path: Path of the file to update. Required. + :vartype path: str + :ivar diff: Diff to apply. Required. + :vartype diff: str + """ + type: Required[Literal['update_file']] + 'Update an existing file with the provided diff. Required. UPDATE_FILE.' + path: Required[str] + 'Path of the file to update. Required.' + diff: Required[str] + 'Diff to apply. Required.' + ApplyPatchUpdateFileOperation.__qualname__ = 'ApplyPatchUpdateFileOperation' + if _version_info < (3, 13): + ApplyPatchUpdateFileOperation.__doc__ = 'Apply patch update file operation.\n\n :ivar type: Update an existing file with the provided diff. Required. UPDATE_FILE.\n :vartype type: Literal["update_file"]\n :ivar path: Path of the file to update. Required.\n :vartype path: str\n :ivar diff: Diff to apply. Required.\n :vartype diff: str\n ' + return ApplyPatchUpdateFileOperation + + def _make_ApplyPatchUpdateFileOperationParam(): + class ApplyPatchUpdateFileOperationParam(TypedDict, total=False): + """Apply patch update file operation. + + :ivar type: The operation type. Always ``update_file``. Required. UPDATE_FILE. + :vartype type: Literal["update_file"] + :ivar path: Path of the file to update relative to the workspace root. Required. + :vartype path: str + :ivar diff: Unified diff content to apply to the existing file. Required. + :vartype diff: str + """ + type: Required[Literal['update_file']] + 'The operation type. Always ``update_file``. Required. UPDATE_FILE.' + path: Required[str] + 'Path of the file to update relative to the workspace root. Required.' + diff: Required[str] + 'Unified diff content to apply to the existing file. Required.' + ApplyPatchUpdateFileOperationParam.__qualname__ = 'ApplyPatchUpdateFileOperationParam' + if _version_info < (3, 13): + ApplyPatchUpdateFileOperationParam.__doc__ = 'Apply patch update file operation.\n\n :ivar type: The operation type. Always ``update_file``. Required. UPDATE_FILE.\n :vartype type: Literal["update_file"]\n :ivar path: Path of the file to update relative to the workspace root. Required.\n :vartype path: str\n :ivar diff: Unified diff content to apply to the existing file. Required.\n :vartype diff: str\n ' + return ApplyPatchUpdateFileOperationParam + + def _make_ApproximateLocation(): + class ApproximateLocation(TypedDict, total=False): + """ApproximateLocation. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: Literal["approximate"] + :ivar country: + :vartype country: str + :ivar region: + :vartype region: str + :ivar city: + :vartype city: str + :ivar timezone: + :vartype timezone: str + """ + type: Required[Literal['approximate']] + 'The type of location approximation. Always ``approximate``. Required. Default value is\n "approximate".' + country: Optional[str] + region: Optional[str] + city: Optional[str] + timezone: Optional[str] + ApproximateLocation.__qualname__ = 'ApproximateLocation' + if _version_info < (3, 13): + ApproximateLocation.__doc__ = 'ApproximateLocation.\n\n :ivar type: The type of location approximation. Always ``approximate``. Required. Default value\n is "approximate".\n :vartype type: Literal["approximate"]\n :ivar country:\n :vartype country: str\n :ivar region:\n :vartype region: str\n :ivar city:\n :vartype city: str\n :ivar timezone:\n :vartype timezone: str\n ' + return ApproximateLocation + + def _make_AutoCodeInterpreterToolParam(): + class AutoCodeInterpreterToolParam(TypedDict, total=False): + """Automatic Code Interpreter Tool Parameters. + + :ivar type: Always ``auto``. Required. Default value is "auto". + :vartype type: Literal["auto"] + :ivar file_ids: An optional list of uploaded files to make available to your code. + :vartype file_ids: list[str] + :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". + :vartype memory_limit: ContainerMemoryLimit + :ivar network_policy: + :vartype network_policy: "ContainerNetworkPolicyParam" + """ + type: Required[Literal['auto']] + 'Always ``auto``. Required. Default value is "auto".' + file_ids: list[str] + 'An optional list of uploaded files to make available to your code.' + memory_limit: Optional[_resolve('ContainerMemoryLimit')] + 'Known values are: "1g", "4g", "16g", and "64g".' + network_policy: '_types.ContainerNetworkPolicyParam' + AutoCodeInterpreterToolParam.__qualname__ = 'AutoCodeInterpreterToolParam' + if _version_info < (3, 13): + AutoCodeInterpreterToolParam.__doc__ = 'Automatic Code Interpreter Tool Parameters.\n\n :ivar type: Always ``auto``. Required. Default value is "auto".\n :vartype type: Literal["auto"]\n :ivar file_ids: An optional list of uploaded files to make available to your code.\n :vartype file_ids: list[str]\n :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g".\n :vartype memory_limit: ContainerMemoryLimit\n :ivar network_policy:\n :vartype network_policy: "ContainerNetworkPolicyParam"\n ' + return AutoCodeInterpreterToolParam + + def _make_AzureAISearchTool(): + class AzureAISearchTool(TypedDict, total=False): + """The input definition information for an Azure AI search tool as used to configure an agent. + + :ivar type: The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH. + :vartype type: Literal["azure_ai_search"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar azure_ai_search: The azure ai search index resource. Required. + :vartype azure_ai_search: "AzureAISearchToolResource" + """ + type: Required[Literal['azure_ai_search']] + "The object type, which is always 'azure_ai_search'. Required. AZURE_AI_SEARCH." + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + azure_ai_search: Required['_types.AzureAISearchToolResource'] + 'The azure ai search index resource. Required.' + AzureAISearchTool.__qualname__ = 'AzureAISearchTool' + if _version_info < (3, 13): + AzureAISearchTool.__doc__ = 'The input definition information for an Azure AI search tool as used to configure an agent.\n\n :ivar type: The object type, which is always \'azure_ai_search\'. Required. AZURE_AI_SEARCH.\n :vartype type: Literal["azure_ai_search"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar azure_ai_search: The azure ai search index resource. Required.\n :vartype azure_ai_search: "AzureAISearchToolResource"\n ' + return AzureAISearchTool + + def _make_AzureAISearchToolCall(): + class AzureAISearchToolCall(TypedDict, total=False): + """An Azure AI Search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL. + :vartype type: Literal["azure_ai_search_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['azure_ai_search_call']] + 'Required. AZURE_AI_SEARCH_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + AzureAISearchToolCall.__qualname__ = 'AzureAISearchToolCall' + if _version_info < (3, 13): + AzureAISearchToolCall.__doc__ = 'An Azure AI Search tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. AZURE_AI_SEARCH_CALL.\n :vartype type: Literal["azure_ai_search_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return AzureAISearchToolCall + + def _make_AzureAISearchToolCallOutput(): + class AzureAISearchToolCallOutput(TypedDict, total=False): + """The output of an Azure AI Search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_AI_SEARCH_CALL_OUTPUT. + :vartype type: Literal["azure_ai_search_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Azure AI Search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['azure_ai_search_call_output']] + 'Required. AZURE_AI_SEARCH_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the Azure AI Search tool call. Is one of the following types: {str: Any}, str,\n [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + AzureAISearchToolCallOutput.__qualname__ = 'AzureAISearchToolCallOutput' + if _version_info < (3, 13): + AzureAISearchToolCallOutput.__doc__ = 'The output of an Azure AI Search tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. AZURE_AI_SEARCH_CALL_OUTPUT.\n :vartype type: Literal["azure_ai_search_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar output: The output from the Azure AI Search tool call. Is one of the following types:\n {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return AzureAISearchToolCallOutput + + def _make_AzureAISearchToolResource(): + class AzureAISearchToolResource(TypedDict, total=False): + """A set of index resources used by the ``azure_ai_search`` tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar indexes: The indices attached to this agent. There can be a maximum of 1 index resource + attached to the agent. Required. + :vartype indexes: list["AISearchIndexResource"] + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + indexes: Required[list['_types.AISearchIndexResource']] + 'The indices attached to this agent. There can be a maximum of 1 index resource attached to the\n agent. Required.' + AzureAISearchToolResource.__qualname__ = 'AzureAISearchToolResource' + if _version_info < (3, 13): + AzureAISearchToolResource.__doc__ = 'A set of index resources used by the ``azure_ai_search`` tool.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar indexes: The indices attached to this agent. There can be a maximum of 1 index resource\n attached to the agent. Required.\n :vartype indexes: list["AISearchIndexResource"]\n ' + return AzureAISearchToolResource + + def _make_AzureFunctionBinding(): + class AzureFunctionBinding(TypedDict, total=False): + """The structure for keeping storage queue name and URI. + + :ivar type: The type of binding, which is always 'storage_queue'. Required. Default value is + "storage_queue". + :vartype type: Literal["storage_queue"] + :ivar storage_queue: Storage queue. Required. + :vartype storage_queue: "AzureFunctionStorageQueue" + """ + type: Required[Literal['storage_queue']] + 'The type of binding, which is always \'storage_queue\'. Required. Default value is\n "storage_queue".' + storage_queue: Required['_types.AzureFunctionStorageQueue'] + 'Storage queue. Required.' + AzureFunctionBinding.__qualname__ = 'AzureFunctionBinding' + if _version_info < (3, 13): + AzureFunctionBinding.__doc__ = 'The structure for keeping storage queue name and URI.\n\n :ivar type: The type of binding, which is always \'storage_queue\'. Required. Default value is\n "storage_queue".\n :vartype type: Literal["storage_queue"]\n :ivar storage_queue: Storage queue. Required.\n :vartype storage_queue: "AzureFunctionStorageQueue"\n ' + return AzureFunctionBinding + + def _make_AzureFunctionDefinition(): + class AzureFunctionDefinition(TypedDict, total=False): + """The definition of Azure function. + + :ivar function: The definition of azure function and its parameters. Required. + :vartype function: "AzureFunctionDefinitionFunction" + :ivar input_binding: Input storage queue. The queue storage trigger runs a function as messages + are added to it. Required. + :vartype input_binding: "AzureFunctionBinding" + :ivar output_binding: Output storage queue. The function writes output to this queue when the + input items are processed. Required. + :vartype output_binding: "AzureFunctionBinding" + """ + function: Required['_types.AzureFunctionDefinitionFunction'] + 'The definition of azure function and its parameters. Required.' + input_binding: Required['_types.AzureFunctionBinding'] + 'Input storage queue. The queue storage trigger runs a function as messages are added to it.\n Required.' + output_binding: Required['_types.AzureFunctionBinding'] + 'Output storage queue. The function writes output to this queue when the input items are\n processed. Required.' + AzureFunctionDefinition.__qualname__ = 'AzureFunctionDefinition' + if _version_info < (3, 13): + AzureFunctionDefinition.__doc__ = 'The definition of Azure function.\n\n :ivar function: The definition of azure function and its parameters. Required.\n :vartype function: "AzureFunctionDefinitionFunction"\n :ivar input_binding: Input storage queue. The queue storage trigger runs a function as messages\n are added to it. Required.\n :vartype input_binding: "AzureFunctionBinding"\n :ivar output_binding: Output storage queue. The function writes output to this queue when the\n input items are processed. Required.\n :vartype output_binding: "AzureFunctionBinding"\n ' + return AzureFunctionDefinition + + def _make_AzureFunctionDefinitionFunction(): + class AzureFunctionDefinitionFunction(TypedDict, total=False): + """AzureFunctionDefinitionFunction. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, Any] + """ + name: Required[str] + 'The name of the function to be called. Required.' + description: str + 'A description of what the function does, used by the model to choose when and how to call the\n function.' + parameters: Required[dict[str, Any]] + 'The parameters the functions accepts, described as a JSON Schema object. Required.' + AzureFunctionDefinitionFunction.__qualname__ = 'AzureFunctionDefinitionFunction' + if _version_info < (3, 13): + AzureFunctionDefinitionFunction.__doc__ = 'AzureFunctionDefinitionFunction.\n\n :ivar name: The name of the function to be called. Required.\n :vartype name: str\n :ivar description: A description of what the function does, used by the model to choose when\n and how to call the function.\n :vartype description: str\n :ivar parameters: The parameters the functions accepts, described as a JSON Schema object.\n Required.\n :vartype parameters: dict[str, Any]\n ' + return AzureFunctionDefinitionFunction + + def _make_AzureFunctionStorageQueue(): + class AzureFunctionStorageQueue(TypedDict, total=False): + """The structure for keeping storage queue name and URI. + + :ivar queue_service_endpoint: URI to the Azure Storage Queue service allowing you to manipulate + a queue. Required. + :vartype queue_service_endpoint: str + :ivar queue_name: The name of an Azure function storage queue. Required. + :vartype queue_name: str + """ + queue_service_endpoint: Required[str] + 'URI to the Azure Storage Queue service allowing you to manipulate a queue. Required.' + queue_name: Required[str] + 'The name of an Azure function storage queue. Required.' + AzureFunctionStorageQueue.__qualname__ = 'AzureFunctionStorageQueue' + if _version_info < (3, 13): + AzureFunctionStorageQueue.__doc__ = 'The structure for keeping storage queue name and URI.\n\n :ivar queue_service_endpoint: URI to the Azure Storage Queue service allowing you to manipulate\n a queue. Required.\n :vartype queue_service_endpoint: str\n :ivar queue_name: The name of an Azure function storage queue. Required.\n :vartype queue_name: str\n ' + return AzureFunctionStorageQueue + + def _make_AzureFunctionTool(): + class AzureFunctionTool(TypedDict, total=False): + """The input definition information for an Azure Function Tool, as used to configure an Agent. + + :ivar type: The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION. + :vartype type: Literal["azure_function"] + :ivar azure_function: The Azure Function Tool definition. Required. + :vartype azure_function: "AzureFunctionDefinition" + """ + type: Required[Literal['azure_function']] + "The object type, which is always 'browser_automation'. Required. AZURE_FUNCTION." + azure_function: Required['_types.AzureFunctionDefinition'] + 'The Azure Function Tool definition. Required.' + AzureFunctionTool.__qualname__ = 'AzureFunctionTool' + if _version_info < (3, 13): + AzureFunctionTool.__doc__ = 'The input definition information for an Azure Function Tool, as used to configure an Agent.\n\n :ivar type: The object type, which is always \'browser_automation\'. Required. AZURE_FUNCTION.\n :vartype type: Literal["azure_function"]\n :ivar azure_function: The Azure Function Tool definition. Required.\n :vartype azure_function: "AzureFunctionDefinition"\n ' + return AzureFunctionTool + + def _make_AzureFunctionToolCall(): + class AzureFunctionToolCall(TypedDict, total=False): + """An Azure Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL. + :vartype type: Literal["azure_function_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['azure_function_call']] + 'Required. AZURE_FUNCTION_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + name: Required[str] + 'The name of the Azure Function being called. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + AzureFunctionToolCall.__qualname__ = 'AzureFunctionToolCall' + if _version_info < (3, 13): + AzureFunctionToolCall.__doc__ = 'An Azure Function tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. AZURE_FUNCTION_CALL.\n :vartype type: Literal["azure_function_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar name: The name of the Azure Function being called. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return AzureFunctionToolCall + + def _make_AzureFunctionToolCallOutput(): + class AzureFunctionToolCallOutput(TypedDict, total=False): + """The output of an Azure Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. AZURE_FUNCTION_CALL_OUTPUT. + :vartype type: Literal["azure_function_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the Azure Function that was called. Required. + :vartype name: str + :ivar output: The output from the Azure Function tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['azure_function_call_output']] + 'Required. AZURE_FUNCTION_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + name: Required[str] + 'The name of the Azure Function that was called. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the Azure Function tool call. Is one of the following types: {str: Any}, str,\n [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + AzureFunctionToolCallOutput.__qualname__ = 'AzureFunctionToolCallOutput' + if _version_info < (3, 13): + AzureFunctionToolCallOutput.__doc__ = 'The output of an Azure Function tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. AZURE_FUNCTION_CALL_OUTPUT.\n :vartype type: Literal["azure_function_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar name: The name of the Azure Function that was called. Required.\n :vartype name: str\n :ivar output: The output from the Azure Function tool call. Is one of the following types:\n {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return AzureFunctionToolCallOutput + + def _make_BingCustomSearchConfiguration(): + class BingCustomSearchConfiguration(TypedDict, total=False): + """A bing custom search configuration. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar instance_name: Name of the custom configuration instance given to config. Required. + :vartype instance_name: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str + :ivar count: The number of search results to return in the bing api response. + :vartype count: int + :ivar freshness: Filter search results by a specific time range. See `accepted values here + `_. + :vartype freshness: str + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connection_id: Required[str] + 'Project connection id for grounding with bing search. Required.' + instance_name: Required[str] + 'Name of the custom configuration instance given to config. Required.' + market: str + 'The market where the results come from.' + set_lang: str + 'The language to use for user interface strings when calling Bing API.' + count: int + 'The number of search results to return in the bing api response.' + freshness: str + 'Filter search results by a specific time range. See `accepted values here\n `_.' + BingCustomSearchConfiguration.__qualname__ = 'BingCustomSearchConfiguration' + if _version_info < (3, 13): + BingCustomSearchConfiguration.__doc__ = 'A bing custom search configuration.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connection_id: Project connection id for grounding with bing search. Required.\n :vartype project_connection_id: str\n :ivar instance_name: Name of the custom configuration instance given to config. Required.\n :vartype instance_name: str\n :ivar market: The market where the results come from.\n :vartype market: str\n :ivar set_lang: The language to use for user interface strings when calling Bing API.\n :vartype set_lang: str\n :ivar count: The number of search results to return in the bing api response.\n :vartype count: int\n :ivar freshness: Filter search results by a specific time range. See `accepted values here\n `_.\n :vartype freshness: str\n ' + return BingCustomSearchConfiguration + + def _make_BingCustomSearchPreviewTool(): + class BingCustomSearchPreviewTool(TypedDict, total=False): + """The input definition information for a Bing custom search tool as used to configure an agent. + + :ivar type: The object type, which is always 'bing_custom_search_preview'. Required. + BING_CUSTOM_SEARCH_PREVIEW. + :vartype type: Literal["bing_custom_search_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar bing_custom_search_preview: The bing custom search tool parameters. Required. + :vartype bing_custom_search_preview: "BingCustomSearchToolParameters" + """ + type: Required[Literal['bing_custom_search_preview']] + "The object type, which is always 'bing_custom_search_preview'. Required.\n BING_CUSTOM_SEARCH_PREVIEW." + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + bing_custom_search_preview: Required['_types.BingCustomSearchToolParameters'] + 'The bing custom search tool parameters. Required.' + BingCustomSearchPreviewTool.__qualname__ = 'BingCustomSearchPreviewTool' + if _version_info < (3, 13): + BingCustomSearchPreviewTool.__doc__ = 'The input definition information for a Bing custom search tool as used to configure an agent.\n\n :ivar type: The object type, which is always \'bing_custom_search_preview\'. Required.\n BING_CUSTOM_SEARCH_PREVIEW.\n :vartype type: Literal["bing_custom_search_preview"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar bing_custom_search_preview: The bing custom search tool parameters. Required.\n :vartype bing_custom_search_preview: "BingCustomSearchToolParameters"\n ' + return BingCustomSearchPreviewTool + + def _make_BingCustomSearchToolCall(): + class BingCustomSearchToolCall(TypedDict, total=False): + """A Bing custom search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL. + :vartype type: Literal["bing_custom_search_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['bing_custom_search_preview_call']] + 'Required. BING_CUSTOM_SEARCH_PREVIEW_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + BingCustomSearchToolCall.__qualname__ = 'BingCustomSearchToolCall' + if _version_info < (3, 13): + BingCustomSearchToolCall.__doc__ = 'A Bing custom search tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL.\n :vartype type: Literal["bing_custom_search_preview_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return BingCustomSearchToolCall + + def _make_BingCustomSearchToolCallOutput(): + class BingCustomSearchToolCallOutput(TypedDict, total=False): + """The output of a Bing custom search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["bing_custom_search_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing custom search tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['bing_custom_search_preview_call_output']] + 'Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the Bing custom search tool call. Is one of the following types: {str: Any},\n str, [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + BingCustomSearchToolCallOutput.__qualname__ = 'BingCustomSearchToolCallOutput' + if _version_info < (3, 13): + BingCustomSearchToolCallOutput.__doc__ = 'The output of a Bing custom search tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. BING_CUSTOM_SEARCH_PREVIEW_CALL_OUTPUT.\n :vartype type: Literal["bing_custom_search_preview_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar output: The output from the Bing custom search tool call. Is one of the following types:\n {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return BingCustomSearchToolCallOutput + + def _make_BingCustomSearchToolParameters(): + class BingCustomSearchToolParameters(TypedDict, total=False): + """The bing custom search tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar search_configurations: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. Required. + :vartype search_configurations: list["BingCustomSearchConfiguration"] + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + search_configurations: Required[list['_types.BingCustomSearchConfiguration']] + 'The project connections attached to this tool. There can be a maximum of 1 connection resource\n attached to the tool. Required.' + BingCustomSearchToolParameters.__qualname__ = 'BingCustomSearchToolParameters' + if _version_info < (3, 13): + BingCustomSearchToolParameters.__doc__ = 'The bing custom search tool parameters.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar search_configurations: The project connections attached to this tool. There can be a\n maximum of 1 connection resource attached to the tool. Required.\n :vartype search_configurations: list["BingCustomSearchConfiguration"]\n ' + return BingCustomSearchToolParameters + + def _make_BingGroundingSearchConfiguration(): + class BingGroundingSearchConfiguration(TypedDict, total=False): + """Search configuration for Bing Grounding. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing search. Required. + :vartype project_connection_id: str + :ivar market: The market where the results come from. + :vartype market: str + :ivar set_lang: The language to use for user interface strings when calling Bing API. + :vartype set_lang: str + :ivar count: The number of search results to return in the bing api response. + :vartype count: int + :ivar freshness: Filter search results by a specific time range. See `accepted values here + `_. + :vartype freshness: str + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connection_id: Required[str] + 'Project connection id for grounding with bing search. Required.' + market: str + 'The market where the results come from.' + set_lang: str + 'The language to use for user interface strings when calling Bing API.' + count: int + 'The number of search results to return in the bing api response.' + freshness: str + 'Filter search results by a specific time range. See `accepted values here\n `_.' + BingGroundingSearchConfiguration.__qualname__ = 'BingGroundingSearchConfiguration' + if _version_info < (3, 13): + BingGroundingSearchConfiguration.__doc__ = 'Search configuration for Bing Grounding.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connection_id: Project connection id for grounding with bing search. Required.\n :vartype project_connection_id: str\n :ivar market: The market where the results come from.\n :vartype market: str\n :ivar set_lang: The language to use for user interface strings when calling Bing API.\n :vartype set_lang: str\n :ivar count: The number of search results to return in the bing api response.\n :vartype count: int\n :ivar freshness: Filter search results by a specific time range. See `accepted values here\n `_.\n :vartype freshness: str\n ' + return BingGroundingSearchConfiguration + + def _make_BingGroundingSearchToolParameters(): + class BingGroundingSearchToolParameters(TypedDict, total=False): + """The bing grounding search tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar search_configurations: The search configurations attached to this tool. There can be a + maximum of 1 search configuration resource attached to the tool. Required. + :vartype search_configurations: list["BingGroundingSearchConfiguration"] + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + search_configurations: Required[list['_types.BingGroundingSearchConfiguration']] + 'The search configurations attached to this tool. There can be a maximum of 1 search\n configuration resource attached to the tool. Required.' + BingGroundingSearchToolParameters.__qualname__ = 'BingGroundingSearchToolParameters' + if _version_info < (3, 13): + BingGroundingSearchToolParameters.__doc__ = 'The bing grounding search tool parameters.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar search_configurations: The search configurations attached to this tool. There can be a\n maximum of 1 search configuration resource attached to the tool. Required.\n :vartype search_configurations: list["BingGroundingSearchConfiguration"]\n ' + return BingGroundingSearchToolParameters + + def _make_BingGroundingTool(): + class BingGroundingTool(TypedDict, total=False): + """The input definition information for a bing grounding search tool as used to configure an + agent. + + :ivar type: The object type, which is always 'bing_grounding'. Required. BING_GROUNDING. + :vartype type: Literal["bing_grounding"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar bing_grounding: The bing grounding search tool parameters. Required. + :vartype bing_grounding: "BingGroundingSearchToolParameters" + """ + type: Required[Literal['bing_grounding']] + "The object type, which is always 'bing_grounding'. Required. BING_GROUNDING." + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + bing_grounding: Required['_types.BingGroundingSearchToolParameters'] + 'The bing grounding search tool parameters. Required.' + BingGroundingTool.__qualname__ = 'BingGroundingTool' + if _version_info < (3, 13): + BingGroundingTool.__doc__ = 'The input definition information for a bing grounding search tool as used to configure an\n agent.\n\n :ivar type: The object type, which is always \'bing_grounding\'. Required. BING_GROUNDING.\n :vartype type: Literal["bing_grounding"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar bing_grounding: The bing grounding search tool parameters. Required.\n :vartype bing_grounding: "BingGroundingSearchToolParameters"\n ' + return BingGroundingTool + + def _make_BingGroundingToolCall(): + class BingGroundingToolCall(TypedDict, total=False): + """A Bing grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL. + :vartype type: Literal["bing_grounding_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['bing_grounding_call']] + 'Required. BING_GROUNDING_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + BingGroundingToolCall.__qualname__ = 'BingGroundingToolCall' + if _version_info < (3, 13): + BingGroundingToolCall.__doc__ = 'A Bing grounding tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. BING_GROUNDING_CALL.\n :vartype type: Literal["bing_grounding_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return BingGroundingToolCall + + def _make_BingGroundingToolCallOutput(): + class BingGroundingToolCallOutput(TypedDict, total=False): + """The output of a Bing grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BING_GROUNDING_CALL_OUTPUT. + :vartype type: Literal["bing_grounding_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Bing grounding tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['bing_grounding_call_output']] + 'Required. BING_GROUNDING_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the Bing grounding tool call. Is one of the following types: {str: Any}, str,\n [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + BingGroundingToolCallOutput.__qualname__ = 'BingGroundingToolCallOutput' + if _version_info < (3, 13): + BingGroundingToolCallOutput.__doc__ = 'The output of a Bing grounding tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. BING_GROUNDING_CALL_OUTPUT.\n :vartype type: Literal["bing_grounding_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar output: The output from the Bing grounding tool call. Is one of the following types:\n {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return BingGroundingToolCallOutput + + def _make_BrowserAutomationPreviewTool(): + class BrowserAutomationPreviewTool(TypedDict, total=False): + """The input definition information for a Browser Automation Tool, as used to configure an Agent. + + :ivar type: The object type, which is always 'browser_automation_preview'. Required. + BROWSER_AUTOMATION_PREVIEW. + :vartype type: Literal["browser_automation_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar browser_automation_preview: The Browser Automation Tool parameters. Required. + :vartype browser_automation_preview: "BrowserAutomationToolParameters" + """ + type: Required[Literal['browser_automation_preview']] + "The object type, which is always 'browser_automation_preview'. Required.\n BROWSER_AUTOMATION_PREVIEW." + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + browser_automation_preview: Required['_types.BrowserAutomationToolParameters'] + 'The Browser Automation Tool parameters. Required.' + BrowserAutomationPreviewTool.__qualname__ = 'BrowserAutomationPreviewTool' + if _version_info < (3, 13): + BrowserAutomationPreviewTool.__doc__ = 'The input definition information for a Browser Automation Tool, as used to configure an Agent.\n\n :ivar type: The object type, which is always \'browser_automation_preview\'. Required.\n BROWSER_AUTOMATION_PREVIEW.\n :vartype type: Literal["browser_automation_preview"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar browser_automation_preview: The Browser Automation Tool parameters. Required.\n :vartype browser_automation_preview: "BrowserAutomationToolParameters"\n ' + return BrowserAutomationPreviewTool + + def _make_BrowserAutomationToolCall(): + class BrowserAutomationToolCall(TypedDict, total=False): + """A browser automation tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL. + :vartype type: Literal["browser_automation_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['browser_automation_preview_call']] + 'Required. BROWSER_AUTOMATION_PREVIEW_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + BrowserAutomationToolCall.__qualname__ = 'BrowserAutomationToolCall' + if _version_info < (3, 13): + BrowserAutomationToolCall.__doc__ = 'A browser automation tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL.\n :vartype type: Literal["browser_automation_preview_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return BrowserAutomationToolCall + + def _make_BrowserAutomationToolCallOutput(): + class BrowserAutomationToolCallOutput(TypedDict, total=False): + """The output of a browser automation tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["browser_automation_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the browser automation tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['browser_automation_preview_call_output']] + 'Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the browser automation tool call. Is one of the following types: {str: Any},\n str, [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + BrowserAutomationToolCallOutput.__qualname__ = 'BrowserAutomationToolCallOutput' + if _version_info < (3, 13): + BrowserAutomationToolCallOutput.__doc__ = 'The output of a browser automation tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. BROWSER_AUTOMATION_PREVIEW_CALL_OUTPUT.\n :vartype type: Literal["browser_automation_preview_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar output: The output from the browser automation tool call. Is one of the following types:\n {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return BrowserAutomationToolCallOutput + + def _make_BrowserAutomationToolConnectionParameters(): + class BrowserAutomationToolConnectionParameters(TypedDict, total=False): + """Definition of input parameters for the connection used by the Browser Automation Tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: The ID of the project connection to your Azure Playwright + resource. Required. + :vartype project_connection_id: str + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connection_id: Required[str] + 'The ID of the project connection to your Azure Playwright resource. Required.' + BrowserAutomationToolConnectionParameters.__qualname__ = 'BrowserAutomationToolConnectionParameters' + if _version_info < (3, 13): + BrowserAutomationToolConnectionParameters.__doc__ = 'Definition of input parameters for the connection used by the Browser Automation Tool.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connection_id: The ID of the project connection to your Azure Playwright\n resource. Required.\n :vartype project_connection_id: str\n ' + return BrowserAutomationToolConnectionParameters + + def _make_BrowserAutomationToolParameters(): + class BrowserAutomationToolParameters(TypedDict, total=False): + """Definition of input parameters for the Browser Automation Tool. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar connection: The project connection parameters associated with the Browser Automation + Tool. Required. + :vartype connection: "BrowserAutomationToolConnectionParameters" + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + connection: Required['_types.BrowserAutomationToolConnectionParameters'] + 'The project connection parameters associated with the Browser Automation Tool. Required.' + BrowserAutomationToolParameters.__qualname__ = 'BrowserAutomationToolParameters' + if _version_info < (3, 13): + BrowserAutomationToolParameters.__doc__ = 'Definition of input parameters for the Browser Automation Tool.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar connection: The project connection parameters associated with the Browser Automation\n Tool. Required.\n :vartype connection: "BrowserAutomationToolConnectionParameters"\n ' + return BrowserAutomationToolParameters + + def _make_CaptureStructuredOutputsTool(): + class CaptureStructuredOutputsTool(TypedDict, total=False): + """A tool for capturing structured outputs. + + :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required. + CAPTURE_STRUCTURED_OUTPUTS. + :vartype type: Literal["capture_structured_outputs"] + :ivar outputs: The structured outputs to capture from the model. Required. + :vartype outputs: "StructuredOutputDefinition" + """ + type: Required[Literal['capture_structured_outputs']] + 'The type of the tool. Always ``capture_structured_outputs``. Required.\n CAPTURE_STRUCTURED_OUTPUTS.' + outputs: Required['_types.StructuredOutputDefinition'] + 'The structured outputs to capture from the model. Required.' + CaptureStructuredOutputsTool.__qualname__ = 'CaptureStructuredOutputsTool' + if _version_info < (3, 13): + CaptureStructuredOutputsTool.__doc__ = 'A tool for capturing structured outputs.\n\n :ivar type: The type of the tool. Always ``capture_structured_outputs``. Required.\n CAPTURE_STRUCTURED_OUTPUTS.\n :vartype type: Literal["capture_structured_outputs"]\n :ivar outputs: The structured outputs to capture from the model. Required.\n :vartype outputs: "StructuredOutputDefinition"\n ' + return CaptureStructuredOutputsTool + + def _make_ChatSummaryMemoryItem(): + class ChatSummaryMemoryItem(TypedDict, total=False): + """A memory item containing a summary extracted from conversations. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: int + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. Summary of chat conversations. + :vartype kind: Literal["chat_summary"] + """ + memory_id: Required[str] + 'The unique ID of the memory item. Required.' + updated_at: Required[int] + 'The last update time of the memory item. Required.' + scope: Required[str] + 'The namespace that logically groups and isolates memories, such as a user ID. Required.' + content: Required[str] + 'The content of the memory. Required.' + kind: Required[Literal['chat_summary']] + 'The kind of the memory item. Required. Summary of chat conversations.' + ChatSummaryMemoryItem.__qualname__ = 'ChatSummaryMemoryItem' + if _version_info < (3, 13): + ChatSummaryMemoryItem.__doc__ = 'A memory item containing a summary extracted from conversations.\n\n :ivar memory_id: The unique ID of the memory item. Required.\n :vartype memory_id: str\n :ivar updated_at: The last update time of the memory item. Required.\n :vartype updated_at: int\n :ivar scope: The namespace that logically groups and isolates memories, such as a user ID.\n Required.\n :vartype scope: str\n :ivar content: The content of the memory. Required.\n :vartype content: str\n :ivar kind: The kind of the memory item. Required. Summary of chat conversations.\n :vartype kind: Literal["chat_summary"]\n ' + return ChatSummaryMemoryItem + + def _make_ClickParam(): + class ClickParam(TypedDict, total=False): + """Click. + + :ivar type: Specifies the event type. For a click action, this property is always ``click``. + Required. CLICK. + :vartype type: Literal["click"] + :ivar button: Indicates which mouse button was pressed during the click. One of ``left``, + ``right``, ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right", + "wheel", "back", and "forward". + :vartype button: ClickButtonType + :ivar x: The x-coordinate where the click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the click occurred. Required. + :vartype y: int + :ivar keys: + :vartype keys: list[str] + """ + type: Required[Literal['click']] + 'Specifies the event type. For a click action, this property is always ``click``. Required.\n CLICK.' + button: Required[_resolve('ClickButtonType')] + 'Indicates which mouse button was pressed during the click. One of ``left``, ``right``,\n ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right",\n "wheel", "back", and "forward".' + x: Required[int] + 'The x-coordinate where the click occurred. Required.' + y: Required[int] + 'The y-coordinate where the click occurred. Required.' + keys: Optional[list[str]] + ClickParam.__qualname__ = 'ClickParam' + if _version_info < (3, 13): + ClickParam.__doc__ = 'Click.\n\n :ivar type: Specifies the event type. For a click action, this property is always ``click``.\n Required. CLICK.\n :vartype type: Literal["click"]\n :ivar button: Indicates which mouse button was pressed during the click. One of ``left``,\n ``right``, ``wheel``, ``back``, or ``forward``. Required. Known values are: "left", "right",\n "wheel", "back", and "forward".\n :vartype button: ClickButtonType\n :ivar x: The x-coordinate where the click occurred. Required.\n :vartype x: int\n :ivar y: The y-coordinate where the click occurred. Required.\n :vartype y: int\n :ivar keys:\n :vartype keys: list[str]\n ' + return ClickParam + + def _make_CodeInterpreterOutputImage(): + class CodeInterpreterOutputImage(TypedDict, total=False): + """Code interpreter output image. + + :ivar type: The type of the output. Always ``image``. Required. Default value is "image". + :vartype type: Literal["image"] + :ivar url: The URL of the image output from the code interpreter. Required. + :vartype url: str + """ + type: Required[Literal['image']] + 'The type of the output. Always ``image``. Required. Default value is "image".' + url: Required[str] + 'The URL of the image output from the code interpreter. Required.' + CodeInterpreterOutputImage.__qualname__ = 'CodeInterpreterOutputImage' + if _version_info < (3, 13): + CodeInterpreterOutputImage.__doc__ = 'Code interpreter output image.\n\n :ivar type: The type of the output. Always ``image``. Required. Default value is "image".\n :vartype type: Literal["image"]\n :ivar url: The URL of the image output from the code interpreter. Required.\n :vartype url: str\n ' + return CodeInterpreterOutputImage + + def _make_CodeInterpreterOutputLogs(): + class CodeInterpreterOutputLogs(TypedDict, total=False): + """Code interpreter output logs. + + :ivar type: The type of the output. Always ``logs``. Required. Default value is "logs". + :vartype type: Literal["logs"] + :ivar logs: The logs output from the code interpreter. Required. + :vartype logs: str + """ + type: Required[Literal['logs']] + 'The type of the output. Always ``logs``. Required. Default value is "logs".' + logs: Required[str] + 'The logs output from the code interpreter. Required.' + CodeInterpreterOutputLogs.__qualname__ = 'CodeInterpreterOutputLogs' + if _version_info < (3, 13): + CodeInterpreterOutputLogs.__doc__ = 'Code interpreter output logs.\n\n :ivar type: The type of the output. Always ``logs``. Required. Default value is "logs".\n :vartype type: Literal["logs"]\n :ivar logs: The logs output from the code interpreter. Required.\n :vartype logs: str\n ' + return CodeInterpreterOutputLogs + + def _make_CodeInterpreterTool(): + class CodeInterpreterTool(TypedDict, total=False): + """Code interpreter. + + :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required. + CODE_INTERPRETER. + :vartype type: Literal["code_interpreter"] + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar container: The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an optional + ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a + AutoCodeInterpreterToolParam type. + :vartype container: Union[str, "AutoCodeInterpreterToolParam"] + """ + type: Required[Literal['code_interpreter']] + 'The type of the code interpreter tool. Always ``code_interpreter``. Required. CODE_INTERPRETER.' + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + container: Union[str, '_types.AutoCodeInterpreterToolParam'] + 'The code interpreter container. Can be a container ID or an object that specifies uploaded file\n IDs to make available to your code, along with an optional ``memory_limit`` setting. If not\n provided, the service assumes auto. Is either a str type or a AutoCodeInterpreterToolParam\n type.' + CodeInterpreterTool.__qualname__ = 'CodeInterpreterTool' + if _version_info < (3, 13): + CodeInterpreterTool.__doc__ = 'Code interpreter.\n\n :ivar type: The type of the code interpreter tool. Always ``code_interpreter``. Required.\n CODE_INTERPRETER.\n :vartype type: Literal["code_interpreter"]\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar container: The code interpreter container. Can be a container ID or an object that\n specifies uploaded file IDs to make available to your code, along with an optional\n ``memory_limit`` setting. If not provided, the service assumes auto. Is either a str type or a\n AutoCodeInterpreterToolParam type.\n :vartype container: Union[str, "AutoCodeInterpreterToolParam"]\n ' + return CodeInterpreterTool + + def _make_CompactionSummaryItemParam(): + class CompactionSummaryItemParam(TypedDict, total=False): + """Compaction item. + + :ivar id: + :vartype id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: Literal["compaction"] + :ivar encrypted_content: The encrypted content of the compaction summary. Required. + :vartype encrypted_content: str + """ + id: Optional[str] + type: Required[Literal['compaction']] + 'The type of the item. Always ``compaction``. Required. COMPACTION.' + encrypted_content: Required[str] + 'The encrypted content of the compaction summary. Required.' + CompactionSummaryItemParam.__qualname__ = 'CompactionSummaryItemParam' + if _version_info < (3, 13): + CompactionSummaryItemParam.__doc__ = 'Compaction item.\n\n :ivar id:\n :vartype id: str\n :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION.\n :vartype type: Literal["compaction"]\n :ivar encrypted_content: The encrypted content of the compaction summary. Required.\n :vartype encrypted_content: str\n ' + return CompactionSummaryItemParam + + def _make_CompactResource(): + class CompactResource(TypedDict, total=False): + """The compacted response object. + + :ivar id: The unique identifier for the compacted response. Required. + :vartype id: str + :ivar object: The object type. Always ``response.compaction``. Required. Default value is + "response.compaction". + :vartype object: Literal["response.compaction"] + :ivar output: The compacted list of output items. Required. + :vartype output: list["ItemField"] + :ivar created_at: Unix timestamp (in seconds) when the compacted conversation was created. + Required. + :vartype created_at: int + :ivar usage: Token accounting for the compaction pass, including cached, reasoning, and total + tokens. Required. + :vartype usage: "ResponseUsage" + """ + id: Required[str] + 'The unique identifier for the compacted response. Required.' + object: Required[Literal['response.compaction']] + 'The object type. Always ``response.compaction``. Required. Default value is\n "response.compaction".' + output: Required[list['_types.ItemField']] + 'The compacted list of output items. Required.' + created_at: Required[int] + 'Unix timestamp (in seconds) when the compacted conversation was created. Required.' + usage: Required['_types.ResponseUsage'] + 'Token accounting for the compaction pass, including cached, reasoning, and total tokens.\n Required.' + CompactResource.__qualname__ = 'CompactResource' + if _version_info < (3, 13): + CompactResource.__doc__ = 'The compacted response object.\n\n :ivar id: The unique identifier for the compacted response. Required.\n :vartype id: str\n :ivar object: The object type. Always ``response.compaction``. Required. Default value is\n "response.compaction".\n :vartype object: Literal["response.compaction"]\n :ivar output: The compacted list of output items. Required.\n :vartype output: list["ItemField"]\n :ivar created_at: Unix timestamp (in seconds) when the compacted conversation was created.\n Required.\n :vartype created_at: int\n :ivar usage: Token accounting for the compaction pass, including cached, reasoning, and total\n tokens. Required.\n :vartype usage: "ResponseUsage"\n ' + return CompactResource + + def _make_ComparisonFilter(): + class ComparisonFilter(TypedDict, total=False): + """Comparison Filter. + + :ivar type: Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, + ``lte``, ``in``, ``nin``. + + * `eq`: equals + * `ne`: not equal + * `gt`: greater than + * `gte`: greater than or equal + * `lt`: less than + * `lte`: less than or equal + * `in`: in + * `nin`: not in. Required. Is one of the following types: Literal["eq"], Literal["ne"], + Literal["gt"], Literal["gte"], Literal["lt"], Literal["lte"], Literal["in"], Literal["nin"] + :vartype type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"] + :ivar key: The key to compare against the value. Required. + :vartype key: str + :ivar value: The value to compare against the attribute key; supports string, number, or + boolean types. Required. Is one of the following types: str, float, bool, [Union[str, float]] + :vartype value: Union[str, float, bool, list[Union[str, float]]] + """ + type: Required[Literal['eq', 'ne', 'gt', 'gte', 'lt', 'lte', 'in', 'nin']] + 'Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``, ``lte``, ``in``,\n ``nin``.\n\n * `eq`: equals\n * `ne`: not equal\n * `gt`: greater than\n * `gte`: greater than or equal\n * `lt`: less than\n * `lte`: less than or equal\n * `in`: in\n * `nin`: not in. Required. Is one of the following types: Literal["eq"],\n Literal["ne"], Literal["gt"], Literal["gte"], Literal["lt"], Literal["lte"],\n Literal["in"], Literal["nin"]' + key: Required[str] + 'The key to compare against the value. Required.' + value: Required[Union[str, float, bool, list[Union[str, float]]]] + 'The value to compare against the attribute key; supports string, number, or boolean types.\n Required. Is one of the following types: str, float, bool, [Union[str, float]]' + ComparisonFilter.__qualname__ = 'ComparisonFilter' + if _version_info < (3, 13): + ComparisonFilter.__doc__ = 'Comparison Filter.\n\n :ivar type: Specifies the comparison operator: ``eq``, ``ne``, ``gt``, ``gte``, ``lt``,\n ``lte``, ``in``, ``nin``.\n\n * `eq`: equals\n * `ne`: not equal\n * `gt`: greater than\n * `gte`: greater than or equal\n * `lt`: less than\n * `lte`: less than or equal\n * `in`: in\n * `nin`: not in. Required. Is one of the following types: Literal["eq"], Literal["ne"],\n Literal["gt"], Literal["gte"], Literal["lt"], Literal["lte"], Literal["in"], Literal["nin"]\n :vartype type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]\n :ivar key: The key to compare against the value. Required.\n :vartype key: str\n :ivar value: The value to compare against the attribute key; supports string, number, or\n boolean types. Required. Is one of the following types: str, float, bool, [Union[str, float]]\n :vartype value: Union[str, float, bool, list[Union[str, float]]]\n ' + return ComparisonFilter + + def _make_CompoundFilter(): + class CompoundFilter(TypedDict, total=False): + """Compound Filter. + + :ivar type: Type of operation: ``and`` or ``or``. Required. Is either a Literal["and"] type or + a Literal["or"] type. + :vartype type: Literal["and", "or"] + :ivar filters: Array of filters to combine. Items can be ``ComparisonFilter`` or + ``CompoundFilter``. Required. + :vartype filters: list[Union["ComparisonFilter", Any]] + """ + type: Required[Literal['and', 'or']] + 'Type of operation: ``and`` or ``or``. Required. Is either a Literal["and"] type or a\n Literal["or"] type.' + filters: Required[list[Union['_types.ComparisonFilter', Any]]] + 'Array of filters to combine. Items can be ``ComparisonFilter`` or ``CompoundFilter``. Required.' + CompoundFilter.__qualname__ = 'CompoundFilter' + if _version_info < (3, 13): + CompoundFilter.__doc__ = 'Compound Filter.\n\n :ivar type: Type of operation: ``and`` or ``or``. Required. Is either a Literal["and"] type or\n a Literal["or"] type.\n :vartype type: Literal["and", "or"]\n :ivar filters: Array of filters to combine. Items can be ``ComparisonFilter`` or\n ``CompoundFilter``. Required.\n :vartype filters: list[Union["ComparisonFilter", Any]]\n ' + return CompoundFilter + + def _make_ComputerCallOutputItemParam(): + class ComputerCallOutputItemParam(TypedDict, total=False): + """Computer tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: Literal["computer_call_output"] + :ivar output: Required. + :vartype output: "ComputerScreenshotImage" + :ivar acknowledged_safety_checks: + :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + id: Optional[str] + call_id: Required[str] + 'The ID of the computer tool call that produced the output. Required.' + type: Required[Literal['computer_call_output']] + 'The type of the computer tool call output. Always ``computer_call_output``. Required.\n COMPUTER_CALL_OUTPUT.' + output: Required['_types.ComputerScreenshotImage'] + 'Required.' + acknowledged_safety_checks: Optional[list['_types.ComputerCallSafetyCheckParam']] + status: Optional[_resolve('FunctionCallItemStatus')] + 'Known values are: "in_progress", "completed", and "incomplete".' + ComputerCallOutputItemParam.__qualname__ = 'ComputerCallOutputItemParam' + if _version_info < (3, 13): + ComputerCallOutputItemParam.__doc__ = 'Computer tool call output.\n\n :ivar id:\n :vartype id: str\n :ivar call_id: The ID of the computer tool call that produced the output. Required.\n :vartype call_id: str\n :ivar type: The type of the computer tool call output. Always ``computer_call_output``.\n Required. COMPUTER_CALL_OUTPUT.\n :vartype type: Literal["computer_call_output"]\n :ivar output: Required.\n :vartype output: "ComputerScreenshotImage"\n :ivar acknowledged_safety_checks:\n :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"]\n :ivar status: Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallItemStatus\n ' + return ComputerCallOutputItemParam + + def _make_ComputerCallSafetyCheckParam(): + class ComputerCallSafetyCheckParam(TypedDict, total=False): + """A pending safety check for the computer call. + + :ivar id: The ID of the pending safety check. Required. + :vartype id: str + :ivar code: + :vartype code: str + :ivar message: + :vartype message: str + """ + id: Required[str] + 'The ID of the pending safety check. Required.' + code: Optional[str] + message: Optional[str] + ComputerCallSafetyCheckParam.__qualname__ = 'ComputerCallSafetyCheckParam' + if _version_info < (3, 13): + ComputerCallSafetyCheckParam.__doc__ = 'A pending safety check for the computer call.\n\n :ivar id: The ID of the pending safety check. Required.\n :vartype id: str\n :ivar code:\n :vartype code: str\n :ivar message:\n :vartype message: str\n ' + return ComputerCallSafetyCheckParam + + def _make_ComputerScreenshotContent(): + class ComputerScreenshotContent(TypedDict, total=False): + """Computer screenshot. + + :ivar type: Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. COMPUTER_SCREENSHOT. + :vartype type: Literal["computer_screenshot"] + :ivar image_url: Required. + :vartype image_url: str + :ivar file_id: Required. + :vartype file_id: str + :ivar detail: The detail level of the screenshot image to be sent to the model. One of + ``high``, ``low``, ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: + "low", "high", "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['computer_screenshot']] + 'Specifies the event type. For a computer screenshot, this property is always set to\n ``computer_screenshot``. Required. COMPUTER_SCREENSHOT.' + image_url: Required[Optional[str]] + 'Required.' + file_id: Required[Optional[str]] + 'Required.' + detail: Required[_resolve('ImageDetail')] + 'The detail level of the screenshot image to be sent to the model. One of ``high``, ``low``,\n ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high",\n "auto", and "original".' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + ComputerScreenshotContent.__qualname__ = 'ComputerScreenshotContent' + if _version_info < (3, 13): + ComputerScreenshotContent.__doc__ = 'Computer screenshot.\n\n :ivar type: Specifies the event type. For a computer screenshot, this property is always set to\n ``computer_screenshot``. Required. COMPUTER_SCREENSHOT.\n :vartype type: Literal["computer_screenshot"]\n :ivar image_url: Required.\n :vartype image_url: str\n :ivar file_id: Required.\n :vartype file_id: str\n :ivar detail: The detail level of the screenshot image to be sent to the model. One of\n ``high``, ``low``, ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are:\n "low", "high", "auto", and "original".\n :vartype detail: ImageDetail\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return ComputerScreenshotContent + + def _make_ComputerScreenshotImage(): + class ComputerScreenshotImage(TypedDict, total=False): + """A computer screenshot image used with the computer use tool. + + :ivar type: Specifies the event type. For a computer screenshot, this property is always set to + ``computer_screenshot``. Required. Default value is "computer_screenshot". + :vartype type: Literal["computer_screenshot"] + :ivar image_url: The URL of the screenshot image. + :vartype image_url: str + :ivar file_id: The identifier of an uploaded file that contains the screenshot. + :vartype file_id: str + """ + type: Required[Literal['computer_screenshot']] + 'Specifies the event type. For a computer screenshot, this property is always set to\n ``computer_screenshot``. Required. Default value is "computer_screenshot".' + image_url: str + 'The URL of the screenshot image.' + file_id: str + 'The identifier of an uploaded file that contains the screenshot.' + ComputerScreenshotImage.__qualname__ = 'ComputerScreenshotImage' + if _version_info < (3, 13): + ComputerScreenshotImage.__doc__ = 'A computer screenshot image used with the computer use tool.\n\n :ivar type: Specifies the event type. For a computer screenshot, this property is always set to\n ``computer_screenshot``. Required. Default value is "computer_screenshot".\n :vartype type: Literal["computer_screenshot"]\n :ivar image_url: The URL of the screenshot image.\n :vartype image_url: str\n :ivar file_id: The identifier of an uploaded file that contains the screenshot.\n :vartype file_id: str\n ' + return ComputerScreenshotImage + + def _make_ComputerTool(): + class ComputerTool(TypedDict, total=False): + """Computer. + + :ivar type: The type of the computer tool. Always ``computer``. Required. COMPUTER. + :vartype type: Literal["computer"] + """ + type: Required[Literal['computer']] + 'The type of the computer tool. Always ``computer``. Required. COMPUTER.' + ComputerTool.__qualname__ = 'ComputerTool' + if _version_info < (3, 13): + ComputerTool.__doc__ = 'Computer.\n\n :ivar type: The type of the computer tool. Always ``computer``. Required. COMPUTER.\n :vartype type: Literal["computer"]\n ' + return ComputerTool + + def _make_ComputerUsePreviewTool(): + class ComputerUsePreviewTool(TypedDict, total=False): + """Computer use preview. + + :ivar type: The type of the computer use tool. Always ``computer_use_preview``. Required. + COMPUTER_USE_PREVIEW. + :vartype type: Literal["computer_use_preview"] + :ivar environment: The type of computer environment to control. Required. Known values are: + "windows", "mac", "linux", "ubuntu", and "browser". + :vartype environment: ComputerEnvironment + :ivar display_width: The width of the computer display. Required. + :vartype display_width: int + :ivar display_height: The height of the computer display. Required. + :vartype display_height: int + """ + type: Required[Literal['computer_use_preview']] + 'The type of the computer use tool. Always ``computer_use_preview``. Required.\n COMPUTER_USE_PREVIEW.' + environment: Required[_resolve('ComputerEnvironment')] + 'The type of computer environment to control. Required. Known values are: "windows", "mac",\n "linux", "ubuntu", and "browser".' + display_width: Required[int] + 'The width of the computer display. Required.' + display_height: Required[int] + 'The height of the computer display. Required.' + ComputerUsePreviewTool.__qualname__ = 'ComputerUsePreviewTool' + if _version_info < (3, 13): + ComputerUsePreviewTool.__doc__ = 'Computer use preview.\n\n :ivar type: The type of the computer use tool. Always ``computer_use_preview``. Required.\n COMPUTER_USE_PREVIEW.\n :vartype type: Literal["computer_use_preview"]\n :ivar environment: The type of computer environment to control. Required. Known values are:\n "windows", "mac", "linux", "ubuntu", and "browser".\n :vartype environment: ComputerEnvironment\n :ivar display_width: The width of the computer display. Required.\n :vartype display_width: int\n :ivar display_height: The height of the computer display. Required.\n :vartype display_height: int\n ' + return ComputerUsePreviewTool + + def _make_ContainerAutoParam(): + class ContainerAutoParam(TypedDict, total=False): + """ContainerAutoParam. + + :ivar type: Automatically creates a container for this request. Required. CONTAINER_AUTO. + :vartype type: Literal["container_auto"] + :ivar file_ids: An optional list of uploaded files to make available to your code. + :vartype file_ids: list[str] + :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g". + :vartype memory_limit: ContainerMemoryLimit + :ivar skills: An optional list of skills referenced by id or inline data. + :vartype skills: list["ContainerSkill"] + :ivar network_policy: + :vartype network_policy: "ContainerNetworkPolicyParam" + """ + type: Required[Literal['container_auto']] + 'Automatically creates a container for this request. Required. CONTAINER_AUTO.' + file_ids: list[str] + 'An optional list of uploaded files to make available to your code.' + memory_limit: Optional[_resolve('ContainerMemoryLimit')] + 'Known values are: "1g", "4g", "16g", and "64g".' + skills: list['_types.ContainerSkill'] + 'An optional list of skills referenced by id or inline data.' + network_policy: '_types.ContainerNetworkPolicyParam' + ContainerAutoParam.__qualname__ = 'ContainerAutoParam' + if _version_info < (3, 13): + ContainerAutoParam.__doc__ = 'ContainerAutoParam.\n\n :ivar type: Automatically creates a container for this request. Required. CONTAINER_AUTO.\n :vartype type: Literal["container_auto"]\n :ivar file_ids: An optional list of uploaded files to make available to your code.\n :vartype file_ids: list[str]\n :ivar memory_limit: Known values are: "1g", "4g", "16g", and "64g".\n :vartype memory_limit: ContainerMemoryLimit\n :ivar skills: An optional list of skills referenced by id or inline data.\n :vartype skills: list["ContainerSkill"]\n :ivar network_policy:\n :vartype network_policy: "ContainerNetworkPolicyParam"\n ' + return ContainerAutoParam + + def _make_ContainerFileCitationBody(): + class ContainerFileCitationBody(TypedDict, total=False): + """Container file citation. + + :ivar type: The type of the container file citation. Always ``container_file_citation``. + Required. CONTAINER_FILE_CITATION. + :vartype type: Literal["container_file_citation"] + :ivar container_id: The ID of the container file. Required. + :vartype container_id: str + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar start_index: The index of the first character of the container file citation in the + message. Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the container file citation in the message. + Required. + :vartype end_index: int + :ivar filename: The filename of the container file cited. Required. + :vartype filename: str + """ + type: Required[Literal['container_file_citation']] + 'The type of the container file citation. Always ``container_file_citation``. Required.\n CONTAINER_FILE_CITATION.' + container_id: Required[str] + 'The ID of the container file. Required.' + file_id: Required[str] + 'The ID of the file. Required.' + start_index: Required[int] + 'The index of the first character of the container file citation in the message. Required.' + end_index: Required[int] + 'The index of the last character of the container file citation in the message. Required.' + filename: Required[str] + 'The filename of the container file cited. Required.' + ContainerFileCitationBody.__qualname__ = 'ContainerFileCitationBody' + if _version_info < (3, 13): + ContainerFileCitationBody.__doc__ = 'Container file citation.\n\n :ivar type: The type of the container file citation. Always ``container_file_citation``.\n Required. CONTAINER_FILE_CITATION.\n :vartype type: Literal["container_file_citation"]\n :ivar container_id: The ID of the container file. Required.\n :vartype container_id: str\n :ivar file_id: The ID of the file. Required.\n :vartype file_id: str\n :ivar start_index: The index of the first character of the container file citation in the\n message. Required.\n :vartype start_index: int\n :ivar end_index: The index of the last character of the container file citation in the message.\n Required.\n :vartype end_index: int\n :ivar filename: The filename of the container file cited. Required.\n :vartype filename: str\n ' + return ContainerFileCitationBody + + def _make_ContainerNetworkPolicyAllowlistParam(): + class ContainerNetworkPolicyAllowlistParam(TypedDict, total=False): + """ContainerNetworkPolicyAllowlistParam. + + :ivar type: Allow outbound network access only to specified domains. Always ``allowlist``. + Required. ALLOWLIST. + :vartype type: Literal["allowlist"] + :ivar allowed_domains: A list of allowed domains when type is ``allowlist``. Required. + :vartype allowed_domains: list[str] + :ivar domain_secrets: Optional domain-scoped secrets for allowlisted domains. + :vartype domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"] + """ + type: Required[Literal['allowlist']] + 'Allow outbound network access only to specified domains. Always ``allowlist``. Required.\n ALLOWLIST.' + allowed_domains: Required[list[str]] + 'A list of allowed domains when type is ``allowlist``. Required.' + domain_secrets: list['_types.ContainerNetworkPolicyDomainSecretParam'] + 'Optional domain-scoped secrets for allowlisted domains.' + ContainerNetworkPolicyAllowlistParam.__qualname__ = 'ContainerNetworkPolicyAllowlistParam' + if _version_info < (3, 13): + ContainerNetworkPolicyAllowlistParam.__doc__ = 'ContainerNetworkPolicyAllowlistParam.\n\n :ivar type: Allow outbound network access only to specified domains. Always ``allowlist``.\n Required. ALLOWLIST.\n :vartype type: Literal["allowlist"]\n :ivar allowed_domains: A list of allowed domains when type is ``allowlist``. Required.\n :vartype allowed_domains: list[str]\n :ivar domain_secrets: Optional domain-scoped secrets for allowlisted domains.\n :vartype domain_secrets: list["ContainerNetworkPolicyDomainSecretParam"]\n ' + return ContainerNetworkPolicyAllowlistParam + + def _make_ContainerNetworkPolicyDisabledParam(): + class ContainerNetworkPolicyDisabledParam(TypedDict, total=False): + """ContainerNetworkPolicyDisabledParam. + + :ivar type: Disable outbound network access. Always ``disabled``. Required. DISABLED. + :vartype type: Literal["disabled"] + """ + type: Required[Literal['disabled']] + 'Disable outbound network access. Always ``disabled``. Required. DISABLED.' + ContainerNetworkPolicyDisabledParam.__qualname__ = 'ContainerNetworkPolicyDisabledParam' + if _version_info < (3, 13): + ContainerNetworkPolicyDisabledParam.__doc__ = 'ContainerNetworkPolicyDisabledParam.\n\n :ivar type: Disable outbound network access. Always ``disabled``. Required. DISABLED.\n :vartype type: Literal["disabled"]\n ' + return ContainerNetworkPolicyDisabledParam + + def _make_ContainerNetworkPolicyDomainSecretParam(): + class ContainerNetworkPolicyDomainSecretParam(TypedDict, total=False): + """ContainerNetworkPolicyDomainSecretParam. + + :ivar domain: The domain associated with the secret. Required. + :vartype domain: str + :ivar name: The name of the secret to inject for the domain. Required. + :vartype name: str + :ivar value: The secret value to inject for the domain. Required. + :vartype value: str + """ + domain: Required[str] + 'The domain associated with the secret. Required.' + name: Required[str] + 'The name of the secret to inject for the domain. Required.' + value: Required[str] + 'The secret value to inject for the domain. Required.' + ContainerNetworkPolicyDomainSecretParam.__qualname__ = 'ContainerNetworkPolicyDomainSecretParam' + if _version_info < (3, 13): + ContainerNetworkPolicyDomainSecretParam.__doc__ = 'ContainerNetworkPolicyDomainSecretParam.\n\n :ivar domain: The domain associated with the secret. Required.\n :vartype domain: str\n :ivar name: The name of the secret to inject for the domain. Required.\n :vartype name: str\n :ivar value: The secret value to inject for the domain. Required.\n :vartype value: str\n ' + return ContainerNetworkPolicyDomainSecretParam + + def _make_ContainerReferenceResource(): + class ContainerReferenceResource(TypedDict, total=False): + """Container Reference. + + :ivar type: The environment type. Always ``container_reference``. Required. + CONTAINER_REFERENCE. + :vartype type: Literal["container_reference"] + :ivar container_id: Required. + :vartype container_id: str + """ + type: Required[Literal['container_reference']] + 'The environment type. Always ``container_reference``. Required. CONTAINER_REFERENCE.' + container_id: Required[str] + 'Required.' + ContainerReferenceResource.__qualname__ = 'ContainerReferenceResource' + if _version_info < (3, 13): + ContainerReferenceResource.__doc__ = 'Container Reference.\n\n :ivar type: The environment type. Always ``container_reference``. Required.\n CONTAINER_REFERENCE.\n :vartype type: Literal["container_reference"]\n :ivar container_id: Required.\n :vartype container_id: str\n ' + return ContainerReferenceResource + + def _make_ContextManagementParam(): + class ContextManagementParam(TypedDict, total=False): + """ContextManagementParam. + + :ivar type: The context management entry type. Currently only 'compaction' is supported. + Required. + :vartype type: str + :ivar compact_threshold: + :vartype compact_threshold: int + """ + type: Required[str] + "The context management entry type. Currently only 'compaction' is supported. Required." + compact_threshold: Optional[int] + ContextManagementParam.__qualname__ = 'ContextManagementParam' + if _version_info < (3, 13): + ContextManagementParam.__doc__ = "ContextManagementParam.\n\n :ivar type: The context management entry type. Currently only 'compaction' is supported.\n Required.\n :vartype type: str\n :ivar compact_threshold:\n :vartype compact_threshold: int\n " + return ContextManagementParam + + def _make_ConversationParam_2(): + class ConversationParam_2(TypedDict, total=False): + """Conversation object. + + :ivar id: The unique ID of the conversation. Required. + :vartype id: str + """ + id: Required[str] + 'The unique ID of the conversation. Required.' + ConversationParam_2.__qualname__ = 'ConversationParam_2' + if _version_info < (3, 13): + ConversationParam_2.__doc__ = 'Conversation object.\n\n :ivar id: The unique ID of the conversation. Required.\n :vartype id: str\n ' + return ConversationParam_2 + + def _make_ConversationReference(): + class ConversationReference(TypedDict, total=False): + """Conversation. + + :ivar id: The unique ID of the conversation that this response was associated with. Required. + :vartype id: str + """ + id: Required[str] + 'The unique ID of the conversation that this response was associated with. Required.' + ConversationReference.__qualname__ = 'ConversationReference' + if _version_info < (3, 13): + ConversationReference.__doc__ = 'Conversation.\n\n :ivar id: The unique ID of the conversation that this response was associated with. Required.\n :vartype id: str\n ' + return ConversationReference + + def _make_CoordParam(): + class CoordParam(TypedDict, total=False): + """Coordinate. + + :ivar x: The x-coordinate. Required. + :vartype x: int + :ivar y: The y-coordinate. Required. + :vartype y: int + """ + x: Required[int] + 'The x-coordinate. Required.' + y: Required[int] + 'The y-coordinate. Required.' + CoordParam.__qualname__ = 'CoordParam' + if _version_info < (3, 13): + CoordParam.__doc__ = 'Coordinate.\n\n :ivar x: The x-coordinate. Required.\n :vartype x: int\n :ivar y: The y-coordinate. Required.\n :vartype y: int\n ' + return CoordParam + + def _make_CreateResponse(): + class CreateResponse(TypedDict, total=False): + """CreateResponse. + + :ivar metadata: + :vartype metadata: "Metadata" + :ivar top_logprobs: + :vartype top_logprobs: int + :ivar temperature: + :vartype temperature: float + :ivar top_p: + :vartype top_p: float + :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers. + :vartype user: str + :ivar safety_identifier: + :vartype safety_identifier: str + :ivar prompt_cache_key: + :vartype prompt_cache_key: str + :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type. + :vartype prompt_cache_retention: Literal["in_memory", "24h"] + :ivar prompt_cache_options: + :vartype prompt_cache_options: "PromptCacheOptionsParam" + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar model: The model deployment to use for the creation of this response. + :vartype model: str + :ivar background: + :vartype background: bool + :ivar max_tool_calls: + :vartype max_tool_calls: int + :ivar text: + :vartype text: "ResponseTextParam" + :ivar tools: + :vartype tools: list["Tool"] + :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. + :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + :ivar prompt: + :vartype prompt: "Prompt" + :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"] + :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast", + "ultrafast"] + :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. + :vartype truncation: Literal["auto", "disabled"] + :ivar reasoning: + :vartype reasoning: "Reasoning" + :ivar input: Is either a str type or a [Item] type. + :vartype input: "_unions.InputParam" + :ivar include: + :vartype include: list[IncludeEnum] + :ivar parallel_tool_calls: + :vartype parallel_tool_calls: bool + :ivar store: + :vartype store: bool + :ivar instructions: + :vartype instructions: str + :ivar moderation: + :vartype moderation: "ModerationParam" + :ivar stream: + :vartype stream: bool + :ivar stream_options: + :vartype stream_options: "ResponseStreamOptions" + :ivar conversation: Is either a str type or a ConversationParam_2 type. + :vartype conversation: "_unions.ConversationParam" + :ivar context_management: Context management configuration for this request. + :vartype context_management: list["ContextManagementParam"] + :ivar max_output_tokens: + :vartype max_output_tokens: int + :ivar agent_reference: The agent to use for generating the response. + :vartype agent_reference: "AgentReference" + :ivar structured_inputs: The structured inputs to the response that can participate in prompt + template substitution or tool argument bindings. + :vartype structured_inputs: dict[str, Any] + """ + metadata: Optional['_types.Metadata'] + top_logprobs: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + user: str + 'This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use\n ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your\n end-users. Used to boost cache hit rates by better bucketing similar requests and to help\n OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.' + safety_identifier: Optional[str] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[Literal['in_memory', '24h']] + 'Is either a Literal["in_memory"] type or a Literal["24h"] type.' + prompt_cache_options: '_types.PromptCacheOptionsParam' + previous_response_id: Optional[str] + model: str + 'The model deployment to use for the creation of this response.' + background: Optional[bool] + max_tool_calls: Optional[int] + text: '_types.ResponseTextParam' + tools: list['_types.Tool'] + tool_choice: Union[_resolve('ToolChoiceOptions'), '_types.ToolChoiceParam'] + 'Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.' + prompt: '_types.Prompt' + service_tier: Optional[Literal['auto', 'default', 'flex', 'scale', 'priority', 'fast', 'ultrafast']] + 'Is one of the following types: Literal["auto"], Literal["default"], Literal["flex"],\n Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"]' + truncation: Optional[Literal['auto', 'disabled']] + 'Is either a Literal["auto"] type or a Literal["disabled"] type.' + reasoning: Optional['_types.Reasoning'] + input: '_unions.InputParam' + 'Is either a str type or a [Item] type.' + include: Optional[list[_resolve('IncludeEnum')]] + parallel_tool_calls: Optional[bool] + store: Optional[bool] + instructions: Optional[str] + moderation: Optional['_types.ModerationParam'] + stream: Optional[bool] + stream_options: Optional['_types.ResponseStreamOptions'] + conversation: Optional['_unions.ConversationParam'] + 'Is either a str type or a ConversationParam_2 type.' + context_management: Optional[list['_types.ContextManagementParam']] + 'Context management configuration for this request.' + max_output_tokens: Optional[int] + agent_reference: '_types.AgentReference' + 'The agent to use for generating the response.' + structured_inputs: dict[str, Any] + 'The structured inputs to the response that can participate in prompt template substitution or\n tool argument bindings.' + CreateResponse.__qualname__ = 'CreateResponse' + if _version_info < (3, 13): + CreateResponse.__doc__ = 'CreateResponse.\n\n :ivar metadata:\n :vartype metadata: "Metadata"\n :ivar top_logprobs:\n :vartype top_logprobs: int\n :ivar temperature:\n :vartype temperature: float\n :ivar top_p:\n :vartype top_p: float\n :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use\n ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your\n end-users. Used to boost cache hit rates by better bucketing similar requests and to help\n OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.\n :vartype user: str\n :ivar safety_identifier:\n :vartype safety_identifier: str\n :ivar prompt_cache_key:\n :vartype prompt_cache_key: str\n :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type.\n :vartype prompt_cache_retention: Literal["in_memory", "24h"]\n :ivar prompt_cache_options:\n :vartype prompt_cache_options: "PromptCacheOptionsParam"\n :ivar previous_response_id:\n :vartype previous_response_id: str\n :ivar model: The model deployment to use for the creation of this response.\n :vartype model: str\n :ivar background:\n :vartype background: bool\n :ivar max_tool_calls:\n :vartype max_tool_calls: int\n :ivar text:\n :vartype text: "ResponseTextParam"\n :ivar tools:\n :vartype tools: list["Tool"]\n :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.\n :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"]\n :ivar prompt:\n :vartype prompt: "Prompt"\n :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"],\n Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"]\n :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast",\n "ultrafast"]\n :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type.\n :vartype truncation: Literal["auto", "disabled"]\n :ivar reasoning:\n :vartype reasoning: "Reasoning"\n :ivar input: Is either a str type or a [Item] type.\n :vartype input: "_unions.InputParam"\n :ivar include:\n :vartype include: list[IncludeEnum]\n :ivar parallel_tool_calls:\n :vartype parallel_tool_calls: bool\n :ivar store:\n :vartype store: bool\n :ivar instructions:\n :vartype instructions: str\n :ivar moderation:\n :vartype moderation: "ModerationParam"\n :ivar stream:\n :vartype stream: bool\n :ivar stream_options:\n :vartype stream_options: "ResponseStreamOptions"\n :ivar conversation: Is either a str type or a ConversationParam_2 type.\n :vartype conversation: "_unions.ConversationParam"\n :ivar context_management: Context management configuration for this request.\n :vartype context_management: list["ContextManagementParam"]\n :ivar max_output_tokens:\n :vartype max_output_tokens: int\n :ivar agent_reference: The agent to use for generating the response.\n :vartype agent_reference: "AgentReference"\n :ivar structured_inputs: The structured inputs to the response that can participate in prompt\n template substitution or tool argument bindings.\n :vartype structured_inputs: dict[str, Any]\n ' + return CreateResponse + + def _make_CustomGrammarFormatParam(): + class CustomGrammarFormatParam(TypedDict, total=False): + """Grammar format. + + :ivar type: Grammar format. Always ``grammar``. Required. GRAMMAR. + :vartype type: Literal["grammar"] + :ivar syntax: The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. + Known values are: "lark" and "regex". + :vartype syntax: GrammarSyntax1 + :ivar definition: The grammar definition. Required. + :vartype definition: str + """ + type: Required[Literal['grammar']] + 'Grammar format. Always ``grammar``. Required. GRAMMAR.' + syntax: Required[_resolve('GrammarSyntax1')] + 'The syntax of the grammar definition. One of ``lark`` or ``regex``. Required. Known values are:\n "lark" and "regex".' + definition: Required[str] + 'The grammar definition. Required.' + CustomGrammarFormatParam.__qualname__ = 'CustomGrammarFormatParam' + if _version_info < (3, 13): + CustomGrammarFormatParam.__doc__ = 'Grammar format.\n\n :ivar type: Grammar format. Always ``grammar``. Required. GRAMMAR.\n :vartype type: Literal["grammar"]\n :ivar syntax: The syntax of the grammar definition. One of ``lark`` or ``regex``. Required.\n Known values are: "lark" and "regex".\n :vartype syntax: GrammarSyntax1\n :ivar definition: The grammar definition. Required.\n :vartype definition: str\n ' + return CustomGrammarFormatParam + + def _make_CustomTextFormatParam(): + class CustomTextFormatParam(TypedDict, total=False): + """Text format. + + :ivar type: Unconstrained text format. Always ``text``. Required. TEXT. + :vartype type: Literal["text"] + """ + type: Required[Literal['text']] + 'Unconstrained text format. Always ``text``. Required. TEXT.' + CustomTextFormatParam.__qualname__ = 'CustomTextFormatParam' + if _version_info < (3, 13): + CustomTextFormatParam.__doc__ = 'Text format.\n\n :ivar type: Unconstrained text format. Always ``text``. Required. TEXT.\n :vartype type: Literal["text"]\n ' + return CustomTextFormatParam + + def _make_CustomToolCallOutputResource(): + class CustomToolCallOutputResource(TypedDict, total=False): + """ResponseCustomToolCallOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: Literal["custom_tool_call_output"] + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: FunctionCallOutputStatusEnum + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['custom_tool_call_output']] + 'The type of the custom tool call output. Always ``custom_tool_call_output``. Required.\n CUSTOM_TOOL_CALL_OUTPUT.' + id: str + 'The unique ID of the custom tool call output in the OpenAI platform.' + call_id: Required[str] + 'The call ID, used to map this custom tool call output to a custom tool call. Required.' + caller: Optional['_types.ToolCallCallerParam'] + output: Required[Union[str, list['_types.FunctionAndCustomToolCallOutput']]] + 'The output from the custom tool call generated by your code. Can be a string or an list of\n output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.' + status: Required[_resolve('FunctionCallOutputStatusEnum')] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Required. Known values are: "in_progress", "completed",\n and "incomplete".' + created_by: str + 'The identifier of the actor that created the item.' + CustomToolCallOutputResource.__qualname__ = 'CustomToolCallOutputResource' + if _version_info < (3, 13): + CustomToolCallOutputResource.__doc__ = 'ResponseCustomToolCallOutputItem.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``.\n Required. CUSTOM_TOOL_CALL_OUTPUT.\n :vartype type: Literal["custom_tool_call_output"]\n :ivar id: The unique ID of the custom tool call output in the OpenAI platform.\n :vartype id: str\n :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call.\n Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar output: The output from the custom tool call generated by your code. Can be a string or\n an list of output content. Required. Is either a str type or a\n [FunctionAndCustomToolCallOutput] type.\n :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Known values are: "in_progress",\n "completed", and "incomplete".\n :vartype status: FunctionCallOutputStatusEnum\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return CustomToolCallOutputResource + + def _make_CustomToolCallResource(): + class CustomToolCallResource(TypedDict, total=False): + """ResponseCustomToolCallItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: Literal["custom_tool_call"] + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the custom tool being called. + :vartype namespace: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: FunctionCallStatus + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['custom_tool_call']] + 'The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.' + id: str + 'The unique ID of the custom tool call in the OpenAI platform.' + call_id: Required[str] + 'An identifier used to map this custom tool call to a tool call output. Required.' + caller: Optional['_types.ToolCallCaller'] + namespace: str + 'The namespace of the custom tool being called.' + name: Required[str] + 'The name of the custom tool being called. Required.' + input: Required[str] + 'The input for the custom tool call generated by the model. Required.' + status: Required[_resolve('FunctionCallStatus')] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Required. Known values are: "in_progress", "completed",\n and "incomplete".' + created_by: str + 'The identifier of the actor that created the item.' + CustomToolCallResource.__qualname__ = 'CustomToolCallResource' + if _version_info < (3, 13): + CustomToolCallResource.__doc__ = 'ResponseCustomToolCallItem.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required.\n CUSTOM_TOOL_CALL.\n :vartype type: Literal["custom_tool_call"]\n :ivar id: The unique ID of the custom tool call in the OpenAI platform.\n :vartype id: str\n :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar namespace: The namespace of the custom tool being called.\n :vartype namespace: str\n :ivar name: The name of the custom tool being called. Required.\n :vartype name: str\n :ivar input: The input for the custom tool call generated by the model. Required.\n :vartype input: str\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Known values are: "in_progress",\n "completed", and "incomplete".\n :vartype status: FunctionCallStatus\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return CustomToolCallResource + + def _make_CustomToolParam(): + class CustomToolParam(TypedDict, total=False): + """Custom tool. + + :ivar type: The type of the custom tool. Always ``custom``. Required. CUSTOM. + :vartype type: Literal["custom"] + :ivar name: The name of the custom tool, used to identify it in tool calls. Required. + :vartype name: str + :ivar description: Optional description of the custom tool, used to provide more context. + :vartype description: str + :ivar format: The input format for the custom tool. Default is unconstrained text. + :vartype format: "CustomToolParamFormat" + :ivar defer_loading: Whether this tool should be deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + type: Required[Literal['custom']] + 'The type of the custom tool. Always ``custom``. Required. CUSTOM.' + name: Required[str] + 'The name of the custom tool, used to identify it in tool calls. Required.' + description: str + 'Optional description of the custom tool, used to provide more context.' + format: '_types.CustomToolParamFormat' + 'The input format for the custom tool. Default is unconstrained text.' + defer_loading: bool + 'Whether this tool should be deferred and discovered via tool search.' + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + CustomToolParam.__qualname__ = 'CustomToolParam' + if _version_info < (3, 13): + CustomToolParam.__doc__ = 'Custom tool.\n\n :ivar type: The type of the custom tool. Always ``custom``. Required. CUSTOM.\n :vartype type: Literal["custom"]\n :ivar name: The name of the custom tool, used to identify it in tool calls. Required.\n :vartype name: str\n :ivar description: Optional description of the custom tool, used to provide more context.\n :vartype description: str\n :ivar format: The input format for the custom tool. Default is unconstrained text.\n :vartype format: "CustomToolParamFormat"\n :ivar defer_loading: Whether this tool should be deferred and discovered via tool search.\n :vartype defer_loading: bool\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n ' + return CustomToolParam + + def _make_DeleteResponseResult(): + class DeleteResponseResult(TypedDict, total=False): + """The result of a delete response operation. + + :ivar id: The operation ID. Required. + :vartype id: str + :ivar deleted: Always return true. Required. Default value is True. + :vartype deleted: Literal[True] + :ivar object: Required. Default value is "response". + :vartype object: Literal["response"] + """ + id: Required[str] + 'The operation ID. Required.' + deleted: Required[Literal[True]] + 'Always return true. Required. Default value is True.' + object: Required[Literal['response']] + 'Required. Default value is "response".' + DeleteResponseResult.__qualname__ = 'DeleteResponseResult' + if _version_info < (3, 13): + DeleteResponseResult.__doc__ = 'The result of a delete response operation.\n\n :ivar id: The operation ID. Required.\n :vartype id: str\n :ivar deleted: Always return true. Required. Default value is True.\n :vartype deleted: Literal[True]\n :ivar object: Required. Default value is "response".\n :vartype object: Literal["response"]\n ' + return DeleteResponseResult + + def _make_DirectToolCallCaller(): + class DirectToolCallCaller(TypedDict, total=False): + """DirectToolCallCaller. + + :ivar type: Required. DIRECT. + :vartype type: Literal["direct"] + """ + type: Required[Literal['direct']] + 'Required. DIRECT.' + DirectToolCallCaller.__qualname__ = 'DirectToolCallCaller' + if _version_info < (3, 13): + DirectToolCallCaller.__doc__ = 'DirectToolCallCaller.\n\n :ivar type: Required. DIRECT.\n :vartype type: Literal["direct"]\n ' + return DirectToolCallCaller + + def _make_DirectToolCallCallerParam(): + class DirectToolCallCallerParam(TypedDict, total=False): + """DirectToolCallCallerParam. + + :ivar type: The caller type. Always ``direct``. Required. DIRECT. + :vartype type: Literal["direct"] + """ + type: Required[Literal['direct']] + 'The caller type. Always ``direct``. Required. DIRECT.' + DirectToolCallCallerParam.__qualname__ = 'DirectToolCallCallerParam' + if _version_info < (3, 13): + DirectToolCallCallerParam.__doc__ = 'DirectToolCallCallerParam.\n\n :ivar type: The caller type. Always ``direct``. Required. DIRECT.\n :vartype type: Literal["direct"]\n ' + return DirectToolCallCallerParam + + def _make_DoubleClickAction(): + class DoubleClickAction(TypedDict, total=False): + """DoubleClick. + + :ivar type: Specifies the event type. For a double click action, this property is always set to + ``double_click``. Required. DOUBLE_CLICK. + :vartype type: Literal["double_click"] + :ivar x: The x-coordinate where the double click occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the double click occurred. Required. + :vartype y: int + :ivar keys: Required. + :vartype keys: list[str] + """ + type: Required[Literal['double_click']] + 'Specifies the event type. For a double click action, this property is always set to\n ``double_click``. Required. DOUBLE_CLICK.' + x: Required[int] + 'The x-coordinate where the double click occurred. Required.' + y: Required[int] + 'The y-coordinate where the double click occurred. Required.' + keys: Required[Optional[list[str]]] + 'Required.' + DoubleClickAction.__qualname__ = 'DoubleClickAction' + if _version_info < (3, 13): + DoubleClickAction.__doc__ = 'DoubleClick.\n\n :ivar type: Specifies the event type. For a double click action, this property is always set to\n ``double_click``. Required. DOUBLE_CLICK.\n :vartype type: Literal["double_click"]\n :ivar x: The x-coordinate where the double click occurred. Required.\n :vartype x: int\n :ivar y: The y-coordinate where the double click occurred. Required.\n :vartype y: int\n :ivar keys: Required.\n :vartype keys: list[str]\n ' + return DoubleClickAction + + def _make_DragParam(): + class DragParam(TypedDict, total=False): + """Drag. + + :ivar type: Specifies the event type. For a drag action, this property is always set to + ``drag``. Required. DRAG. + :vartype type: Literal["drag"] + :ivar path: Required. An array of coordinates representing the path of the drag action. + Coordinates will appear as an array of objects, eg + + .. code-block:: + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + :vartype path: list["CoordParam"] + :ivar keys: + :vartype keys: list[str] + """ + type: Required[Literal['drag']] + 'Specifies the event type. For a drag action, this property is always set to ``drag``. Required.\n DRAG.' + path: Required[list['_types.CoordParam']] + 'Required. An array of coordinates representing the path of the drag action. Coordinates will\n appear as an array of objects, eg\n\n .. code-block::\n\n [\n { x: 100, y: 200 },\n { x: 200, y: 300 }\n ]' + keys: Optional[list[str]] + DragParam.__qualname__ = 'DragParam' + if _version_info < (3, 13): + DragParam.__doc__ = 'Drag.\n\n :ivar type: Specifies the event type. For a drag action, this property is always set to\n ``drag``. Required. DRAG.\n :vartype type: Literal["drag"]\n :ivar path: Required. An array of coordinates representing the path of the drag action.\n Coordinates will appear as an array of objects, eg\n\n .. code-block::\n\n [\n { x: 100, y: 200 },\n { x: 200, y: 300 }\n ]\n :vartype path: list["CoordParam"]\n :ivar keys:\n :vartype keys: list[str]\n ' + return DragParam + + def _make_EmptyModelParam(): + class EmptyModelParam(TypedDict, total=False): + """EmptyModelParam.""" + EmptyModelParam.__qualname__ = 'EmptyModelParam' + if _version_info < (3, 13): + EmptyModelParam.__doc__ = 'EmptyModelParam.' + return EmptyModelParam + + def _make_Error(): + class Error(TypedDict, total=False): + """Error. + + :ivar code: Required. + :vartype code: str + :ivar message: Required. + :vartype message: str + :ivar param: + :vartype param: str + :ivar type: + :vartype type: str + :ivar details: + :vartype details: list["Error"] + :ivar additionalInfo: + :vartype additionalInfo: dict[str, Any] + :ivar debugInfo: + :vartype debugInfo: dict[str, Any] + """ + code: Required[Optional[str]] + 'Required.' + message: Required[str] + 'Required.' + param: Optional[str] + type: str + details: list['_types.Error'] + additionalInfo: dict[str, Any] + debugInfo: dict[str, Any] + Error.__qualname__ = 'Error' + if _version_info < (3, 13): + Error.__doc__ = 'Error.\n\n :ivar code: Required.\n :vartype code: str\n :ivar message: Required.\n :vartype message: str\n :ivar param:\n :vartype param: str\n :ivar type:\n :vartype type: str\n :ivar details:\n :vartype details: list["Error"]\n :ivar additionalInfo:\n :vartype additionalInfo: dict[str, Any]\n :ivar debugInfo:\n :vartype debugInfo: dict[str, Any]\n ' + return Error + + def _make_FabricDataAgentToolCall(): + class FabricDataAgentToolCall(TypedDict, total=False): + """A Fabric data agent tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL. + :vartype type: Literal["fabric_dataagent_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['fabric_dataagent_preview_call']] + 'Required. FABRIC_DATAAGENT_PREVIEW_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + FabricDataAgentToolCall.__qualname__ = 'FabricDataAgentToolCall' + if _version_info < (3, 13): + FabricDataAgentToolCall.__doc__ = 'A Fabric data agent tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL.\n :vartype type: Literal["fabric_dataagent_preview_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return FabricDataAgentToolCall + + def _make_FabricDataAgentToolCallOutput(): + class FabricDataAgentToolCallOutput(TypedDict, total=False): + """The output of a Fabric data agent tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["fabric_dataagent_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the Fabric data agent tool call. Is one of the following types: + {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['fabric_dataagent_preview_call_output']] + 'Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the Fabric data agent tool call. Is one of the following types: {str: Any},\n str, [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + FabricDataAgentToolCallOutput.__qualname__ = 'FabricDataAgentToolCallOutput' + if _version_info < (3, 13): + FabricDataAgentToolCallOutput.__doc__ = 'The output of a Fabric data agent tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. FABRIC_DATAAGENT_PREVIEW_CALL_OUTPUT.\n :vartype type: Literal["fabric_dataagent_preview_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar output: The output from the Fabric data agent tool call. Is one of the following types:\n {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return FabricDataAgentToolCallOutput + + def _make_FabricDataAgentToolParameters(): + class FabricDataAgentToolParameters(TypedDict, total=False): + """The fabric data agent tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: list["ToolProjectConnection"] + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connections: list['_types.ToolProjectConnection'] + 'The project connections attached to this tool. There can be a maximum of 1 connection resource\n attached to the tool.' + FabricDataAgentToolParameters.__qualname__ = 'FabricDataAgentToolParameters' + if _version_info < (3, 13): + FabricDataAgentToolParameters.__doc__ = 'The fabric data agent tool parameters.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connections: The project connections attached to this tool. There can be a\n maximum of 1 connection resource attached to the tool.\n :vartype project_connections: list["ToolProjectConnection"]\n ' + return FabricDataAgentToolParameters + + def _make_FileCitationBody(): + class FileCitationBody(TypedDict, total=False): + """File citation. + + :ivar type: The type of the file citation. Always ``file_citation``. Required. FILE_CITATION. + :vartype type: Literal["file_citation"] + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + :ivar filename: The filename of the file cited. Required. + :vartype filename: str + """ + type: Required[Literal['file_citation']] + 'The type of the file citation. Always ``file_citation``. Required. FILE_CITATION.' + file_id: Required[str] + 'The ID of the file. Required.' + index: Required[int] + 'The index of the file in the list of files. Required.' + filename: Required[str] + 'The filename of the file cited. Required.' + FileCitationBody.__qualname__ = 'FileCitationBody' + if _version_info < (3, 13): + FileCitationBody.__doc__ = 'File citation.\n\n :ivar type: The type of the file citation. Always ``file_citation``. Required. FILE_CITATION.\n :vartype type: Literal["file_citation"]\n :ivar file_id: The ID of the file. Required.\n :vartype file_id: str\n :ivar index: The index of the file in the list of files. Required.\n :vartype index: int\n :ivar filename: The filename of the file cited. Required.\n :vartype filename: str\n ' + return FileCitationBody + + def _make_FilePath(): + class FilePath(TypedDict, total=False): + """File path. + + :ivar type: The type of the file path. Always ``file_path``. Required. FILE_PATH. + :vartype type: Literal["file_path"] + :ivar file_id: The ID of the file. Required. + :vartype file_id: str + :ivar index: The index of the file in the list of files. Required. + :vartype index: int + """ + type: Required[Literal['file_path']] + 'The type of the file path. Always ``file_path``. Required. FILE_PATH.' + file_id: Required[str] + 'The ID of the file. Required.' + index: Required[int] + 'The index of the file in the list of files. Required.' + FilePath.__qualname__ = 'FilePath' + if _version_info < (3, 13): + FilePath.__doc__ = 'File path.\n\n :ivar type: The type of the file path. Always ``file_path``. Required. FILE_PATH.\n :vartype type: Literal["file_path"]\n :ivar file_id: The ID of the file. Required.\n :vartype file_id: str\n :ivar index: The index of the file in the list of files. Required.\n :vartype index: int\n ' + return FilePath + + def _make_FileSearchTool(): + class FileSearchTool(TypedDict, total=False): + """File search. + + :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH. + :vartype type: Literal["file_search"] + :ivar vector_store_ids: The IDs of the vector stores to search. Required. + :vartype vector_store_ids: list[str] + :ivar max_num_results: The maximum number of results to return. This number should be between 1 + and 50 inclusive. + :vartype max_num_results: int + :ivar ranking_options: Ranking options for search. + :vartype ranking_options: "RankingOptions" + :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type. + :vartype filters: "_unions.Filters" + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + type: Required[Literal['file_search']] + 'The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.' + vector_store_ids: Required[list[str]] + 'The IDs of the vector stores to search. Required.' + max_num_results: int + 'The maximum number of results to return. This number should be between 1 and 50 inclusive.' + ranking_options: '_types.RankingOptions' + 'Ranking options for search.' + filters: Optional['_unions.Filters'] + 'Is either a ComparisonFilter type or a CompoundFilter type.' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + FileSearchTool.__qualname__ = 'FileSearchTool' + if _version_info < (3, 13): + FileSearchTool.__doc__ = 'File search.\n\n :ivar type: The type of the file search tool. Always ``file_search``. Required. FILE_SEARCH.\n :vartype type: Literal["file_search"]\n :ivar vector_store_ids: The IDs of the vector stores to search. Required.\n :vartype vector_store_ids: list[str]\n :ivar max_num_results: The maximum number of results to return. This number should be between 1\n and 50 inclusive.\n :vartype max_num_results: int\n :ivar ranking_options: Ranking options for search.\n :vartype ranking_options: "RankingOptions"\n :ivar filters: Is either a ComparisonFilter type or a CompoundFilter type.\n :vartype filters: "_unions.Filters"\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n ' + return FileSearchTool + + def _make_FileSearchToolCallResults(): + class FileSearchToolCallResults(TypedDict, total=False): + """FileSearchToolCallResults. + + :ivar file_id: + :vartype file_id: str + :ivar text: + :vartype text: str + :ivar filename: + :vartype filename: str + :ivar attributes: + :vartype attributes: "VectorStoreFileAttributes" + :ivar score: + :vartype score: float + """ + file_id: str + text: str + filename: str + attributes: Optional['_types.VectorStoreFileAttributes'] + score: float + FileSearchToolCallResults.__qualname__ = 'FileSearchToolCallResults' + if _version_info < (3, 13): + FileSearchToolCallResults.__doc__ = 'FileSearchToolCallResults.\n\n :ivar file_id:\n :vartype file_id: str\n :ivar text:\n :vartype text: str\n :ivar filename:\n :vartype filename: str\n :ivar attributes:\n :vartype attributes: "VectorStoreFileAttributes"\n :ivar score:\n :vartype score: float\n ' + return FileSearchToolCallResults + + def _make_FunctionAndCustomToolCallOutputInputFileContent(): + class FunctionAndCustomToolCallOutputInputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + """ + type: Required[Literal['input_file']] + 'The type of the input item. Always ``input_file``. Required. INPUT_FILE.' + file_id: Optional[str] + filename: str + 'The name of the file to be sent to the model.' + file_data: str + 'The content of the file to be sent to the model.' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + file_url: str + 'The URL of the file to be sent to the model.' + detail: _resolve('FileInputDetail') + 'The detail level of the file to be sent to the model. Use ``auto`` to let the system select the\n detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may\n increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the\n file at higher quality. Defaults to ``auto``. Known values are: "auto", "low", and\n "high".' + FunctionAndCustomToolCallOutputInputFileContent.__qualname__ = 'FunctionAndCustomToolCallOutputInputFileContent' + if _version_info < (3, 13): + FunctionAndCustomToolCallOutputInputFileContent.__doc__ = 'Input file.\n\n :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE.\n :vartype type: Literal["input_file"]\n :ivar file_id:\n :vartype file_id: str\n :ivar filename: The name of the file to be sent to the model.\n :vartype filename: str\n :ivar file_data: The content of the file to be sent to the model.\n :vartype file_data: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n :ivar file_url: The URL of the file to be sent to the model.\n :vartype file_url: str\n :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the\n system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality\n rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or\n ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto",\n "low", and "high".\n :vartype detail: FileInputDetail\n ' + return FunctionAndCustomToolCallOutputInputFileContent + + def _make_FunctionAndCustomToolCallOutputInputImageContent(): + class FunctionAndCustomToolCallOutputInputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", + "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['input_image']] + 'The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.' + image_url: Optional[str] + file_id: Optional[str] + detail: Required[_resolve('ImageDetail')] + 'The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or\n ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", "auto",\n and "original".' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + FunctionAndCustomToolCallOutputInputImageContent.__qualname__ = 'FunctionAndCustomToolCallOutputInputImageContent' + if _version_info < (3, 13): + FunctionAndCustomToolCallOutputInputImageContent.__doc__ = 'Input image.\n\n :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.\n :vartype type: Literal["input_image"]\n :ivar image_url:\n :vartype image_url: str\n :ivar file_id:\n :vartype file_id: str\n :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``,\n ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high",\n "auto", and "original".\n :vartype detail: ImageDetail\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return FunctionAndCustomToolCallOutputInputImageContent + + def _make_FunctionAndCustomToolCallOutputInputTextContent(): + class FunctionAndCustomToolCallOutputInputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['input_text']] + 'The type of the input item. Always ``input_text``. Required. INPUT_TEXT.' + text: Required[str] + 'The text input to the model. Required.' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + FunctionAndCustomToolCallOutputInputTextContent.__qualname__ = 'FunctionAndCustomToolCallOutputInputTextContent' + if _version_info < (3, 13): + FunctionAndCustomToolCallOutputInputTextContent.__doc__ = 'Input text.\n\n :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT.\n :vartype type: Literal["input_text"]\n :ivar text: The text input to the model. Required.\n :vartype text: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return FunctionAndCustomToolCallOutputInputTextContent + + def _make_FunctionCallOutputItemParam(): + class FunctionCallOutputItemParam(TypedDict, total=False): + """Function tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: + :vartype call_id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: Literal["function_call_output"] + :ivar output: Text, image, or file output of the function tool call. Required. Is either a str + type or a [Union["_types.InputTextContentParam", "_types.InputImageContentParamAutoParam", + "_types.InputFileContentParam"]] type. + :vartype output: Union[str, list[Union["InputTextContentParam", + "InputImageContentParamAutoParam", "InputFileContentParam"]]] + :ivar name: + :vartype name: str + :ivar namespace: + :vartype namespace: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + id: Optional[str] + call_id: Optional[str] + type: Required[Literal['function_call_output']] + 'The type of the function tool call output. Always ``function_call_output``. Required.\n FUNCTION_CALL_OUTPUT.' + output: Required[Union[str, list[Union['_types.InputTextContentParam', '_types.InputImageContentParamAutoParam', '_types.InputFileContentParam']]]] + 'Text, image, or file output of the function tool call. Required. Is either a str type or a\n [Union["_types.InputTextContentParam", "_types.InputImageContentParamAutoParam",\n "_types.InputFileContentParam"]] type.' + name: Optional[str] + namespace: Optional[str] + caller: Optional['_types.ToolCallCallerParam'] + status: Optional[_resolve('FunctionCallItemStatus')] + 'Known values are: "in_progress", "completed", and "incomplete".' + FunctionCallOutputItemParam.__qualname__ = 'FunctionCallOutputItemParam' + if _version_info < (3, 13): + FunctionCallOutputItemParam.__doc__ = 'Function tool call output.\n\n :ivar id:\n :vartype id: str\n :ivar call_id:\n :vartype call_id: str\n :ivar type: The type of the function tool call output. Always ``function_call_output``.\n Required. FUNCTION_CALL_OUTPUT.\n :vartype type: Literal["function_call_output"]\n :ivar output: Text, image, or file output of the function tool call. Required. Is either a str\n type or a [Union["_types.InputTextContentParam", "_types.InputImageContentParamAutoParam",\n "_types.InputFileContentParam"]] type.\n :vartype output: Union[str, list[Union["InputTextContentParam",\n "InputImageContentParamAutoParam", "InputFileContentParam"]]]\n :ivar name:\n :vartype name: str\n :ivar namespace:\n :vartype namespace: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar status: Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallItemStatus\n ' + return FunctionCallOutputItemParam + + def _make_FunctionShellAction(): + class FunctionShellAction(TypedDict, total=False): + """Shell exec action. + + :ivar commands: Required. + :vartype commands: list[str] + :ivar timeout_ms: Required. + :vartype timeout_ms: int + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + commands: Required[list[str]] + 'Required.' + timeout_ms: Required[Optional[int]] + 'Required.' + max_output_length: Required[Optional[int]] + 'Required.' + FunctionShellAction.__qualname__ = 'FunctionShellAction' + if _version_info < (3, 13): + FunctionShellAction.__doc__ = 'Shell exec action.\n\n :ivar commands: Required.\n :vartype commands: list[str]\n :ivar timeout_ms: Required.\n :vartype timeout_ms: int\n :ivar max_output_length: Required.\n :vartype max_output_length: int\n ' + return FunctionShellAction + + def _make_FunctionShellActionParam(): + class FunctionShellActionParam(TypedDict, total=False): + """Shell action. + + :ivar commands: Ordered shell commands for the execution environment to run. Required. + :vartype commands: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar max_output_length: + :vartype max_output_length: int + """ + commands: Required[list[str]] + 'Ordered shell commands for the execution environment to run. Required.' + timeout_ms: Optional[int] + max_output_length: Optional[int] + FunctionShellActionParam.__qualname__ = 'FunctionShellActionParam' + if _version_info < (3, 13): + FunctionShellActionParam.__doc__ = 'Shell action.\n\n :ivar commands: Ordered shell commands for the execution environment to run. Required.\n :vartype commands: list[str]\n :ivar timeout_ms:\n :vartype timeout_ms: int\n :ivar max_output_length:\n :vartype max_output_length: int\n ' + return FunctionShellActionParam + + def _make_FunctionShellCallItemParam(): + class FunctionShellCallItemParam(TypedDict, total=False): + """Shell tool call. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: Literal["shell_call"] + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: "FunctionShellActionParam" + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallItemStatus + :ivar environment: + :vartype environment: "FunctionShellCallItemParamEnvironment" + """ + id: Optional[str] + call_id: Required[str] + 'The unique ID of the shell tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCallerParam'] + type: Required[Literal['shell_call']] + 'The type of the item. Always ``shell_call``. Required. SHELL_CALL.' + action: Required['_types.FunctionShellActionParam'] + 'The shell commands and limits that describe how to run the tool call. Required.' + status: Optional[_resolve('FunctionShellCallItemStatus')] + 'Known values are: "in_progress", "completed", and "incomplete".' + environment: Optional['_types.FunctionShellCallItemParamEnvironment'] + FunctionShellCallItemParam.__qualname__ = 'FunctionShellCallItemParam' + if _version_info < (3, 13): + FunctionShellCallItemParam.__doc__ = 'Shell tool call.\n\n :ivar id:\n :vartype id: str\n :ivar call_id: The unique ID of the shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL.\n :vartype type: Literal["shell_call"]\n :ivar action: The shell commands and limits that describe how to run the tool call. Required.\n :vartype action: "FunctionShellActionParam"\n :ivar status: Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionShellCallItemStatus\n :ivar environment:\n :vartype environment: "FunctionShellCallItemParamEnvironment"\n ' + return FunctionShellCallItemParam + + def _make_FunctionShellCallItemParamEnvironmentContainerReferenceParam(): + class FunctionShellCallItemParamEnvironmentContainerReferenceParam(TypedDict, total=False): + """FunctionShellCallItemParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: Literal["container_reference"] + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + type: Required[Literal['container_reference']] + 'References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.' + container_id: Required[str] + 'The ID of the referenced container. Required.' + FunctionShellCallItemParamEnvironmentContainerReferenceParam.__qualname__ = 'FunctionShellCallItemParamEnvironmentContainerReferenceParam' + if _version_info < (3, 13): + FunctionShellCallItemParamEnvironmentContainerReferenceParam.__doc__ = 'FunctionShellCallItemParamEnvironmentContainerReferenceParam.\n\n :ivar type: References a container created with the /v1/containers endpoint. Required.\n CONTAINER_REFERENCE.\n :vartype type: Literal["container_reference"]\n :ivar container_id: The ID of the referenced container. Required.\n :vartype container_id: str\n ' + return FunctionShellCallItemParamEnvironmentContainerReferenceParam + + def _make_FunctionShellCallItemParamEnvironmentLocalEnvironmentParam(): + class FunctionShellCallItemParamEnvironmentLocalEnvironmentParam(TypedDict, total=False): + """FunctionShellCallItemParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: Literal["local"] + :ivar skills: An optional list of skills. + :vartype skills: list["LocalSkillParam"] + """ + type: Required[Literal['local']] + 'Use a local computer environment. Required. LOCAL.' + skills: list['_types.LocalSkillParam'] + 'An optional list of skills.' + FunctionShellCallItemParamEnvironmentLocalEnvironmentParam.__qualname__ = 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam' + if _version_info < (3, 13): + FunctionShellCallItemParamEnvironmentLocalEnvironmentParam.__doc__ = 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam.\n\n :ivar type: Use a local computer environment. Required. LOCAL.\n :vartype type: Literal["local"]\n :ivar skills: An optional list of skills.\n :vartype skills: list["LocalSkillParam"]\n ' + return FunctionShellCallItemParamEnvironmentLocalEnvironmentParam + + def _make_FunctionShellCallOutputContent(): + class FunctionShellCallOutputContent(TypedDict, total=False): + """Shell call output content. + + :ivar stdout: The standard output that was captured. Required. + :vartype stdout: str + :ivar stderr: The standard error output that was captured. Required. + :vartype stderr: str + :ivar outcome: Shell call outcome. Required. + :vartype outcome: "FunctionShellCallOutputOutcome" + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + stdout: Required[str] + 'The standard output that was captured. Required.' + stderr: Required[str] + 'The standard error output that was captured. Required.' + outcome: Required['_types.FunctionShellCallOutputOutcome'] + 'Shell call outcome. Required.' + created_by: str + 'The identifier of the actor that created the item.' + FunctionShellCallOutputContent.__qualname__ = 'FunctionShellCallOutputContent' + if _version_info < (3, 13): + FunctionShellCallOutputContent.__doc__ = 'Shell call output content.\n\n :ivar stdout: The standard output that was captured. Required.\n :vartype stdout: str\n :ivar stderr: The standard error output that was captured. Required.\n :vartype stderr: str\n :ivar outcome: Shell call outcome. Required.\n :vartype outcome: "FunctionShellCallOutputOutcome"\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return FunctionShellCallOutputContent + + def _make_FunctionShellCallOutputContentParam(): + class FunctionShellCallOutputContentParam(TypedDict, total=False): + """Shell output content. + + :ivar stdout: Captured stdout output for the shell call. Required. + :vartype stdout: str + :ivar stderr: Captured stderr output for the shell call. Required. + :vartype stderr: str + :ivar outcome: The exit or timeout outcome associated with this shell call. Required. + :vartype outcome: "FunctionShellCallOutputOutcomeParam" + """ + stdout: Required[str] + 'Captured stdout output for the shell call. Required.' + stderr: Required[str] + 'Captured stderr output for the shell call. Required.' + outcome: Required['_types.FunctionShellCallOutputOutcomeParam'] + 'The exit or timeout outcome associated with this shell call. Required.' + FunctionShellCallOutputContentParam.__qualname__ = 'FunctionShellCallOutputContentParam' + if _version_info < (3, 13): + FunctionShellCallOutputContentParam.__doc__ = 'Shell output content.\n\n :ivar stdout: Captured stdout output for the shell call. Required.\n :vartype stdout: str\n :ivar stderr: Captured stderr output for the shell call. Required.\n :vartype stderr: str\n :ivar outcome: The exit or timeout outcome associated with this shell call. Required.\n :vartype outcome: "FunctionShellCallOutputOutcomeParam"\n ' + return FunctionShellCallOutputContentParam + + def _make_FunctionShellCallOutputExitOutcome(): + class FunctionShellCallOutputExitOutcome(TypedDict, total=False): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: Literal["exit"] + :ivar exit_code: Exit code from the shell process. Required. + :vartype exit_code: int + """ + type: Required[Literal['exit']] + 'The outcome type. Always ``exit``. Required. EXIT.' + exit_code: Required[int] + 'Exit code from the shell process. Required.' + FunctionShellCallOutputExitOutcome.__qualname__ = 'FunctionShellCallOutputExitOutcome' + if _version_info < (3, 13): + FunctionShellCallOutputExitOutcome.__doc__ = 'Shell call exit outcome.\n\n :ivar type: The outcome type. Always ``exit``. Required. EXIT.\n :vartype type: Literal["exit"]\n :ivar exit_code: Exit code from the shell process. Required.\n :vartype exit_code: int\n ' + return FunctionShellCallOutputExitOutcome + + def _make_FunctionShellCallOutputExitOutcomeParam(): + class FunctionShellCallOutputExitOutcomeParam(TypedDict, total=False): + """Shell call exit outcome. + + :ivar type: The outcome type. Always ``exit``. Required. EXIT. + :vartype type: Literal["exit"] + :ivar exit_code: The exit code returned by the shell process. Required. + :vartype exit_code: int + """ + type: Required[Literal['exit']] + 'The outcome type. Always ``exit``. Required. EXIT.' + exit_code: Required[int] + 'The exit code returned by the shell process. Required.' + FunctionShellCallOutputExitOutcomeParam.__qualname__ = 'FunctionShellCallOutputExitOutcomeParam' + if _version_info < (3, 13): + FunctionShellCallOutputExitOutcomeParam.__doc__ = 'Shell call exit outcome.\n\n :ivar type: The outcome type. Always ``exit``. Required. EXIT.\n :vartype type: Literal["exit"]\n :ivar exit_code: The exit code returned by the shell process. Required.\n :vartype exit_code: int\n ' + return FunctionShellCallOutputExitOutcomeParam + + def _make_FunctionShellCallOutputItemParam(): + class FunctionShellCallOutputItemParam(TypedDict, total=False): + """Shell tool call output. + + :ivar id: + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar type: The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT. + :vartype type: Literal["shell_call_output"] + :ivar output: Captured chunks of stdout and stderr output, along with their associated + outcomes. Required. + :vartype output: list["FunctionShellCallOutputContentParam"] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallItemStatus + :ivar max_output_length: + :vartype max_output_length: int + """ + id: Optional[str] + call_id: Required[str] + 'The unique ID of the shell tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCallerParam'] + type: Required[Literal['shell_call_output']] + 'The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.' + output: Required[list['_types.FunctionShellCallOutputContentParam']] + 'Captured chunks of stdout and stderr output, along with their associated outcomes. Required.' + status: Optional[_resolve('FunctionShellCallItemStatus')] + 'Known values are: "in_progress", "completed", and "incomplete".' + max_output_length: Optional[int] + FunctionShellCallOutputItemParam.__qualname__ = 'FunctionShellCallOutputItemParam' + if _version_info < (3, 13): + FunctionShellCallOutputItemParam.__doc__ = 'Shell tool call output.\n\n :ivar id:\n :vartype id: str\n :ivar call_id: The unique ID of the shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar type: The type of the item. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.\n :vartype type: Literal["shell_call_output"]\n :ivar output: Captured chunks of stdout and stderr output, along with their associated\n outcomes. Required.\n :vartype output: list["FunctionShellCallOutputContentParam"]\n :ivar status: Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionShellCallItemStatus\n :ivar max_output_length:\n :vartype max_output_length: int\n ' + return FunctionShellCallOutputItemParam + + def _make_FunctionShellCallOutputTimeoutOutcome(): + class FunctionShellCallOutputTimeoutOutcome(TypedDict, total=False): + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: Literal["timeout"] + """ + type: Required[Literal['timeout']] + 'The outcome type. Always ``timeout``. Required. TIMEOUT.' + FunctionShellCallOutputTimeoutOutcome.__qualname__ = 'FunctionShellCallOutputTimeoutOutcome' + if _version_info < (3, 13): + FunctionShellCallOutputTimeoutOutcome.__doc__ = 'Shell call timeout outcome.\n\n :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT.\n :vartype type: Literal["timeout"]\n ' + return FunctionShellCallOutputTimeoutOutcome + + def _make_FunctionShellCallOutputTimeoutOutcomeParam(): + class FunctionShellCallOutputTimeoutOutcomeParam(TypedDict, total=False): + """Shell call timeout outcome. + + :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT. + :vartype type: Literal["timeout"] + """ + type: Required[Literal['timeout']] + 'The outcome type. Always ``timeout``. Required. TIMEOUT.' + FunctionShellCallOutputTimeoutOutcomeParam.__qualname__ = 'FunctionShellCallOutputTimeoutOutcomeParam' + if _version_info < (3, 13): + FunctionShellCallOutputTimeoutOutcomeParam.__doc__ = 'Shell call timeout outcome.\n\n :ivar type: The outcome type. Always ``timeout``. Required. TIMEOUT.\n :vartype type: Literal["timeout"]\n ' + return FunctionShellCallOutputTimeoutOutcomeParam + + def _make_FunctionShellToolParam(): + class FunctionShellToolParam(TypedDict, total=False): + """Shell tool. + + :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL. + :vartype type: Literal["shell"] + :ivar environment: + :vartype environment: "FunctionShellToolParamEnvironment" + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + type: Required[Literal['shell']] + 'The type of the shell tool. Always ``shell``. Required. SHELL.' + environment: Optional['_types.FunctionShellToolParamEnvironment'] + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + FunctionShellToolParam.__qualname__ = 'FunctionShellToolParam' + if _version_info < (3, 13): + FunctionShellToolParam.__doc__ = 'Shell tool.\n\n :ivar type: The type of the shell tool. Always ``shell``. Required. SHELL.\n :vartype type: Literal["shell"]\n :ivar environment:\n :vartype environment: "FunctionShellToolParamEnvironment"\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n ' + return FunctionShellToolParam + + def _make_FunctionShellToolParamEnvironmentContainerReferenceParam(): + class FunctionShellToolParamEnvironmentContainerReferenceParam(TypedDict, total=False): + """FunctionShellToolParamEnvironmentContainerReferenceParam. + + :ivar type: References a container created with the /v1/containers endpoint. Required. + CONTAINER_REFERENCE. + :vartype type: Literal["container_reference"] + :ivar container_id: The ID of the referenced container. Required. + :vartype container_id: str + """ + type: Required[Literal['container_reference']] + 'References a container created with the /v1/containers endpoint. Required. CONTAINER_REFERENCE.' + container_id: Required[str] + 'The ID of the referenced container. Required.' + FunctionShellToolParamEnvironmentContainerReferenceParam.__qualname__ = 'FunctionShellToolParamEnvironmentContainerReferenceParam' + if _version_info < (3, 13): + FunctionShellToolParamEnvironmentContainerReferenceParam.__doc__ = 'FunctionShellToolParamEnvironmentContainerReferenceParam.\n\n :ivar type: References a container created with the /v1/containers endpoint. Required.\n CONTAINER_REFERENCE.\n :vartype type: Literal["container_reference"]\n :ivar container_id: The ID of the referenced container. Required.\n :vartype container_id: str\n ' + return FunctionShellToolParamEnvironmentContainerReferenceParam + + def _make_FunctionShellToolParamEnvironmentLocalEnvironmentParam(): + class FunctionShellToolParamEnvironmentLocalEnvironmentParam(TypedDict, total=False): + """FunctionShellToolParamEnvironmentLocalEnvironmentParam. + + :ivar type: Use a local computer environment. Required. LOCAL. + :vartype type: Literal["local"] + :ivar skills: An optional list of skills. + :vartype skills: list["LocalSkillParam"] + """ + type: Required[Literal['local']] + 'Use a local computer environment. Required. LOCAL.' + skills: list['_types.LocalSkillParam'] + 'An optional list of skills.' + FunctionShellToolParamEnvironmentLocalEnvironmentParam.__qualname__ = 'FunctionShellToolParamEnvironmentLocalEnvironmentParam' + if _version_info < (3, 13): + FunctionShellToolParamEnvironmentLocalEnvironmentParam.__doc__ = 'FunctionShellToolParamEnvironmentLocalEnvironmentParam.\n\n :ivar type: Use a local computer environment. Required. LOCAL.\n :vartype type: Literal["local"]\n :ivar skills: An optional list of skills.\n :vartype skills: list["LocalSkillParam"]\n ' + return FunctionShellToolParamEnvironmentLocalEnvironmentParam + + def _make_FunctionTool(): + class FunctionTool(TypedDict, total=False): + """Function. + + :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION. + :vartype type: Literal["function"] + :ivar name: The name of the function to call. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar parameters: Required. + :vartype parameters: dict[str, Any] + :ivar output_schema: + :vartype output_schema: dict[str, Any] + :ivar strict: Required. + :vartype strict: bool + :ivar defer_loading: Whether this function is deferred and loaded via tool search. + :vartype defer_loading: bool + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + type: Required[Literal['function']] + 'The type of the function tool. Always ``function``. Required. FUNCTION.' + name: Required[str] + 'The name of the function to call. Required.' + description: Optional[str] + parameters: Required[Optional[dict[str, Any]]] + 'Required.' + output_schema: Optional[dict[str, Any]] + strict: Required[Optional[bool]] + 'Required.' + defer_loading: bool + 'Whether this function is deferred and loaded via tool search.' + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + FunctionTool.__qualname__ = 'FunctionTool' + if _version_info < (3, 13): + FunctionTool.__doc__ = 'Function.\n\n :ivar type: The type of the function tool. Always ``function``. Required. FUNCTION.\n :vartype type: Literal["function"]\n :ivar name: The name of the function to call. Required.\n :vartype name: str\n :ivar description:\n :vartype description: str\n :ivar parameters: Required.\n :vartype parameters: dict[str, Any]\n :ivar output_schema:\n :vartype output_schema: dict[str, Any]\n :ivar strict: Required.\n :vartype strict: bool\n :ivar defer_loading: Whether this function is deferred and loaded via tool search.\n :vartype defer_loading: bool\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n ' + return FunctionTool + + def _make_FunctionToolParam(): + class FunctionToolParam(TypedDict, total=False): + """FunctionToolParam. + + :ivar name: Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar parameters: + :vartype parameters: "EmptyModelParam" + :ivar strict: + :vartype strict: bool + :ivar type: Required. Default value is "function". + :vartype type: Literal["function"] + :ivar output_schema: + :vartype output_schema: dict[str, Any] + :ivar defer_loading: Whether this function should be deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + """ + name: Required[str] + 'Required.' + description: Optional[str] + parameters: Optional['_types.EmptyModelParam'] + strict: Optional[bool] + type: Required[Literal['function']] + 'Required. Default value is "function".' + output_schema: Optional[dict[str, Any]] + defer_loading: bool + 'Whether this function should be deferred and discovered via tool search.' + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + FunctionToolParam.__qualname__ = 'FunctionToolParam' + if _version_info < (3, 13): + FunctionToolParam.__doc__ = 'FunctionToolParam.\n\n :ivar name: Required.\n :vartype name: str\n :ivar description:\n :vartype description: str\n :ivar parameters:\n :vartype parameters: "EmptyModelParam"\n :ivar strict:\n :vartype strict: bool\n :ivar type: Required. Default value is "function".\n :vartype type: Literal["function"]\n :ivar output_schema:\n :vartype output_schema: dict[str, Any]\n :ivar defer_loading: Whether this function should be deferred and discovered via tool search.\n :vartype defer_loading: bool\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n ' + return FunctionToolParam + + def _make_HybridSearchOptions(): + class HybridSearchOptions(TypedDict, total=False): + """HybridSearchOptions. + + :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required. + :vartype embedding_weight: float + :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required. + :vartype text_weight: float + """ + embedding_weight: Required[float] + 'The weight of the embedding in the reciprocal ranking fusion. Required.' + text_weight: Required[float] + 'The weight of the text in the reciprocal ranking fusion. Required.' + HybridSearchOptions.__qualname__ = 'HybridSearchOptions' + if _version_info < (3, 13): + HybridSearchOptions.__doc__ = 'HybridSearchOptions.\n\n :ivar embedding_weight: The weight of the embedding in the reciprocal ranking fusion. Required.\n :vartype embedding_weight: float\n :ivar text_weight: The weight of the text in the reciprocal ranking fusion. Required.\n :vartype text_weight: float\n ' + return HybridSearchOptions + + def _make_ImageGenTool(): + class ImageGenTool(TypedDict, total=False): + """Image generation tool. + + :ivar type: The type of the image generation tool. Always ``image_generation``. Required. + IMAGE_GENERATION. + :vartype type: Literal["image_generation"] + :ivar model: Is one of the following types: Literal["gpt-image-1"], + Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str + :vartype model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], + Literal["gpt-image-1.5"], str] + :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or + ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"], Literal["auto"] + :vartype quality: Literal["low", "medium", "high", "auto"] + :ivar size: The size of the generated images. For ``gpt-image-2`` and + ``gpt-image-2-2026-04-21``, arbitrary resolutions are supported as ``WIDTHxHEIGHT`` strings, + for example ``1536x864``. Width and height must both be divisible by 16 and the requested + aspect ratio must be between 1:3 and 3:1. Resolutions above ``2560x1440`` are experimental, and + the maximum supported resolution is ``3840x2160``. The requested size must also satisfy the + model's current pixel and edge limits. The standard sizes ``1024x1024``, ``1536x1024``, and + ``1024x1536`` are supported by the GPT image models; ``auto`` is supported for models that + allow automatic sizing. For ``dall-e-2``, use one of ``256x256``, ``512x512``, or + ``1024x1024``. For ``dall-e-3``, use one of ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is + one of the following types: Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], + Literal["auto"], str + :vartype size: Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], + Literal["auto"], str] + :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or + ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"], + Literal["jpeg"] + :vartype output_format: Literal["png", "webp", "jpeg"] + :ivar output_compression: Compression level for the output image. Default: 100. + :vartype output_compression: int + :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a + Literal["auto"] type or a Literal["low"] type. + :vartype moderation: Literal["auto", "low"] + :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``, + or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"], + Literal["opaque"], Literal["auto"] + :vartype background: Literal["transparent", "opaque", "auto"] + :ivar input_fidelity: Known values are: "high" and "low". + :vartype input_fidelity: InputFidelity + :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional) + and ``file_id`` (string, optional). + :vartype input_image_mask: "ImageGenToolInputImageMask" + :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default + value) to 3. + :vartype partial_images: int + :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``. + Known values are: "generate", "edit", and "auto". + :vartype action: ImageGenActionEnum + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + type: Required[Literal['image_generation']] + 'The type of the image generation tool. Always ``image_generation``. Required. IMAGE_GENERATION.' + model: Union[Literal['gpt-image-1'], Literal['gpt-image-1-mini'], Literal['gpt-image-1.5'], str] + 'Is one of the following types: Literal["gpt-image-1"], Literal["gpt-image-1-mini"],\n Literal["gpt-image-1.5"], str' + quality: Literal['low', 'medium', 'high', 'auto'] + 'The quality of the generated image. One of ``low``, ``medium``, ``high``, or ``auto``. Default:\n ``auto``. Is one of the following types: Literal["low"], Literal["medium"],\n Literal["high"], Literal["auto"]' + size: Union[Literal['1024x1024'], Literal['1024x1536'], Literal['1536x1024'], Literal['auto'], str] + 'The size of the generated images. For ``gpt-image-2`` and ``gpt-image-2-2026-04-21``, arbitrary\n resolutions are supported as ``WIDTHxHEIGHT`` strings, for example ``1536x864``. Width and\n height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.\n Resolutions above ``2560x1440`` are experimental, and the maximum supported resolution is\n ``3840x2160``. The requested size must also satisfy the model\'s current pixel and edge limits.\n The standard sizes ``1024x1024``, ``1536x1024``, and ``1024x1536`` are supported by the GPT\n image models; ``auto`` is supported for models that allow automatic sizing. For ``dall-e-2``,\n use one of ``256x256``, ``512x512``, or ``1024x1024``. For ``dall-e-3``, use one of\n ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is one of the following types:\n Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"], str' + output_format: Literal['png', 'webp', 'jpeg'] + 'The output format of the generated image. One of ``png``, ``webp``, or ``jpeg``. Default:\n ``png``. Is one of the following types: Literal["png"], Literal["webp"], Literal["jpeg"]' + output_compression: int + 'Compression level for the output image. Default: 100.' + moderation: Literal['auto', 'low'] + 'Moderation level for the generated image. Default: ``auto``. Is either a Literal["auto"] type\n or a Literal["low"] type.' + background: Literal['transparent', 'opaque', 'auto'] + 'Background type for the generated image. One of ``transparent``, ``opaque``, or ``auto``.\n Default: ``auto``. Is one of the following types: Literal["transparent"],\n Literal["opaque"], Literal["auto"]' + input_fidelity: Optional[_resolve('InputFidelity')] + 'Known values are: "high" and "low".' + input_image_mask: '_types.ImageGenToolInputImageMask' + 'Optional mask for inpainting. Contains ``image_url`` (string, optional) and ``file_id``\n (string, optional).' + partial_images: int + 'Number of partial images to generate in streaming mode, from 0 (default value) to 3.' + action: _resolve('ImageGenActionEnum') + 'Whether to generate a new image or edit an existing image. Default: ``auto``. Known values are:\n "generate", "edit", and "auto".' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + ImageGenTool.__qualname__ = 'ImageGenTool' + if _version_info < (3, 13): + ImageGenTool.__doc__ = 'Image generation tool.\n\n :ivar type: The type of the image generation tool. Always ``image_generation``. Required.\n IMAGE_GENERATION.\n :vartype type: Literal["image_generation"]\n :ivar model: Is one of the following types: Literal["gpt-image-1"],\n Literal["gpt-image-1-mini"], Literal["gpt-image-1.5"], str\n :vartype model: Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"],\n Literal["gpt-image-1.5"], str]\n :ivar quality: The quality of the generated image. One of ``low``, ``medium``, ``high``, or\n ``auto``. Default: ``auto``. Is one of the following types: Literal["low"], Literal["medium"],\n Literal["high"], Literal["auto"]\n :vartype quality: Literal["low", "medium", "high", "auto"]\n :ivar size: The size of the generated images. For ``gpt-image-2`` and\n ``gpt-image-2-2026-04-21``, arbitrary resolutions are supported as ``WIDTHxHEIGHT`` strings,\n for example ``1536x864``. Width and height must both be divisible by 16 and the requested\n aspect ratio must be between 1:3 and 3:1. Resolutions above ``2560x1440`` are experimental, and\n the maximum supported resolution is ``3840x2160``. The requested size must also satisfy the\n model\'s current pixel and edge limits. The standard sizes ``1024x1024``, ``1536x1024``, and\n ``1024x1536`` are supported by the GPT image models; ``auto`` is supported for models that\n allow automatic sizing. For ``dall-e-2``, use one of ``256x256``, ``512x512``, or\n ``1024x1024``. For ``dall-e-3``, use one of ``1024x1024``, ``1792x1024``, or ``1024x1792``. Is\n one of the following types: Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"],\n Literal["auto"], str\n :vartype size: Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"],\n Literal["auto"], str]\n :ivar output_format: The output format of the generated image. One of ``png``, ``webp``, or\n ``jpeg``. Default: ``png``. Is one of the following types: Literal["png"], Literal["webp"],\n Literal["jpeg"]\n :vartype output_format: Literal["png", "webp", "jpeg"]\n :ivar output_compression: Compression level for the output image. Default: 100.\n :vartype output_compression: int\n :ivar moderation: Moderation level for the generated image. Default: ``auto``. Is either a\n Literal["auto"] type or a Literal["low"] type.\n :vartype moderation: Literal["auto", "low"]\n :ivar background: Background type for the generated image. One of ``transparent``, ``opaque``,\n or ``auto``. Default: ``auto``. Is one of the following types: Literal["transparent"],\n Literal["opaque"], Literal["auto"]\n :vartype background: Literal["transparent", "opaque", "auto"]\n :ivar input_fidelity: Known values are: "high" and "low".\n :vartype input_fidelity: InputFidelity\n :ivar input_image_mask: Optional mask for inpainting. Contains ``image_url`` (string, optional)\n and ``file_id`` (string, optional).\n :vartype input_image_mask: "ImageGenToolInputImageMask"\n :ivar partial_images: Number of partial images to generate in streaming mode, from 0 (default\n value) to 3.\n :vartype partial_images: int\n :ivar action: Whether to generate a new image or edit an existing image. Default: ``auto``.\n Known values are: "generate", "edit", and "auto".\n :vartype action: ImageGenActionEnum\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n ' + return ImageGenTool + + def _make_ImageGenToolInputImageMask(): + class ImageGenToolInputImageMask(TypedDict, total=False): + """ImageGenToolInputImageMask. + + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + """ + image_url: str + file_id: str + ImageGenToolInputImageMask.__qualname__ = 'ImageGenToolInputImageMask' + if _version_info < (3, 13): + ImageGenToolInputImageMask.__doc__ = 'ImageGenToolInputImageMask.\n\n :ivar image_url:\n :vartype image_url: str\n :ivar file_id:\n :vartype file_id: str\n ' + return ImageGenToolInputImageMask + + def _make_InlineSkillParam(): + class InlineSkillParam(TypedDict, total=False): + """InlineSkillParam. + + :ivar type: Defines an inline skill for this request. Required. INLINE. + :vartype type: Literal["inline"] + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar source: Inline skill payload. Required. + :vartype source: "InlineSkillSourceParam" + """ + type: Required[Literal['inline']] + 'Defines an inline skill for this request. Required. INLINE.' + name: Required[str] + 'The name of the skill. Required.' + description: Required[str] + 'The description of the skill. Required.' + source: Required['_types.InlineSkillSourceParam'] + 'Inline skill payload. Required.' + InlineSkillParam.__qualname__ = 'InlineSkillParam' + if _version_info < (3, 13): + InlineSkillParam.__doc__ = 'InlineSkillParam.\n\n :ivar type: Defines an inline skill for this request. Required. INLINE.\n :vartype type: Literal["inline"]\n :ivar name: The name of the skill. Required.\n :vartype name: str\n :ivar description: The description of the skill. Required.\n :vartype description: str\n :ivar source: Inline skill payload. Required.\n :vartype source: "InlineSkillSourceParam"\n ' + return InlineSkillParam + + def _make_InlineSkillSourceParam(): + class InlineSkillSourceParam(TypedDict, total=False): + """Inline skill payload. + + :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is + "base64". + :vartype type: Literal["base64"] + :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``. + Required. Default value is "application/zip". + :vartype media_type: Literal["application/zip"] + :ivar data: Base64-encoded skill zip bundle. Required. + :vartype data: str + """ + type: Required[Literal['base64']] + 'The type of the inline skill source. Must be ``base64``. Required. Default value is "base64".' + media_type: Required[Literal['application/zip']] + 'The media type of the inline skill payload. Must be ``application/zip``. Required. Default\n value is "application/zip".' + data: Required[str] + 'Base64-encoded skill zip bundle. Required.' + InlineSkillSourceParam.__qualname__ = 'InlineSkillSourceParam' + if _version_info < (3, 13): + InlineSkillSourceParam.__doc__ = 'Inline skill payload.\n\n :ivar type: The type of the inline skill source. Must be ``base64``. Required. Default value is\n "base64".\n :vartype type: Literal["base64"]\n :ivar media_type: The media type of the inline skill payload. Must be ``application/zip``.\n Required. Default value is "application/zip".\n :vartype media_type: Literal["application/zip"]\n :ivar data: Base64-encoded skill zip bundle. Required.\n :vartype data: str\n ' + return InlineSkillSourceParam + + def _make_InputFileContent(): + class InputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. Default value is + "input_file". + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + """ + type: Required[Literal['input_file']] + 'The type of the input item. Always ``input_file``. Required. Default value is "input_file".' + file_id: Optional[str] + filename: str + 'The name of the file to be sent to the model.' + file_data: str + 'The content of the file to be sent to the model.' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + file_url: str + 'The URL of the file to be sent to the model.' + detail: _resolve('FileInputDetail') + 'The detail level of the file to be sent to the model. Use ``auto`` to let the system select the\n detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may\n increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the\n file at higher quality. Defaults to ``auto``. Known values are: "auto", "low", and\n "high".' + InputFileContent.__qualname__ = 'InputFileContent' + if _version_info < (3, 13): + InputFileContent.__doc__ = 'Input file.\n\n :ivar type: The type of the input item. Always ``input_file``. Required. Default value is\n "input_file".\n :vartype type: Literal["input_file"]\n :ivar file_id:\n :vartype file_id: str\n :ivar filename: The name of the file to be sent to the model.\n :vartype filename: str\n :ivar file_data: The content of the file to be sent to the model.\n :vartype file_data: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n :ivar file_url: The URL of the file to be sent to the model.\n :vartype file_url: str\n :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the\n system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality\n rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or\n ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto",\n "low", and "high".\n :vartype detail: FileInputDetail\n ' + return InputFileContent + + def _make_InputFileContentParam(): + class InputFileContentParam(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. Default value is + "input_file". + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: + :vartype filename: str + :ivar file_data: + :vartype file_data: str + :ivar file_url: + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" + """ + type: Required[Literal['input_file']] + 'The type of the input item. Always ``input_file``. Required. Default value is "input_file".' + file_id: Optional[str] + filename: Optional[str] + file_data: Optional[str] + file_url: Optional[str] + detail: _resolve('FileInputDetail') + 'The detail level of the file to be sent to the model. Use ``auto`` to let the system select the\n detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may\n increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the\n file at higher quality. Defaults to ``auto``. Known values are: "auto", "low", and\n "high".' + prompt_cache_breakpoint: Optional['_types.PromptCacheBreakpointParam'] + InputFileContentParam.__qualname__ = 'InputFileContentParam' + if _version_info < (3, 13): + InputFileContentParam.__doc__ = 'Input file.\n\n :ivar type: The type of the input item. Always ``input_file``. Required. Default value is\n "input_file".\n :vartype type: Literal["input_file"]\n :ivar file_id:\n :vartype file_id: str\n :ivar filename:\n :vartype filename: str\n :ivar file_data:\n :vartype file_data: str\n :ivar file_url:\n :vartype file_url: str\n :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the\n system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality\n rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or\n ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto",\n "low", and "high".\n :vartype detail: FileInputDetail\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam"\n ' + return InputFileContentParam + + def _make_InputImageContent(): + class InputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. Default value is + "input_image". + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", + "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['input_image']] + 'The type of the input item. Always ``input_image``. Required. Default value is "input_image".' + image_url: Optional[str] + file_id: Optional[str] + detail: Required[_resolve('ImageDetail')] + 'The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or\n ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", "auto",\n and "original".' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + InputImageContent.__qualname__ = 'InputImageContent' + if _version_info < (3, 13): + InputImageContent.__doc__ = 'Input image.\n\n :ivar type: The type of the input item. Always ``input_image``. Required. Default value is\n "input_image".\n :vartype type: Literal["input_image"]\n :ivar image_url:\n :vartype image_url: str\n :ivar file_id:\n :vartype file_id: str\n :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``,\n ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high",\n "auto", and "original".\n :vartype detail: ImageDetail\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return InputImageContent + + def _make_InputImageContentParamAutoParam(): + class InputImageContentParamAutoParam(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. Default value is + "input_image". + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: Known values are: "low", "high", "auto", and "original". + :vartype detail: DetailEnum + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" + """ + type: Required[Literal['input_image']] + 'The type of the input item. Always ``input_image``. Required. Default value is "input_image".' + image_url: Optional[str] + file_id: Optional[str] + detail: Optional[_resolve('DetailEnum')] + 'Known values are: "low", "high", "auto", and "original".' + prompt_cache_breakpoint: Optional['_types.PromptCacheBreakpointParam'] + InputImageContentParamAutoParam.__qualname__ = 'InputImageContentParamAutoParam' + if _version_info < (3, 13): + InputImageContentParamAutoParam.__doc__ = 'Input image.\n\n :ivar type: The type of the input item. Always ``input_image``. Required. Default value is\n "input_image".\n :vartype type: Literal["input_image"]\n :ivar image_url:\n :vartype image_url: str\n :ivar file_id:\n :vartype file_id: str\n :ivar detail: Known values are: "low", "high", "auto", and "original".\n :vartype detail: DetailEnum\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam"\n ' + return InputImageContentParamAutoParam + + def _make_InputTextContent(): + class InputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. Default value is + "input_text". + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['input_text']] + 'The type of the input item. Always ``input_text``. Required. Default value is "input_text".' + text: Required[str] + 'The text input to the model. Required.' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + InputTextContent.__qualname__ = 'InputTextContent' + if _version_info < (3, 13): + InputTextContent.__doc__ = 'Input text.\n\n :ivar type: The type of the input item. Always ``input_text``. Required. Default value is\n "input_text".\n :vartype type: Literal["input_text"]\n :ivar text: The text input to the model. Required.\n :vartype text: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return InputTextContent + + def _make_InputTextContentParam(): + class InputTextContentParam(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. Default value is + "input_text". + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam" + """ + type: Required[Literal['input_text']] + 'The type of the input item. Always ``input_text``. Required. Default value is "input_text".' + text: Required[str] + 'The text input to the model. Required.' + prompt_cache_breakpoint: Optional['_types.PromptCacheBreakpointParam'] + InputTextContentParam.__qualname__ = 'InputTextContentParam' + if _version_info < (3, 13): + InputTextContentParam.__doc__ = 'Input text.\n\n :ivar type: The type of the input item. Always ``input_text``. Required. Default value is\n "input_text".\n :vartype type: Literal["input_text"]\n :ivar text: The text input to the model. Required.\n :vartype text: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointParam"\n ' + return InputTextContentParam + + def _make_ItemCodeInterpreterToolCall(): + class ItemCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. Default value is "code_interpreter_call". + :vartype type: Literal["code_interpreter_call"] + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] + """ + type: Required[Literal['code_interpreter_call']] + 'The type of the code interpreter tool call. Always ``code_interpreter_call``. Required. Default\n value is "code_interpreter_call".' + id: Required[str] + 'The unique ID of the code interpreter tool call. Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete', 'interpreting', 'failed']] + 'The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``,\n ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"],\n Literal["interpreting"], Literal["failed"]' + container_id: Required[str] + 'The ID of the container used to run the code. Required.' + code: Required[Optional[str]] + 'Required.' + outputs: Required[Optional[list[Union['_types.CodeInterpreterOutputLogs', '_types.CodeInterpreterOutputImage']]]] + 'Required.' + ItemCodeInterpreterToolCall.__qualname__ = 'ItemCodeInterpreterToolCall' + if _version_info < (3, 13): + ItemCodeInterpreterToolCall.__doc__ = 'Code interpreter tool call.\n\n :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``.\n Required. Default value is "code_interpreter_call".\n :vartype type: Literal["code_interpreter_call"]\n :ivar id: The unique ID of the code interpreter tool call. Required.\n :vartype id: str\n :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``,\n ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the\n following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"],\n Literal["interpreting"], Literal["failed"]\n :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]\n :ivar container_id: The ID of the container used to run the code. Required.\n :vartype container_id: str\n :ivar code: Required.\n :vartype code: str\n :ivar outputs: Required.\n :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]\n ' + return ItemCodeInterpreterToolCall + + def _make_ItemComputerToolCall(): + class ItemComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar type: The type of the computer call. Always ``computer_call``. Required. Default value is + "computer_call". + :vartype type: Literal["computer_call"] + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: + :vartype action: "ComputerAction" + :ivar actions: + :vartype actions: list["ComputerAction"] + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['computer_call']] + 'The type of the computer call. Always ``computer_call``. Required. Default value is\n "computer_call".' + id: Required[str] + 'The unique ID of the computer call. Required.' + call_id: Required[str] + 'An identifier used when responding to the tool call with output. Required.' + action: '_types.ComputerAction' + actions: list['_types.ComputerAction'] + pending_safety_checks: Required[list['_types.ComputerCallSafetyCheckParam']] + 'The pending safety checks for the computer call. Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + ItemComputerToolCall.__qualname__ = 'ItemComputerToolCall' + if _version_info < (3, 13): + ItemComputerToolCall.__doc__ = 'Computer tool call.\n\n :ivar type: The type of the computer call. Always ``computer_call``. Required. Default value is\n "computer_call".\n :vartype type: Literal["computer_call"]\n :ivar id: The unique ID of the computer call. Required.\n :vartype id: str\n :ivar call_id: An identifier used when responding to the tool call with output. Required.\n :vartype call_id: str\n :ivar action:\n :vartype action: "ComputerAction"\n :ivar actions:\n :vartype actions: list["ComputerAction"]\n :ivar pending_safety_checks: The pending safety checks for the computer call. Required.\n :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemComputerToolCall + + def _make_ItemCustomToolCall(): + class ItemCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. Default + value is "custom_tool_call". + :vartype type: Literal["custom_tool_call"] + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the custom tool being called. + :vartype namespace: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + type: Required[Literal['custom_tool_call']] + 'The type of the custom tool call. Always ``custom_tool_call``. Required. Default value is\n "custom_tool_call".' + id: str + 'The unique ID of the custom tool call in the OpenAI platform.' + call_id: Required[str] + 'An identifier used to map this custom tool call to a tool call output. Required.' + caller: Optional['_types.ToolCallCaller'] + namespace: str + 'The namespace of the custom tool being called.' + name: Required[str] + 'The name of the custom tool being called. Required.' + input: Required[str] + 'The input for the custom tool call generated by the model. Required.' + ItemCustomToolCall.__qualname__ = 'ItemCustomToolCall' + if _version_info < (3, 13): + ItemCustomToolCall.__doc__ = 'Custom tool call.\n\n :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. Default\n value is "custom_tool_call".\n :vartype type: Literal["custom_tool_call"]\n :ivar id: The unique ID of the custom tool call in the OpenAI platform.\n :vartype id: str\n :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar namespace: The namespace of the custom tool being called.\n :vartype namespace: str\n :ivar name: The name of the custom tool being called. Required.\n :vartype name: str\n :ivar input: The input for the custom tool call generated by the model. Required.\n :vartype input: str\n ' + return ItemCustomToolCall + + def _make_ItemCustomToolCallOutput(): + class ItemCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. Default value is "custom_tool_call_output". + :vartype type: Literal["custom_tool_call_output"] + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + """ + type: Required[Literal['custom_tool_call_output']] + 'The type of the custom tool call output. Always ``custom_tool_call_output``. Required. Default\n value is "custom_tool_call_output".' + id: str + 'The unique ID of the custom tool call output in the OpenAI platform.' + call_id: Required[str] + 'The call ID, used to map this custom tool call output to a custom tool call. Required.' + caller: Optional['_types.ToolCallCallerParam'] + output: Required[Union[str, list['_types.FunctionAndCustomToolCallOutput']]] + 'The output from the custom tool call generated by your code. Can be a string or an list of\n output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.' + ItemCustomToolCallOutput.__qualname__ = 'ItemCustomToolCallOutput' + if _version_info < (3, 13): + ItemCustomToolCallOutput.__doc__ = 'Custom tool call output.\n\n :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``.\n Required. Default value is "custom_tool_call_output".\n :vartype type: Literal["custom_tool_call_output"]\n :ivar id: The unique ID of the custom tool call output in the OpenAI platform.\n :vartype id: str\n :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call.\n Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar output: The output from the custom tool call generated by your code. Can be a string or\n an list of output content. Required. Is either a str type or a\n [FunctionAndCustomToolCallOutput] type.\n :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]]\n ' + return ItemCustomToolCallOutput + + def _make_ItemFieldAdditionalTools(): + class ItemFieldAdditionalTools(TypedDict, total=False): + """ItemFieldAdditionalTools. + + :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. + :vartype type: Literal["additional_tools"] + :ivar id: The unique ID of the additional tools item. Required. + :vartype id: str + :ivar role: The role that provided the additional tools. Required. Known values are: "unknown", + "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar tools: The additional tool definitions made available at this item. Required. + :vartype tools: list["Tool"] + """ + type: Required[Literal['additional_tools']] + 'The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.' + id: Required[str] + 'The unique ID of the additional tools item. Required.' + role: Required[_resolve('MessageRole')] + 'The role that provided the additional tools. Required. Known values are: "unknown", "user",\n "assistant", "system", "critic", "discriminator", "developer", and "tool".' + tools: Required[list['_types.Tool']] + 'The additional tool definitions made available at this item. Required.' + ItemFieldAdditionalTools.__qualname__ = 'ItemFieldAdditionalTools' + if _version_info < (3, 13): + ItemFieldAdditionalTools.__doc__ = 'ItemFieldAdditionalTools.\n\n :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.\n :vartype type: Literal["additional_tools"]\n :ivar id: The unique ID of the additional tools item. Required.\n :vartype id: str\n :ivar role: The role that provided the additional tools. Required. Known values are: "unknown",\n "user", "assistant", "system", "critic", "discriminator", "developer", and "tool".\n :vartype role: MessageRole\n :ivar tools: The additional tool definitions made available at this item. Required.\n :vartype tools: list["Tool"]\n ' + return ItemFieldAdditionalTools + + def _make_ItemFieldApplyPatchToolCall(): + class ItemFieldApplyPatchToolCall(TypedDict, total=False): + """Apply patch tool call. + + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: Literal["apply_patch_call"] + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: "ApplyPatchFileOperation" + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str + """ + type: Required[Literal['apply_patch_call']] + 'The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.' + id: Required[str] + 'The unique ID of the apply patch tool call. Populated when this item is returned via API.\n Required.' + call_id: Required[str] + 'The unique ID of the apply patch tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + status: Required[_resolve('ApplyPatchCallStatus')] + 'The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required.\n Known values are: "in_progress" and "completed".' + operation: Required['_types.ApplyPatchFileOperation'] + 'Apply patch operation. Required.' + created_by: str + 'The ID of the entity that created this tool call.' + ItemFieldApplyPatchToolCall.__qualname__ = 'ItemFieldApplyPatchToolCall' + if _version_info < (3, 13): + ItemFieldApplyPatchToolCall.__doc__ = 'Apply patch tool call.\n\n :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.\n :vartype type: Literal["apply_patch_call"]\n :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via\n API. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``.\n Required. Known values are: "in_progress" and "completed".\n :vartype status: ApplyPatchCallStatus\n :ivar operation: Apply patch operation. Required.\n :vartype operation: "ApplyPatchFileOperation"\n :ivar created_by: The ID of the entity that created this tool call.\n :vartype created_by: str\n ' + return ItemFieldApplyPatchToolCall + + def _make_ItemFieldApplyPatchToolCallOutput(): + class ItemFieldApplyPatchToolCallOutput(TypedDict, total=False): + """Apply patch tool call output. + + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: Literal["apply_patch_call_output"] + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + :ivar created_by: The ID of the entity that created this tool call output. + :vartype created_by: str + """ + type: Required[Literal['apply_patch_call_output']] + 'The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.' + id: Required[str] + 'The unique ID of the apply patch tool call output. Populated when this item is returned via\n API. Required.' + call_id: Required[str] + 'The unique ID of the apply patch tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + status: Required[_resolve('ApplyPatchCallOutputStatus')] + 'The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required.\n Known values are: "completed" and "failed".' + output: Optional[str] + created_by: str + 'The ID of the entity that created this tool call output.' + ItemFieldApplyPatchToolCallOutput.__qualname__ = 'ItemFieldApplyPatchToolCallOutput' + if _version_info < (3, 13): + ItemFieldApplyPatchToolCallOutput.__doc__ = 'Apply patch tool call output.\n\n :ivar type: The type of the item. Always ``apply_patch_call_output``. Required.\n APPLY_PATCH_CALL_OUTPUT.\n :vartype type: Literal["apply_patch_call_output"]\n :ivar id: The unique ID of the apply patch tool call output. Populated when this item is\n returned via API. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar status: The status of the apply patch tool call output. One of ``completed`` or\n ``failed``. Required. Known values are: "completed" and "failed".\n :vartype status: ApplyPatchCallOutputStatus\n :ivar output:\n :vartype output: str\n :ivar created_by: The ID of the entity that created this tool call output.\n :vartype created_by: str\n ' + return ItemFieldApplyPatchToolCallOutput + + def _make_ItemFieldCodeInterpreterToolCall(): + class ItemFieldCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: Literal["code_interpreter_call"] + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] + """ + type: Required[Literal['code_interpreter_call']] + 'The type of the code interpreter tool call. Always ``code_interpreter_call``. Required.\n CODE_INTERPRETER_CALL.' + id: Required[str] + 'The unique ID of the code interpreter tool call. Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete', 'interpreting', 'failed']] + 'The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``,\n ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"],\n Literal["interpreting"], Literal["failed"]' + container_id: Required[str] + 'The ID of the container used to run the code. Required.' + code: Required[Optional[str]] + 'Required.' + outputs: Required[Optional[list[Union['_types.CodeInterpreterOutputLogs', '_types.CodeInterpreterOutputImage']]]] + 'Required.' + ItemFieldCodeInterpreterToolCall.__qualname__ = 'ItemFieldCodeInterpreterToolCall' + if _version_info < (3, 13): + ItemFieldCodeInterpreterToolCall.__doc__ = 'Code interpreter tool call.\n\n :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``.\n Required. CODE_INTERPRETER_CALL.\n :vartype type: Literal["code_interpreter_call"]\n :ivar id: The unique ID of the code interpreter tool call. Required.\n :vartype id: str\n :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``,\n ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the\n following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"],\n Literal["interpreting"], Literal["failed"]\n :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]\n :ivar container_id: The ID of the container used to run the code. Required.\n :vartype container_id: str\n :ivar code: Required.\n :vartype code: str\n :ivar outputs: Required.\n :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]\n ' + return ItemFieldCodeInterpreterToolCall + + def _make_ItemFieldCompactionBody(): + class ItemFieldCompactionBody(TypedDict, total=False): + """Compaction item. + + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: Literal["compaction"] + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + type: Required[Literal['compaction']] + 'The type of the item. Always ``compaction``. Required. COMPACTION.' + id: Required[str] + 'The unique ID of the compaction item. Required.' + encrypted_content: Required[str] + 'The encrypted content that was produced by compaction. Required.' + created_by: str + 'The identifier of the actor that created the item.' + ItemFieldCompactionBody.__qualname__ = 'ItemFieldCompactionBody' + if _version_info < (3, 13): + ItemFieldCompactionBody.__doc__ = 'Compaction item.\n\n :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION.\n :vartype type: Literal["compaction"]\n :ivar id: The unique ID of the compaction item. Required.\n :vartype id: str\n :ivar encrypted_content: The encrypted content that was produced by compaction. Required.\n :vartype encrypted_content: str\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return ItemFieldCompactionBody + + def _make_ItemFieldComputerToolCall(): + class ItemFieldComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: Literal["computer_call"] + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: + :vartype action: "ComputerAction" + :ivar actions: + :vartype actions: list["ComputerAction"] + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['computer_call']] + 'The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.' + id: Required[str] + 'The unique ID of the computer call. Required.' + call_id: Required[str] + 'An identifier used when responding to the tool call with output. Required.' + action: '_types.ComputerAction' + actions: list['_types.ComputerAction'] + pending_safety_checks: Required[list['_types.ComputerCallSafetyCheckParam']] + 'The pending safety checks for the computer call. Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + ItemFieldComputerToolCall.__qualname__ = 'ItemFieldComputerToolCall' + if _version_info < (3, 13): + ItemFieldComputerToolCall.__doc__ = 'Computer tool call.\n\n :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.\n :vartype type: Literal["computer_call"]\n :ivar id: The unique ID of the computer call. Required.\n :vartype id: str\n :ivar call_id: An identifier used when responding to the tool call with output. Required.\n :vartype call_id: str\n :ivar action:\n :vartype action: "ComputerAction"\n :ivar actions:\n :vartype actions: list["ComputerAction"]\n :ivar pending_safety_checks: The pending safety checks for the computer call. Required.\n :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldComputerToolCall + + def _make_ItemFieldComputerToolCallOutput(): + class ItemFieldComputerToolCallOutput(TypedDict, total=False): + """Computer tool call output. + + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: Literal["computer_call_output"] + :ivar id: The ID of the computer tool call output. Required. + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar acknowledged_safety_checks: The safety checks reported by the API that have been + acknowledged by the developer. + :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar output: Required. + :vartype output: "ComputerScreenshotImage" + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['computer_call_output']] + 'The type of the computer tool call output. Always ``computer_call_output``. Required.\n COMPUTER_CALL_OUTPUT.' + id: Required[str] + 'The ID of the computer tool call output. Required.' + call_id: Required[str] + 'The ID of the computer tool call that produced the output. Required.' + acknowledged_safety_checks: list['_types.ComputerCallSafetyCheckParam'] + 'The safety checks reported by the API that have been acknowledged by the developer.' + output: Required['_types.ComputerScreenshotImage'] + 'Required.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when input items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + ItemFieldComputerToolCallOutput.__qualname__ = 'ItemFieldComputerToolCallOutput' + if _version_info < (3, 13): + ItemFieldComputerToolCallOutput.__doc__ = 'Computer tool call output.\n\n :ivar type: The type of the computer tool call output. Always ``computer_call_output``.\n Required. COMPUTER_CALL_OUTPUT.\n :vartype type: Literal["computer_call_output"]\n :ivar id: The ID of the computer tool call output. Required.\n :vartype id: str\n :ivar call_id: The ID of the computer tool call that produced the output. Required.\n :vartype call_id: str\n :ivar acknowledged_safety_checks: The safety checks reported by the API that have been\n acknowledged by the developer.\n :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"]\n :ivar output: Required.\n :vartype output: "ComputerScreenshotImage"\n :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or\n ``incomplete``. Populated when input items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldComputerToolCallOutput + + def _make_ItemFieldCustomToolCall(): + class ItemFieldCustomToolCall(TypedDict, total=False): + """Custom tool call. + + :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required. + CUSTOM_TOOL_CALL. + :vartype type: Literal["custom_tool_call"] + :ivar id: The unique ID of the custom tool call in the OpenAI platform. + :vartype id: str + :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the custom tool being called. + :vartype namespace: str + :ivar name: The name of the custom tool being called. Required. + :vartype name: str + :ivar input: The input for the custom tool call generated by the model. Required. + :vartype input: str + """ + type: Required[Literal['custom_tool_call']] + 'The type of the custom tool call. Always ``custom_tool_call``. Required. CUSTOM_TOOL_CALL.' + id: str + 'The unique ID of the custom tool call in the OpenAI platform.' + call_id: Required[str] + 'An identifier used to map this custom tool call to a tool call output. Required.' + caller: Optional['_types.ToolCallCaller'] + namespace: str + 'The namespace of the custom tool being called.' + name: Required[str] + 'The name of the custom tool being called. Required.' + input: Required[str] + 'The input for the custom tool call generated by the model. Required.' + ItemFieldCustomToolCall.__qualname__ = 'ItemFieldCustomToolCall' + if _version_info < (3, 13): + ItemFieldCustomToolCall.__doc__ = 'Custom tool call.\n\n :ivar type: The type of the custom tool call. Always ``custom_tool_call``. Required.\n CUSTOM_TOOL_CALL.\n :vartype type: Literal["custom_tool_call"]\n :ivar id: The unique ID of the custom tool call in the OpenAI platform.\n :vartype id: str\n :ivar call_id: An identifier used to map this custom tool call to a tool call output. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar namespace: The namespace of the custom tool being called.\n :vartype namespace: str\n :ivar name: The name of the custom tool being called. Required.\n :vartype name: str\n :ivar input: The input for the custom tool call generated by the model. Required.\n :vartype input: str\n ' + return ItemFieldCustomToolCall + + def _make_ItemFieldCustomToolCallOutput(): + class ItemFieldCustomToolCallOutput(TypedDict, total=False): + """Custom tool call output. + + :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``. + Required. CUSTOM_TOOL_CALL_OUTPUT. + :vartype type: Literal["custom_tool_call_output"] + :ivar id: The unique ID of the custom tool call output in the OpenAI platform. + :vartype id: str + :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call. + Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the custom tool call generated by your code. Can be a string or + an list of output content. Required. Is either a str type or a + [FunctionAndCustomToolCallOutput] type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + """ + type: Required[Literal['custom_tool_call_output']] + 'The type of the custom tool call output. Always ``custom_tool_call_output``. Required.\n CUSTOM_TOOL_CALL_OUTPUT.' + id: str + 'The unique ID of the custom tool call output in the OpenAI platform.' + call_id: Required[str] + 'The call ID, used to map this custom tool call output to a custom tool call. Required.' + caller: Optional['_types.ToolCallCallerParam'] + output: Required[Union[str, list['_types.FunctionAndCustomToolCallOutput']]] + 'The output from the custom tool call generated by your code. Can be a string or an list of\n output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.' + ItemFieldCustomToolCallOutput.__qualname__ = 'ItemFieldCustomToolCallOutput' + if _version_info < (3, 13): + ItemFieldCustomToolCallOutput.__doc__ = 'Custom tool call output.\n\n :ivar type: The type of the custom tool call output. Always ``custom_tool_call_output``.\n Required. CUSTOM_TOOL_CALL_OUTPUT.\n :vartype type: Literal["custom_tool_call_output"]\n :ivar id: The unique ID of the custom tool call output in the OpenAI platform.\n :vartype id: str\n :ivar call_id: The call ID, used to map this custom tool call output to a custom tool call.\n Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar output: The output from the custom tool call generated by your code. Can be a string or\n an list of output content. Required. Is either a str type or a\n [FunctionAndCustomToolCallOutput] type.\n :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]]\n ' + return ItemFieldCustomToolCallOutput + + def _make_ItemFieldFileSearchToolCall(): + class ItemFieldFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: Literal["file_search_call"] + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list["FileSearchToolCallResults"] + """ + id: Required[str] + 'The unique ID of the file search tool call. Required.' + type: Required[Literal['file_search_call']] + 'The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.' + status: Required[Literal['in_progress', 'searching', 'completed', 'incomplete', 'failed']] + 'The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete``\n or ``failed``,. Required. Is one of the following types: Literal["in_progress"],\n Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"]' + queries: Required[list[str]] + 'The queries used to search for files. Required.' + results: Optional[list['_types.FileSearchToolCallResults']] + ItemFieldFileSearchToolCall.__qualname__ = 'ItemFieldFileSearchToolCall' + if _version_info < (3, 13): + ItemFieldFileSearchToolCall.__doc__ = 'File search tool call.\n\n :ivar id: The unique ID of the file search tool call. Required.\n :vartype id: str\n :ivar type: The type of the file search tool call. Always ``file_search_call``. Required.\n FILE_SEARCH_CALL.\n :vartype type: Literal["file_search_call"]\n :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``,\n ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"],\n Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"]\n :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"]\n :ivar queries: The queries used to search for files. Required.\n :vartype queries: list[str]\n :ivar results:\n :vartype results: list["FileSearchToolCallResults"]\n ' + return ItemFieldFileSearchToolCall + + def _make_ItemFieldFunctionShellCall(): + class ItemFieldFunctionShellCall(TypedDict, total=False): + """Shell tool call. + + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: Literal["shell_call"] + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: "FunctionShellAction" + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallStatus + :ivar environment: Required. + :vartype environment: "FunctionShellCallEnvironment" + :ivar created_by: The ID of the entity that created this tool call. + :vartype created_by: str + """ + type: Required[Literal['shell_call']] + 'The type of the item. Always ``shell_call``. Required. SHELL_CALL.' + id: Required[str] + 'The unique ID of the shell tool call. Populated when this item is returned via API. Required.' + call_id: Required[str] + 'The unique ID of the shell tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + action: Required['_types.FunctionShellAction'] + 'The shell commands and limits that describe how to run the tool call. Required.' + status: Required[_resolve('FunctionShellCallStatus')] + 'The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``.\n Required. Known values are: "in_progress", "completed", and "incomplete".' + environment: Required[Optional['_types.FunctionShellCallEnvironment']] + 'Required.' + created_by: str + 'The ID of the entity that created this tool call.' + ItemFieldFunctionShellCall.__qualname__ = 'ItemFieldFunctionShellCall' + if _version_info < (3, 13): + ItemFieldFunctionShellCall.__doc__ = 'Shell tool call.\n\n :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL.\n :vartype type: Literal["shell_call"]\n :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API.\n Required.\n :vartype id: str\n :ivar call_id: The unique ID of the shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar action: The shell commands and limits that describe how to run the tool call. Required.\n :vartype action: "FunctionShellAction"\n :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or\n ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionShellCallStatus\n :ivar environment: Required.\n :vartype environment: "FunctionShellCallEnvironment"\n :ivar created_by: The ID of the entity that created this tool call.\n :vartype created_by: str\n ' + return ItemFieldFunctionShellCall + + def _make_ItemFieldFunctionShellCallOutput(): + class ItemFieldFunctionShellCallOutput(TypedDict, total=False): + """Shell call output. + + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: Literal["shell_call_output"] + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: list["FunctionShellCallOutputContent"] + :ivar max_output_length: Required. + :vartype max_output_length: int + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + type: Required[Literal['shell_call_output']] + 'The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.' + id: Required[str] + 'The unique ID of the shell call output. Populated when this item is returned via API. Required.' + call_id: Required[str] + 'The unique ID of the shell tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + status: Required[_resolve('FunctionShellCallOutputStatusEnum')] + 'The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``.\n Required. Known values are: "in_progress", "completed", and "incomplete".' + output: Required[list['_types.FunctionShellCallOutputContent']] + 'An array of shell call output contents. Required.' + max_output_length: Required[Optional[int]] + 'Required.' + created_by: str + 'The identifier of the actor that created the item.' + ItemFieldFunctionShellCallOutput.__qualname__ = 'ItemFieldFunctionShellCallOutput' + if _version_info < (3, 13): + ItemFieldFunctionShellCallOutput.__doc__ = 'Shell call output.\n\n :ivar type: The type of the shell call output. Always ``shell_call_output``. Required.\n SHELL_CALL_OUTPUT.\n :vartype type: Literal["shell_call_output"]\n :ivar id: The unique ID of the shell call output. Populated when this item is returned via API.\n Required.\n :vartype id: str\n :ivar call_id: The unique ID of the shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or\n ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionShellCallOutputStatusEnum\n :ivar output: An array of shell call output contents. Required.\n :vartype output: list["FunctionShellCallOutputContent"]\n :ivar max_output_length: Required.\n :vartype max_output_length: int\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return ItemFieldFunctionShellCallOutput + + def _make_ItemFieldFunctionToolCall(): + class ItemFieldFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar id: The unique ID of the function tool call. Required. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: Literal["function_call"] + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the function to run. + :vartype namespace: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + id: Required[str] + 'The unique ID of the function tool call. Required.' + type: Required[Literal['function_call']] + 'The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.' + call_id: Required[str] + 'The unique ID of the function tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + namespace: str + 'The namespace of the function to run.' + name: Required[str] + 'The name of the function to run. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the function. Required.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + ItemFieldFunctionToolCall.__qualname__ = 'ItemFieldFunctionToolCall' + if _version_info < (3, 13): + ItemFieldFunctionToolCall.__doc__ = 'Function tool call.\n\n :ivar id: The unique ID of the function tool call. Required.\n :vartype id: str\n :ivar type: The type of the function tool call. Always ``function_call``. Required.\n FUNCTION_CALL.\n :vartype type: Literal["function_call"]\n :ivar call_id: The unique ID of the function tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar namespace: The namespace of the function to run.\n :vartype namespace: str\n :ivar name: The name of the function to run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments to pass to the function. Required.\n :vartype arguments: str\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldFunctionToolCall + + def _make_ItemFieldFunctionToolCallOutput(): + class ItemFieldFunctionToolCallOutput(TypedDict, total=False): + """Function tool call output. + + :ivar id: The unique ID of the function tool call output. Populated when this item is returned + via API. Required. + :vartype id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: Literal["function_call_output"] + :ivar call_id: The unique ID of the function tool call generated by the model. + :vartype call_id: str + :ivar name: The name of the tool that produced the output. + :vartype name: str + :ivar namespace: The namespace of the tool that produced the output. + :vartype namespace: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the function call generated by your code. Can be a string or an + list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] + type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + id: Required[str] + 'The unique ID of the function tool call output. Populated when this item is returned via API.\n Required.' + type: Required[Literal['function_call_output']] + 'The type of the function tool call output. Always ``function_call_output``. Required.\n FUNCTION_CALL_OUTPUT.' + call_id: str + 'The unique ID of the function tool call generated by the model.' + name: str + 'The name of the tool that produced the output.' + namespace: str + 'The namespace of the tool that produced the output.' + caller: Optional['_types.ToolCallCallerParam'] + output: Required[Union[str, list['_types.FunctionAndCustomToolCallOutput']]] + 'The output from the function call generated by your code. Can be a string or an list of output\n content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + ItemFieldFunctionToolCallOutput.__qualname__ = 'ItemFieldFunctionToolCallOutput' + if _version_info < (3, 13): + ItemFieldFunctionToolCallOutput.__doc__ = 'Function tool call output.\n\n :ivar id: The unique ID of the function tool call output. Populated when this item is returned\n via API. Required.\n :vartype id: str\n :ivar type: The type of the function tool call output. Always ``function_call_output``.\n Required. FUNCTION_CALL_OUTPUT.\n :vartype type: Literal["function_call_output"]\n :ivar call_id: The unique ID of the function tool call generated by the model.\n :vartype call_id: str\n :ivar name: The name of the tool that produced the output.\n :vartype name: str\n :ivar namespace: The namespace of the tool that produced the output.\n :vartype namespace: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar output: The output from the function call generated by your code. Can be a string or an\n list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput]\n type.\n :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldFunctionToolCallOutput + + def _make_ItemFieldImageGenToolCall(): + class ItemFieldImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: Literal["image_generation_call"] + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "generating", "failed"] + :ivar result: Required. + :vartype result: str + """ + type: Required[Literal['image_generation_call']] + 'The type of the image generation call. Always ``image_generation_call``. Required.\n IMAGE_GENERATION_CALL.' + id: Required[str] + 'The unique ID of the image generation call. Required.' + status: Required[Literal['in_progress', 'completed', 'generating', 'failed']] + 'The status of the image generation call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"]' + result: Required[Optional[str]] + 'Required.' + ItemFieldImageGenToolCall.__qualname__ = 'ItemFieldImageGenToolCall' + if _version_info < (3, 13): + ItemFieldImageGenToolCall.__doc__ = 'Image generation call.\n\n :ivar type: The type of the image generation call. Always ``image_generation_call``. Required.\n IMAGE_GENERATION_CALL.\n :vartype type: Literal["image_generation_call"]\n :ivar id: The unique ID of the image generation call. Required.\n :vartype id: str\n :ivar status: The status of the image generation call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"]\n :vartype status: Literal["in_progress", "completed", "generating", "failed"]\n :ivar result: Required.\n :vartype result: str\n ' + return ItemFieldImageGenToolCall + + def _make_ItemFieldLocalShellToolCall(): + class ItemFieldLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: Literal["local_shell_call"] + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: "LocalShellExecAction" + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['local_shell_call']] + 'The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.' + id: Required[str] + 'The unique ID of the local shell call. Required.' + call_id: Required[str] + 'The unique ID of the local shell tool call generated by the model. Required.' + action: Required['_types.LocalShellExecAction'] + 'Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the local shell call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + ItemFieldLocalShellToolCall.__qualname__ = 'ItemFieldLocalShellToolCall' + if _version_info < (3, 13): + ItemFieldLocalShellToolCall.__doc__ = 'Local shell call.\n\n :ivar type: The type of the local shell call. Always ``local_shell_call``. Required.\n LOCAL_SHELL_CALL.\n :vartype type: Literal["local_shell_call"]\n :ivar id: The unique ID of the local shell call. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the local shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar action: Required.\n :vartype action: "LocalShellExecAction"\n :ivar status: The status of the local shell call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldLocalShellToolCall + + def _make_ItemFieldLocalShellToolCallOutput(): + class ItemFieldLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: Literal["local_shell_call_output"] + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['local_shell_call_output']] + 'The type of the local shell tool call output. Always ``local_shell_call_output``. Required.\n LOCAL_SHELL_CALL_OUTPUT.' + id: Required[str] + 'The unique ID of the local shell tool call generated by the model. Required.' + output: Required[str] + 'A JSON string of the output of the local shell tool call. Required.' + status: Optional[Literal['in_progress', 'completed', 'incomplete']] + 'Is one of the following types: Literal["in_progress"], Literal["completed"],\n Literal["incomplete"]' + ItemFieldLocalShellToolCallOutput.__qualname__ = 'ItemFieldLocalShellToolCallOutput' + if _version_info < (3, 13): + ItemFieldLocalShellToolCallOutput.__doc__ = 'Local shell call output.\n\n :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``.\n Required. LOCAL_SHELL_CALL_OUTPUT.\n :vartype type: Literal["local_shell_call_output"]\n :ivar id: The unique ID of the local shell tool call generated by the model. Required.\n :vartype id: str\n :ivar output: A JSON string of the output of the local shell tool call. Required.\n :vartype output: str\n :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"],\n Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldLocalShellToolCallOutput + + def _make_ItemFieldMcpApprovalRequest(): + class ItemFieldMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: Literal["mcp_approval_request"] + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + type: Required[Literal['mcp_approval_request']] + 'The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.' + id: Required[str] + 'The unique ID of the approval request. Required.' + server_label: Required[str] + 'The label of the MCP server making the request. Required.' + name: Required[str] + 'The name of the tool to run. Required.' + arguments: Required[str] + 'A JSON string of arguments for the tool. Required.' + ItemFieldMcpApprovalRequest.__qualname__ = 'ItemFieldMcpApprovalRequest' + if _version_info < (3, 13): + ItemFieldMcpApprovalRequest.__doc__ = 'MCP approval request.\n\n :ivar type: The type of the item. Always ``mcp_approval_request``. Required.\n MCP_APPROVAL_REQUEST.\n :vartype type: Literal["mcp_approval_request"]\n :ivar id: The unique ID of the approval request. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server making the request. Required.\n :vartype server_label: str\n :ivar name: The name of the tool to run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of arguments for the tool. Required.\n :vartype arguments: str\n ' + return ItemFieldMcpApprovalRequest + + def _make_ItemFieldMcpApprovalResponseResource(): + class ItemFieldMcpApprovalResponseResource(TypedDict, total=False): + """MCP approval response. + + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: Literal["mcp_approval_response"] + :ivar id: The unique ID of the approval response. Required. + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + type: Required[Literal['mcp_approval_response']] + 'The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.' + id: Required[str] + 'The unique ID of the approval response. Required.' + approval_request_id: Required[str] + 'The ID of the approval request being answered. Required.' + approve: Required[bool] + 'Whether the request was approved. Required.' + reason: Optional[str] + ItemFieldMcpApprovalResponseResource.__qualname__ = 'ItemFieldMcpApprovalResponseResource' + if _version_info < (3, 13): + ItemFieldMcpApprovalResponseResource.__doc__ = 'MCP approval response.\n\n :ivar type: The type of the item. Always ``mcp_approval_response``. Required.\n MCP_APPROVAL_RESPONSE.\n :vartype type: Literal["mcp_approval_response"]\n :ivar id: The unique ID of the approval response. Required.\n :vartype id: str\n :ivar approval_request_id: The ID of the approval request being answered. Required.\n :vartype approval_request_id: str\n :ivar approve: Whether the request was approved. Required.\n :vartype approve: bool\n :ivar reason:\n :vartype reason: str\n ' + return ItemFieldMcpApprovalResponseResource + + def _make_ItemFieldMcpListTools(): + class ItemFieldMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: Literal["mcp_list_tools"] + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list["MCPListToolsTool"] + :ivar error: + :vartype error: "RealtimeMCPError" + """ + type: Required[Literal['mcp_list_tools']] + 'The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.' + id: Required[str] + 'The unique ID of the list. Required.' + server_label: Required[str] + 'The label of the MCP server. Required.' + tools: Required[list['_types.MCPListToolsTool']] + 'The tools available on the server. Required.' + error: '_types.RealtimeMCPError' + ItemFieldMcpListTools.__qualname__ = 'ItemFieldMcpListTools' + if _version_info < (3, 13): + ItemFieldMcpListTools.__doc__ = 'MCP list tools.\n\n :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.\n :vartype type: Literal["mcp_list_tools"]\n :ivar id: The unique ID of the list. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server. Required.\n :vartype server_label: str\n :ivar tools: The tools available on the server. Required.\n :vartype tools: list["MCPListToolsTool"]\n :ivar error:\n :vartype error: "RealtimeMCPError"\n ' + return ItemFieldMcpListTools + + def _make_ItemFieldMcpToolCall(): + class ItemFieldMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: Literal["mcp_call"] + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: The error from the tool call, if any. + :vartype error: dict[str, Any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + type: Required[Literal['mcp_call']] + 'The type of the item. Always ``mcp_call``. Required. MCP_CALL.' + id: Required[str] + 'The unique ID of the tool call. Required.' + server_label: Required[str] + 'The label of the MCP server running the tool. Required.' + name: Required[str] + 'The name of the tool that was run. Required.' + arguments: Required[str] + 'A JSON string of the arguments passed to the tool. Required.' + output: Optional[str] + error: dict[str, Any] + 'The error from the tool call, if any.' + status: _resolve('MCPToolCallStatus') + 'The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``,\n ``calling``, or ``failed``. Known values are: "in_progress", "completed", "incomplete",\n "calling", and "failed".' + approval_request_id: Optional[str] + ItemFieldMcpToolCall.__qualname__ = 'ItemFieldMcpToolCall' + if _version_info < (3, 13): + ItemFieldMcpToolCall.__doc__ = 'MCP tool call.\n\n :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL.\n :vartype type: Literal["mcp_call"]\n :ivar id: The unique ID of the tool call. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server running the tool. Required.\n :vartype server_label: str\n :ivar name: The name of the tool that was run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments passed to the tool. Required.\n :vartype arguments: str\n :ivar output:\n :vartype output: str\n :ivar error: The error from the tool call, if any.\n :vartype error: dict[str, Any]\n :ivar status: The status of the tool call. One of ``in_progress``, ``completed``,\n ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed",\n "incomplete", "calling", and "failed".\n :vartype status: MCPToolCallStatus\n :ivar approval_request_id:\n :vartype approval_request_id: str\n ' + return ItemFieldMcpToolCall + + def _make_ItemFieldMessage(): + class ItemFieldMessage(TypedDict, total=False): + """Message. + + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: Literal["message"] + :ivar id: The unique ID of the message. Required. + :vartype id: str + :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: MessageStatus + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar content: The content of the message. Required. + :vartype content: list["MessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + """ + type: Required[Literal['message']] + 'The type of the message. Always set to ``message``. Required. MESSAGE.' + id: Required[str] + 'The unique ID of the message. Required.' + status: Required[_resolve('MessageStatus')] + 'The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when\n items are returned via API. Required. Known values are: "in_progress", "completed", and\n "incomplete".' + role: Required[_resolve('MessageRole')] + 'The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``,\n ``discriminator``, ``developer``, or ``tool``. Required. Known values are: "unknown",\n "user", "assistant", "system", "critic", "discriminator", "developer", and\n "tool".' + content: Required[list['_types.MessageContent']] + 'The content of the message. Required.' + phase: Optional[_resolve('MessagePhase')] + 'Known values are: "commentary" and "final_answer".' + ItemFieldMessage.__qualname__ = 'ItemFieldMessage' + if _version_info < (3, 13): + ItemFieldMessage.__doc__ = 'Message.\n\n :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE.\n :vartype type: Literal["message"]\n :ivar id: The unique ID of the message. Required.\n :vartype id: str\n :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Known values are: "in_progress",\n "completed", and "incomplete".\n :vartype status: MessageStatus\n :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``,\n ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are:\n "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool".\n :vartype role: MessageRole\n :ivar content: The content of the message. Required.\n :vartype content: list["MessageContent"]\n :ivar phase: Known values are: "commentary" and "final_answer".\n :vartype phase: MessagePhase\n ' + return ItemFieldMessage + + def _make_ItemFieldProgram(): + class ItemFieldProgram(TypedDict, total=False): + """ItemFieldProgram. + + :ivar type: The type of the item. Always ``program``. Required. PROGRAM. + :vartype type: Literal["program"] + :ivar id: The unique ID of the program item. Required. + :vartype id: str + :ivar call_id: The stable call ID of the program item. Required. + :vartype call_id: str + :ivar code: The JavaScript source executed by programmatic tool calling. Required. + :vartype code: str + :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. + :vartype fingerprint: str + """ + type: Required[Literal['program']] + 'The type of the item. Always ``program``. Required. PROGRAM.' + id: Required[str] + 'The unique ID of the program item. Required.' + call_id: Required[str] + 'The stable call ID of the program item. Required.' + code: Required[str] + 'The JavaScript source executed by programmatic tool calling. Required.' + fingerprint: Required[str] + 'Opaque program replay fingerprint that must be round-tripped. Required.' + ItemFieldProgram.__qualname__ = 'ItemFieldProgram' + if _version_info < (3, 13): + ItemFieldProgram.__doc__ = 'ItemFieldProgram.\n\n :ivar type: The type of the item. Always ``program``. Required. PROGRAM.\n :vartype type: Literal["program"]\n :ivar id: The unique ID of the program item. Required.\n :vartype id: str\n :ivar call_id: The stable call ID of the program item. Required.\n :vartype call_id: str\n :ivar code: The JavaScript source executed by programmatic tool calling. Required.\n :vartype code: str\n :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required.\n :vartype fingerprint: str\n ' + return ItemFieldProgram + + def _make_ItemFieldProgramOutput(): + class ItemFieldProgramOutput(TypedDict, total=False): + """ItemFieldProgramOutput. + + :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT. + :vartype type: Literal["program_output"] + :ivar id: The unique ID of the program output item. Required. + :vartype id: str + :ivar call_id: The call ID of the program item. Required. + :vartype call_id: str + :ivar result: The result produced by the program item. Required. + :vartype result: str + :ivar status: The terminal status of the program output item. Required. Known values are: + "completed" and "incomplete". + :vartype status: ProgramOutputStatus + """ + type: Required[Literal['program_output']] + 'The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.' + id: Required[str] + 'The unique ID of the program output item. Required.' + call_id: Required[str] + 'The call ID of the program item. Required.' + result: Required[str] + 'The result produced by the program item. Required.' + status: Required[_resolve('ProgramOutputStatus')] + 'The terminal status of the program output item. Required. Known values are: "completed" and\n "incomplete".' + ItemFieldProgramOutput.__qualname__ = 'ItemFieldProgramOutput' + if _version_info < (3, 13): + ItemFieldProgramOutput.__doc__ = 'ItemFieldProgramOutput.\n\n :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.\n :vartype type: Literal["program_output"]\n :ivar id: The unique ID of the program output item. Required.\n :vartype id: str\n :ivar call_id: The call ID of the program item. Required.\n :vartype call_id: str\n :ivar result: The result produced by the program item. Required.\n :vartype result: str\n :ivar status: The terminal status of the program output item. Required. Known values are:\n "completed" and "incomplete".\n :vartype status: ProgramOutputStatus\n ' + return ItemFieldProgramOutput + + def _make_ItemFieldReasoningItem(): + class ItemFieldReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: Literal["reasoning"] + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list["SummaryTextContent"] + :ivar content: Reasoning text content. + :vartype content: list["ReasoningTextContent"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['reasoning']] + 'The type of the object. Always ``reasoning``. Required. REASONING.' + id: Required[str] + 'The unique identifier of the reasoning content. Required.' + encrypted_content: Optional[str] + summary: Required[list['_types.SummaryTextContent']] + 'Reasoning summary content. Required.' + content: list['_types.ReasoningTextContent'] + 'Reasoning text content.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + ItemFieldReasoningItem.__qualname__ = 'ItemFieldReasoningItem' + if _version_info < (3, 13): + ItemFieldReasoningItem.__doc__ = 'Reasoning.\n\n :ivar type: The type of the object. Always ``reasoning``. Required. REASONING.\n :vartype type: Literal["reasoning"]\n :ivar id: The unique identifier of the reasoning content. Required.\n :vartype id: str\n :ivar encrypted_content:\n :vartype encrypted_content: str\n :ivar summary: Reasoning summary content. Required.\n :vartype summary: list["SummaryTextContent"]\n :ivar content: Reasoning text content.\n :vartype content: list["ReasoningTextContent"]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFieldReasoningItem + + def _make_ItemFieldToolSearchCall(): + class ItemFieldToolSearchCall(TypedDict, total=False): + """ItemFieldToolSearchCall. + + :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. + :vartype type: Literal["tool_search_call"] + :ivar id: The unique ID of the tool search call item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar arguments: Arguments used for the tool search call. Required. + :vartype arguments: Any + :ivar status: The status of the tool search call item that was recorded. Required. Known values + are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallStatus + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + type: Required[Literal['tool_search_call']] + 'The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.' + id: Required[str] + 'The unique ID of the tool search call item. Required.' + call_id: Required[Optional[str]] + 'Required.' + execution: Required[_resolve('ToolSearchExecutionType')] + 'Whether tool search was executed by the server or by the client. Required. Known values are:\n "server" and "client".' + arguments: Required[Any] + 'Arguments used for the tool search call. Required.' + status: Required[_resolve('FunctionCallStatus')] + 'The status of the tool search call item that was recorded. Required. Known values are:\n "in_progress", "completed", and "incomplete".' + created_by: str + 'The identifier of the actor that created the item.' + ItemFieldToolSearchCall.__qualname__ = 'ItemFieldToolSearchCall' + if _version_info < (3, 13): + ItemFieldToolSearchCall.__doc__ = 'ItemFieldToolSearchCall.\n\n :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.\n :vartype type: Literal["tool_search_call"]\n :ivar id: The unique ID of the tool search call item. Required.\n :vartype id: str\n :ivar call_id: Required.\n :vartype call_id: str\n :ivar execution: Whether tool search was executed by the server or by the client. Required.\n Known values are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar arguments: Arguments used for the tool search call. Required.\n :vartype arguments: Any\n :ivar status: The status of the tool search call item that was recorded. Required. Known values\n are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallStatus\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return ItemFieldToolSearchCall + + def _make_ItemFieldToolSearchOutput(): + class ItemFieldToolSearchOutput(TypedDict, total=False): + """ItemFieldToolSearchOutput. + + :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. + :vartype type: Literal["tool_search_output"] + :ivar id: The unique ID of the tool search output item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar tools: The loaded tool definitions returned by tool search. Required. + :vartype tools: list["Tool"] + :ivar status: The status of the tool search output item that was recorded. Required. Known + values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallOutputStatusEnum + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + type: Required[Literal['tool_search_output']] + 'The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.' + id: Required[str] + 'The unique ID of the tool search output item. Required.' + call_id: Required[Optional[str]] + 'Required.' + execution: Required[_resolve('ToolSearchExecutionType')] + 'Whether tool search was executed by the server or by the client. Required. Known values are:\n "server" and "client".' + tools: Required[list['_types.Tool']] + 'The loaded tool definitions returned by tool search. Required.' + status: Required[_resolve('FunctionCallOutputStatusEnum')] + 'The status of the tool search output item that was recorded. Required. Known values are:\n "in_progress", "completed", and "incomplete".' + created_by: str + 'The identifier of the actor that created the item.' + ItemFieldToolSearchOutput.__qualname__ = 'ItemFieldToolSearchOutput' + if _version_info < (3, 13): + ItemFieldToolSearchOutput.__doc__ = 'ItemFieldToolSearchOutput.\n\n :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.\n :vartype type: Literal["tool_search_output"]\n :ivar id: The unique ID of the tool search output item. Required.\n :vartype id: str\n :ivar call_id: Required.\n :vartype call_id: str\n :ivar execution: Whether tool search was executed by the server or by the client. Required.\n Known values are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar tools: The loaded tool definitions returned by tool search. Required.\n :vartype tools: list["Tool"]\n :ivar status: The status of the tool search output item that was recorded. Required. Known\n values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallOutputStatusEnum\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return ItemFieldToolSearchOutput + + def _make_ItemFieldWebSearchToolCall(): + class ItemFieldWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: Literal["web_search_call"] + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", + "WebSearchActionFind"] + """ + id: Required[str] + 'The unique ID of the web search tool call. Required.' + type: Required[Literal['web_search_call']] + 'The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.' + status: Required[Literal['in_progress', 'searching', 'completed', 'failed', 'incomplete']] + 'The status of the web search tool call. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"],\n Literal["incomplete"]' + action: Required[Union['_types.WebSearchActionSearch', '_types.WebSearchActionOpenPage', '_types.WebSearchActionFind']] + 'An object describing the specific action taken in this web search call. Includes details on how\n the model used the web (search, open_page, find_in_page). Required. Is one of the following\n types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind' + ItemFieldWebSearchToolCall.__qualname__ = 'ItemFieldWebSearchToolCall' + if _version_info < (3, 13): + ItemFieldWebSearchToolCall.__doc__ = 'Web search tool call.\n\n :ivar id: The unique ID of the web search tool call. Required.\n :vartype id: str\n :ivar type: The type of the web search tool call. Always ``web_search_call``. Required.\n WEB_SEARCH_CALL.\n :vartype type: Literal["web_search_call"]\n :ivar status: The status of the web search tool call. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"],\n Literal["incomplete"]\n :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"]\n :ivar action: An object describing the specific action taken in this web search call. Includes\n details on how the model used the web (search, open_page, find_in_page). Required. Is one of\n the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind\n :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage",\n "WebSearchActionFind"]\n ' + return ItemFieldWebSearchToolCall + + def _make_ItemFileSearchToolCall(): + class ItemFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + Default value is "file_search_call". + :vartype type: Literal["file_search_call"] + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list["FileSearchToolCallResults"] + """ + id: Required[str] + 'The unique ID of the file search tool call. Required.' + type: Required[Literal['file_search_call']] + 'The type of the file search tool call. Always ``file_search_call``. Required. Default value is\n "file_search_call".' + status: Required[Literal['in_progress', 'searching', 'completed', 'incomplete', 'failed']] + 'The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete``\n or ``failed``,. Required. Is one of the following types: Literal["in_progress"],\n Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"]' + queries: Required[list[str]] + 'The queries used to search for files. Required.' + results: Optional[list['_types.FileSearchToolCallResults']] + ItemFileSearchToolCall.__qualname__ = 'ItemFileSearchToolCall' + if _version_info < (3, 13): + ItemFileSearchToolCall.__doc__ = 'File search tool call.\n\n :ivar id: The unique ID of the file search tool call. Required.\n :vartype id: str\n :ivar type: The type of the file search tool call. Always ``file_search_call``. Required.\n Default value is "file_search_call".\n :vartype type: Literal["file_search_call"]\n :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``,\n ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"],\n Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"]\n :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"]\n :ivar queries: The queries used to search for files. Required.\n :vartype queries: list[str]\n :ivar results:\n :vartype results: list["FileSearchToolCallResults"]\n ' + return ItemFileSearchToolCall + + def _make_ItemFunctionToolCall(): + class ItemFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar type: The type of the function tool call. Always ``function_call``. Required. Default + value is "function_call". + :vartype type: Literal["function_call"] + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the function to run. + :vartype namespace: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['function_call']] + 'The type of the function tool call. Always ``function_call``. Required. Default value is\n "function_call".' + call_id: Required[str] + 'The unique ID of the function tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + namespace: str + 'The namespace of the function to run.' + name: Required[str] + 'The name of the function to run. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the function. Required.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + ItemFunctionToolCall.__qualname__ = 'ItemFunctionToolCall' + if _version_info < (3, 13): + ItemFunctionToolCall.__doc__ = 'Function tool call.\n\n :ivar type: The type of the function tool call. Always ``function_call``. Required. Default\n value is "function_call".\n :vartype type: Literal["function_call"]\n :ivar call_id: The unique ID of the function tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar namespace: The namespace of the function to run.\n :vartype namespace: str\n :ivar name: The name of the function to run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments to pass to the function. Required.\n :vartype arguments: str\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemFunctionToolCall + + def _make_ItemImageGenToolCall(): + class ItemImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + Default value is "image_generation_call". + :vartype type: Literal["image_generation_call"] + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "generating", "failed"] + :ivar result: Required. + :vartype result: str + """ + type: Required[Literal['image_generation_call']] + 'The type of the image generation call. Always ``image_generation_call``. Required. Default\n value is "image_generation_call".' + id: Required[str] + 'The unique ID of the image generation call. Required.' + status: Required[Literal['in_progress', 'completed', 'generating', 'failed']] + 'The status of the image generation call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"]' + result: Required[Optional[str]] + 'Required.' + ItemImageGenToolCall.__qualname__ = 'ItemImageGenToolCall' + if _version_info < (3, 13): + ItemImageGenToolCall.__doc__ = 'Image generation call.\n\n :ivar type: The type of the image generation call. Always ``image_generation_call``. Required.\n Default value is "image_generation_call".\n :vartype type: Literal["image_generation_call"]\n :ivar id: The unique ID of the image generation call. Required.\n :vartype id: str\n :ivar status: The status of the image generation call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"]\n :vartype status: Literal["in_progress", "completed", "generating", "failed"]\n :ivar result: Required.\n :vartype result: str\n ' + return ItemImageGenToolCall + + def _make_ItemLocalShellToolCall(): + class ItemLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. Default + value is "local_shell_call". + :vartype type: Literal["local_shell_call"] + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: "LocalShellExecAction" + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['local_shell_call']] + 'The type of the local shell call. Always ``local_shell_call``. Required. Default value is\n "local_shell_call".' + id: Required[str] + 'The unique ID of the local shell call. Required.' + call_id: Required[str] + 'The unique ID of the local shell tool call generated by the model. Required.' + action: Required['_types.LocalShellExecAction'] + 'Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the local shell call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + ItemLocalShellToolCall.__qualname__ = 'ItemLocalShellToolCall' + if _version_info < (3, 13): + ItemLocalShellToolCall.__doc__ = 'Local shell call.\n\n :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. Default\n value is "local_shell_call".\n :vartype type: Literal["local_shell_call"]\n :ivar id: The unique ID of the local shell call. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the local shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar action: Required.\n :vartype action: "LocalShellExecAction"\n :ivar status: The status of the local shell call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemLocalShellToolCall + + def _make_ItemLocalShellToolCallOutput(): + class ItemLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. Default value is "local_shell_call_output". + :vartype type: Literal["local_shell_call_output"] + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['local_shell_call_output']] + 'The type of the local shell tool call output. Always ``local_shell_call_output``. Required.\n Default value is "local_shell_call_output".' + id: Required[str] + 'The unique ID of the local shell tool call generated by the model. Required.' + output: Required[str] + 'A JSON string of the output of the local shell tool call. Required.' + status: Optional[Literal['in_progress', 'completed', 'incomplete']] + 'Is one of the following types: Literal["in_progress"], Literal["completed"],\n Literal["incomplete"]' + ItemLocalShellToolCallOutput.__qualname__ = 'ItemLocalShellToolCallOutput' + if _version_info < (3, 13): + ItemLocalShellToolCallOutput.__doc__ = 'Local shell call output.\n\n :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``.\n Required. Default value is "local_shell_call_output".\n :vartype type: Literal["local_shell_call_output"]\n :ivar id: The unique ID of the local shell tool call generated by the model. Required.\n :vartype id: str\n :ivar output: A JSON string of the output of the local shell tool call. Required.\n :vartype output: str\n :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"],\n Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemLocalShellToolCallOutput + + def _make_ItemMcpApprovalRequest(): + class ItemMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. Default value is + "mcp_approval_request". + :vartype type: Literal["mcp_approval_request"] + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + type: Required[Literal['mcp_approval_request']] + 'The type of the item. Always ``mcp_approval_request``. Required. Default value is\n "mcp_approval_request".' + id: Required[str] + 'The unique ID of the approval request. Required.' + server_label: Required[str] + 'The label of the MCP server making the request. Required.' + name: Required[str] + 'The name of the tool to run. Required.' + arguments: Required[str] + 'A JSON string of arguments for the tool. Required.' + ItemMcpApprovalRequest.__qualname__ = 'ItemMcpApprovalRequest' + if _version_info < (3, 13): + ItemMcpApprovalRequest.__doc__ = 'MCP approval request.\n\n :ivar type: The type of the item. Always ``mcp_approval_request``. Required. Default value is\n "mcp_approval_request".\n :vartype type: Literal["mcp_approval_request"]\n :ivar id: The unique ID of the approval request. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server making the request. Required.\n :vartype server_label: str\n :ivar name: The name of the tool to run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of arguments for the tool. Required.\n :vartype arguments: str\n ' + return ItemMcpApprovalRequest + + def _make_ItemMcpListTools(): + class ItemMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. Default value is + "mcp_list_tools". + :vartype type: Literal["mcp_list_tools"] + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list["MCPListToolsTool"] + :ivar error: + :vartype error: "RealtimeMCPError" + """ + type: Required[Literal['mcp_list_tools']] + 'The type of the item. Always ``mcp_list_tools``. Required. Default value is "mcp_list_tools".' + id: Required[str] + 'The unique ID of the list. Required.' + server_label: Required[str] + 'The label of the MCP server. Required.' + tools: Required[list['_types.MCPListToolsTool']] + 'The tools available on the server. Required.' + error: '_types.RealtimeMCPError' + ItemMcpListTools.__qualname__ = 'ItemMcpListTools' + if _version_info < (3, 13): + ItemMcpListTools.__doc__ = 'MCP list tools.\n\n :ivar type: The type of the item. Always ``mcp_list_tools``. Required. Default value is\n "mcp_list_tools".\n :vartype type: Literal["mcp_list_tools"]\n :ivar id: The unique ID of the list. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server. Required.\n :vartype server_label: str\n :ivar tools: The tools available on the server. Required.\n :vartype tools: list["MCPListToolsTool"]\n :ivar error:\n :vartype error: "RealtimeMCPError"\n ' + return ItemMcpListTools + + def _make_ItemMcpToolCall(): + class ItemMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar type: The type of the item. Always ``mcp_call``. Required. Default value is "mcp_call". + :vartype type: Literal["mcp_call"] + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: The error from the tool call, if any. + :vartype error: dict[str, Any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + type: Required[Literal['mcp_call']] + 'The type of the item. Always ``mcp_call``. Required. Default value is "mcp_call".' + id: Required[str] + 'The unique ID of the tool call. Required.' + server_label: Required[str] + 'The label of the MCP server running the tool. Required.' + name: Required[str] + 'The name of the tool that was run. Required.' + arguments: Required[str] + 'A JSON string of the arguments passed to the tool. Required.' + output: Optional[str] + error: dict[str, Any] + 'The error from the tool call, if any.' + status: _resolve('MCPToolCallStatus') + 'The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``,\n ``calling``, or ``failed``. Known values are: "in_progress", "completed", "incomplete",\n "calling", and "failed".' + approval_request_id: Optional[str] + ItemMcpToolCall.__qualname__ = 'ItemMcpToolCall' + if _version_info < (3, 13): + ItemMcpToolCall.__doc__ = 'MCP tool call.\n\n :ivar type: The type of the item. Always ``mcp_call``. Required. Default value is "mcp_call".\n :vartype type: Literal["mcp_call"]\n :ivar id: The unique ID of the tool call. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server running the tool. Required.\n :vartype server_label: str\n :ivar name: The name of the tool that was run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments passed to the tool. Required.\n :vartype arguments: str\n :ivar output:\n :vartype output: str\n :ivar error: The error from the tool call, if any.\n :vartype error: dict[str, Any]\n :ivar status: The status of the tool call. One of ``in_progress``, ``completed``,\n ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed",\n "incomplete", "calling", and "failed".\n :vartype status: MCPToolCallStatus\n :ivar approval_request_id:\n :vartype approval_request_id: str\n ' + return ItemMcpToolCall + + def _make_ItemMessage(): + class ItemMessage(TypedDict, total=False): + """Message. + + :ivar type: The type of the message. Always set to ``message``. Required. Default value is + "message". + :vartype type: Literal["message"] + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + :ivar content: Required. Is either a str type or a [MessageContent] type. + :vartype content: Union[str, list["MessageContent"]] + """ + type: Required[Literal['message']] + 'The type of the message. Always set to ``message``. Required. Default value is "message".' + role: Required[_resolve('MessageRole')] + 'The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``,\n ``discriminator``, ``developer``, or ``tool``. Required. Known values are: "unknown",\n "user", "assistant", "system", "critic", "discriminator", "developer", and\n "tool".' + phase: Optional[_resolve('MessagePhase')] + 'Known values are: "commentary" and "final_answer".' + content: Required[Union[str, list['_types.MessageContent']]] + 'Required. Is either a str type or a [MessageContent] type.' + ItemMessage.__qualname__ = 'ItemMessage' + if _version_info < (3, 13): + ItemMessage.__doc__ = 'Message.\n\n :ivar type: The type of the message. Always set to ``message``. Required. Default value is\n "message".\n :vartype type: Literal["message"]\n :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``,\n ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are:\n "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool".\n :vartype role: MessageRole\n :ivar phase: Known values are: "commentary" and "final_answer".\n :vartype phase: MessagePhase\n :ivar content: Required. Is either a str type or a [MessageContent] type.\n :vartype content: Union[str, list["MessageContent"]]\n ' + return ItemMessage + + def _make_ItemOutputMessage(): + class ItemOutputMessage(TypedDict, total=False): + """Output message. + + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. Default value is + "output_message". + :vartype type: Literal["output_message"] + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: Literal["assistant"] + :ivar content: The content of the output message. Required. + :vartype content: list["OutputMessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + id: Required[str] + 'The unique ID of the output message. Required.' + type: Required[Literal['output_message']] + 'The type of the output message. Always ``message``. Required. Default value is\n "output_message".' + role: Required[Literal['assistant']] + 'The role of the output message. Always ``assistant``. Required. Default value is "assistant".' + content: Required[list['_types.OutputMessageContent']] + 'The content of the output message. Required.' + phase: Optional[_resolve('MessagePhase')] + 'Known values are: "commentary" and "final_answer".' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when input items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + ItemOutputMessage.__qualname__ = 'ItemOutputMessage' + if _version_info < (3, 13): + ItemOutputMessage.__doc__ = 'Output message.\n\n :ivar id: The unique ID of the output message. Required.\n :vartype id: str\n :ivar type: The type of the output message. Always ``message``. Required. Default value is\n "output_message".\n :vartype type: Literal["output_message"]\n :ivar role: The role of the output message. Always ``assistant``. Required. Default value is\n "assistant".\n :vartype role: Literal["assistant"]\n :ivar content: The content of the output message. Required.\n :vartype content: list["OutputMessageContent"]\n :ivar phase: Known values are: "commentary" and "final_answer".\n :vartype phase: MessagePhase\n :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or\n ``incomplete``. Populated when input items are returned via API. Required. Is one of the\n following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemOutputMessage + + def _make_ItemProgram(): + class ItemProgram(TypedDict, total=False): + """ItemProgram. + + :ivar type: The type of the item. Always ``program``. Required. Default value is "program". + :vartype type: Literal["program"] + :ivar id: The unique ID of the program item. Required. + :vartype id: str + :ivar call_id: The stable call ID of the program item. Required. + :vartype call_id: str + :ivar code: The JavaScript source executed by programmatic tool calling. Required. + :vartype code: str + :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. + :vartype fingerprint: str + """ + type: Required[Literal['program']] + 'The type of the item. Always ``program``. Required. Default value is "program".' + id: Required[str] + 'The unique ID of the program item. Required.' + call_id: Required[str] + 'The stable call ID of the program item. Required.' + code: Required[str] + 'The JavaScript source executed by programmatic tool calling. Required.' + fingerprint: Required[str] + 'Opaque program replay fingerprint that must be round-tripped. Required.' + ItemProgram.__qualname__ = 'ItemProgram' + if _version_info < (3, 13): + ItemProgram.__doc__ = 'ItemProgram.\n\n :ivar type: The type of the item. Always ``program``. Required. Default value is "program".\n :vartype type: Literal["program"]\n :ivar id: The unique ID of the program item. Required.\n :vartype id: str\n :ivar call_id: The stable call ID of the program item. Required.\n :vartype call_id: str\n :ivar code: The JavaScript source executed by programmatic tool calling. Required.\n :vartype code: str\n :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required.\n :vartype fingerprint: str\n ' + return ItemProgram + + def _make_ItemProgramOutput(): + class ItemProgramOutput(TypedDict, total=False): + """ItemProgramOutput. + + :ivar type: The type of the item. Always ``program_output``. Required. Default value is + "program_output". + :vartype type: Literal["program_output"] + :ivar id: The unique ID of the program output item. Required. + :vartype id: str + :ivar call_id: The call ID of the program item. Required. + :vartype call_id: str + :ivar result: The result produced by the program item. Required. + :vartype result: str + :ivar status: The terminal status of the program output item. Required. Known values are: + "completed" and "incomplete". + :vartype status: ProgramOutputStatus + """ + type: Required[Literal['program_output']] + 'The type of the item. Always ``program_output``. Required. Default value is "program_output".' + id: Required[str] + 'The unique ID of the program output item. Required.' + call_id: Required[str] + 'The call ID of the program item. Required.' + result: Required[str] + 'The result produced by the program item. Required.' + status: Required[_resolve('ProgramOutputStatus')] + 'The terminal status of the program output item. Required. Known values are: "completed" and\n "incomplete".' + ItemProgramOutput.__qualname__ = 'ItemProgramOutput' + if _version_info < (3, 13): + ItemProgramOutput.__doc__ = 'ItemProgramOutput.\n\n :ivar type: The type of the item. Always ``program_output``. Required. Default value is\n "program_output".\n :vartype type: Literal["program_output"]\n :ivar id: The unique ID of the program output item. Required.\n :vartype id: str\n :ivar call_id: The call ID of the program item. Required.\n :vartype call_id: str\n :ivar result: The result produced by the program item. Required.\n :vartype result: str\n :ivar status: The terminal status of the program output item. Required. Known values are:\n "completed" and "incomplete".\n :vartype status: ProgramOutputStatus\n ' + return ItemProgramOutput + + def _make_ItemReasoningItem(): + class ItemReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar type: The type of the object. Always ``reasoning``. Required. Default value is + "reasoning". + :vartype type: Literal["reasoning"] + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list["SummaryTextContent"] + :ivar content: Reasoning text content. + :vartype content: list["ReasoningTextContent"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + type: Required[Literal['reasoning']] + 'The type of the object. Always ``reasoning``. Required. Default value is "reasoning".' + id: Required[str] + 'The unique identifier of the reasoning content. Required.' + encrypted_content: Optional[str] + summary: Required[list['_types.SummaryTextContent']] + 'Reasoning summary content. Required.' + content: list['_types.ReasoningTextContent'] + 'Reasoning text content.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + ItemReasoningItem.__qualname__ = 'ItemReasoningItem' + if _version_info < (3, 13): + ItemReasoningItem.__doc__ = 'Reasoning.\n\n :ivar type: The type of the object. Always ``reasoning``. Required. Default value is\n "reasoning".\n :vartype type: Literal["reasoning"]\n :ivar id: The unique identifier of the reasoning content. Required.\n :vartype id: str\n :ivar encrypted_content:\n :vartype encrypted_content: str\n :ivar summary: Reasoning summary content. Required.\n :vartype summary: list["SummaryTextContent"]\n :ivar content: Reasoning text content.\n :vartype content: list["ReasoningTextContent"]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return ItemReasoningItem + + def _make_ItemReferenceParam(): + class ItemReferenceParam(TypedDict, total=False): + """Item reference. + + :ivar type: The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE. + :vartype type: Literal["item_reference"] + :ivar id: The ID of the item to reference. Required. + :vartype id: str + """ + type: Required[Literal['item_reference']] + 'The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE.' + id: Required[str] + 'The ID of the item to reference. Required.' + ItemReferenceParam.__qualname__ = 'ItemReferenceParam' + if _version_info < (3, 13): + ItemReferenceParam.__doc__ = 'Item reference.\n\n :ivar type: The type of item to reference. Always ``item_reference``. Required. ITEM_REFERENCE.\n :vartype type: Literal["item_reference"]\n :ivar id: The ID of the item to reference. Required.\n :vartype id: str\n ' + return ItemReferenceParam + + def _make_ItemWebSearchToolCall(): + class ItemWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. Default + value is "web_search_call". + :vartype type: Literal["web_search_call"] + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", + "WebSearchActionFind"] + """ + id: Required[str] + 'The unique ID of the web search tool call. Required.' + type: Required[Literal['web_search_call']] + 'The type of the web search tool call. Always ``web_search_call``. Required. Default value is\n "web_search_call".' + status: Required[Literal['in_progress', 'searching', 'completed', 'failed', 'incomplete']] + 'The status of the web search tool call. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"],\n Literal["incomplete"]' + action: Required[Union['_types.WebSearchActionSearch', '_types.WebSearchActionOpenPage', '_types.WebSearchActionFind']] + 'An object describing the specific action taken in this web search call. Includes details on how\n the model used the web (search, open_page, find_in_page). Required. Is one of the following\n types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind' + ItemWebSearchToolCall.__qualname__ = 'ItemWebSearchToolCall' + if _version_info < (3, 13): + ItemWebSearchToolCall.__doc__ = 'Web search tool call.\n\n :ivar id: The unique ID of the web search tool call. Required.\n :vartype id: str\n :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. Default\n value is "web_search_call".\n :vartype type: Literal["web_search_call"]\n :ivar status: The status of the web search tool call. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"],\n Literal["incomplete"]\n :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"]\n :ivar action: An object describing the specific action taken in this web search call. Includes\n details on how the model used the web (search, open_page, find_in_page). Required. Is one of\n the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind\n :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage",\n "WebSearchActionFind"]\n ' + return ItemWebSearchToolCall + + def _make_KeyPressAction(): + class KeyPressAction(TypedDict, total=False): + """KeyPress. + + :ivar type: Specifies the event type. For a keypress action, this property is always set to + ``keypress``. Required. KEYPRESS. + :vartype type: Literal["keypress"] + :ivar keys: The combination of keys the model is requesting to be pressed. This is an array of + strings, each representing a key. Required. + :vartype keys: list[str] + """ + type: Required[Literal['keypress']] + 'Specifies the event type. For a keypress action, this property is always set to ``keypress``.\n Required. KEYPRESS.' + keys: Required[list[str]] + 'The combination of keys the model is requesting to be pressed. This is an array of strings,\n each representing a key. Required.' + KeyPressAction.__qualname__ = 'KeyPressAction' + if _version_info < (3, 13): + KeyPressAction.__doc__ = 'KeyPress.\n\n :ivar type: Specifies the event type. For a keypress action, this property is always set to\n ``keypress``. Required. KEYPRESS.\n :vartype type: Literal["keypress"]\n :ivar keys: The combination of keys the model is requesting to be pressed. This is an array of\n strings, each representing a key. Required.\n :vartype keys: list[str]\n ' + return KeyPressAction + + def _make_LocalEnvironmentResource(): + class LocalEnvironmentResource(TypedDict, total=False): + """Local Environment. + + :ivar type: The environment type. Always ``local``. Required. LOCAL. + :vartype type: Literal["local"] + """ + type: Required[Literal['local']] + 'The environment type. Always ``local``. Required. LOCAL.' + LocalEnvironmentResource.__qualname__ = 'LocalEnvironmentResource' + if _version_info < (3, 13): + LocalEnvironmentResource.__doc__ = 'Local Environment.\n\n :ivar type: The environment type. Always ``local``. Required. LOCAL.\n :vartype type: Literal["local"]\n ' + return LocalEnvironmentResource + + def _make_LocalShellExecAction(): + class LocalShellExecAction(TypedDict, total=False): + """Local shell exec action. + + :ivar type: The type of the local shell action. Always ``exec``. Required. Default value is + "exec". + :vartype type: Literal["exec"] + :ivar command: The command to run. Required. + :vartype command: list[str] + :ivar timeout_ms: + :vartype timeout_ms: int + :ivar working_directory: + :vartype working_directory: str + :ivar env: Environment variables to set for the command. Required. + :vartype env: dict[str, str] + :ivar user: + :vartype user: str + """ + type: Required[Literal['exec']] + 'The type of the local shell action. Always ``exec``. Required. Default value is "exec".' + command: Required[list[str]] + 'The command to run. Required.' + timeout_ms: Optional[int] + working_directory: Optional[str] + env: Required[dict[str, str]] + 'Environment variables to set for the command. Required.' + user: Optional[str] + LocalShellExecAction.__qualname__ = 'LocalShellExecAction' + if _version_info < (3, 13): + LocalShellExecAction.__doc__ = 'Local shell exec action.\n\n :ivar type: The type of the local shell action. Always ``exec``. Required. Default value is\n "exec".\n :vartype type: Literal["exec"]\n :ivar command: The command to run. Required.\n :vartype command: list[str]\n :ivar timeout_ms:\n :vartype timeout_ms: int\n :ivar working_directory:\n :vartype working_directory: str\n :ivar env: Environment variables to set for the command. Required.\n :vartype env: dict[str, str]\n :ivar user:\n :vartype user: str\n ' + return LocalShellExecAction + + def _make_LocalShellToolParam(): + class LocalShellToolParam(TypedDict, total=False): + """Local shell tool. + + :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL. + :vartype type: Literal["local_shell"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + """ + type: Required[Literal['local_shell']] + 'The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + LocalShellToolParam.__qualname__ = 'LocalShellToolParam' + if _version_info < (3, 13): + LocalShellToolParam.__doc__ = 'Local shell tool.\n\n :ivar type: The type of the local shell tool. Always ``local_shell``. Required. LOCAL_SHELL.\n :vartype type: Literal["local_shell"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n ' + return LocalShellToolParam + + def _make_LocalSkillParam(): + class LocalSkillParam(TypedDict, total=False): + """LocalSkillParam. + + :ivar name: The name of the skill. Required. + :vartype name: str + :ivar description: The description of the skill. Required. + :vartype description: str + :ivar path: The path to the directory containing the skill. Required. + :vartype path: str + """ + name: Required[str] + 'The name of the skill. Required.' + description: Required[str] + 'The description of the skill. Required.' + path: Required[str] + 'The path to the directory containing the skill. Required.' + LocalSkillParam.__qualname__ = 'LocalSkillParam' + if _version_info < (3, 13): + LocalSkillParam.__doc__ = 'LocalSkillParam.\n\n :ivar name: The name of the skill. Required.\n :vartype name: str\n :ivar description: The description of the skill. Required.\n :vartype description: str\n :ivar path: The path to the directory containing the skill. Required.\n :vartype path: str\n ' + return LocalSkillParam + + def _make_LogProb(): + class LogProb(TypedDict, total=False): + """Log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: float + :ivar bytes: Required. + :vartype bytes: list[int] + :ivar top_logprobs: Required. + :vartype top_logprobs: list["TopLogProb"] + """ + token: Required[str] + 'Required.' + logprob: Required[float] + 'Required.' + bytes: Required[list[int]] + 'Required.' + top_logprobs: Required[list['_types.TopLogProb']] + 'Required.' + LogProb.__qualname__ = 'LogProb' + if _version_info < (3, 13): + LogProb.__doc__ = 'Log probability.\n\n :ivar token: Required.\n :vartype token: str\n :ivar logprob: Required.\n :vartype logprob: float\n :ivar bytes: Required.\n :vartype bytes: list[int]\n :ivar top_logprobs: Required.\n :vartype top_logprobs: list["TopLogProb"]\n ' + return LogProb + + def _make_MCPApprovalResponse(): + class MCPApprovalResponse(TypedDict, total=False): + """MCP approval response. + + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: Literal["mcp_approval_response"] + :ivar id: + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + type: Required[Literal['mcp_approval_response']] + 'The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.' + id: Optional[str] + approval_request_id: Required[str] + 'The ID of the approval request being answered. Required.' + approve: Required[bool] + 'Whether the request was approved. Required.' + reason: Optional[str] + MCPApprovalResponse.__qualname__ = 'MCPApprovalResponse' + if _version_info < (3, 13): + MCPApprovalResponse.__doc__ = 'MCP approval response.\n\n :ivar type: The type of the item. Always ``mcp_approval_response``. Required.\n MCP_APPROVAL_RESPONSE.\n :vartype type: Literal["mcp_approval_response"]\n :ivar id:\n :vartype id: str\n :ivar approval_request_id: The ID of the approval request being answered. Required.\n :vartype approval_request_id: str\n :ivar approve: Whether the request was approved. Required.\n :vartype approve: bool\n :ivar reason:\n :vartype reason: str\n ' + return MCPApprovalResponse + + def _make_MCPListToolsTool(): + class MCPListToolsTool(TypedDict, total=False): + """MCP list tools tool. + + :ivar name: The name of the tool. Required. + :vartype name: str + :ivar description: + :vartype description: str + :ivar input_schema: The JSON schema describing the tool's input. Required. + :vartype input_schema: "MCPListToolsToolInputSchema" + :ivar annotations: + :vartype annotations: "MCPListToolsToolAnnotations" + """ + name: Required[str] + 'The name of the tool. Required.' + description: Optional[str] + input_schema: Required['_types.MCPListToolsToolInputSchema'] + "The JSON schema describing the tool's input. Required." + annotations: Optional['_types.MCPListToolsToolAnnotations'] + MCPListToolsTool.__qualname__ = 'MCPListToolsTool' + if _version_info < (3, 13): + MCPListToolsTool.__doc__ = 'MCP list tools tool.\n\n :ivar name: The name of the tool. Required.\n :vartype name: str\n :ivar description:\n :vartype description: str\n :ivar input_schema: The JSON schema describing the tool\'s input. Required.\n :vartype input_schema: "MCPListToolsToolInputSchema"\n :ivar annotations:\n :vartype annotations: "MCPListToolsToolAnnotations"\n ' + return MCPListToolsTool + + def _make_MCPListToolsToolAnnotations(): + class MCPListToolsToolAnnotations(TypedDict, total=False): + """MCPListToolsToolAnnotations.""" + MCPListToolsToolAnnotations.__qualname__ = 'MCPListToolsToolAnnotations' + if _version_info < (3, 13): + MCPListToolsToolAnnotations.__doc__ = 'MCPListToolsToolAnnotations.' + return MCPListToolsToolAnnotations + + def _make_MCPListToolsToolInputSchema(): + class MCPListToolsToolInputSchema(TypedDict, total=False): + """MCPListToolsToolInputSchema.""" + MCPListToolsToolInputSchema.__qualname__ = 'MCPListToolsToolInputSchema' + if _version_info < (3, 13): + MCPListToolsToolInputSchema.__doc__ = 'MCPListToolsToolInputSchema.' + return MCPListToolsToolInputSchema + + def _make_MCPTool(): + class MCPTool(TypedDict, total=False): + """MCP tool. + + :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP. + :vartype type: Literal["mcp"] + :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required. + :vartype server_label: str + :ivar server_url: The URL for the MCP server. One of ``server_url``, ``connector_id``, or + ``tunnel_id`` must be provided. + :vartype server_url: str + :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of + ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service + connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported + ``connector_id`` values are: + + * Dropbox: `connector_dropbox` + * Gmail: `connector_gmail` + * Google Calendar: `connector_googlecalendar` + * Google Drive: `connector_googledrive` + * Microsoft Teams: `connector_microsoftteams` + * Outlook Calendar: `connector_outlookcalendar` + * Outlook Email: `connector_outlookemail` + * SharePoint: `connector_sharepoint`. Is one of the following types: + Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"], + Literal["connector_googledrive"], Literal["connector_microsoftteams"], + Literal["connector_outlookcalendar"], Literal["connector_outlookemail"], + Literal["connector_sharepoint"] + :vartype connector_id: Literal["connector_dropbox", "connector_gmail", + "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", + "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"] + :ivar tunnel_id: The Secure MCP Tunnel ID to use instead of a direct server URL. One of + ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. + :vartype tunnel_id: str + :ivar authorization: An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application must handle the OAuth + authorization flow and provide the token here. + :vartype authorization: str + :ivar server_description: Optional description of the MCP server, used to provide more context. + :vartype server_description: str + :ivar headers: + :vartype headers: dict[str, str] + :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type. + :vartype allowed_tools: Union[list[str], "MCPToolFilter"] + :ivar allowed_callers: + :vartype allowed_callers: list[CallableToolAllowedCaller] + :ivar require_approval: Is one of the following types: MCPToolRequireApproval, + Literal["always"], Literal["never"] + :vartype require_approval: Union["MCPToolRequireApproval", Literal["always"], Literal["never"]] + :ivar defer_loading: Whether this MCP tool is deferred and discovered via tool search. + :vartype defer_loading: bool + :ivar project_connection_id: The connection ID in the project for the MCP server. The + connection stores authentication and other connection details needed to connect to the MCP + server. + :vartype project_connection_id: str + """ + type: Required[Literal['mcp']] + 'The type of the MCP tool. Always ``mcp``. Required. MCP.' + server_label: Required[str] + 'A label for this MCP server, used to identify it in tool calls. Required.' + server_url: str + 'The URL for the MCP server. One of ``server_url``, ``connector_id``, or ``tunnel_id`` must be\n provided.' + connector_id: Literal['connector_dropbox', 'connector_gmail', 'connector_googlecalendar', 'connector_googledrive', 'connector_microsoftteams', 'connector_outlookcalendar', 'connector_outlookemail', 'connector_sharepoint'] + 'Identifier for service connectors, like those available in ChatGPT. One of ``server_url``,\n ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported ``connector_id`` values are:\n\n * Dropbox: `connector_dropbox`\n * Gmail: `connector_gmail`\n * Google Calendar: `connector_googlecalendar`\n * Google Drive: `connector_googledrive`\n * Microsoft Teams: `connector_microsoftteams`\n * Outlook Calendar: `connector_outlookcalendar`\n * Outlook Email: `connector_outlookemail`\n * SharePoint: `connector_sharepoint`. Is one of the following types:\n Literal["connector_dropbox"], Literal["connector_gmail"],\n Literal["connector_googlecalendar"], Literal["connector_googledrive"],\n Literal["connector_microsoftteams"], Literal["connector_outlookcalendar"],\n Literal["connector_outlookemail"], Literal["connector_sharepoint"]' + tunnel_id: str + 'The Secure MCP Tunnel ID to use instead of a direct server URL. One of ``server_url``,\n ``connector_id``, or ``tunnel_id`` must be provided.' + authorization: str + 'An OAuth access token that can be used with a remote MCP server, either with a custom MCP\n server URL or a service connector. Your application must handle the OAuth authorization flow\n and provide the token here.' + server_description: str + 'Optional description of the MCP server, used to provide more context.' + headers: Optional[dict[str, str]] + allowed_tools: Optional[Union[list[str], '_types.MCPToolFilter']] + 'Is either a [str] type or a MCPToolFilter type.' + allowed_callers: Optional[list[_resolve('CallableToolAllowedCaller')]] + require_approval: Optional[Union['_types.MCPToolRequireApproval', Literal['always'], Literal['never']]] + 'Is one of the following types: MCPToolRequireApproval, Literal["always"], Literal["never"]' + defer_loading: bool + 'Whether this MCP tool is deferred and discovered via tool search.' + project_connection_id: str + 'The connection ID in the project for the MCP server. The connection stores authentication and\n other connection details needed to connect to the MCP server.' + MCPTool.__qualname__ = 'MCPTool' + if _version_info < (3, 13): + MCPTool.__doc__ = 'MCP tool.\n\n :ivar type: The type of the MCP tool. Always ``mcp``. Required. MCP.\n :vartype type: Literal["mcp"]\n :ivar server_label: A label for this MCP server, used to identify it in tool calls. Required.\n :vartype server_label: str\n :ivar server_url: The URL for the MCP server. One of ``server_url``, ``connector_id``, or\n ``tunnel_id`` must be provided.\n :vartype server_url: str\n :ivar connector_id: Identifier for service connectors, like those available in ChatGPT. One of\n ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided. Learn more about service\n connectors here: /docs/guides/tools-remote-mcp#connectors. Currently supported\n ``connector_id`` values are:\n\n * Dropbox: `connector_dropbox`\n * Gmail: `connector_gmail`\n * Google Calendar: `connector_googlecalendar`\n * Google Drive: `connector_googledrive`\n * Microsoft Teams: `connector_microsoftteams`\n * Outlook Calendar: `connector_outlookcalendar`\n * Outlook Email: `connector_outlookemail`\n * SharePoint: `connector_sharepoint`. Is one of the following types:\n Literal["connector_dropbox"], Literal["connector_gmail"], Literal["connector_googlecalendar"],\n Literal["connector_googledrive"], Literal["connector_microsoftteams"],\n Literal["connector_outlookcalendar"], Literal["connector_outlookemail"],\n Literal["connector_sharepoint"]\n :vartype connector_id: Literal["connector_dropbox", "connector_gmail",\n "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams",\n "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"]\n :ivar tunnel_id: The Secure MCP Tunnel ID to use instead of a direct server URL. One of\n ``server_url``, ``connector_id``, or ``tunnel_id`` must be provided.\n :vartype tunnel_id: str\n :ivar authorization: An OAuth access token that can be used with a remote MCP server, either\n with a custom MCP server URL or a service connector. Your application must handle the OAuth\n authorization flow and provide the token here.\n :vartype authorization: str\n :ivar server_description: Optional description of the MCP server, used to provide more context.\n :vartype server_description: str\n :ivar headers:\n :vartype headers: dict[str, str]\n :ivar allowed_tools: Is either a [str] type or a MCPToolFilter type.\n :vartype allowed_tools: Union[list[str], "MCPToolFilter"]\n :ivar allowed_callers:\n :vartype allowed_callers: list[CallableToolAllowedCaller]\n :ivar require_approval: Is one of the following types: MCPToolRequireApproval,\n Literal["always"], Literal["never"]\n :vartype require_approval: Union["MCPToolRequireApproval", Literal["always"], Literal["never"]]\n :ivar defer_loading: Whether this MCP tool is deferred and discovered via tool search.\n :vartype defer_loading: bool\n :ivar project_connection_id: The connection ID in the project for the MCP server. The\n connection stores authentication and other connection details needed to connect to the MCP\n server.\n :vartype project_connection_id: str\n ' + return MCPTool + + def _make_MCPToolFilter(): + class MCPToolFilter(TypedDict, total=False): + """MCP tool filter. + + :ivar tool_names: MCP allowed tools. + :vartype tool_names: list[str] + :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP + server is `annotated with `readOnlyHint` + `_, + it will match this filter. + :vartype read_only: bool + """ + tool_names: list[str] + 'MCP allowed tools.' + read_only: bool + 'Indicates whether or not a tool modifies data or is read-only. If an MCP server is `annotated\n with `readOnlyHint`\n `_,\n it will match this filter.' + MCPToolFilter.__qualname__ = 'MCPToolFilter' + if _version_info < (3, 13): + MCPToolFilter.__doc__ = 'MCP tool filter.\n\n :ivar tool_names: MCP allowed tools.\n :vartype tool_names: list[str]\n :ivar read_only: Indicates whether or not a tool modifies data or is read-only. If an MCP\n server is `annotated with `readOnlyHint`\n `_,\n it will match this filter.\n :vartype read_only: bool\n ' + return MCPToolFilter + + def _make_MCPToolRequireApproval(): + class MCPToolRequireApproval(TypedDict, total=False): + """MCPToolRequireApproval. + + :ivar always: + :vartype always: "MCPToolFilter" + :ivar never: + :vartype never: "MCPToolFilter" + """ + always: '_types.MCPToolFilter' + never: '_types.MCPToolFilter' + MCPToolRequireApproval.__qualname__ = 'MCPToolRequireApproval' + if _version_info < (3, 13): + MCPToolRequireApproval.__doc__ = 'MCPToolRequireApproval.\n\n :ivar always:\n :vartype always: "MCPToolFilter"\n :ivar never:\n :vartype never: "MCPToolFilter"\n ' + return MCPToolRequireApproval + + def _make_MemorySearchItem(): + class MemorySearchItem(TypedDict, total=False): + """A retrieved memory item from memory search. + + :ivar memory_item: Retrieved memory item. Required. + :vartype memory_item: "MemoryItem" + """ + memory_item: Required['_types.MemoryItem'] + 'Retrieved memory item. Required.' + MemorySearchItem.__qualname__ = 'MemorySearchItem' + if _version_info < (3, 13): + MemorySearchItem.__doc__ = 'A retrieved memory item from memory search.\n\n :ivar memory_item: Retrieved memory item. Required.\n :vartype memory_item: "MemoryItem"\n ' + return MemorySearchItem + + def _make_MemorySearchOptions(): + class MemorySearchOptions(TypedDict, total=False): + """Memory search options. + + :ivar max_memories: Maximum number of memory items to return. + :vartype max_memories: int + """ + max_memories: int + 'Maximum number of memory items to return.' + MemorySearchOptions.__qualname__ = 'MemorySearchOptions' + if _version_info < (3, 13): + MemorySearchOptions.__doc__ = 'Memory search options.\n\n :ivar max_memories: Maximum number of memory items to return.\n :vartype max_memories: int\n ' + return MemorySearchOptions + + def _make_MemorySearchPreviewTool(): + class MemorySearchPreviewTool(TypedDict, total=False): + """A tool for integrating memories into the agent. + + :ivar type: The type of the tool. Always ``memory_search_preview``. Required. + MEMORY_SEARCH_PREVIEW. + :vartype type: Literal["memory_search_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar memory_store_name: The name of the memory store to use. Required. + :vartype memory_store_name: str + :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which + memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to + the current signed-in user. Required. + :vartype scope: str + :ivar search_options: Options for searching the memory store. + :vartype search_options: "MemorySearchOptions" + :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default + 300. + :vartype update_delay: int + """ + type: Required[Literal['memory_search_preview']] + 'The type of the tool. Always ``memory_search_preview``. Required. MEMORY_SEARCH_PREVIEW.' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + memory_store_name: Required[str] + 'The name of the memory store to use. Required.' + scope: Required[str] + 'The namespace used to group and isolate memories, such as a user ID. Limits which memories can\n be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to the current\n signed-in user. Required.' + search_options: '_types.MemorySearchOptions' + 'Options for searching the memory store.' + update_delay: int + 'Time to wait before updating memories after inactivity (seconds). Default 300.' + MemorySearchPreviewTool.__qualname__ = 'MemorySearchPreviewTool' + if _version_info < (3, 13): + MemorySearchPreviewTool.__doc__ = 'A tool for integrating memories into the agent.\n\n :ivar type: The type of the tool. Always ``memory_search_preview``. Required.\n MEMORY_SEARCH_PREVIEW.\n :vartype type: Literal["memory_search_preview"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar memory_store_name: The name of the memory store to use. Required.\n :vartype memory_store_name: str\n :ivar scope: The namespace used to group and isolate memories, such as a user ID. Limits which\n memories can be retrieved or updated. Use special variable ``{{$userId}}`` to scope memories to\n the current signed-in user. Required.\n :vartype scope: str\n :ivar search_options: Options for searching the memory store.\n :vartype search_options: "MemorySearchOptions"\n :ivar update_delay: Time to wait before updating memories after inactivity (seconds). Default\n 300.\n :vartype update_delay: int\n ' + return MemorySearchPreviewTool + + def _make_MemorySearchToolCallItemParam(): + class MemorySearchToolCallItemParam(TypedDict, total=False): + """MemorySearchToolCallItemParam. + + :ivar type: Required. Default value is "memory_search_call". + :vartype type: Literal["memory_search_call"] + :ivar results: The results returned from the memory search. + :vartype results: list["MemorySearchItem"] + """ + type: Required[Literal['memory_search_call']] + 'Required. Default value is "memory_search_call".' + results: Optional[list['_types.MemorySearchItem']] + 'The results returned from the memory search.' + MemorySearchToolCallItemParam.__qualname__ = 'MemorySearchToolCallItemParam' + if _version_info < (3, 13): + MemorySearchToolCallItemParam.__doc__ = 'MemorySearchToolCallItemParam.\n\n :ivar type: Required. Default value is "memory_search_call".\n :vartype type: Literal["memory_search_call"]\n :ivar results: The results returned from the memory search.\n :vartype results: list["MemorySearchItem"]\n ' + return MemorySearchToolCallItemParam + + def _make_MemorySearchToolCallItemResource(): + class MemorySearchToolCallItemResource(TypedDict, total=False): + """MemorySearchToolCallItemResource. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. MEMORY_SEARCH_CALL. + :vartype type: Literal["memory_search_call"] + :ivar status: The status of the memory search tool call. One of ``in_progress``, ``searching``, + ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["incomplete"], + Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar results: The results returned from the memory search. + :vartype results: list["MemorySearchItem"] + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['memory_search_call']] + 'Required. MEMORY_SEARCH_CALL.' + status: Required[Literal['in_progress', 'searching', 'completed', 'incomplete', 'failed']] + 'The status of the memory search tool call. One of ``in_progress``, ``searching``,\n ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"],\n Literal["incomplete"], Literal["failed"]' + results: Optional[list['_types.MemorySearchItem']] + 'The results returned from the memory search.' + id: Required[str] + 'Required.' + MemorySearchToolCallItemResource.__qualname__ = 'MemorySearchToolCallItemResource' + if _version_info < (3, 13): + MemorySearchToolCallItemResource.__doc__ = 'MemorySearchToolCallItemResource.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. MEMORY_SEARCH_CALL.\n :vartype type: Literal["memory_search_call"]\n :ivar status: The status of the memory search tool call. One of ``in_progress``, ``searching``,\n ``completed``, ``incomplete`` or ``failed``,. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["incomplete"],\n Literal["failed"]\n :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"]\n :ivar results: The results returned from the memory search.\n :vartype results: list["MemorySearchItem"]\n :ivar id: Required.\n :vartype id: str\n ' + return MemorySearchToolCallItemResource + + def _make_MessageContentInputFileContent(): + class MessageContentInputFileContent(TypedDict, total=False): + """Input file. + + :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE. + :vartype type: Literal["input_file"] + :ivar file_id: + :vartype file_id: str + :ivar filename: The name of the file to be sent to the model. + :vartype filename: str + :ivar file_data: The content of the file to be sent to the model. + :vartype file_data: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + :ivar file_url: The URL of the file to be sent to the model. + :vartype file_url: str + :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the + system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality + rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or + ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto", + "low", and "high". + :vartype detail: FileInputDetail + """ + type: Required[Literal['input_file']] + 'The type of the input item. Always ``input_file``. Required. INPUT_FILE.' + file_id: Optional[str] + filename: str + 'The name of the file to be sent to the model.' + file_data: str + 'The content of the file to be sent to the model.' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + file_url: str + 'The URL of the file to be sent to the model.' + detail: _resolve('FileInputDetail') + 'The detail level of the file to be sent to the model. Use ``auto`` to let the system select the\n detail level; for GPT-5.6 and later models, ``auto`` uses high-quality rendering, which may\n increase input token usage. Use ``low`` for lower-cost rendering, or ``high`` to render the\n file at higher quality. Defaults to ``auto``. Known values are: "auto", "low", and\n "high".' + MessageContentInputFileContent.__qualname__ = 'MessageContentInputFileContent' + if _version_info < (3, 13): + MessageContentInputFileContent.__doc__ = 'Input file.\n\n :ivar type: The type of the input item. Always ``input_file``. Required. INPUT_FILE.\n :vartype type: Literal["input_file"]\n :ivar file_id:\n :vartype file_id: str\n :ivar filename: The name of the file to be sent to the model.\n :vartype filename: str\n :ivar file_data: The content of the file to be sent to the model.\n :vartype file_data: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n :ivar file_url: The URL of the file to be sent to the model.\n :vartype file_url: str\n :ivar detail: The detail level of the file to be sent to the model. Use ``auto`` to let the\n system select the detail level; for GPT-5.6 and later models, ``auto`` uses high-quality\n rendering, which may increase input token usage. Use ``low`` for lower-cost rendering, or\n ``high`` to render the file at higher quality. Defaults to ``auto``. Known values are: "auto",\n "low", and "high".\n :vartype detail: FileInputDetail\n ' + return MessageContentInputFileContent + + def _make_MessageContentInputImageContent(): + class MessageContentInputImageContent(TypedDict, total=False): + """Input image. + + :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE. + :vartype type: Literal["input_image"] + :ivar image_url: + :vartype image_url: str + :ivar file_id: + :vartype file_id: str + :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``, + ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", + "auto", and "original". + :vartype detail: ImageDetail + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['input_image']] + 'The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.' + image_url: Optional[str] + file_id: Optional[str] + detail: Required[_resolve('ImageDetail')] + 'The detail level of the image to be sent to the model. One of ``high``, ``low``, ``auto``, or\n ``original``. Defaults to ``auto``. Required. Known values are: "low", "high", "auto",\n and "original".' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + MessageContentInputImageContent.__qualname__ = 'MessageContentInputImageContent' + if _version_info < (3, 13): + MessageContentInputImageContent.__doc__ = 'Input image.\n\n :ivar type: The type of the input item. Always ``input_image``. Required. INPUT_IMAGE.\n :vartype type: Literal["input_image"]\n :ivar image_url:\n :vartype image_url: str\n :ivar file_id:\n :vartype file_id: str\n :ivar detail: The detail level of the image to be sent to the model. One of ``high``, ``low``,\n ``auto``, or ``original``. Defaults to ``auto``. Required. Known values are: "low", "high",\n "auto", and "original".\n :vartype detail: ImageDetail\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return MessageContentInputImageContent + + def _make_MessageContentInputTextContent(): + class MessageContentInputTextContent(TypedDict, total=False): + """Input text. + + :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT. + :vartype type: Literal["input_text"] + :ivar text: The text input to the model. Required. + :vartype text: str + :ivar prompt_cache_breakpoint: + :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig" + """ + type: Required[Literal['input_text']] + 'The type of the input item. Always ``input_text``. Required. INPUT_TEXT.' + text: Required[str] + 'The text input to the model. Required.' + prompt_cache_breakpoint: '_types.PromptCacheBreakpointConfig' + MessageContentInputTextContent.__qualname__ = 'MessageContentInputTextContent' + if _version_info < (3, 13): + MessageContentInputTextContent.__doc__ = 'Input text.\n\n :ivar type: The type of the input item. Always ``input_text``. Required. INPUT_TEXT.\n :vartype type: Literal["input_text"]\n :ivar text: The text input to the model. Required.\n :vartype text: str\n :ivar prompt_cache_breakpoint:\n :vartype prompt_cache_breakpoint: "PromptCacheBreakpointConfig"\n ' + return MessageContentInputTextContent + + def _make_MessageContentOutputTextContent(): + class MessageContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: Literal["output_text"] + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. + :vartype annotations: list["Annotation"] + :ivar logprobs: + :vartype logprobs: list["LogProb"] + """ + type: Required[Literal['output_text']] + 'The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.' + text: Required[str] + 'The text output from the model. Required.' + annotations: list['_types.Annotation'] + 'The annotations of the text output.' + logprobs: list['_types.LogProb'] + MessageContentOutputTextContent.__qualname__ = 'MessageContentOutputTextContent' + if _version_info < (3, 13): + MessageContentOutputTextContent.__doc__ = 'Output text.\n\n :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.\n :vartype type: Literal["output_text"]\n :ivar text: The text output from the model. Required.\n :vartype text: str\n :ivar annotations: The annotations of the text output.\n :vartype annotations: list["Annotation"]\n :ivar logprobs:\n :vartype logprobs: list["LogProb"]\n ' + return MessageContentOutputTextContent + + def _make_MessageContentReasoningTextContent(): + class MessageContentReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. + REASONING_TEXT. + :vartype type: Literal["reasoning_text"] + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + type: Required[Literal['reasoning_text']] + 'The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.' + text: Required[str] + 'The reasoning text from the model. Required.' + MessageContentReasoningTextContent.__qualname__ = 'MessageContentReasoningTextContent' + if _version_info < (3, 13): + MessageContentReasoningTextContent.__doc__ = 'Reasoning text.\n\n :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required.\n REASONING_TEXT.\n :vartype type: Literal["reasoning_text"]\n :ivar text: The reasoning text from the model. Required.\n :vartype text: str\n ' + return MessageContentReasoningTextContent + + def _make_MessageContentRefusalContent(): + class MessageContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: Literal["refusal"] + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + type: Required[Literal['refusal']] + 'The type of the refusal. Always ``refusal``. Required. REFUSAL.' + refusal: Required[str] + 'The refusal explanation from the model. Required.' + MessageContentRefusalContent.__qualname__ = 'MessageContentRefusalContent' + if _version_info < (3, 13): + MessageContentRefusalContent.__doc__ = 'Refusal.\n\n :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL.\n :vartype type: Literal["refusal"]\n :ivar refusal: The refusal explanation from the model. Required.\n :vartype refusal: str\n ' + return MessageContentRefusalContent + + def _make_Metadata(): + class Metadata(TypedDict, total=False): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters. + + """ + Metadata.__qualname__ = 'Metadata' + if _version_info < (3, 13): + Metadata.__doc__ = 'Set of 16 key-value pairs that can be attached to an object. This can be useful for storing\n additional information about the object in a structured format, and querying for objects via\n API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are\n strings with a maximum length of 512 characters.\n\n ' + return Metadata + + def _make_MicrosoftFabricPreviewTool(): + class MicrosoftFabricPreviewTool(TypedDict, total=False): + """The input definition information for a Microsoft Fabric tool as used to configure an agent. + + :ivar type: The object type, which is always 'fabric_dataagent_preview'. Required. + FABRIC_DATAAGENT_PREVIEW. + :vartype type: Literal["fabric_dataagent_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required. + :vartype fabric_dataagent_preview: "FabricDataAgentToolParameters" + """ + type: Required[Literal['fabric_dataagent_preview']] + "The object type, which is always 'fabric_dataagent_preview'. Required.\n FABRIC_DATAAGENT_PREVIEW." + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + fabric_dataagent_preview: Required['_types.FabricDataAgentToolParameters'] + 'The fabric data agent tool parameters. Required.' + MicrosoftFabricPreviewTool.__qualname__ = 'MicrosoftFabricPreviewTool' + if _version_info < (3, 13): + MicrosoftFabricPreviewTool.__doc__ = 'The input definition information for a Microsoft Fabric tool as used to configure an agent.\n\n :ivar type: The object type, which is always \'fabric_dataagent_preview\'. Required.\n FABRIC_DATAAGENT_PREVIEW.\n :vartype type: Literal["fabric_dataagent_preview"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar fabric_dataagent_preview: The fabric data agent tool parameters. Required.\n :vartype fabric_dataagent_preview: "FabricDataAgentToolParameters"\n ' + return MicrosoftFabricPreviewTool + + def _make_Moderation(): + class Moderation(TypedDict, total=False): + """Moderation. + + :ivar input: Moderation for the response input. Required. + :vartype input: "ModerationEntry" + :ivar output: Moderation for the response output. Required. + :vartype output: "ModerationEntry" + """ + input: Required['_types.ModerationEntry'] + 'Moderation for the response input. Required.' + output: Required['_types.ModerationEntry'] + 'Moderation for the response output. Required.' + Moderation.__qualname__ = 'Moderation' + if _version_info < (3, 13): + Moderation.__doc__ = 'Moderation.\n\n :ivar input: Moderation for the response input. Required.\n :vartype input: "ModerationEntry"\n :ivar output: Moderation for the response output. Required.\n :vartype output: "ModerationEntry"\n ' + return Moderation + + def _make_ModerationConfigParam(): + class ModerationConfigParam(TypedDict, total=False): + """The moderation policy for the response input. + + :ivar mode: Required. Known values are: "score" and "block". + :vartype mode: ModerationMode + """ + mode: Required[_resolve('ModerationMode')] + 'Required. Known values are: "score" and "block".' + ModerationConfigParam.__qualname__ = 'ModerationConfigParam' + if _version_info < (3, 13): + ModerationConfigParam.__doc__ = 'The moderation policy for the response input.\n\n :ivar mode: Required. Known values are: "score" and "block".\n :vartype mode: ModerationMode\n ' + return ModerationConfigParam + + def _make_ModerationErrorBody(): + class ModerationErrorBody(TypedDict, total=False): + """Moderation error. + + :ivar type: The object type, which was always ``error`` for moderation failures. Required. + ERROR. + :vartype type: Literal["error"] + :ivar code: The error code. Required. + :vartype code: str + :ivar message: The error message. Required. + :vartype message: str + """ + type: Required[Literal['error']] + 'The object type, which was always ``error`` for moderation failures. Required. ERROR.' + code: Required[str] + 'The error code. Required.' + message: Required[str] + 'The error message. Required.' + ModerationErrorBody.__qualname__ = 'ModerationErrorBody' + if _version_info < (3, 13): + ModerationErrorBody.__doc__ = 'Moderation error.\n\n :ivar type: The object type, which was always ``error`` for moderation failures. Required.\n ERROR.\n :vartype type: Literal["error"]\n :ivar code: The error code. Required.\n :vartype code: str\n :ivar message: The error message. Required.\n :vartype message: str\n ' + return ModerationErrorBody + + def _make_ModerationParam(): + class ModerationParam(TypedDict, total=False): + """Configuration for running moderation on the input and output of this response. + + :ivar model: The moderation model to use for moderated completions, e.g. + 'omni-moderation-latest'. Required. + :vartype model: str + :ivar policy: + :vartype policy: "ModerationPolicyParam" + """ + model: Required[str] + "The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'. Required." + policy: Optional['_types.ModerationPolicyParam'] + ModerationParam.__qualname__ = 'ModerationParam' + if _version_info < (3, 13): + ModerationParam.__doc__ = 'Configuration for running moderation on the input and output of this response.\n\n :ivar model: The moderation model to use for moderated completions, e.g.\n \'omni-moderation-latest\'. Required.\n :vartype model: str\n :ivar policy:\n :vartype policy: "ModerationPolicyParam"\n ' + return ModerationParam + + def _make_ModerationPolicyParam(): + class ModerationPolicyParam(TypedDict, total=False): + """The policy to apply to moderated response input and output. + + :ivar input: + :vartype input: "ModerationConfigParam" + :ivar output: + :vartype output: "ModerationConfigParam" + """ + input: Optional['_types.ModerationConfigParam'] + output: Optional['_types.ModerationConfigParam'] + ModerationPolicyParam.__qualname__ = 'ModerationPolicyParam' + if _version_info < (3, 13): + ModerationPolicyParam.__doc__ = 'The policy to apply to moderated response input and output.\n\n :ivar input:\n :vartype input: "ModerationConfigParam"\n :ivar output:\n :vartype output: "ModerationConfigParam"\n ' + return ModerationPolicyParam + + def _make_ModerationResultBody(): + class ModerationResultBody(TypedDict, total=False): + """Moderation result. + + :ivar type: The object type, which was always ``moderation_result`` for successful moderation + results. Required. MODERATION_RESULT. + :vartype type: Literal["moderation_result"] + :ivar model: The moderation model that produced this result. Required. + :vartype model: str + :ivar flagged: A boolean indicating whether the content was flagged by any category. Required. + :vartype flagged: bool + :ivar categories: A dictionary of moderation categories to booleans, True if the input is + flagged under this category. Required. + :vartype categories: dict[str, bool] + :ivar category_scores: A dictionary of moderation categories to scores. Required. + :vartype category_scores: dict[str, float] + :ivar category_applied_input_types: Which modalities of input are reflected by the score for + each category. Required. + :vartype category_applied_input_types: dict[str, list[ModerationInputType]] + """ + type: Required[Literal['moderation_result']] + 'The object type, which was always ``moderation_result`` for successful moderation results.\n Required. MODERATION_RESULT.' + model: Required[str] + 'The moderation model that produced this result. Required.' + flagged: Required[bool] + 'A boolean indicating whether the content was flagged by any category. Required.' + categories: Required[dict[str, bool]] + 'A dictionary of moderation categories to booleans, True if the input is flagged under this\n category. Required.' + category_scores: Required[dict[str, float]] + 'A dictionary of moderation categories to scores. Required.' + category_applied_input_types: Required[dict[str, list[_resolve('ModerationInputType')]]] + 'Which modalities of input are reflected by the score for each category. Required.' + ModerationResultBody.__qualname__ = 'ModerationResultBody' + if _version_info < (3, 13): + ModerationResultBody.__doc__ = 'Moderation result.\n\n :ivar type: The object type, which was always ``moderation_result`` for successful moderation\n results. Required. MODERATION_RESULT.\n :vartype type: Literal["moderation_result"]\n :ivar model: The moderation model that produced this result. Required.\n :vartype model: str\n :ivar flagged: A boolean indicating whether the content was flagged by any category. Required.\n :vartype flagged: bool\n :ivar categories: A dictionary of moderation categories to booleans, True if the input is\n flagged under this category. Required.\n :vartype categories: dict[str, bool]\n :ivar category_scores: A dictionary of moderation categories to scores. Required.\n :vartype category_scores: dict[str, float]\n :ivar category_applied_input_types: Which modalities of input are reflected by the score for\n each category. Required.\n :vartype category_applied_input_types: dict[str, list[ModerationInputType]]\n ' + return ModerationResultBody + + def _make_MoveParam(): + class MoveParam(TypedDict, total=False): + """Move. + + :ivar type: Specifies the event type. For a move action, this property is always set to + ``move``. Required. MOVE. + :vartype type: Literal["move"] + :ivar x: The x-coordinate to move to. Required. + :vartype x: int + :ivar y: The y-coordinate to move to. Required. + :vartype y: int + :ivar keys: + :vartype keys: list[str] + """ + type: Required[Literal['move']] + 'Specifies the event type. For a move action, this property is always set to ``move``. Required.\n MOVE.' + x: Required[int] + 'The x-coordinate to move to. Required.' + y: Required[int] + 'The y-coordinate to move to. Required.' + keys: Optional[list[str]] + MoveParam.__qualname__ = 'MoveParam' + if _version_info < (3, 13): + MoveParam.__doc__ = 'Move.\n\n :ivar type: Specifies the event type. For a move action, this property is always set to\n ``move``. Required. MOVE.\n :vartype type: Literal["move"]\n :ivar x: The x-coordinate to move to. Required.\n :vartype x: int\n :ivar y: The y-coordinate to move to. Required.\n :vartype y: int\n :ivar keys:\n :vartype keys: list[str]\n ' + return MoveParam + + def _make_NamespaceToolParam(): + class NamespaceToolParam(TypedDict, total=False): + """Namespace. + + :ivar type: The type of the tool. Always ``namespace``. Required. NAMESPACE. + :vartype type: Literal["namespace"] + :ivar name: The namespace name used in tool calls (for example, ``crm``). Required. + :vartype name: str + :ivar description: A description of the namespace shown to the model. Required. + :vartype description: str + :ivar tools: The function/custom tools available inside this namespace. Required. + :vartype tools: list[Union["FunctionToolParam", "CustomToolParam"]] + """ + type: Required[Literal['namespace']] + 'The type of the tool. Always ``namespace``. Required. NAMESPACE.' + name: Required[str] + 'The namespace name used in tool calls (for example, ``crm``). Required.' + description: Required[str] + 'A description of the namespace shown to the model. Required.' + tools: Required[list[Union['_types.FunctionToolParam', '_types.CustomToolParam']]] + 'The function/custom tools available inside this namespace. Required.' + NamespaceToolParam.__qualname__ = 'NamespaceToolParam' + if _version_info < (3, 13): + NamespaceToolParam.__doc__ = 'Namespace.\n\n :ivar type: The type of the tool. Always ``namespace``. Required. NAMESPACE.\n :vartype type: Literal["namespace"]\n :ivar name: The namespace name used in tool calls (for example, ``crm``). Required.\n :vartype name: str\n :ivar description: A description of the namespace shown to the model. Required.\n :vartype description: str\n :ivar tools: The function/custom tools available inside this namespace. Required.\n :vartype tools: list[Union["FunctionToolParam", "CustomToolParam"]]\n ' + return NamespaceToolParam + + def _make_OAuthConsentRequestOutputItem(): + class OAuthConsentRequestOutputItem(TypedDict, total=False): + """Request from the service for the user to perform OAuth consent. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: Required. + :vartype id: str + :ivar type: Required. OAUTH_CONSENT_REQUEST. + :vartype type: Literal["oauth_consent_request"] + :ivar consent_link: The link the user can use to perform OAuth consent. Required. + :vartype consent_link: str + :ivar server_label: The server label for the OAuth consent request. Required. + :vartype server_label: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + id: Required[str] + 'Required.' + type: Required[Literal['oauth_consent_request']] + 'Required. OAUTH_CONSENT_REQUEST.' + consent_link: Required[str] + 'The link the user can use to perform OAuth consent. Required.' + server_label: Required[str] + 'The server label for the OAuth consent request. Required.' + OAuthConsentRequestOutputItem.__qualname__ = 'OAuthConsentRequestOutputItem' + if _version_info < (3, 13): + OAuthConsentRequestOutputItem.__doc__ = 'Request from the service for the user to perform OAuth consent.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar id: Required.\n :vartype id: str\n :ivar type: Required. OAUTH_CONSENT_REQUEST.\n :vartype type: Literal["oauth_consent_request"]\n :ivar consent_link: The link the user can use to perform OAuth consent. Required.\n :vartype consent_link: str\n :ivar server_label: The server label for the OAuth consent request. Required.\n :vartype server_label: str\n ' + return OAuthConsentRequestOutputItem + + def _make_OpenApiAnonymousAuthDetails(): + class OpenApiAnonymousAuthDetails(TypedDict, total=False): + """Security details for OpenApi anonymous authentication. + + :ivar type: The object type, which is always 'anonymous'. Required. ANONYMOUS. + :vartype type: Literal["anonymous"] + """ + type: Required[Literal['anonymous']] + "The object type, which is always 'anonymous'. Required. ANONYMOUS." + OpenApiAnonymousAuthDetails.__qualname__ = 'OpenApiAnonymousAuthDetails' + if _version_info < (3, 13): + OpenApiAnonymousAuthDetails.__doc__ = 'Security details for OpenApi anonymous authentication.\n\n :ivar type: The object type, which is always \'anonymous\'. Required. ANONYMOUS.\n :vartype type: Literal["anonymous"]\n ' + return OpenApiAnonymousAuthDetails + + def _make_OpenApiFunctionDefinition(): + class OpenApiFunctionDefinition(TypedDict, total=False): + """The input definition information for an openapi function. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar spec: The openapi function shape, described as a JSON Schema object. Required. + :vartype spec: dict[str, Any] + :ivar auth: Open API authentication details. Required. + :vartype auth: "OpenApiAuthDetails" + :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults. + :vartype default_params: list[str] + :ivar functions: List of function definitions used by OpenApi tool. + :vartype functions: list["OpenApiFunctionDefinitionFunction"] + """ + name: Required[str] + 'The name of the function to be called. Required.' + description: str + 'A description of what the function does, used by the model to choose when and how to call the\n function.' + spec: Required[dict[str, Any]] + 'The openapi function shape, described as a JSON Schema object. Required.' + auth: Required['_types.OpenApiAuthDetails'] + 'Open API authentication details. Required.' + default_params: list[str] + 'List of OpenAPI spec parameters that will use user-provided defaults.' + functions: list['_types.OpenApiFunctionDefinitionFunction'] + 'List of function definitions used by OpenApi tool.' + OpenApiFunctionDefinition.__qualname__ = 'OpenApiFunctionDefinition' + if _version_info < (3, 13): + OpenApiFunctionDefinition.__doc__ = 'The input definition information for an openapi function.\n\n :ivar name: The name of the function to be called. Required.\n :vartype name: str\n :ivar description: A description of what the function does, used by the model to choose when\n and how to call the function.\n :vartype description: str\n :ivar spec: The openapi function shape, described as a JSON Schema object. Required.\n :vartype spec: dict[str, Any]\n :ivar auth: Open API authentication details. Required.\n :vartype auth: "OpenApiAuthDetails"\n :ivar default_params: List of OpenAPI spec parameters that will use user-provided defaults.\n :vartype default_params: list[str]\n :ivar functions: List of function definitions used by OpenApi tool.\n :vartype functions: list["OpenApiFunctionDefinitionFunction"]\n ' + return OpenApiFunctionDefinition + + def _make_OpenApiFunctionDefinitionFunction(): + class OpenApiFunctionDefinitionFunction(TypedDict, total=False): + """OpenApiFunctionDefinitionFunction. + + :ivar name: The name of the function to be called. Required. + :vartype name: str + :ivar description: A description of what the function does, used by the model to choose when + and how to call the function. + :vartype description: str + :ivar parameters: The parameters the functions accepts, described as a JSON Schema object. + Required. + :vartype parameters: dict[str, Any] + """ + name: Required[str] + 'The name of the function to be called. Required.' + description: str + 'A description of what the function does, used by the model to choose when and how to call the\n function.' + parameters: Required[dict[str, Any]] + 'The parameters the functions accepts, described as a JSON Schema object. Required.' + OpenApiFunctionDefinitionFunction.__qualname__ = 'OpenApiFunctionDefinitionFunction' + if _version_info < (3, 13): + OpenApiFunctionDefinitionFunction.__doc__ = 'OpenApiFunctionDefinitionFunction.\n\n :ivar name: The name of the function to be called. Required.\n :vartype name: str\n :ivar description: A description of what the function does, used by the model to choose when\n and how to call the function.\n :vartype description: str\n :ivar parameters: The parameters the functions accepts, described as a JSON Schema object.\n Required.\n :vartype parameters: dict[str, Any]\n ' + return OpenApiFunctionDefinitionFunction + + def _make_OpenApiManagedAuthDetails(): + class OpenApiManagedAuthDetails(TypedDict, total=False): + """Security details for OpenApi managed_identity authentication. + + :ivar type: The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY. + :vartype type: Literal["managed_identity"] + :ivar security_scheme: Connection auth security details. Required. + :vartype security_scheme: "OpenApiManagedSecurityScheme" + """ + type: Required[Literal['managed_identity']] + "The object type, which is always 'managed_identity'. Required. MANAGED_IDENTITY." + security_scheme: Required['_types.OpenApiManagedSecurityScheme'] + 'Connection auth security details. Required.' + OpenApiManagedAuthDetails.__qualname__ = 'OpenApiManagedAuthDetails' + if _version_info < (3, 13): + OpenApiManagedAuthDetails.__doc__ = 'Security details for OpenApi managed_identity authentication.\n\n :ivar type: The object type, which is always \'managed_identity\'. Required. MANAGED_IDENTITY.\n :vartype type: Literal["managed_identity"]\n :ivar security_scheme: Connection auth security details. Required.\n :vartype security_scheme: "OpenApiManagedSecurityScheme"\n ' + return OpenApiManagedAuthDetails + + def _make_OpenApiManagedSecurityScheme(): + class OpenApiManagedSecurityScheme(TypedDict, total=False): + """Security scheme for OpenApi managed_identity authentication. + + :ivar audience: Authentication scope for managed_identity auth type. Required. + :vartype audience: str + """ + audience: Required[str] + 'Authentication scope for managed_identity auth type. Required.' + OpenApiManagedSecurityScheme.__qualname__ = 'OpenApiManagedSecurityScheme' + if _version_info < (3, 13): + OpenApiManagedSecurityScheme.__doc__ = 'Security scheme for OpenApi managed_identity authentication.\n\n :ivar audience: Authentication scope for managed_identity auth type. Required.\n :vartype audience: str\n ' + return OpenApiManagedSecurityScheme + + def _make_OpenApiProjectConnectionAuthDetails(): + class OpenApiProjectConnectionAuthDetails(TypedDict, total=False): + """Security details for OpenApi project connection authentication. + + :ivar type: The object type, which is always 'project_connection'. Required. + PROJECT_CONNECTION. + :vartype type: Literal["project_connection"] + :ivar security_scheme: Project connection auth security details. Required. + :vartype security_scheme: "OpenApiProjectConnectionSecurityScheme" + """ + type: Required[Literal['project_connection']] + "The object type, which is always 'project_connection'. Required. PROJECT_CONNECTION." + security_scheme: Required['_types.OpenApiProjectConnectionSecurityScheme'] + 'Project connection auth security details. Required.' + OpenApiProjectConnectionAuthDetails.__qualname__ = 'OpenApiProjectConnectionAuthDetails' + if _version_info < (3, 13): + OpenApiProjectConnectionAuthDetails.__doc__ = 'Security details for OpenApi project connection authentication.\n\n :ivar type: The object type, which is always \'project_connection\'. Required.\n PROJECT_CONNECTION.\n :vartype type: Literal["project_connection"]\n :ivar security_scheme: Project connection auth security details. Required.\n :vartype security_scheme: "OpenApiProjectConnectionSecurityScheme"\n ' + return OpenApiProjectConnectionAuthDetails + + def _make_OpenApiProjectConnectionSecurityScheme(): + class OpenApiProjectConnectionSecurityScheme(TypedDict, total=False): + """Security scheme for OpenApi managed_identity authentication. + + :ivar project_connection_id: Project connection id for Project Connection auth type. Required. + :vartype project_connection_id: str + """ + project_connection_id: Required[str] + 'Project connection id for Project Connection auth type. Required.' + OpenApiProjectConnectionSecurityScheme.__qualname__ = 'OpenApiProjectConnectionSecurityScheme' + if _version_info < (3, 13): + OpenApiProjectConnectionSecurityScheme.__doc__ = 'Security scheme for OpenApi managed_identity authentication.\n\n :ivar project_connection_id: Project connection id for Project Connection auth type. Required.\n :vartype project_connection_id: str\n ' + return OpenApiProjectConnectionSecurityScheme + + def _make_OpenApiTool(): + class OpenApiTool(TypedDict, total=False): + """The input definition information for an OpenAPI tool as used to configure an agent. + + :ivar type: The object type, which is always 'openapi'. Required. OPENAPI. + :vartype type: Literal["openapi"] + :ivar openapi: The openapi function definition. Required. + :vartype openapi: "OpenApiFunctionDefinition" + """ + type: Required[Literal['openapi']] + "The object type, which is always 'openapi'. Required. OPENAPI." + openapi: Required['_types.OpenApiFunctionDefinition'] + 'The openapi function definition. Required.' + OpenApiTool.__qualname__ = 'OpenApiTool' + if _version_info < (3, 13): + OpenApiTool.__doc__ = 'The input definition information for an OpenAPI tool as used to configure an agent.\n\n :ivar type: The object type, which is always \'openapi\'. Required. OPENAPI.\n :vartype type: Literal["openapi"]\n :ivar openapi: The openapi function definition. Required.\n :vartype openapi: "OpenApiFunctionDefinition"\n ' + return OpenApiTool + + def _make_OpenApiToolCall(): + class OpenApiToolCall(TypedDict, total=False): + """An OpenAPI tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL. + :vartype type: Literal["openapi_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation being called. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['openapi_call']] + 'Required. OPENAPI_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + name: Required[str] + 'The name of the OpenAPI operation being called. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + OpenApiToolCall.__qualname__ = 'OpenApiToolCall' + if _version_info < (3, 13): + OpenApiToolCall.__doc__ = 'An OpenAPI tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. OPENAPI_CALL.\n :vartype type: Literal["openapi_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar name: The name of the OpenAPI operation being called. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return OpenApiToolCall + + def _make_OpenApiToolCallOutput(): + class OpenApiToolCallOutput(TypedDict, total=False): + """The output of an OpenAPI tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. OPENAPI_CALL_OUTPUT. + :vartype type: Literal["openapi_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar name: The name of the OpenAPI operation that was called. Required. + :vartype name: str + :ivar output: The output from the OpenAPI tool call. Is one of the following types: {str: Any}, + str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['openapi_call_output']] + 'Required. OPENAPI_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + name: Required[str] + 'The name of the OpenAPI operation that was called. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the OpenAPI tool call. Is one of the following types: {str: Any}, str, [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + OpenApiToolCallOutput.__qualname__ = 'OpenApiToolCallOutput' + if _version_info < (3, 13): + OpenApiToolCallOutput.__doc__ = 'The output of an OpenAPI tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. OPENAPI_CALL_OUTPUT.\n :vartype type: Literal["openapi_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar name: The name of the OpenAPI operation that was called. Required.\n :vartype name: str\n :ivar output: The output from the OpenAPI tool call. Is one of the following types: {str: Any},\n str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return OpenApiToolCallOutput + + def _make_OutputContentOutputTextContent(): + class OutputContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: Literal["output_text"] + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. + :vartype annotations: list["Annotation"] + :ivar logprobs: + :vartype logprobs: list["LogProb"] + """ + type: Required[Literal['output_text']] + 'The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.' + text: Required[str] + 'The text output from the model. Required.' + annotations: list['_types.Annotation'] + 'The annotations of the text output.' + logprobs: list['_types.LogProb'] + OutputContentOutputTextContent.__qualname__ = 'OutputContentOutputTextContent' + if _version_info < (3, 13): + OutputContentOutputTextContent.__doc__ = 'Output text.\n\n :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.\n :vartype type: Literal["output_text"]\n :ivar text: The text output from the model. Required.\n :vartype text: str\n :ivar annotations: The annotations of the text output.\n :vartype annotations: list["Annotation"]\n :ivar logprobs:\n :vartype logprobs: list["LogProb"]\n ' + return OutputContentOutputTextContent + + def _make_OutputContentReasoningTextContent(): + class OutputContentReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. + REASONING_TEXT. + :vartype type: Literal["reasoning_text"] + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + type: Required[Literal['reasoning_text']] + 'The type of the reasoning text. Always ``reasoning_text``. Required. REASONING_TEXT.' + text: Required[str] + 'The reasoning text from the model. Required.' + OutputContentReasoningTextContent.__qualname__ = 'OutputContentReasoningTextContent' + if _version_info < (3, 13): + OutputContentReasoningTextContent.__doc__ = 'Reasoning text.\n\n :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required.\n REASONING_TEXT.\n :vartype type: Literal["reasoning_text"]\n :ivar text: The reasoning text from the model. Required.\n :vartype text: str\n ' + return OutputContentReasoningTextContent + + def _make_OutputContentRefusalContent(): + class OutputContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: Literal["refusal"] + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + type: Required[Literal['refusal']] + 'The type of the refusal. Always ``refusal``. Required. REFUSAL.' + refusal: Required[str] + 'The refusal explanation from the model. Required.' + OutputContentRefusalContent.__qualname__ = 'OutputContentRefusalContent' + if _version_info < (3, 13): + OutputContentRefusalContent.__doc__ = 'Refusal.\n\n :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL.\n :vartype type: Literal["refusal"]\n :ivar refusal: The refusal explanation from the model. Required.\n :vartype refusal: str\n ' + return OutputContentRefusalContent + + def _make_OutputItemAdditionalTools(): + class OutputItemAdditionalTools(TypedDict, total=False): + """OutputItemAdditionalTools. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS. + :vartype type: Literal["additional_tools"] + :ivar id: The unique ID of the additional tools item. Required. + :vartype id: str + :ivar role: The role that provided the additional tools. Required. Known values are: "unknown", + "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar tools: The additional tool definitions made available at this item. Required. + :vartype tools: list["Tool"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['additional_tools']] + 'The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.' + id: Required[str] + 'The unique ID of the additional tools item. Required.' + role: Required[_resolve('MessageRole')] + 'The role that provided the additional tools. Required. Known values are: "unknown", "user",\n "assistant", "system", "critic", "discriminator", "developer", and "tool".' + tools: Required[list['_types.Tool']] + 'The additional tool definitions made available at this item. Required.' + OutputItemAdditionalTools.__qualname__ = 'OutputItemAdditionalTools' + if _version_info < (3, 13): + OutputItemAdditionalTools.__doc__ = 'OutputItemAdditionalTools.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``additional_tools``. Required. ADDITIONAL_TOOLS.\n :vartype type: Literal["additional_tools"]\n :ivar id: The unique ID of the additional tools item. Required.\n :vartype id: str\n :ivar role: The role that provided the additional tools. Required. Known values are: "unknown",\n "user", "assistant", "system", "critic", "discriminator", "developer", and "tool".\n :vartype role: MessageRole\n :ivar tools: The additional tool definitions made available at this item. Required.\n :vartype tools: list["Tool"]\n ' + return OutputItemAdditionalTools + + def _make_OutputItemApplyPatchToolCall(): + class OutputItemApplyPatchToolCall(TypedDict, total=False): + """Apply patch tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL. + :vartype type: Literal["apply_patch_call"] + :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via + API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``. + Required. Known values are: "in_progress" and "completed". + :vartype status: ApplyPatchCallStatus + :ivar operation: Apply patch operation. Required. + :vartype operation: "ApplyPatchFileOperation" + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['apply_patch_call']] + 'The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.' + id: Required[str] + 'The unique ID of the apply patch tool call. Populated when this item is returned via API.\n Required.' + call_id: Required[str] + 'The unique ID of the apply patch tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + status: Required[_resolve('ApplyPatchCallStatus')] + 'The status of the apply patch tool call. One of ``in_progress`` or ``completed``. Required.\n Known values are: "in_progress" and "completed".' + operation: Required['_types.ApplyPatchFileOperation'] + 'Apply patch operation. Required.' + OutputItemApplyPatchToolCall.__qualname__ = 'OutputItemApplyPatchToolCall' + if _version_info < (3, 13): + OutputItemApplyPatchToolCall.__doc__ = 'Apply patch tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``apply_patch_call``. Required. APPLY_PATCH_CALL.\n :vartype type: Literal["apply_patch_call"]\n :ivar id: The unique ID of the apply patch tool call. Populated when this item is returned via\n API. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar status: The status of the apply patch tool call. One of ``in_progress`` or ``completed``.\n Required. Known values are: "in_progress" and "completed".\n :vartype status: ApplyPatchCallStatus\n :ivar operation: Apply patch operation. Required.\n :vartype operation: "ApplyPatchFileOperation"\n ' + return OutputItemApplyPatchToolCall + + def _make_OutputItemApplyPatchToolCallOutput(): + class OutputItemApplyPatchToolCallOutput(TypedDict, total=False): + """Apply patch tool call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``apply_patch_call_output``. Required. + APPLY_PATCH_CALL_OUTPUT. + :vartype type: Literal["apply_patch_call_output"] + :ivar id: The unique ID of the apply patch tool call output. Populated when this item is + returned via API. Required. + :vartype id: str + :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the apply patch tool call output. One of ``completed`` or + ``failed``. Required. Known values are: "completed" and "failed". + :vartype status: ApplyPatchCallOutputStatus + :ivar output: + :vartype output: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['apply_patch_call_output']] + 'The type of the item. Always ``apply_patch_call_output``. Required. APPLY_PATCH_CALL_OUTPUT.' + id: Required[str] + 'The unique ID of the apply patch tool call output. Populated when this item is returned via\n API. Required.' + call_id: Required[str] + 'The unique ID of the apply patch tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + status: Required[_resolve('ApplyPatchCallOutputStatus')] + 'The status of the apply patch tool call output. One of ``completed`` or ``failed``. Required.\n Known values are: "completed" and "failed".' + output: Optional[str] + OutputItemApplyPatchToolCallOutput.__qualname__ = 'OutputItemApplyPatchToolCallOutput' + if _version_info < (3, 13): + OutputItemApplyPatchToolCallOutput.__doc__ = 'Apply patch tool call output.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``apply_patch_call_output``. Required.\n APPLY_PATCH_CALL_OUTPUT.\n :vartype type: Literal["apply_patch_call_output"]\n :ivar id: The unique ID of the apply patch tool call output. Populated when this item is\n returned via API. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the apply patch tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar status: The status of the apply patch tool call output. One of ``completed`` or\n ``failed``. Required. Known values are: "completed" and "failed".\n :vartype status: ApplyPatchCallOutputStatus\n :ivar output:\n :vartype output: str\n ' + return OutputItemApplyPatchToolCallOutput + + def _make_OutputItemCodeInterpreterToolCall(): + class OutputItemCodeInterpreterToolCall(TypedDict, total=False): + """Code interpreter tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``. + Required. CODE_INTERPRETER_CALL. + :vartype type: Literal["code_interpreter_call"] + :ivar id: The unique ID of the code interpreter tool call. Required. + :vartype id: str + :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``, + ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"], + Literal["interpreting"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"] + :ivar container_id: The ID of the container used to run the code. Required. + :vartype container_id: str + :ivar code: Required. + :vartype code: str + :ivar outputs: Required. + :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['code_interpreter_call']] + 'The type of the code interpreter tool call. Always ``code_interpreter_call``. Required.\n CODE_INTERPRETER_CALL.' + id: Required[str] + 'The unique ID of the code interpreter tool call. Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete', 'interpreting', 'failed']] + 'The status of the code interpreter tool call. Valid values are ``in_progress``, ``completed``,\n ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"],\n Literal["interpreting"], Literal["failed"]' + container_id: Required[str] + 'The ID of the container used to run the code. Required.' + code: Required[Optional[str]] + 'Required.' + outputs: Required[Optional[list[Union['_types.CodeInterpreterOutputLogs', '_types.CodeInterpreterOutputImage']]]] + 'Required.' + OutputItemCodeInterpreterToolCall.__qualname__ = 'OutputItemCodeInterpreterToolCall' + if _version_info < (3, 13): + OutputItemCodeInterpreterToolCall.__doc__ = 'Code interpreter tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the code interpreter tool call. Always ``code_interpreter_call``.\n Required. CODE_INTERPRETER_CALL.\n :vartype type: Literal["code_interpreter_call"]\n :ivar id: The unique ID of the code interpreter tool call. Required.\n :vartype id: str\n :ivar status: The status of the code interpreter tool call. Valid values are ``in_progress``,\n ``completed``, ``incomplete``, ``interpreting``, and ``failed``. Required. Is one of the\n following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"],\n Literal["interpreting"], Literal["failed"]\n :vartype status: Literal["in_progress", "completed", "incomplete", "interpreting", "failed"]\n :ivar container_id: The ID of the container used to run the code. Required.\n :vartype container_id: str\n :ivar code: Required.\n :vartype code: str\n :ivar outputs: Required.\n :vartype outputs: list[Union["CodeInterpreterOutputLogs", "CodeInterpreterOutputImage"]]\n ' + return OutputItemCodeInterpreterToolCall + + def _make_OutputItemCompactionBody(): + class OutputItemCompactionBody(TypedDict, total=False): + """Compaction item. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION. + :vartype type: Literal["compaction"] + :ivar id: The unique ID of the compaction item. Required. + :vartype id: str + :ivar encrypted_content: The encrypted content that was produced by compaction. Required. + :vartype encrypted_content: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['compaction']] + 'The type of the item. Always ``compaction``. Required. COMPACTION.' + id: Required[str] + 'The unique ID of the compaction item. Required.' + encrypted_content: Required[str] + 'The encrypted content that was produced by compaction. Required.' + OutputItemCompactionBody.__qualname__ = 'OutputItemCompactionBody' + if _version_info < (3, 13): + OutputItemCompactionBody.__doc__ = 'Compaction item.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``compaction``. Required. COMPACTION.\n :vartype type: Literal["compaction"]\n :ivar id: The unique ID of the compaction item. Required.\n :vartype id: str\n :ivar encrypted_content: The encrypted content that was produced by compaction. Required.\n :vartype encrypted_content: str\n ' + return OutputItemCompactionBody + + def _make_OutputItemComputerToolCall(): + class OutputItemComputerToolCall(TypedDict, total=False): + """Computer tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL. + :vartype type: Literal["computer_call"] + :ivar id: The unique ID of the computer call. Required. + :vartype id: str + :ivar call_id: An identifier used when responding to the tool call with output. Required. + :vartype call_id: str + :ivar action: + :vartype action: "ComputerAction" + :ivar actions: + :vartype actions: list["ComputerAction"] + :ivar pending_safety_checks: The pending safety checks for the computer call. Required. + :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['computer_call']] + 'The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.' + id: Required[str] + 'The unique ID of the computer call. Required.' + call_id: Required[str] + 'An identifier used when responding to the tool call with output. Required.' + action: '_types.ComputerAction' + actions: list['_types.ComputerAction'] + pending_safety_checks: Required[list['_types.ComputerCallSafetyCheckParam']] + 'The pending safety checks for the computer call. Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + OutputItemComputerToolCall.__qualname__ = 'OutputItemComputerToolCall' + if _version_info < (3, 13): + OutputItemComputerToolCall.__doc__ = 'Computer tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the computer call. Always ``computer_call``. Required. COMPUTER_CALL.\n :vartype type: Literal["computer_call"]\n :ivar id: The unique ID of the computer call. Required.\n :vartype id: str\n :ivar call_id: An identifier used when responding to the tool call with output. Required.\n :vartype call_id: str\n :ivar action:\n :vartype action: "ComputerAction"\n :ivar actions:\n :vartype actions: list["ComputerAction"]\n :ivar pending_safety_checks: The pending safety checks for the computer call. Required.\n :vartype pending_safety_checks: list["ComputerCallSafetyCheckParam"]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemComputerToolCall + + def _make_OutputItemComputerToolCallOutput(): + class OutputItemComputerToolCallOutput(TypedDict, total=False): + """Computer tool call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the computer tool call output. Always ``computer_call_output``. + Required. COMPUTER_CALL_OUTPUT. + :vartype type: Literal["computer_call_output"] + :ivar id: The ID of the computer tool call output. Required. + :vartype id: str + :ivar call_id: The ID of the computer tool call that produced the output. Required. + :vartype call_id: str + :ivar acknowledged_safety_checks: The safety checks reported by the API that have been + acknowledged by the developer. + :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"] + :ivar output: Required. + :vartype output: "ComputerScreenshotImage" + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['computer_call_output']] + 'The type of the computer tool call output. Always ``computer_call_output``. Required.\n COMPUTER_CALL_OUTPUT.' + id: Required[str] + 'The ID of the computer tool call output. Required.' + call_id: Required[str] + 'The ID of the computer tool call that produced the output. Required.' + acknowledged_safety_checks: list['_types.ComputerCallSafetyCheckParam'] + 'The safety checks reported by the API that have been acknowledged by the developer.' + output: Required['_types.ComputerScreenshotImage'] + 'Required.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when input items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + OutputItemComputerToolCallOutput.__qualname__ = 'OutputItemComputerToolCallOutput' + if _version_info < (3, 13): + OutputItemComputerToolCallOutput.__doc__ = 'Computer tool call output.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the computer tool call output. Always ``computer_call_output``.\n Required. COMPUTER_CALL_OUTPUT.\n :vartype type: Literal["computer_call_output"]\n :ivar id: The ID of the computer tool call output. Required.\n :vartype id: str\n :ivar call_id: The ID of the computer tool call that produced the output. Required.\n :vartype call_id: str\n :ivar acknowledged_safety_checks: The safety checks reported by the API that have been\n acknowledged by the developer.\n :vartype acknowledged_safety_checks: list["ComputerCallSafetyCheckParam"]\n :ivar output: Required.\n :vartype output: "ComputerScreenshotImage"\n :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or\n ``incomplete``. Populated when input items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemComputerToolCallOutput + + def _make_OutputItemFileSearchToolCall(): + class OutputItemFileSearchToolCall(TypedDict, total=False): + """File search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the file search tool call. Required. + :vartype id: str + :ivar type: The type of the file search tool call. Always ``file_search_call``. Required. + FILE_SEARCH_CALL. + :vartype type: Literal["file_search_call"] + :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``, + ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"], + Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"] + :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"] + :ivar queries: The queries used to search for files. Required. + :vartype queries: list[str] + :ivar results: + :vartype results: list["FileSearchToolCallResults"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + id: Required[str] + 'The unique ID of the file search tool call. Required.' + type: Required[Literal['file_search_call']] + 'The type of the file search tool call. Always ``file_search_call``. Required. FILE_SEARCH_CALL.' + status: Required[Literal['in_progress', 'searching', 'completed', 'incomplete', 'failed']] + 'The status of the file search tool call. One of ``in_progress``, ``searching``, ``incomplete``\n or ``failed``,. Required. Is one of the following types: Literal["in_progress"],\n Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"]' + queries: Required[list[str]] + 'The queries used to search for files. Required.' + results: Optional[list['_types.FileSearchToolCallResults']] + OutputItemFileSearchToolCall.__qualname__ = 'OutputItemFileSearchToolCall' + if _version_info < (3, 13): + OutputItemFileSearchToolCall.__doc__ = 'File search tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar id: The unique ID of the file search tool call. Required.\n :vartype id: str\n :ivar type: The type of the file search tool call. Always ``file_search_call``. Required.\n FILE_SEARCH_CALL.\n :vartype type: Literal["file_search_call"]\n :ivar status: The status of the file search tool call. One of ``in_progress``, ``searching``,\n ``incomplete`` or ``failed``,. Required. Is one of the following types: Literal["in_progress"],\n Literal["searching"], Literal["completed"], Literal["incomplete"], Literal["failed"]\n :vartype status: Literal["in_progress", "searching", "completed", "incomplete", "failed"]\n :ivar queries: The queries used to search for files. Required.\n :vartype queries: list[str]\n :ivar results:\n :vartype results: list["FileSearchToolCallResults"]\n ' + return OutputItemFileSearchToolCall + + def _make_OutputItemFunctionShellCall(): + class OutputItemFunctionShellCall(TypedDict, total=False): + """Shell tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL. + :vartype type: Literal["shell_call"] + :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar action: The shell commands and limits that describe how to run the tool call. Required. + :vartype action: "FunctionShellAction" + :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallStatus + :ivar environment: Required. + :vartype environment: "FunctionShellCallEnvironment" + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['shell_call']] + 'The type of the item. Always ``shell_call``. Required. SHELL_CALL.' + id: Required[str] + 'The unique ID of the shell tool call. Populated when this item is returned via API. Required.' + call_id: Required[str] + 'The unique ID of the shell tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + action: Required['_types.FunctionShellAction'] + 'The shell commands and limits that describe how to run the tool call. Required.' + status: Required[_resolve('FunctionShellCallStatus')] + 'The status of the shell call. One of ``in_progress``, ``completed``, or ``incomplete``.\n Required. Known values are: "in_progress", "completed", and "incomplete".' + environment: Required[Optional['_types.FunctionShellCallEnvironment']] + 'Required.' + OutputItemFunctionShellCall.__qualname__ = 'OutputItemFunctionShellCall' + if _version_info < (3, 13): + OutputItemFunctionShellCall.__doc__ = 'Shell tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``shell_call``. Required. SHELL_CALL.\n :vartype type: Literal["shell_call"]\n :ivar id: The unique ID of the shell tool call. Populated when this item is returned via API.\n Required.\n :vartype id: str\n :ivar call_id: The unique ID of the shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar action: The shell commands and limits that describe how to run the tool call. Required.\n :vartype action: "FunctionShellAction"\n :ivar status: The status of the shell call. One of ``in_progress``, ``completed``, or\n ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionShellCallStatus\n :ivar environment: Required.\n :vartype environment: "FunctionShellCallEnvironment"\n ' + return OutputItemFunctionShellCall + + def _make_OutputItemFunctionShellCallOutput(): + class OutputItemFunctionShellCallOutput(TypedDict, total=False): + """Shell call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the shell call output. Always ``shell_call_output``. Required. + SHELL_CALL_OUTPUT. + :vartype type: Literal["shell_call_output"] + :ivar id: The unique ID of the shell call output. Populated when this item is returned via API. + Required. + :vartype id: str + :ivar call_id: The unique ID of the shell tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or + ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionShellCallOutputStatusEnum + :ivar output: An array of shell call output contents. Required. + :vartype output: list["FunctionShellCallOutputContent"] + :ivar max_output_length: Required. + :vartype max_output_length: int + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['shell_call_output']] + 'The type of the shell call output. Always ``shell_call_output``. Required. SHELL_CALL_OUTPUT.' + id: Required[str] + 'The unique ID of the shell call output. Populated when this item is returned via API. Required.' + call_id: Required[str] + 'The unique ID of the shell tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + status: Required[_resolve('FunctionShellCallOutputStatusEnum')] + 'The status of the shell call output. One of ``in_progress``, ``completed``, or ``incomplete``.\n Required. Known values are: "in_progress", "completed", and "incomplete".' + output: Required[list['_types.FunctionShellCallOutputContent']] + 'An array of shell call output contents. Required.' + max_output_length: Required[Optional[int]] + 'Required.' + OutputItemFunctionShellCallOutput.__qualname__ = 'OutputItemFunctionShellCallOutput' + if _version_info < (3, 13): + OutputItemFunctionShellCallOutput.__doc__ = 'Shell call output.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the shell call output. Always ``shell_call_output``. Required.\n SHELL_CALL_OUTPUT.\n :vartype type: Literal["shell_call_output"]\n :ivar id: The unique ID of the shell call output. Populated when this item is returned via API.\n Required.\n :vartype id: str\n :ivar call_id: The unique ID of the shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar status: The status of the shell call output. One of ``in_progress``, ``completed``, or\n ``incomplete``. Required. Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionShellCallOutputStatusEnum\n :ivar output: An array of shell call output contents. Required.\n :vartype output: list["FunctionShellCallOutputContent"]\n :ivar max_output_length: Required.\n :vartype max_output_length: int\n ' + return OutputItemFunctionShellCallOutput + + def _make_OutputItemFunctionToolCall(): + class OutputItemFunctionToolCall(TypedDict, total=False): + """Function tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call. Required. + :vartype id: str + :ivar type: The type of the function tool call. Always ``function_call``. Required. + FUNCTION_CALL. + :vartype type: Literal["function_call"] + :ivar call_id: The unique ID of the function tool call generated by the model. Required. + :vartype call_id: str + :ivar caller: + :vartype caller: "ToolCallCaller" + :ivar namespace: The namespace of the function to run. + :vartype namespace: str + :ivar name: The name of the function to run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments to pass to the function. Required. + :vartype arguments: str + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + id: Required[str] + 'The unique ID of the function tool call. Required.' + type: Required[Literal['function_call']] + 'The type of the function tool call. Always ``function_call``. Required. FUNCTION_CALL.' + call_id: Required[str] + 'The unique ID of the function tool call generated by the model. Required.' + caller: Optional['_types.ToolCallCaller'] + namespace: str + 'The namespace of the function to run.' + name: Required[str] + 'The name of the function to run. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the function. Required.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + OutputItemFunctionToolCall.__qualname__ = 'OutputItemFunctionToolCall' + if _version_info < (3, 13): + OutputItemFunctionToolCall.__doc__ = 'Function tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar id: The unique ID of the function tool call. Required.\n :vartype id: str\n :ivar type: The type of the function tool call. Always ``function_call``. Required.\n FUNCTION_CALL.\n :vartype type: Literal["function_call"]\n :ivar call_id: The unique ID of the function tool call generated by the model. Required.\n :vartype call_id: str\n :ivar caller:\n :vartype caller: "ToolCallCaller"\n :ivar namespace: The namespace of the function to run.\n :vartype namespace: str\n :ivar name: The name of the function to run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments to pass to the function. Required.\n :vartype arguments: str\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemFunctionToolCall + + def _make_OutputItemFunctionToolCallOutput(): + class OutputItemFunctionToolCallOutput(TypedDict, total=False): + """Function tool call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the function tool call output. Populated when this item is returned + via API. Required. + :vartype id: str + :ivar type: The type of the function tool call output. Always ``function_call_output``. + Required. FUNCTION_CALL_OUTPUT. + :vartype type: Literal["function_call_output"] + :ivar call_id: The unique ID of the function tool call generated by the model. + :vartype call_id: str + :ivar name: The name of the tool that produced the output. + :vartype name: str + :ivar namespace: The namespace of the tool that produced the output. + :vartype namespace: str + :ivar caller: + :vartype caller: "ToolCallCallerParam" + :ivar output: The output from the function call generated by your code. Can be a string or an + list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] + type. + :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + id: Required[str] + 'The unique ID of the function tool call output. Populated when this item is returned via API.\n Required.' + type: Required[Literal['function_call_output']] + 'The type of the function tool call output. Always ``function_call_output``. Required.\n FUNCTION_CALL_OUTPUT.' + call_id: str + 'The unique ID of the function tool call generated by the model.' + name: str + 'The name of the tool that produced the output.' + namespace: str + 'The namespace of the tool that produced the output.' + caller: Optional['_types.ToolCallCallerParam'] + output: Required[Union[str, list['_types.FunctionAndCustomToolCallOutput']]] + 'The output from the function call generated by your code. Can be a string or an list of output\n content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput] type.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + OutputItemFunctionToolCallOutput.__qualname__ = 'OutputItemFunctionToolCallOutput' + if _version_info < (3, 13): + OutputItemFunctionToolCallOutput.__doc__ = 'Function tool call output.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar id: The unique ID of the function tool call output. Populated when this item is returned\n via API. Required.\n :vartype id: str\n :ivar type: The type of the function tool call output. Always ``function_call_output``.\n Required. FUNCTION_CALL_OUTPUT.\n :vartype type: Literal["function_call_output"]\n :ivar call_id: The unique ID of the function tool call generated by the model.\n :vartype call_id: str\n :ivar name: The name of the tool that produced the output.\n :vartype name: str\n :ivar namespace: The namespace of the tool that produced the output.\n :vartype namespace: str\n :ivar caller:\n :vartype caller: "ToolCallCallerParam"\n :ivar output: The output from the function call generated by your code. Can be a string or an\n list of output content. Required. Is either a str type or a [FunctionAndCustomToolCallOutput]\n type.\n :vartype output: Union[str, list["FunctionAndCustomToolCallOutput"]]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemFunctionToolCallOutput + + def _make_OutputItemImageGenToolCall(): + class OutputItemImageGenToolCall(TypedDict, total=False): + """Image generation call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the image generation call. Always ``image_generation_call``. Required. + IMAGE_GENERATION_CALL. + :vartype type: Literal["image_generation_call"] + :ivar id: The unique ID of the image generation call. Required. + :vartype id: str + :ivar status: The status of the image generation call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"] + :vartype status: Literal["in_progress", "completed", "generating", "failed"] + :ivar result: Required. + :vartype result: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['image_generation_call']] + 'The type of the image generation call. Always ``image_generation_call``. Required.\n IMAGE_GENERATION_CALL.' + id: Required[str] + 'The unique ID of the image generation call. Required.' + status: Required[Literal['in_progress', 'completed', 'generating', 'failed']] + 'The status of the image generation call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"]' + result: Required[Optional[str]] + 'Required.' + OutputItemImageGenToolCall.__qualname__ = 'OutputItemImageGenToolCall' + if _version_info < (3, 13): + OutputItemImageGenToolCall.__doc__ = 'Image generation call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the image generation call. Always ``image_generation_call``. Required.\n IMAGE_GENERATION_CALL.\n :vartype type: Literal["image_generation_call"]\n :ivar id: The unique ID of the image generation call. Required.\n :vartype id: str\n :ivar status: The status of the image generation call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["generating"], Literal["failed"]\n :vartype status: Literal["in_progress", "completed", "generating", "failed"]\n :ivar result: Required.\n :vartype result: str\n ' + return OutputItemImageGenToolCall + + def _make_OutputItemLocalShellToolCall(): + class OutputItemLocalShellToolCall(TypedDict, total=False): + """Local shell call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell call. Always ``local_shell_call``. Required. + LOCAL_SHELL_CALL. + :vartype type: Literal["local_shell_call"] + :ivar id: The unique ID of the local shell call. Required. + :vartype id: str + :ivar call_id: The unique ID of the local shell tool call generated by the model. Required. + :vartype call_id: str + :ivar action: Required. + :vartype action: "LocalShellExecAction" + :ivar status: The status of the local shell call. Required. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['local_shell_call']] + 'The type of the local shell call. Always ``local_shell_call``. Required. LOCAL_SHELL_CALL.' + id: Required[str] + 'The unique ID of the local shell call. Required.' + call_id: Required[str] + 'The unique ID of the local shell tool call generated by the model. Required.' + action: Required['_types.LocalShellExecAction'] + 'Required.' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the local shell call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + OutputItemLocalShellToolCall.__qualname__ = 'OutputItemLocalShellToolCall' + if _version_info < (3, 13): + OutputItemLocalShellToolCall.__doc__ = 'Local shell call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the local shell call. Always ``local_shell_call``. Required.\n LOCAL_SHELL_CALL.\n :vartype type: Literal["local_shell_call"]\n :ivar id: The unique ID of the local shell call. Required.\n :vartype id: str\n :ivar call_id: The unique ID of the local shell tool call generated by the model. Required.\n :vartype call_id: str\n :ivar action: Required.\n :vartype action: "LocalShellExecAction"\n :ivar status: The status of the local shell call. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemLocalShellToolCall + + def _make_OutputItemLocalShellToolCallOutput(): + class OutputItemLocalShellToolCallOutput(TypedDict, total=False): + """Local shell call output. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``. + Required. LOCAL_SHELL_CALL_OUTPUT. + :vartype type: Literal["local_shell_call_output"] + :ivar id: The unique ID of the local shell tool call generated by the model. Required. + :vartype id: str + :ivar output: A JSON string of the output of the local shell tool call. Required. + :vartype output: str + :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['local_shell_call_output']] + 'The type of the local shell tool call output. Always ``local_shell_call_output``. Required.\n LOCAL_SHELL_CALL_OUTPUT.' + id: Required[str] + 'The unique ID of the local shell tool call generated by the model. Required.' + output: Required[str] + 'A JSON string of the output of the local shell tool call. Required.' + status: Optional[Literal['in_progress', 'completed', 'incomplete']] + 'Is one of the following types: Literal["in_progress"], Literal["completed"],\n Literal["incomplete"]' + OutputItemLocalShellToolCallOutput.__qualname__ = 'OutputItemLocalShellToolCallOutput' + if _version_info < (3, 13): + OutputItemLocalShellToolCallOutput.__doc__ = 'Local shell call output.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the local shell tool call output. Always ``local_shell_call_output``.\n Required. LOCAL_SHELL_CALL_OUTPUT.\n :vartype type: Literal["local_shell_call_output"]\n :ivar id: The unique ID of the local shell tool call generated by the model. Required.\n :vartype id: str\n :ivar output: A JSON string of the output of the local shell tool call. Required.\n :vartype output: str\n :ivar status: Is one of the following types: Literal["in_progress"], Literal["completed"],\n Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemLocalShellToolCallOutput + + def _make_OutputItemMcpApprovalRequest(): + class OutputItemMcpApprovalRequest(TypedDict, total=False): + """MCP approval request. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_request``. Required. + MCP_APPROVAL_REQUEST. + :vartype type: Literal["mcp_approval_request"] + :ivar id: The unique ID of the approval request. Required. + :vartype id: str + :ivar server_label: The label of the MCP server making the request. Required. + :vartype server_label: str + :ivar name: The name of the tool to run. Required. + :vartype name: str + :ivar arguments: A JSON string of arguments for the tool. Required. + :vartype arguments: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['mcp_approval_request']] + 'The type of the item. Always ``mcp_approval_request``. Required. MCP_APPROVAL_REQUEST.' + id: Required[str] + 'The unique ID of the approval request. Required.' + server_label: Required[str] + 'The label of the MCP server making the request. Required.' + name: Required[str] + 'The name of the tool to run. Required.' + arguments: Required[str] + 'A JSON string of arguments for the tool. Required.' + OutputItemMcpApprovalRequest.__qualname__ = 'OutputItemMcpApprovalRequest' + if _version_info < (3, 13): + OutputItemMcpApprovalRequest.__doc__ = 'MCP approval request.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``mcp_approval_request``. Required.\n MCP_APPROVAL_REQUEST.\n :vartype type: Literal["mcp_approval_request"]\n :ivar id: The unique ID of the approval request. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server making the request. Required.\n :vartype server_label: str\n :ivar name: The name of the tool to run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of arguments for the tool. Required.\n :vartype arguments: str\n ' + return OutputItemMcpApprovalRequest + + def _make_OutputItemMcpApprovalResponseResource(): + class OutputItemMcpApprovalResponseResource(TypedDict, total=False): + """MCP approval response. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_approval_response``. Required. + MCP_APPROVAL_RESPONSE. + :vartype type: Literal["mcp_approval_response"] + :ivar id: The unique ID of the approval response. Required. + :vartype id: str + :ivar approval_request_id: The ID of the approval request being answered. Required. + :vartype approval_request_id: str + :ivar approve: Whether the request was approved. Required. + :vartype approve: bool + :ivar reason: + :vartype reason: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['mcp_approval_response']] + 'The type of the item. Always ``mcp_approval_response``. Required. MCP_APPROVAL_RESPONSE.' + id: Required[str] + 'The unique ID of the approval response. Required.' + approval_request_id: Required[str] + 'The ID of the approval request being answered. Required.' + approve: Required[bool] + 'Whether the request was approved. Required.' + reason: Optional[str] + OutputItemMcpApprovalResponseResource.__qualname__ = 'OutputItemMcpApprovalResponseResource' + if _version_info < (3, 13): + OutputItemMcpApprovalResponseResource.__doc__ = 'MCP approval response.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``mcp_approval_response``. Required.\n MCP_APPROVAL_RESPONSE.\n :vartype type: Literal["mcp_approval_response"]\n :ivar id: The unique ID of the approval response. Required.\n :vartype id: str\n :ivar approval_request_id: The ID of the approval request being answered. Required.\n :vartype approval_request_id: str\n :ivar approve: Whether the request was approved. Required.\n :vartype approve: bool\n :ivar reason:\n :vartype reason: str\n ' + return OutputItemMcpApprovalResponseResource + + def _make_OutputItemMcpListTools(): + class OutputItemMcpListTools(TypedDict, total=False): + """MCP list tools. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS. + :vartype type: Literal["mcp_list_tools"] + :ivar id: The unique ID of the list. Required. + :vartype id: str + :ivar server_label: The label of the MCP server. Required. + :vartype server_label: str + :ivar tools: The tools available on the server. Required. + :vartype tools: list["MCPListToolsTool"] + :ivar error: + :vartype error: "RealtimeMCPError" + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['mcp_list_tools']] + 'The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.' + id: Required[str] + 'The unique ID of the list. Required.' + server_label: Required[str] + 'The label of the MCP server. Required.' + tools: Required[list['_types.MCPListToolsTool']] + 'The tools available on the server. Required.' + error: '_types.RealtimeMCPError' + OutputItemMcpListTools.__qualname__ = 'OutputItemMcpListTools' + if _version_info < (3, 13): + OutputItemMcpListTools.__doc__ = 'MCP list tools.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``mcp_list_tools``. Required. MCP_LIST_TOOLS.\n :vartype type: Literal["mcp_list_tools"]\n :ivar id: The unique ID of the list. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server. Required.\n :vartype server_label: str\n :ivar tools: The tools available on the server. Required.\n :vartype tools: list["MCPListToolsTool"]\n :ivar error:\n :vartype error: "RealtimeMCPError"\n ' + return OutputItemMcpListTools + + def _make_OutputItemMcpToolCall(): + class OutputItemMcpToolCall(TypedDict, total=False): + """MCP tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL. + :vartype type: Literal["mcp_call"] + :ivar id: The unique ID of the tool call. Required. + :vartype id: str + :ivar server_label: The label of the MCP server running the tool. Required. + :vartype server_label: str + :ivar name: The name of the tool that was run. Required. + :vartype name: str + :ivar arguments: A JSON string of the arguments passed to the tool. Required. + :vartype arguments: str + :ivar output: + :vartype output: str + :ivar error: The error from the tool call, if any. + :vartype error: dict[str, Any] + :ivar status: The status of the tool call. One of ``in_progress``, ``completed``, + ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed", + "incomplete", "calling", and "failed". + :vartype status: MCPToolCallStatus + :ivar approval_request_id: + :vartype approval_request_id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['mcp_call']] + 'The type of the item. Always ``mcp_call``. Required. MCP_CALL.' + id: Required[str] + 'The unique ID of the tool call. Required.' + server_label: Required[str] + 'The label of the MCP server running the tool. Required.' + name: Required[str] + 'The name of the tool that was run. Required.' + arguments: Required[str] + 'A JSON string of the arguments passed to the tool. Required.' + output: Optional[str] + error: dict[str, Any] + 'The error from the tool call, if any.' + status: _resolve('MCPToolCallStatus') + 'The status of the tool call. One of ``in_progress``, ``completed``, ``incomplete``,\n ``calling``, or ``failed``. Known values are: "in_progress", "completed", "incomplete",\n "calling", and "failed".' + approval_request_id: Optional[str] + OutputItemMcpToolCall.__qualname__ = 'OutputItemMcpToolCall' + if _version_info < (3, 13): + OutputItemMcpToolCall.__doc__ = 'MCP tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``mcp_call``. Required. MCP_CALL.\n :vartype type: Literal["mcp_call"]\n :ivar id: The unique ID of the tool call. Required.\n :vartype id: str\n :ivar server_label: The label of the MCP server running the tool. Required.\n :vartype server_label: str\n :ivar name: The name of the tool that was run. Required.\n :vartype name: str\n :ivar arguments: A JSON string of the arguments passed to the tool. Required.\n :vartype arguments: str\n :ivar output:\n :vartype output: str\n :ivar error: The error from the tool call, if any.\n :vartype error: dict[str, Any]\n :ivar status: The status of the tool call. One of ``in_progress``, ``completed``,\n ``incomplete``, ``calling``, or ``failed``. Known values are: "in_progress", "completed",\n "incomplete", "calling", and "failed".\n :vartype status: MCPToolCallStatus\n :ivar approval_request_id:\n :vartype approval_request_id: str\n ' + return OutputItemMcpToolCall + + def _make_OutputItemMessage(): + class OutputItemMessage(TypedDict, total=False): + """Message. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE. + :vartype type: Literal["message"] + :ivar id: The unique ID of the message. Required. + :vartype id: str + :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Required. Known values are: "in_progress", + "completed", and "incomplete". + :vartype status: MessageStatus + :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, + ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are: + "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool". + :vartype role: MessageRole + :ivar content: The content of the message. Required. + :vartype content: list["MessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['message']] + 'The type of the message. Always set to ``message``. Required. MESSAGE.' + id: Required[str] + 'The unique ID of the message. Required.' + status: Required[_resolve('MessageStatus')] + 'The status of item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated when\n items are returned via API. Required. Known values are: "in_progress", "completed", and\n "incomplete".' + role: Required[_resolve('MessageRole')] + 'The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``, ``critic``,\n ``discriminator``, ``developer``, or ``tool``. Required. Known values are: "unknown",\n "user", "assistant", "system", "critic", "discriminator", "developer", and\n "tool".' + content: Required[list['_types.MessageContent']] + 'The content of the message. Required.' + phase: Optional[_resolve('MessagePhase')] + 'Known values are: "commentary" and "final_answer".' + OutputItemMessage.__qualname__ = 'OutputItemMessage' + if _version_info < (3, 13): + OutputItemMessage.__doc__ = 'Message.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the message. Always set to ``message``. Required. MESSAGE.\n :vartype type: Literal["message"]\n :ivar id: The unique ID of the message. Required.\n :vartype id: str\n :ivar status: The status of item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Required. Known values are: "in_progress",\n "completed", and "incomplete".\n :vartype status: MessageStatus\n :ivar role: The role of the message. One of ``unknown``, ``user``, ``assistant``, ``system``,\n ``critic``, ``discriminator``, ``developer``, or ``tool``. Required. Known values are:\n "unknown", "user", "assistant", "system", "critic", "discriminator", "developer", and "tool".\n :vartype role: MessageRole\n :ivar content: The content of the message. Required.\n :vartype content: list["MessageContent"]\n :ivar phase: Known values are: "commentary" and "final_answer".\n :vartype phase: MessagePhase\n ' + return OutputItemMessage + + def _make_OutputItemOutputMessage(): + class OutputItemOutputMessage(TypedDict, total=False): + """Output message. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the output message. Required. + :vartype id: str + :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE. + :vartype type: Literal["output_message"] + :ivar role: The role of the output message. Always ``assistant``. Required. Default value is + "assistant". + :vartype role: Literal["assistant"] + :ivar content: The content of the output message. Required. + :vartype content: list["OutputMessageContent"] + :ivar phase: Known values are: "commentary" and "final_answer". + :vartype phase: MessagePhase + :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or + ``incomplete``. Populated when input items are returned via API. Required. Is one of the + following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + id: Required[str] + 'The unique ID of the output message. Required.' + type: Required[Literal['output_message']] + 'The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.' + role: Required[Literal['assistant']] + 'The role of the output message. Always ``assistant``. Required. Default value is "assistant".' + content: Required[list['_types.OutputMessageContent']] + 'The content of the output message. Required.' + phase: Optional[_resolve('MessagePhase')] + 'Known values are: "commentary" and "final_answer".' + status: Required[Literal['in_progress', 'completed', 'incomplete']] + 'The status of the message input. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when input items are returned via API. Required. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]' + OutputItemOutputMessage.__qualname__ = 'OutputItemOutputMessage' + if _version_info < (3, 13): + OutputItemOutputMessage.__doc__ = 'Output message.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar id: The unique ID of the output message. Required.\n :vartype id: str\n :ivar type: The type of the output message. Always ``message``. Required. OUTPUT_MESSAGE.\n :vartype type: Literal["output_message"]\n :ivar role: The role of the output message. Always ``assistant``. Required. Default value is\n "assistant".\n :vartype role: Literal["assistant"]\n :ivar content: The content of the output message. Required.\n :vartype content: list["OutputMessageContent"]\n :ivar phase: Known values are: "commentary" and "final_answer".\n :vartype phase: MessagePhase\n :ivar status: The status of the message input. One of ``in_progress``, ``completed``, or\n ``incomplete``. Populated when input items are returned via API. Required. Is one of the\n following types: Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemOutputMessage + + def _make_OutputItemProgram(): + class OutputItemProgram(TypedDict, total=False): + """OutputItemProgram. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``program``. Required. PROGRAM. + :vartype type: Literal["program"] + :ivar id: The unique ID of the program item. Required. + :vartype id: str + :ivar call_id: The stable call ID of the program item. Required. + :vartype call_id: str + :ivar code: The JavaScript source executed by programmatic tool calling. Required. + :vartype code: str + :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required. + :vartype fingerprint: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['program']] + 'The type of the item. Always ``program``. Required. PROGRAM.' + id: Required[str] + 'The unique ID of the program item. Required.' + call_id: Required[str] + 'The stable call ID of the program item. Required.' + code: Required[str] + 'The JavaScript source executed by programmatic tool calling. Required.' + fingerprint: Required[str] + 'Opaque program replay fingerprint that must be round-tripped. Required.' + OutputItemProgram.__qualname__ = 'OutputItemProgram' + if _version_info < (3, 13): + OutputItemProgram.__doc__ = 'OutputItemProgram.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``program``. Required. PROGRAM.\n :vartype type: Literal["program"]\n :ivar id: The unique ID of the program item. Required.\n :vartype id: str\n :ivar call_id: The stable call ID of the program item. Required.\n :vartype call_id: str\n :ivar code: The JavaScript source executed by programmatic tool calling. Required.\n :vartype code: str\n :ivar fingerprint: Opaque program replay fingerprint that must be round-tripped. Required.\n :vartype fingerprint: str\n ' + return OutputItemProgram + + def _make_OutputItemProgramOutput(): + class OutputItemProgramOutput(TypedDict, total=False): + """OutputItemProgramOutput. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT. + :vartype type: Literal["program_output"] + :ivar id: The unique ID of the program output item. Required. + :vartype id: str + :ivar call_id: The call ID of the program item. Required. + :vartype call_id: str + :ivar result: The result produced by the program item. Required. + :vartype result: str + :ivar status: The terminal status of the program output item. Required. Known values are: + "completed" and "incomplete". + :vartype status: ProgramOutputStatus + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['program_output']] + 'The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.' + id: Required[str] + 'The unique ID of the program output item. Required.' + call_id: Required[str] + 'The call ID of the program item. Required.' + result: Required[str] + 'The result produced by the program item. Required.' + status: Required[_resolve('ProgramOutputStatus')] + 'The terminal status of the program output item. Required. Known values are: "completed" and\n "incomplete".' + OutputItemProgramOutput.__qualname__ = 'OutputItemProgramOutput' + if _version_info < (3, 13): + OutputItemProgramOutput.__doc__ = 'OutputItemProgramOutput.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``program_output``. Required. PROGRAM_OUTPUT.\n :vartype type: Literal["program_output"]\n :ivar id: The unique ID of the program output item. Required.\n :vartype id: str\n :ivar call_id: The call ID of the program item. Required.\n :vartype call_id: str\n :ivar result: The result produced by the program item. Required.\n :vartype result: str\n :ivar status: The terminal status of the program output item. Required. Known values are:\n "completed" and "incomplete".\n :vartype status: ProgramOutputStatus\n ' + return OutputItemProgramOutput + + def _make_OutputItemReasoningItem(): + class OutputItemReasoningItem(TypedDict, total=False): + """Reasoning. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the object. Always ``reasoning``. Required. REASONING. + :vartype type: Literal["reasoning"] + :ivar id: The unique identifier of the reasoning content. Required. + :vartype id: str + :ivar encrypted_content: + :vartype encrypted_content: str + :ivar summary: Reasoning summary content. Required. + :vartype summary: list["SummaryTextContent"] + :ivar content: Reasoning text content. + :vartype content: list["ReasoningTextContent"] + :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. + Populated when items are returned via API. Is one of the following types: + Literal["in_progress"], Literal["completed"], Literal["incomplete"] + :vartype status: Literal["in_progress", "completed", "incomplete"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['reasoning']] + 'The type of the object. Always ``reasoning``. Required. REASONING.' + id: Required[str] + 'The unique identifier of the reasoning content. Required.' + encrypted_content: Optional[str] + summary: Required[list['_types.SummaryTextContent']] + 'Reasoning summary content. Required.' + content: list['_types.ReasoningTextContent'] + 'Reasoning text content.' + status: Literal['in_progress', 'completed', 'incomplete'] + 'The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``. Populated\n when items are returned via API. Is one of the following types: Literal["in_progress"],\n Literal["completed"], Literal["incomplete"]' + OutputItemReasoningItem.__qualname__ = 'OutputItemReasoningItem' + if _version_info < (3, 13): + OutputItemReasoningItem.__doc__ = 'Reasoning.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the object. Always ``reasoning``. Required. REASONING.\n :vartype type: Literal["reasoning"]\n :ivar id: The unique identifier of the reasoning content. Required.\n :vartype id: str\n :ivar encrypted_content:\n :vartype encrypted_content: str\n :ivar summary: Reasoning summary content. Required.\n :vartype summary: list["SummaryTextContent"]\n :ivar content: Reasoning text content.\n :vartype content: list["ReasoningTextContent"]\n :ivar status: The status of the item. One of ``in_progress``, ``completed``, or ``incomplete``.\n Populated when items are returned via API. Is one of the following types:\n Literal["in_progress"], Literal["completed"], Literal["incomplete"]\n :vartype status: Literal["in_progress", "completed", "incomplete"]\n ' + return OutputItemReasoningItem + + def _make_OutputItemToolSearchCall(): + class OutputItemToolSearchCall(TypedDict, total=False): + """OutputItemToolSearchCall. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. + :vartype type: Literal["tool_search_call"] + :ivar id: The unique ID of the tool search call item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar arguments: Arguments used for the tool search call. Required. + :vartype arguments: Any + :ivar status: The status of the tool search call item that was recorded. Required. Known values + are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallStatus + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['tool_search_call']] + 'The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.' + id: Required[str] + 'The unique ID of the tool search call item. Required.' + call_id: Required[Optional[str]] + 'Required.' + execution: Required[_resolve('ToolSearchExecutionType')] + 'Whether tool search was executed by the server or by the client. Required. Known values are:\n "server" and "client".' + arguments: Required[Any] + 'Arguments used for the tool search call. Required.' + status: Required[_resolve('FunctionCallStatus')] + 'The status of the tool search call item that was recorded. Required. Known values are:\n "in_progress", "completed", and "incomplete".' + created_by: str + 'The identifier of the actor that created the item.' + OutputItemToolSearchCall.__qualname__ = 'OutputItemToolSearchCall' + if _version_info < (3, 13): + OutputItemToolSearchCall.__doc__ = 'OutputItemToolSearchCall.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.\n :vartype type: Literal["tool_search_call"]\n :ivar id: The unique ID of the tool search call item. Required.\n :vartype id: str\n :ivar call_id: Required.\n :vartype call_id: str\n :ivar execution: Whether tool search was executed by the server or by the client. Required.\n Known values are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar arguments: Arguments used for the tool search call. Required.\n :vartype arguments: Any\n :ivar status: The status of the tool search call item that was recorded. Required. Known values\n are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallStatus\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return OutputItemToolSearchCall + + def _make_OutputItemToolSearchOutput(): + class OutputItemToolSearchOutput(TypedDict, total=False): + """OutputItemToolSearchOutput. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. + :vartype type: Literal["tool_search_output"] + :ivar id: The unique ID of the tool search output item. Required. + :vartype id: str + :ivar call_id: Required. + :vartype call_id: str + :ivar execution: Whether tool search was executed by the server or by the client. Required. + Known values are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar tools: The loaded tool definitions returned by tool search. Required. + :vartype tools: list["Tool"] + :ivar status: The status of the tool search output item that was recorded. Required. Known + values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallOutputStatusEnum + :ivar created_by: The identifier of the actor that created the item. + :vartype created_by: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['tool_search_output']] + 'The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.' + id: Required[str] + 'The unique ID of the tool search output item. Required.' + call_id: Required[Optional[str]] + 'Required.' + execution: Required[_resolve('ToolSearchExecutionType')] + 'Whether tool search was executed by the server or by the client. Required. Known values are:\n "server" and "client".' + tools: Required[list['_types.Tool']] + 'The loaded tool definitions returned by tool search. Required.' + status: Required[_resolve('FunctionCallOutputStatusEnum')] + 'The status of the tool search output item that was recorded. Required. Known values are:\n "in_progress", "completed", and "incomplete".' + created_by: str + 'The identifier of the actor that created the item.' + OutputItemToolSearchOutput.__qualname__ = 'OutputItemToolSearchOutput' + if _version_info < (3, 13): + OutputItemToolSearchOutput.__doc__ = 'OutputItemToolSearchOutput.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: The type of the item. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.\n :vartype type: Literal["tool_search_output"]\n :ivar id: The unique ID of the tool search output item. Required.\n :vartype id: str\n :ivar call_id: Required.\n :vartype call_id: str\n :ivar execution: Whether tool search was executed by the server or by the client. Required.\n Known values are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar tools: The loaded tool definitions returned by tool search. Required.\n :vartype tools: list["Tool"]\n :ivar status: The status of the tool search output item that was recorded. Required. Known\n values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallOutputStatusEnum\n :ivar created_by: The identifier of the actor that created the item.\n :vartype created_by: str\n ' + return OutputItemToolSearchOutput + + def _make_OutputItemWebSearchToolCall(): + class OutputItemWebSearchToolCall(TypedDict, total=False): + """Web search tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar id: The unique ID of the web search tool call. Required. + :vartype id: str + :ivar type: The type of the web search tool call. Always ``web_search_call``. Required. + WEB_SEARCH_CALL. + :vartype type: Literal["web_search_call"] + :ivar status: The status of the web search tool call. Required. Is one of the following types: + Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"], + Literal["incomplete"] + :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"] + :ivar action: An object describing the specific action taken in this web search call. Includes + details on how the model used the web (search, open_page, find_in_page). Required. Is one of + the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind + :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage", + "WebSearchActionFind"] + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + id: Required[str] + 'The unique ID of the web search tool call. Required.' + type: Required[Literal['web_search_call']] + 'The type of the web search tool call. Always ``web_search_call``. Required. WEB_SEARCH_CALL.' + status: Required[Literal['in_progress', 'searching', 'completed', 'failed', 'incomplete']] + 'The status of the web search tool call. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"],\n Literal["incomplete"]' + action: Required[Union['_types.WebSearchActionSearch', '_types.WebSearchActionOpenPage', '_types.WebSearchActionFind']] + 'An object describing the specific action taken in this web search call. Includes details on how\n the model used the web (search, open_page, find_in_page). Required. Is one of the following\n types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind' + OutputItemWebSearchToolCall.__qualname__ = 'OutputItemWebSearchToolCall' + if _version_info < (3, 13): + OutputItemWebSearchToolCall.__doc__ = 'Web search tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar id: The unique ID of the web search tool call. Required.\n :vartype id: str\n :ivar type: The type of the web search tool call. Always ``web_search_call``. Required.\n WEB_SEARCH_CALL.\n :vartype type: Literal["web_search_call"]\n :ivar status: The status of the web search tool call. Required. Is one of the following types:\n Literal["in_progress"], Literal["searching"], Literal["completed"], Literal["failed"],\n Literal["incomplete"]\n :vartype status: Literal["in_progress", "searching", "completed", "failed", "incomplete"]\n :ivar action: An object describing the specific action taken in this web search call. Includes\n details on how the model used the web (search, open_page, find_in_page). Required. Is one of\n the following types: WebSearchActionSearch, WebSearchActionOpenPage, WebSearchActionFind\n :vartype action: Union["WebSearchActionSearch", "WebSearchActionOpenPage",\n "WebSearchActionFind"]\n ' + return OutputItemWebSearchToolCall + + def _make_OutputMessageContentOutputTextContent(): + class OutputMessageContentOutputTextContent(TypedDict, total=False): + """Output text. + + :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT. + :vartype type: Literal["output_text"] + :ivar text: The text output from the model. Required. + :vartype text: str + :ivar annotations: The annotations of the text output. + :vartype annotations: list["Annotation"] + :ivar logprobs: + :vartype logprobs: list["LogProb"] + """ + type: Required[Literal['output_text']] + 'The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.' + text: Required[str] + 'The text output from the model. Required.' + annotations: list['_types.Annotation'] + 'The annotations of the text output.' + logprobs: list['_types.LogProb'] + OutputMessageContentOutputTextContent.__qualname__ = 'OutputMessageContentOutputTextContent' + if _version_info < (3, 13): + OutputMessageContentOutputTextContent.__doc__ = 'Output text.\n\n :ivar type: The type of the output text. Always ``output_text``. Required. OUTPUT_TEXT.\n :vartype type: Literal["output_text"]\n :ivar text: The text output from the model. Required.\n :vartype text: str\n :ivar annotations: The annotations of the text output.\n :vartype annotations: list["Annotation"]\n :ivar logprobs:\n :vartype logprobs: list["LogProb"]\n ' + return OutputMessageContentOutputTextContent + + def _make_OutputMessageContentRefusalContent(): + class OutputMessageContentRefusalContent(TypedDict, total=False): + """Refusal. + + :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL. + :vartype type: Literal["refusal"] + :ivar refusal: The refusal explanation from the model. Required. + :vartype refusal: str + """ + type: Required[Literal['refusal']] + 'The type of the refusal. Always ``refusal``. Required. REFUSAL.' + refusal: Required[str] + 'The refusal explanation from the model. Required.' + OutputMessageContentRefusalContent.__qualname__ = 'OutputMessageContentRefusalContent' + if _version_info < (3, 13): + OutputMessageContentRefusalContent.__doc__ = 'Refusal.\n\n :ivar type: The type of the refusal. Always ``refusal``. Required. REFUSAL.\n :vartype type: Literal["refusal"]\n :ivar refusal: The refusal explanation from the model. Required.\n :vartype refusal: str\n ' + return OutputMessageContentRefusalContent + + def _make_ProgrammaticToolCallingParam(): + class ProgrammaticToolCallingParam(TypedDict, total=False): + """ProgrammaticToolCallingParam. + + :ivar type: The type of the tool. Always ``programmatic_tool_calling``. Required. + PROGRAMMATIC_TOOL_CALLING. + :vartype type: Literal["programmatic_tool_calling"] + """ + type: Required[Literal['programmatic_tool_calling']] + 'The type of the tool. Always ``programmatic_tool_calling``. Required.\n PROGRAMMATIC_TOOL_CALLING.' + ProgrammaticToolCallingParam.__qualname__ = 'ProgrammaticToolCallingParam' + if _version_info < (3, 13): + ProgrammaticToolCallingParam.__doc__ = 'ProgrammaticToolCallingParam.\n\n :ivar type: The type of the tool. Always ``programmatic_tool_calling``. Required.\n PROGRAMMATIC_TOOL_CALLING.\n :vartype type: Literal["programmatic_tool_calling"]\n ' + return ProgrammaticToolCallingParam + + def _make_ProgramToolCallCaller(): + class ProgramToolCallCaller(TypedDict, total=False): + """ProgramToolCallCaller. + + :ivar type: Required. PROGRAM. + :vartype type: Literal["program"] + :ivar caller_id: The call ID of the program item that produced this tool call. Required. + :vartype caller_id: str + """ + type: Required[Literal['program']] + 'Required. PROGRAM.' + caller_id: Required[str] + 'The call ID of the program item that produced this tool call. Required.' + ProgramToolCallCaller.__qualname__ = 'ProgramToolCallCaller' + if _version_info < (3, 13): + ProgramToolCallCaller.__doc__ = 'ProgramToolCallCaller.\n\n :ivar type: Required. PROGRAM.\n :vartype type: Literal["program"]\n :ivar caller_id: The call ID of the program item that produced this tool call. Required.\n :vartype caller_id: str\n ' + return ProgramToolCallCaller + + def _make_ProgramToolCallCallerParam(): + class ProgramToolCallCallerParam(TypedDict, total=False): + """ProgramToolCallCallerParam. + + :ivar type: The caller type. Always ``program``. Required. PROGRAM. + :vartype type: Literal["program"] + :ivar caller_id: The call ID of the program item that produced this tool call. Required. + :vartype caller_id: str + """ + type: Required[Literal['program']] + 'The caller type. Always ``program``. Required. PROGRAM.' + caller_id: Required[str] + 'The call ID of the program item that produced this tool call. Required.' + ProgramToolCallCallerParam.__qualname__ = 'ProgramToolCallCallerParam' + if _version_info < (3, 13): + ProgramToolCallCallerParam.__doc__ = 'ProgramToolCallCallerParam.\n\n :ivar type: The caller type. Always ``program``. Required. PROGRAM.\n :vartype type: Literal["program"]\n :ivar caller_id: The call ID of the program item that produced this tool call. Required.\n :vartype caller_id: str\n ' + return ProgramToolCallCallerParam + + def _make_Prompt(): + class Prompt(TypedDict, total=False): + """Reference to a prompt template and its variables. Learn more: /docs/guides/text?api-mode=responses#reusable-prompts. + + :ivar id: The unique identifier of the prompt template to use. Required. + :vartype id: str + :ivar version: + :vartype version: str + :ivar variables: + :vartype variables: "ResponsePromptVariables" + """ + id: Required[str] + 'The unique identifier of the prompt template to use. Required.' + version: Optional[str] + variables: Optional['_types.ResponsePromptVariables'] + Prompt.__qualname__ = 'Prompt' + if _version_info < (3, 13): + Prompt.__doc__ = 'Reference to a prompt template and its variables. Learn more: /docs/guides/text?api-mode=responses#reusable-prompts.\n\n :ivar id: The unique identifier of the prompt template to use. Required.\n :vartype id: str\n :ivar version:\n :vartype version: str\n :ivar variables:\n :vartype variables: "ResponsePromptVariables"\n ' + return Prompt + + def _make_PromptCacheBreakpointConfig(): + class PromptCacheBreakpointConfig(TypedDict, total=False): + """Prompt cache breakpoint. + + :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit". + :vartype mode: Literal["explicit"] + """ + mode: Required[Literal['explicit']] + 'The breakpoint mode. Always ``explicit``. Required. Default value is "explicit".' + PromptCacheBreakpointConfig.__qualname__ = 'PromptCacheBreakpointConfig' + if _version_info < (3, 13): + PromptCacheBreakpointConfig.__doc__ = 'Prompt cache breakpoint.\n\n :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit".\n :vartype mode: Literal["explicit"]\n ' + return PromptCacheBreakpointConfig + + def _make_PromptCacheBreakpointParam(): + class PromptCacheBreakpointParam(TypedDict, total=False): + """Prompt cache breakpoint. + + :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit". + :vartype mode: Literal["explicit"] + """ + mode: Required[Literal['explicit']] + 'The breakpoint mode. Always ``explicit``. Required. Default value is "explicit".' + PromptCacheBreakpointParam.__qualname__ = 'PromptCacheBreakpointParam' + if _version_info < (3, 13): + PromptCacheBreakpointParam.__doc__ = 'Prompt cache breakpoint.\n\n :ivar mode: The breakpoint mode. Always ``explicit``. Required. Default value is "explicit".\n :vartype mode: Literal["explicit"]\n ' + return PromptCacheBreakpointParam + + def _make_PromptCacheOptions(): + class PromptCacheOptions(TypedDict, total=False): + """Prompt cache options. + + :ivar ttl: The minimum lifetime applied to each cache breakpoint. Required. "30m" + :vartype ttl: PromptCacheTTLEnum + :ivar mode: Whether implicit prompt-cache breakpoints were enabled. Required. Known values are: + "implicit" and "explicit". + :vartype mode: PromptCacheModeEnum + """ + ttl: Required[_resolve('PromptCacheTTLEnum')] + 'The minimum lifetime applied to each cache breakpoint. Required. "30m"' + mode: Required[_resolve('PromptCacheModeEnum')] + 'Whether implicit prompt-cache breakpoints were enabled. Required. Known values are:\n "implicit" and "explicit".' + PromptCacheOptions.__qualname__ = 'PromptCacheOptions' + if _version_info < (3, 13): + PromptCacheOptions.__doc__ = 'Prompt cache options.\n\n :ivar ttl: The minimum lifetime applied to each cache breakpoint. Required. "30m"\n :vartype ttl: PromptCacheTTLEnum\n :ivar mode: Whether implicit prompt-cache breakpoints were enabled. Required. Known values are:\n "implicit" and "explicit".\n :vartype mode: PromptCacheModeEnum\n ' + return PromptCacheOptions + + def _make_PromptCacheOptionsParam(): + class PromptCacheOptionsParam(TypedDict, total=False): + """Prompt cache options. + + :ivar ttl: The minimum lifetime applied to every implicit and explicit cache breakpoint written + by the request. Defaults to ``30m``, which is currently the only supported value. The backend + may retain cache entries for longer. "30m" + :vartype ttl: PromptCacheTTLEnum + :ivar mode: Controls whether OpenAI automatically creates an implicit cache breakpoint. + Defaults to ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes + up to the latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not + create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there + are no explicit breakpoints, the request does not use prompt caching. Known values are: + "implicit" and "explicit". + :vartype mode: PromptCacheModeEnum + """ + ttl: _resolve('PromptCacheTTLEnum') + 'The minimum lifetime applied to every implicit and explicit cache breakpoint written by the\n request. Defaults to ``30m``, which is currently the only supported value. The backend may\n retain cache entries for longer. "30m"' + mode: _resolve('PromptCacheModeEnum') + 'Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to\n ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes up to the\n latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not create an\n implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no\n explicit breakpoints, the request does not use prompt caching. Known values are: "implicit"\n and "explicit".' + PromptCacheOptionsParam.__qualname__ = 'PromptCacheOptionsParam' + if _version_info < (3, 13): + PromptCacheOptionsParam.__doc__ = 'Prompt cache options.\n\n :ivar ttl: The minimum lifetime applied to every implicit and explicit cache breakpoint written\n by the request. Defaults to ``30m``, which is currently the only supported value. The backend\n may retain cache entries for longer. "30m"\n :vartype ttl: PromptCacheTTLEnum\n :ivar mode: Controls whether OpenAI automatically creates an implicit cache breakpoint.\n Defaults to ``implicit``. With ``implicit``, OpenAI creates one implicit breakpoint and writes\n up to the latest three explicit breakpoints in the request. With ``explicit``, OpenAI does not\n create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there\n are no explicit breakpoints, the request does not use prompt caching. Known values are:\n "implicit" and "explicit".\n :vartype mode: PromptCacheModeEnum\n ' + return PromptCacheOptionsParam + + def _make_RankingOptions(): + class RankingOptions(TypedDict, total=False): + """RankingOptions. + + :ivar ranker: The ranker to use for the file search. Known values are: "auto" and + "default-2024-11-15". + :vartype ranker: RankerVersionType + :ivar score_threshold: The score threshold for the file search, a number between 0 and 1. + Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer + results. + :vartype score_threshold: float + :ivar hybrid_search: Weights that control how reciprocal rank fusion balances semantic + embedding matches versus sparse keyword matches when hybrid search is enabled. + :vartype hybrid_search: "HybridSearchOptions" + """ + ranker: _resolve('RankerVersionType') + 'The ranker to use for the file search. Known values are: "auto" and "default-2024-11-15".' + score_threshold: float + 'The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will\n attempt to return only the most relevant results, but may return fewer results.' + hybrid_search: '_types.HybridSearchOptions' + 'Weights that control how reciprocal rank fusion balances semantic embedding matches versus\n sparse keyword matches when hybrid search is enabled.' + RankingOptions.__qualname__ = 'RankingOptions' + if _version_info < (3, 13): + RankingOptions.__doc__ = 'RankingOptions.\n\n :ivar ranker: The ranker to use for the file search. Known values are: "auto" and\n "default-2024-11-15".\n :vartype ranker: RankerVersionType\n :ivar score_threshold: The score threshold for the file search, a number between 0 and 1.\n Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer\n results.\n :vartype score_threshold: float\n :ivar hybrid_search: Weights that control how reciprocal rank fusion balances semantic\n embedding matches versus sparse keyword matches when hybrid search is enabled.\n :vartype hybrid_search: "HybridSearchOptions"\n ' + return RankingOptions + + def _make_RealtimeMCPHTTPError(): + class RealtimeMCPHTTPError(TypedDict, total=False): + """Realtime MCP HTTP error. + + :ivar type: Required. HTTP_ERROR. + :vartype type: Literal["http_error"] + :ivar code: Required. + :vartype code: int + :ivar message: Required. + :vartype message: str + """ + type: Required[Literal['http_error']] + 'Required. HTTP_ERROR.' + code: Required[int] + 'Required.' + message: Required[str] + 'Required.' + RealtimeMCPHTTPError.__qualname__ = 'RealtimeMCPHTTPError' + if _version_info < (3, 13): + RealtimeMCPHTTPError.__doc__ = 'Realtime MCP HTTP error.\n\n :ivar type: Required. HTTP_ERROR.\n :vartype type: Literal["http_error"]\n :ivar code: Required.\n :vartype code: int\n :ivar message: Required.\n :vartype message: str\n ' + return RealtimeMCPHTTPError + + def _make_RealtimeMCPProtocolError(): + class RealtimeMCPProtocolError(TypedDict, total=False): + """Realtime MCP protocol error. + + :ivar type: Required. PROTOCOL_ERROR. + :vartype type: Literal["protocol_error"] + :ivar code: Required. + :vartype code: int + :ivar message: Required. + :vartype message: str + """ + type: Required[Literal['protocol_error']] + 'Required. PROTOCOL_ERROR.' + code: Required[int] + 'Required.' + message: Required[str] + 'Required.' + RealtimeMCPProtocolError.__qualname__ = 'RealtimeMCPProtocolError' + if _version_info < (3, 13): + RealtimeMCPProtocolError.__doc__ = 'Realtime MCP protocol error.\n\n :ivar type: Required. PROTOCOL_ERROR.\n :vartype type: Literal["protocol_error"]\n :ivar code: Required.\n :vartype code: int\n :ivar message: Required.\n :vartype message: str\n ' + return RealtimeMCPProtocolError + + def _make_RealtimeMCPToolExecutionError(): + class RealtimeMCPToolExecutionError(TypedDict, total=False): + """Realtime MCP tool execution error. + + :ivar type: Required. TOOL_EXECUTION_ERROR. + :vartype type: Literal["tool_execution_error"] + :ivar message: Required. + :vartype message: str + """ + type: Required[Literal['tool_execution_error']] + 'Required. TOOL_EXECUTION_ERROR.' + message: Required[str] + 'Required.' + RealtimeMCPToolExecutionError.__qualname__ = 'RealtimeMCPToolExecutionError' + if _version_info < (3, 13): + RealtimeMCPToolExecutionError.__doc__ = 'Realtime MCP tool execution error.\n\n :ivar type: Required. TOOL_EXECUTION_ERROR.\n :vartype type: Literal["tool_execution_error"]\n :ivar message: Required.\n :vartype message: str\n ' + return RealtimeMCPToolExecutionError + + def _make_Reasoning(): + class Reasoning(TypedDict, total=False): + """Reasoning. + + :ivar mode: Controls the reasoning execution mode for the request. When returned on a response, + this is the effective execution mode. Known values are: "standard" and "pro". + :vartype mode: ReasoningModeEnum + :ivar effort: Known values are: "none", "minimal", "low", "medium", "high", "xhigh", and "max". + :vartype effort: ReasoningEffort + :ivar summary: Is one of the following types: Literal["auto"], Literal["concise"], + Literal["detailed"] + :vartype summary: Literal["auto", "concise", "detailed"] + :ivar context: Is one of the following types: Literal["auto"], Literal["current_turn"], + Literal["all_turns"] + :vartype context: Literal["auto", "current_turn", "all_turns"] + :ivar generate_summary: Is one of the following types: Literal["auto"], Literal["concise"], + Literal["detailed"] + :vartype generate_summary: Literal["auto", "concise", "detailed"] + """ + mode: _resolve('ReasoningModeEnum') + 'Controls the reasoning execution mode for the request. When returned on a response, this is the\n effective execution mode. Known values are: "standard" and "pro".' + effort: Optional[_resolve('ReasoningEffort')] + 'Known values are: "none", "minimal", "low", "medium", "high", "xhigh", and "max".' + summary: Optional[Literal['auto', 'concise', 'detailed']] + 'Is one of the following types: Literal["auto"], Literal["concise"], Literal["detailed"]' + context: Optional[Literal['auto', 'current_turn', 'all_turns']] + 'Is one of the following types: Literal["auto"], Literal["current_turn"],\n Literal["all_turns"]' + generate_summary: Optional[Literal['auto', 'concise', 'detailed']] + 'Is one of the following types: Literal["auto"], Literal["concise"], Literal["detailed"]' + Reasoning.__qualname__ = 'Reasoning' + if _version_info < (3, 13): + Reasoning.__doc__ = 'Reasoning.\n\n :ivar mode: Controls the reasoning execution mode for the request. When returned on a response,\n this is the effective execution mode. Known values are: "standard" and "pro".\n :vartype mode: ReasoningModeEnum\n :ivar effort: Known values are: "none", "minimal", "low", "medium", "high", "xhigh", and "max".\n :vartype effort: ReasoningEffort\n :ivar summary: Is one of the following types: Literal["auto"], Literal["concise"],\n Literal["detailed"]\n :vartype summary: Literal["auto", "concise", "detailed"]\n :ivar context: Is one of the following types: Literal["auto"], Literal["current_turn"],\n Literal["all_turns"]\n :vartype context: Literal["auto", "current_turn", "all_turns"]\n :ivar generate_summary: Is one of the following types: Literal["auto"], Literal["concise"],\n Literal["detailed"]\n :vartype generate_summary: Literal["auto", "concise", "detailed"]\n ' + return Reasoning + + def _make_ReasoningTextContent(): + class ReasoningTextContent(TypedDict, total=False): + """Reasoning text. + + :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. Default value + is "reasoning_text". + :vartype type: Literal["reasoning_text"] + :ivar text: The reasoning text from the model. Required. + :vartype text: str + """ + type: Required[Literal['reasoning_text']] + 'The type of the reasoning text. Always ``reasoning_text``. Required. Default value is\n "reasoning_text".' + text: Required[str] + 'The reasoning text from the model. Required.' + ReasoningTextContent.__qualname__ = 'ReasoningTextContent' + if _version_info < (3, 13): + ReasoningTextContent.__doc__ = 'Reasoning text.\n\n :ivar type: The type of the reasoning text. Always ``reasoning_text``. Required. Default value\n is "reasoning_text".\n :vartype type: Literal["reasoning_text"]\n :ivar text: The reasoning text from the model. Required.\n :vartype text: str\n ' + return ReasoningTextContent + + def _make_ResponseAudioDeltaEvent(): + class ResponseAudioDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial audio response. + + :ivar type: The type of the event. Always ``response.audio.delta``. Required. + RESPONSE_AUDIO_DELTA. + :vartype type: Literal["response.audio.delta"] + :ivar sequence_number: A sequence number for this chunk of the stream response. Required. + :vartype sequence_number: int + :ivar delta: A chunk of Base64 encoded response audio bytes. Required. + :vartype delta: str + """ + type: Required[Literal['response.audio.delta']] + 'The type of the event. Always ``response.audio.delta``. Required. RESPONSE_AUDIO_DELTA.' + sequence_number: Required[int] + 'A sequence number for this chunk of the stream response. Required.' + delta: Required[str] + 'A chunk of Base64 encoded response audio bytes. Required.' + ResponseAudioDeltaEvent.__qualname__ = 'ResponseAudioDeltaEvent' + if _version_info < (3, 13): + ResponseAudioDeltaEvent.__doc__ = 'Emitted when there is a partial audio response.\n\n :ivar type: The type of the event. Always ``response.audio.delta``. Required.\n RESPONSE_AUDIO_DELTA.\n :vartype type: Literal["response.audio.delta"]\n :ivar sequence_number: A sequence number for this chunk of the stream response. Required.\n :vartype sequence_number: int\n :ivar delta: A chunk of Base64 encoded response audio bytes. Required.\n :vartype delta: str\n ' + return ResponseAudioDeltaEvent + + def _make_ResponseAudioDoneEvent(): + class ResponseAudioDoneEvent(TypedDict, total=False): + """Emitted when the audio response is complete. + + :ivar type: The type of the event. Always ``response.audio.done``. Required. + RESPONSE_AUDIO_DONE. + :vartype type: Literal["response.audio.done"] + :ivar sequence_number: The sequence number of the delta. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.audio.done']] + 'The type of the event. Always ``response.audio.done``. Required. RESPONSE_AUDIO_DONE.' + sequence_number: Required[int] + 'The sequence number of the delta. Required.' + ResponseAudioDoneEvent.__qualname__ = 'ResponseAudioDoneEvent' + if _version_info < (3, 13): + ResponseAudioDoneEvent.__doc__ = 'Emitted when the audio response is complete.\n\n :ivar type: The type of the event. Always ``response.audio.done``. Required.\n RESPONSE_AUDIO_DONE.\n :vartype type: Literal["response.audio.done"]\n :ivar sequence_number: The sequence number of the delta. Required.\n :vartype sequence_number: int\n ' + return ResponseAudioDoneEvent + + def _make_ResponseAudioTranscriptDeltaEvent(): + class ResponseAudioTranscriptDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial transcript of audio. + + :ivar type: The type of the event. Always ``response.audio.transcript.delta``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DELTA. + :vartype type: Literal["response.audio.transcript.delta"] + :ivar delta: The partial transcript of the audio response. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.audio.transcript.delta']] + 'The type of the event. Always ``response.audio.transcript.delta``. Required.\n RESPONSE_AUDIO_TRANSCRIPT_DELTA.' + delta: Required[str] + 'The partial transcript of the audio response. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseAudioTranscriptDeltaEvent.__qualname__ = 'ResponseAudioTranscriptDeltaEvent' + if _version_info < (3, 13): + ResponseAudioTranscriptDeltaEvent.__doc__ = 'Emitted when there is a partial transcript of audio.\n\n :ivar type: The type of the event. Always ``response.audio.transcript.delta``. Required.\n RESPONSE_AUDIO_TRANSCRIPT_DELTA.\n :vartype type: Literal["response.audio.transcript.delta"]\n :ivar delta: The partial transcript of the audio response. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseAudioTranscriptDeltaEvent + + def _make_ResponseAudioTranscriptDoneEvent(): + class ResponseAudioTranscriptDoneEvent(TypedDict, total=False): + """Emitted when the full audio transcript is completed. + + :ivar type: The type of the event. Always ``response.audio.transcript.done``. Required. + RESPONSE_AUDIO_TRANSCRIPT_DONE. + :vartype type: Literal["response.audio.transcript.done"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.audio.transcript.done']] + 'The type of the event. Always ``response.audio.transcript.done``. Required.\n RESPONSE_AUDIO_TRANSCRIPT_DONE.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseAudioTranscriptDoneEvent.__qualname__ = 'ResponseAudioTranscriptDoneEvent' + if _version_info < (3, 13): + ResponseAudioTranscriptDoneEvent.__doc__ = 'Emitted when the full audio transcript is completed.\n\n :ivar type: The type of the event. Always ``response.audio.transcript.done``. Required.\n RESPONSE_AUDIO_TRANSCRIPT_DONE.\n :vartype type: Literal["response.audio.transcript.done"]\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseAudioTranscriptDoneEvent + + def _make_ResponseCodeInterpreterCallCodeDeltaEvent(): + class ResponseCodeInterpreterCallCodeDeltaEvent(TypedDict, total=False): + """Emitted when a partial code snippet is streamed by the code interpreter. + + :ivar type: The type of the event. Always ``response.code_interpreter_call_code.delta``. + Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA. + :vartype type: Literal["response.code_interpreter_call_code.delta"] + :ivar output_index: The index of the output item in the response for which the code is being + streamed. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar delta: The partial code snippet being streamed by the code interpreter. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.code_interpreter_call_code.delta']] + 'The type of the event. Always ``response.code_interpreter_call_code.delta``. Required.\n RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA.' + output_index: Required[int] + 'The index of the output item in the response for which the code is being streamed. Required.' + item_id: Required[str] + 'The unique identifier of the code interpreter tool call item. Required.' + delta: Required[str] + 'The partial code snippet being streamed by the code interpreter. Required.' + sequence_number: Required[int] + 'The sequence number of this event, used to order streaming events. Required.' + ResponseCodeInterpreterCallCodeDeltaEvent.__qualname__ = 'ResponseCodeInterpreterCallCodeDeltaEvent' + if _version_info < (3, 13): + ResponseCodeInterpreterCallCodeDeltaEvent.__doc__ = 'Emitted when a partial code snippet is streamed by the code interpreter.\n\n :ivar type: The type of the event. Always ``response.code_interpreter_call_code.delta``.\n Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DELTA.\n :vartype type: Literal["response.code_interpreter_call_code.delta"]\n :ivar output_index: The index of the output item in the response for which the code is being\n streamed. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the code interpreter tool call item. Required.\n :vartype item_id: str\n :ivar delta: The partial code snippet being streamed by the code interpreter. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number of this event, used to order streaming events.\n Required.\n :vartype sequence_number: int\n ' + return ResponseCodeInterpreterCallCodeDeltaEvent + + def _make_ResponseCodeInterpreterCallCodeDoneEvent(): + class ResponseCodeInterpreterCallCodeDoneEvent(TypedDict, total=False): + """Emitted when the code snippet is finalized by the code interpreter. + + :ivar type: The type of the event. Always ``response.code_interpreter_call_code.done``. + Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE. + :vartype type: Literal["response.code_interpreter_call_code.done"] + :ivar output_index: The index of the output item in the response for which the code is + finalized. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar code: The final code snippet output by the code interpreter. Required. + :vartype code: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.code_interpreter_call_code.done']] + 'The type of the event. Always ``response.code_interpreter_call_code.done``. Required.\n RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE.' + output_index: Required[int] + 'The index of the output item in the response for which the code is finalized. Required.' + item_id: Required[str] + 'The unique identifier of the code interpreter tool call item. Required.' + code: Required[str] + 'The final code snippet output by the code interpreter. Required.' + sequence_number: Required[int] + 'The sequence number of this event, used to order streaming events. Required.' + ResponseCodeInterpreterCallCodeDoneEvent.__qualname__ = 'ResponseCodeInterpreterCallCodeDoneEvent' + if _version_info < (3, 13): + ResponseCodeInterpreterCallCodeDoneEvent.__doc__ = 'Emitted when the code snippet is finalized by the code interpreter.\n\n :ivar type: The type of the event. Always ``response.code_interpreter_call_code.done``.\n Required. RESPONSE_CODE_INTERPRETER_CALL_CODE_DONE.\n :vartype type: Literal["response.code_interpreter_call_code.done"]\n :ivar output_index: The index of the output item in the response for which the code is\n finalized. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the code interpreter tool call item. Required.\n :vartype item_id: str\n :ivar code: The final code snippet output by the code interpreter. Required.\n :vartype code: str\n :ivar sequence_number: The sequence number of this event, used to order streaming events.\n Required.\n :vartype sequence_number: int\n ' + return ResponseCodeInterpreterCallCodeDoneEvent + + def _make_ResponseCodeInterpreterCallCompletedEvent(): + class ResponseCodeInterpreterCallCompletedEvent(TypedDict, total=False): + """Emitted when the code interpreter call is completed. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.completed``. + Required. RESPONSE_CODE_INTERPRETER_CALL_COMPLETED. + :vartype type: Literal["response.code_interpreter_call.completed"] + :ivar output_index: The index of the output item in the response for which the code interpreter + call is completed. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.code_interpreter_call.completed']] + 'The type of the event. Always ``response.code_interpreter_call.completed``. Required.\n RESPONSE_CODE_INTERPRETER_CALL_COMPLETED.' + output_index: Required[int] + 'The index of the output item in the response for which the code interpreter call is completed.\n Required.' + item_id: Required[str] + 'The unique identifier of the code interpreter tool call item. Required.' + sequence_number: Required[int] + 'The sequence number of this event, used to order streaming events. Required.' + ResponseCodeInterpreterCallCompletedEvent.__qualname__ = 'ResponseCodeInterpreterCallCompletedEvent' + if _version_info < (3, 13): + ResponseCodeInterpreterCallCompletedEvent.__doc__ = 'Emitted when the code interpreter call is completed.\n\n :ivar type: The type of the event. Always ``response.code_interpreter_call.completed``.\n Required. RESPONSE_CODE_INTERPRETER_CALL_COMPLETED.\n :vartype type: Literal["response.code_interpreter_call.completed"]\n :ivar output_index: The index of the output item in the response for which the code interpreter\n call is completed. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the code interpreter tool call item. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of this event, used to order streaming events.\n Required.\n :vartype sequence_number: int\n ' + return ResponseCodeInterpreterCallCompletedEvent + + def _make_ResponseCodeInterpreterCallInProgressEvent(): + class ResponseCodeInterpreterCallInProgressEvent(TypedDict, total=False): + """Emitted when a code interpreter call is in progress. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.in_progress``. + Required. RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS. + :vartype type: Literal["response.code_interpreter_call.in_progress"] + :ivar output_index: The index of the output item in the response for which the code interpreter + call is in progress. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.code_interpreter_call.in_progress']] + 'The type of the event. Always ``response.code_interpreter_call.in_progress``. Required.\n RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS.' + output_index: Required[int] + 'The index of the output item in the response for which the code interpreter call is in\n progress. Required.' + item_id: Required[str] + 'The unique identifier of the code interpreter tool call item. Required.' + sequence_number: Required[int] + 'The sequence number of this event, used to order streaming events. Required.' + ResponseCodeInterpreterCallInProgressEvent.__qualname__ = 'ResponseCodeInterpreterCallInProgressEvent' + if _version_info < (3, 13): + ResponseCodeInterpreterCallInProgressEvent.__doc__ = 'Emitted when a code interpreter call is in progress.\n\n :ivar type: The type of the event. Always ``response.code_interpreter_call.in_progress``.\n Required. RESPONSE_CODE_INTERPRETER_CALL_IN_PROGRESS.\n :vartype type: Literal["response.code_interpreter_call.in_progress"]\n :ivar output_index: The index of the output item in the response for which the code interpreter\n call is in progress. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the code interpreter tool call item. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of this event, used to order streaming events.\n Required.\n :vartype sequence_number: int\n ' + return ResponseCodeInterpreterCallInProgressEvent + + def _make_ResponseCodeInterpreterCallInterpretingEvent(): + class ResponseCodeInterpreterCallInterpretingEvent(TypedDict, total=False): + """Emitted when the code interpreter is actively interpreting the code snippet. + + :ivar type: The type of the event. Always ``response.code_interpreter_call.interpreting``. + Required. RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING. + :vartype type: Literal["response.code_interpreter_call.interpreting"] + :ivar output_index: The index of the output item in the response for which the code interpreter + is interpreting code. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the code interpreter tool call item. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event, used to order streaming events. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.code_interpreter_call.interpreting']] + 'The type of the event. Always ``response.code_interpreter_call.interpreting``. Required.\n RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING.' + output_index: Required[int] + 'The index of the output item in the response for which the code interpreter is interpreting\n code. Required.' + item_id: Required[str] + 'The unique identifier of the code interpreter tool call item. Required.' + sequence_number: Required[int] + 'The sequence number of this event, used to order streaming events. Required.' + ResponseCodeInterpreterCallInterpretingEvent.__qualname__ = 'ResponseCodeInterpreterCallInterpretingEvent' + if _version_info < (3, 13): + ResponseCodeInterpreterCallInterpretingEvent.__doc__ = 'Emitted when the code interpreter is actively interpreting the code snippet.\n\n :ivar type: The type of the event. Always ``response.code_interpreter_call.interpreting``.\n Required. RESPONSE_CODE_INTERPRETER_CALL_INTERPRETING.\n :vartype type: Literal["response.code_interpreter_call.interpreting"]\n :ivar output_index: The index of the output item in the response for which the code interpreter\n is interpreting code. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the code interpreter tool call item. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of this event, used to order streaming events.\n Required.\n :vartype sequence_number: int\n ' + return ResponseCodeInterpreterCallInterpretingEvent + + def _make_ResponseCompletedEvent(): + class ResponseCompletedEvent(TypedDict, total=False): + """Emitted when the model response is complete. + + :ivar type: The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED. + :vartype type: Literal["response.completed"] + :ivar response: Properties of the completed response. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.completed']] + 'The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED.' + response: Required['_types.ResponseObject'] + 'Properties of the completed response. Required.' + sequence_number: Required[int] + 'The sequence number for this event. Required.' + ResponseCompletedEvent.__qualname__ = 'ResponseCompletedEvent' + if _version_info < (3, 13): + ResponseCompletedEvent.__doc__ = 'Emitted when the model response is complete.\n\n :ivar type: The type of the event. Always ``response.completed``. Required. RESPONSE_COMPLETED.\n :vartype type: Literal["response.completed"]\n :ivar response: Properties of the completed response. Required.\n :vartype response: "ResponseObject"\n :ivar sequence_number: The sequence number for this event. Required.\n :vartype sequence_number: int\n ' + return ResponseCompletedEvent + + def _make_ResponseContentPartAddedEvent(): + class ResponseContentPartAddedEvent(TypedDict, total=False): + """Emitted when a new content part is added. + + :ivar type: The type of the event. Always ``response.content_part.added``. Required. + RESPONSE_CONTENT_PART_ADDED. + :vartype type: Literal["response.content_part.added"] + :ivar item_id: The ID of the output item that the content part was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the content part was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that was added. Required. + :vartype content_index: int + :ivar part: The content part that was added. Required. + :vartype part: "OutputContent" + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.content_part.added']] + 'The type of the event. Always ``response.content_part.added``. Required.\n RESPONSE_CONTENT_PART_ADDED.' + item_id: Required[str] + 'The ID of the output item that the content part was added to. Required.' + output_index: Required[int] + 'The index of the output item that the content part was added to. Required.' + content_index: Required[int] + 'The index of the content part that was added. Required.' + part: Required['_types.OutputContent'] + 'The content part that was added. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseContentPartAddedEvent.__qualname__ = 'ResponseContentPartAddedEvent' + if _version_info < (3, 13): + ResponseContentPartAddedEvent.__doc__ = 'Emitted when a new content part is added.\n\n :ivar type: The type of the event. Always ``response.content_part.added``. Required.\n RESPONSE_CONTENT_PART_ADDED.\n :vartype type: Literal["response.content_part.added"]\n :ivar item_id: The ID of the output item that the content part was added to. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the content part was added to. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part that was added. Required.\n :vartype content_index: int\n :ivar part: The content part that was added. Required.\n :vartype part: "OutputContent"\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseContentPartAddedEvent + + def _make_ResponseContentPartDoneEvent(): + class ResponseContentPartDoneEvent(TypedDict, total=False): + """Emitted when a content part is done. + + :ivar type: The type of the event. Always ``response.content_part.done``. Required. + RESPONSE_CONTENT_PART_DONE. + :vartype type: Literal["response.content_part.done"] + :ivar item_id: The ID of the output item that the content part was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the content part was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that is done. Required. + :vartype content_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The content part that is done. Required. + :vartype part: "OutputContent" + """ + type: Required[Literal['response.content_part.done']] + 'The type of the event. Always ``response.content_part.done``. Required.\n RESPONSE_CONTENT_PART_DONE.' + item_id: Required[str] + 'The ID of the output item that the content part was added to. Required.' + output_index: Required[int] + 'The index of the output item that the content part was added to. Required.' + content_index: Required[int] + 'The index of the content part that is done. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + part: Required['_types.OutputContent'] + 'The content part that is done. Required.' + ResponseContentPartDoneEvent.__qualname__ = 'ResponseContentPartDoneEvent' + if _version_info < (3, 13): + ResponseContentPartDoneEvent.__doc__ = 'Emitted when a content part is done.\n\n :ivar type: The type of the event. Always ``response.content_part.done``. Required.\n RESPONSE_CONTENT_PART_DONE.\n :vartype type: Literal["response.content_part.done"]\n :ivar item_id: The ID of the output item that the content part was added to. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the content part was added to. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part that is done. Required.\n :vartype content_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar part: The content part that is done. Required.\n :vartype part: "OutputContent"\n ' + return ResponseContentPartDoneEvent + + def _make_ResponseCreatedEvent(): + class ResponseCreatedEvent(TypedDict, total=False): + """An event that is emitted when a response is created. + + :ivar type: The type of the event. Always ``response.created``. Required. RESPONSE_CREATED. + :vartype type: Literal["response.created"] + :ivar response: The response that was created. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.created']] + 'The type of the event. Always ``response.created``. Required. RESPONSE_CREATED.' + response: Required['_types.ResponseObject'] + 'The response that was created. Required.' + sequence_number: Required[int] + 'The sequence number for this event. Required.' + ResponseCreatedEvent.__qualname__ = 'ResponseCreatedEvent' + if _version_info < (3, 13): + ResponseCreatedEvent.__doc__ = 'An event that is emitted when a response is created.\n\n :ivar type: The type of the event. Always ``response.created``. Required. RESPONSE_CREATED.\n :vartype type: Literal["response.created"]\n :ivar response: The response that was created. Required.\n :vartype response: "ResponseObject"\n :ivar sequence_number: The sequence number for this event. Required.\n :vartype sequence_number: int\n ' + return ResponseCreatedEvent + + def _make_ResponseCustomToolCallInputDeltaEvent(): + class ResponseCustomToolCallInputDeltaEvent(TypedDict, total=False): + """ResponseCustomToolCallInputDelta. + + :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA. + :vartype type: Literal["response.custom_tool_call_input.delta"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output this delta applies to. Required. + :vartype output_index: int + :ivar item_id: Unique identifier for the API item associated with this event. Required. + :vartype item_id: str + :ivar delta: The incremental input data (delta) for the custom tool call. Required. + :vartype delta: str + """ + type: Required[Literal['response.custom_tool_call_input.delta']] + 'The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + output_index: Required[int] + 'The index of the output this delta applies to. Required.' + item_id: Required[str] + 'Unique identifier for the API item associated with this event. Required.' + delta: Required[str] + 'The incremental input data (delta) for the custom tool call. Required.' + ResponseCustomToolCallInputDeltaEvent.__qualname__ = 'ResponseCustomToolCallInputDeltaEvent' + if _version_info < (3, 13): + ResponseCustomToolCallInputDeltaEvent.__doc__ = 'ResponseCustomToolCallInputDelta.\n\n :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DELTA.\n :vartype type: Literal["response.custom_tool_call_input.delta"]\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar output_index: The index of the output this delta applies to. Required.\n :vartype output_index: int\n :ivar item_id: Unique identifier for the API item associated with this event. Required.\n :vartype item_id: str\n :ivar delta: The incremental input data (delta) for the custom tool call. Required.\n :vartype delta: str\n ' + return ResponseCustomToolCallInputDeltaEvent + + def _make_ResponseCustomToolCallInputDoneEvent(): + class ResponseCustomToolCallInputDoneEvent(TypedDict, total=False): + """ResponseCustomToolCallInputDone. + + :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE. + :vartype type: Literal["response.custom_tool_call_input.done"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output this event applies to. Required. + :vartype output_index: int + :ivar item_id: Unique identifier for the API item associated with this event. Required. + :vartype item_id: str + :ivar input: The complete input data for the custom tool call. Required. + :vartype input: str + """ + type: Required[Literal['response.custom_tool_call_input.done']] + 'The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + output_index: Required[int] + 'The index of the output this event applies to. Required.' + item_id: Required[str] + 'Unique identifier for the API item associated with this event. Required.' + input: Required[str] + 'The complete input data for the custom tool call. Required.' + ResponseCustomToolCallInputDoneEvent.__qualname__ = 'ResponseCustomToolCallInputDoneEvent' + if _version_info < (3, 13): + ResponseCustomToolCallInputDoneEvent.__doc__ = 'ResponseCustomToolCallInputDone.\n\n :ivar type: The event type identifier. Required. RESPONSE_CUSTOM_TOOL_CALL_INPUT_DONE.\n :vartype type: Literal["response.custom_tool_call_input.done"]\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar output_index: The index of the output this event applies to. Required.\n :vartype output_index: int\n :ivar item_id: Unique identifier for the API item associated with this event. Required.\n :vartype item_id: str\n :ivar input: The complete input data for the custom tool call. Required.\n :vartype input: str\n ' + return ResponseCustomToolCallInputDoneEvent + + def _make_ResponseErrorEvent(): + class ResponseErrorEvent(TypedDict, total=False): + """Emitted when an error occurs. + + :ivar type: The type of the event. Always ``error``. Required. ERROR. + :vartype type: Literal["error"] + :ivar code: Required. + :vartype code: str + :ivar message: The error message. Required. + :vartype message: str + :ivar param: Required. + :vartype param: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['error']] + 'The type of the event. Always ``error``. Required. ERROR.' + code: Required[Optional[str]] + 'Required.' + message: Required[str] + 'The error message. Required.' + param: Required[Optional[str]] + 'Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseErrorEvent.__qualname__ = 'ResponseErrorEvent' + if _version_info < (3, 13): + ResponseErrorEvent.__doc__ = 'Emitted when an error occurs.\n\n :ivar type: The type of the event. Always ``error``. Required. ERROR.\n :vartype type: Literal["error"]\n :ivar code: Required.\n :vartype code: str\n :ivar message: The error message. Required.\n :vartype message: str\n :ivar param: Required.\n :vartype param: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseErrorEvent + + def _make_ResponseErrorInfo(): + class ResponseErrorInfo(TypedDict, total=False): + """An error object returned when the model fails to generate a Response. + + :ivar code: Required. Known values are: "server_error", "rate_limit_exceeded", + "invalid_prompt", "data_residency_mismatch", "bio_policy", "vector_store_timeout", + "invalid_image", "invalid_image_format", "invalid_base64_image", "invalid_image_url", + "image_too_large", "image_too_small", "image_parse_error", "image_content_policy_violation", + "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type", + "empty_image_file", "failed_to_download_image", and "image_file_not_found". + :vartype code: ResponseErrorCode + :ivar message: A human-readable description of the error. Required. + :vartype message: str + """ + code: Required[_resolve('ResponseErrorCode')] + 'Required. Known values are: "server_error", "rate_limit_exceeded", "invalid_prompt",\n "data_residency_mismatch", "bio_policy", "vector_store_timeout", "invalid_image",\n "invalid_image_format", "invalid_base64_image", "invalid_image_url", "image_too_large",\n "image_too_small", "image_parse_error", "image_content_policy_violation",\n "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type",\n "empty_image_file", "failed_to_download_image", and "image_file_not_found".' + message: Required[str] + 'A human-readable description of the error. Required.' + ResponseErrorInfo.__qualname__ = 'ResponseErrorInfo' + if _version_info < (3, 13): + ResponseErrorInfo.__doc__ = 'An error object returned when the model fails to generate a Response.\n\n :ivar code: Required. Known values are: "server_error", "rate_limit_exceeded",\n "invalid_prompt", "data_residency_mismatch", "bio_policy", "vector_store_timeout",\n "invalid_image", "invalid_image_format", "invalid_base64_image", "invalid_image_url",\n "image_too_large", "image_too_small", "image_parse_error", "image_content_policy_violation",\n "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type",\n "empty_image_file", "failed_to_download_image", and "image_file_not_found".\n :vartype code: ResponseErrorCode\n :ivar message: A human-readable description of the error. Required.\n :vartype message: str\n ' + return ResponseErrorInfo + + def _make_ResponseFailedEvent(): + class ResponseFailedEvent(TypedDict, total=False): + """An event that is emitted when a response fails. + + :ivar type: The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED. + :vartype type: Literal["response.failed"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar response: The response that failed. Required. + :vartype response: "ResponseObject" + """ + type: Required[Literal['response.failed']] + 'The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + response: Required['_types.ResponseObject'] + 'The response that failed. Required.' + ResponseFailedEvent.__qualname__ = 'ResponseFailedEvent' + if _version_info < (3, 13): + ResponseFailedEvent.__doc__ = 'An event that is emitted when a response fails.\n\n :ivar type: The type of the event. Always ``response.failed``. Required. RESPONSE_FAILED.\n :vartype type: Literal["response.failed"]\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar response: The response that failed. Required.\n :vartype response: "ResponseObject"\n ' + return ResponseFailedEvent + + def _make_ResponseFileSearchCallCompletedEvent(): + class ResponseFileSearchCallCompletedEvent(TypedDict, total=False): + """Emitted when a file search call is completed (results found). + + :ivar type: The type of the event. Always ``response.file_search_call.completed``. Required. + RESPONSE_FILE_SEARCH_CALL_COMPLETED. + :vartype type: Literal["response.file_search_call.completed"] + :ivar output_index: The index of the output item that the file search call is initiated. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.file_search_call.completed']] + 'The type of the event. Always ``response.file_search_call.completed``. Required.\n RESPONSE_FILE_SEARCH_CALL_COMPLETED.' + output_index: Required[int] + 'The index of the output item that the file search call is initiated. Required.' + item_id: Required[str] + 'The ID of the output item that the file search call is initiated. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseFileSearchCallCompletedEvent.__qualname__ = 'ResponseFileSearchCallCompletedEvent' + if _version_info < (3, 13): + ResponseFileSearchCallCompletedEvent.__doc__ = 'Emitted when a file search call is completed (results found).\n\n :ivar type: The type of the event. Always ``response.file_search_call.completed``. Required.\n RESPONSE_FILE_SEARCH_CALL_COMPLETED.\n :vartype type: Literal["response.file_search_call.completed"]\n :ivar output_index: The index of the output item that the file search call is initiated.\n Required.\n :vartype output_index: int\n :ivar item_id: The ID of the output item that the file search call is initiated. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseFileSearchCallCompletedEvent + + def _make_ResponseFileSearchCallInProgressEvent(): + class ResponseFileSearchCallInProgressEvent(TypedDict, total=False): + """Emitted when a file search call is initiated. + + :ivar type: The type of the event. Always ``response.file_search_call.in_progress``. Required. + RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS. + :vartype type: Literal["response.file_search_call.in_progress"] + :ivar output_index: The index of the output item that the file search call is initiated. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.file_search_call.in_progress']] + 'The type of the event. Always ``response.file_search_call.in_progress``. Required.\n RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS.' + output_index: Required[int] + 'The index of the output item that the file search call is initiated. Required.' + item_id: Required[str] + 'The ID of the output item that the file search call is initiated. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseFileSearchCallInProgressEvent.__qualname__ = 'ResponseFileSearchCallInProgressEvent' + if _version_info < (3, 13): + ResponseFileSearchCallInProgressEvent.__doc__ = 'Emitted when a file search call is initiated.\n\n :ivar type: The type of the event. Always ``response.file_search_call.in_progress``. Required.\n RESPONSE_FILE_SEARCH_CALL_IN_PROGRESS.\n :vartype type: Literal["response.file_search_call.in_progress"]\n :ivar output_index: The index of the output item that the file search call is initiated.\n Required.\n :vartype output_index: int\n :ivar item_id: The ID of the output item that the file search call is initiated. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseFileSearchCallInProgressEvent + + def _make_ResponseFileSearchCallSearchingEvent(): + class ResponseFileSearchCallSearchingEvent(TypedDict, total=False): + """Emitted when a file search is currently searching. + + :ivar type: The type of the event. Always ``response.file_search_call.searching``. Required. + RESPONSE_FILE_SEARCH_CALL_SEARCHING. + :vartype type: Literal["response.file_search_call.searching"] + :ivar output_index: The index of the output item that the file search call is searching. + Required. + :vartype output_index: int + :ivar item_id: The ID of the output item that the file search call is initiated. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.file_search_call.searching']] + 'The type of the event. Always ``response.file_search_call.searching``. Required.\n RESPONSE_FILE_SEARCH_CALL_SEARCHING.' + output_index: Required[int] + 'The index of the output item that the file search call is searching. Required.' + item_id: Required[str] + 'The ID of the output item that the file search call is initiated. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseFileSearchCallSearchingEvent.__qualname__ = 'ResponseFileSearchCallSearchingEvent' + if _version_info < (3, 13): + ResponseFileSearchCallSearchingEvent.__doc__ = 'Emitted when a file search is currently searching.\n\n :ivar type: The type of the event. Always ``response.file_search_call.searching``. Required.\n RESPONSE_FILE_SEARCH_CALL_SEARCHING.\n :vartype type: Literal["response.file_search_call.searching"]\n :ivar output_index: The index of the output item that the file search call is searching.\n Required.\n :vartype output_index: int\n :ivar item_id: The ID of the output item that the file search call is initiated. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseFileSearchCallSearchingEvent + + def _make_ResponseFormatJsonSchemaSchema(): + class ResponseFormatJsonSchemaSchema(TypedDict, total=False): + """JSON schema.""" + ResponseFormatJsonSchemaSchema.__qualname__ = 'ResponseFormatJsonSchemaSchema' + if _version_info < (3, 13): + ResponseFormatJsonSchemaSchema.__doc__ = 'JSON schema.' + return ResponseFormatJsonSchemaSchema + + def _make_ResponseFunctionCallArgumentsDeltaEvent(): + class ResponseFunctionCallArgumentsDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial function-call arguments delta. + + :ivar type: The type of the event. Always ``response.function_call_arguments.delta``. Required. + RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA. + :vartype type: Literal["response.function_call_arguments.delta"] + :ivar item_id: The ID of the output item that the function-call arguments delta is added to. + Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the function-call arguments delta is + added to. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar delta: The function-call arguments delta that is added. Required. + :vartype delta: str + """ + type: Required[Literal['response.function_call_arguments.delta']] + 'The type of the event. Always ``response.function_call_arguments.delta``. Required.\n RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA.' + item_id: Required[str] + 'The ID of the output item that the function-call arguments delta is added to. Required.' + output_index: Required[int] + 'The index of the output item that the function-call arguments delta is added to. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + delta: Required[str] + 'The function-call arguments delta that is added. Required.' + ResponseFunctionCallArgumentsDeltaEvent.__qualname__ = 'ResponseFunctionCallArgumentsDeltaEvent' + if _version_info < (3, 13): + ResponseFunctionCallArgumentsDeltaEvent.__doc__ = 'Emitted when there is a partial function-call arguments delta.\n\n :ivar type: The type of the event. Always ``response.function_call_arguments.delta``. Required.\n RESPONSE_FUNCTION_CALL_ARGUMENTS_DELTA.\n :vartype type: Literal["response.function_call_arguments.delta"]\n :ivar item_id: The ID of the output item that the function-call arguments delta is added to.\n Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the function-call arguments delta is\n added to. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar delta: The function-call arguments delta that is added. Required.\n :vartype delta: str\n ' + return ResponseFunctionCallArgumentsDeltaEvent + + def _make_ResponseFunctionCallArgumentsDoneEvent(): + class ResponseFunctionCallArgumentsDoneEvent(TypedDict, total=False): + """Emitted when function-call arguments are finalized. + + :ivar type: Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE. + :vartype type: Literal["response.function_call_arguments.done"] + :ivar item_id: The ID of the item. Required. + :vartype item_id: str + :ivar name: The name of the function that was called. Required. + :vartype name: str + :ivar output_index: The index of the output item. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar arguments: The function-call arguments. Required. + :vartype arguments: str + """ + type: Required[Literal['response.function_call_arguments.done']] + 'Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE.' + item_id: Required[str] + 'The ID of the item. Required.' + name: Required[str] + 'The name of the function that was called. Required.' + output_index: Required[int] + 'The index of the output item. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + arguments: Required[str] + 'The function-call arguments. Required.' + ResponseFunctionCallArgumentsDoneEvent.__qualname__ = 'ResponseFunctionCallArgumentsDoneEvent' + if _version_info < (3, 13): + ResponseFunctionCallArgumentsDoneEvent.__doc__ = 'Emitted when function-call arguments are finalized.\n\n :ivar type: Required. RESPONSE_FUNCTION_CALL_ARGUMENTS_DONE.\n :vartype type: Literal["response.function_call_arguments.done"]\n :ivar item_id: The ID of the item. Required.\n :vartype item_id: str\n :ivar name: The name of the function that was called. Required.\n :vartype name: str\n :ivar output_index: The index of the output item. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar arguments: The function-call arguments. Required.\n :vartype arguments: str\n ' + return ResponseFunctionCallArgumentsDoneEvent + + def _make_ResponseImageGenCallCompletedEvent(): + class ResponseImageGenCallCompletedEvent(TypedDict, total=False): + """ResponseImageGenCallCompletedEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.completed'. Required. + RESPONSE_IMAGE_GENERATION_CALL_COMPLETED. + :vartype type: Literal["response.image_generation_call.completed"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + """ + type: Required[Literal['response.image_generation_call.completed']] + "The type of the event. Always 'response.image_generation_call.completed'. Required.\n RESPONSE_IMAGE_GENERATION_CALL_COMPLETED." + output_index: Required[int] + "The index of the output item in the response's output array. Required." + sequence_number: Required[int] + 'The sequence number of this event. Required.' + item_id: Required[str] + 'The unique identifier of the image generation item being processed. Required.' + ResponseImageGenCallCompletedEvent.__qualname__ = 'ResponseImageGenCallCompletedEvent' + if _version_info < (3, 13): + ResponseImageGenCallCompletedEvent.__doc__ = 'ResponseImageGenCallCompletedEvent.\n\n :ivar type: The type of the event. Always \'response.image_generation_call.completed\'. Required.\n RESPONSE_IMAGE_GENERATION_CALL_COMPLETED.\n :vartype type: Literal["response.image_generation_call.completed"]\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar item_id: The unique identifier of the image generation item being processed. Required.\n :vartype item_id: str\n ' + return ResponseImageGenCallCompletedEvent + + def _make_ResponseImageGenCallGeneratingEvent(): + class ResponseImageGenCallGeneratingEvent(TypedDict, total=False): + """ResponseImageGenCallGeneratingEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.generating'. + Required. RESPONSE_IMAGE_GENERATION_CALL_GENERATING. + :vartype type: Literal["response.image_generation_call.generating"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.image_generation_call.generating']] + "The type of the event. Always 'response.image_generation_call.generating'. Required.\n RESPONSE_IMAGE_GENERATION_CALL_GENERATING." + output_index: Required[int] + "The index of the output item in the response's output array. Required." + item_id: Required[str] + 'The unique identifier of the image generation item being processed. Required.' + sequence_number: Required[int] + 'The sequence number of the image generation item being processed. Required.' + ResponseImageGenCallGeneratingEvent.__qualname__ = 'ResponseImageGenCallGeneratingEvent' + if _version_info < (3, 13): + ResponseImageGenCallGeneratingEvent.__doc__ = 'ResponseImageGenCallGeneratingEvent.\n\n :ivar type: The type of the event. Always \'response.image_generation_call.generating\'.\n Required. RESPONSE_IMAGE_GENERATION_CALL_GENERATING.\n :vartype type: Literal["response.image_generation_call.generating"]\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the image generation item being processed. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of the image generation item being processed.\n Required.\n :vartype sequence_number: int\n ' + return ResponseImageGenCallGeneratingEvent + + def _make_ResponseImageGenCallInProgressEvent(): + class ResponseImageGenCallInProgressEvent(TypedDict, total=False): + """ResponseImageGenCallInProgressEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.in_progress'. + Required. RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS. + :vartype type: Literal["response.image_generation_call.in_progress"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.image_generation_call.in_progress']] + "The type of the event. Always 'response.image_generation_call.in_progress'. Required.\n RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS." + output_index: Required[int] + "The index of the output item in the response's output array. Required." + item_id: Required[str] + 'The unique identifier of the image generation item being processed. Required.' + sequence_number: Required[int] + 'The sequence number of the image generation item being processed. Required.' + ResponseImageGenCallInProgressEvent.__qualname__ = 'ResponseImageGenCallInProgressEvent' + if _version_info < (3, 13): + ResponseImageGenCallInProgressEvent.__doc__ = 'ResponseImageGenCallInProgressEvent.\n\n :ivar type: The type of the event. Always \'response.image_generation_call.in_progress\'.\n Required. RESPONSE_IMAGE_GENERATION_CALL_IN_PROGRESS.\n :vartype type: Literal["response.image_generation_call.in_progress"]\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the image generation item being processed. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of the image generation item being processed.\n Required.\n :vartype sequence_number: int\n ' + return ResponseImageGenCallInProgressEvent + + def _make_ResponseImageGenCallPartialImageEvent(): + class ResponseImageGenCallPartialImageEvent(TypedDict, total=False): + """ResponseImageGenCallPartialImageEvent. + + :ivar type: The type of the event. Always 'response.image_generation_call.partial_image'. + Required. RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE. + :vartype type: Literal["response.image_generation_call.partial_image"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the image generation item being processed. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the image generation item being processed. + Required. + :vartype sequence_number: int + :ivar partial_image_index: 0-based index for the partial image (backend is 1-based, but this is + 0-based for the user). Required. + :vartype partial_image_index: int + :ivar partial_image_b64: Base64-encoded partial image data, suitable for rendering as an image. + Required. + :vartype partial_image_b64: str + :ivar size: The image size that was used. + :vartype size: str + :ivar quality: The image quality that was used. + :vartype quality: str + :ivar background: The background setting that was used. + :vartype background: str + :ivar output_format: The output format that was used. + :vartype output_format: str + """ + type: Required[Literal['response.image_generation_call.partial_image']] + "The type of the event. Always 'response.image_generation_call.partial_image'. Required.\n RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE." + output_index: Required[int] + "The index of the output item in the response's output array. Required." + item_id: Required[str] + 'The unique identifier of the image generation item being processed. Required.' + sequence_number: Required[int] + 'The sequence number of the image generation item being processed. Required.' + partial_image_index: Required[int] + '0-based index for the partial image (backend is 1-based, but this is 0-based for the user).\n Required.' + partial_image_b64: Required[str] + 'Base64-encoded partial image data, suitable for rendering as an image. Required.' + size: str + 'The image size that was used.' + quality: str + 'The image quality that was used.' + background: str + 'The background setting that was used.' + output_format: str + 'The output format that was used.' + ResponseImageGenCallPartialImageEvent.__qualname__ = 'ResponseImageGenCallPartialImageEvent' + if _version_info < (3, 13): + ResponseImageGenCallPartialImageEvent.__doc__ = 'ResponseImageGenCallPartialImageEvent.\n\n :ivar type: The type of the event. Always \'response.image_generation_call.partial_image\'.\n Required. RESPONSE_IMAGE_GENERATION_CALL_PARTIAL_IMAGE.\n :vartype type: Literal["response.image_generation_call.partial_image"]\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the image generation item being processed. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of the image generation item being processed.\n Required.\n :vartype sequence_number: int\n :ivar partial_image_index: 0-based index for the partial image (backend is 1-based, but this is\n 0-based for the user). Required.\n :vartype partial_image_index: int\n :ivar partial_image_b64: Base64-encoded partial image data, suitable for rendering as an image.\n Required.\n :vartype partial_image_b64: str\n :ivar size: The image size that was used.\n :vartype size: str\n :ivar quality: The image quality that was used.\n :vartype quality: str\n :ivar background: The background setting that was used.\n :vartype background: str\n :ivar output_format: The output format that was used.\n :vartype output_format: str\n ' + return ResponseImageGenCallPartialImageEvent + + def _make_ResponseIncompleteDetails(): + class ResponseIncompleteDetails(TypedDict, total=False): + """ResponseIncompleteDetails. + + :ivar reason: Is either a Literal["max_output_tokens"] type or a Literal["content_filter"] + type. + :vartype reason: Literal["max_output_tokens", "content_filter"] + """ + reason: Literal['max_output_tokens', 'content_filter'] + 'Is either a Literal["max_output_tokens"] type or a Literal["content_filter"] type.' + ResponseIncompleteDetails.__qualname__ = 'ResponseIncompleteDetails' + if _version_info < (3, 13): + ResponseIncompleteDetails.__doc__ = 'ResponseIncompleteDetails.\n\n :ivar reason: Is either a Literal["max_output_tokens"] type or a Literal["content_filter"]\n type.\n :vartype reason: Literal["max_output_tokens", "content_filter"]\n ' + return ResponseIncompleteDetails + + def _make_ResponseIncompleteEvent(): + class ResponseIncompleteEvent(TypedDict, total=False): + """An event that is emitted when a response finishes as incomplete. + + :ivar type: The type of the event. Always ``response.incomplete``. Required. + RESPONSE_INCOMPLETE. + :vartype type: Literal["response.incomplete"] + :ivar response: The response that was incomplete. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.incomplete']] + 'The type of the event. Always ``response.incomplete``. Required. RESPONSE_INCOMPLETE.' + response: Required['_types.ResponseObject'] + 'The response that was incomplete. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseIncompleteEvent.__qualname__ = 'ResponseIncompleteEvent' + if _version_info < (3, 13): + ResponseIncompleteEvent.__doc__ = 'An event that is emitted when a response finishes as incomplete.\n\n :ivar type: The type of the event. Always ``response.incomplete``. Required.\n RESPONSE_INCOMPLETE.\n :vartype type: Literal["response.incomplete"]\n :ivar response: The response that was incomplete. Required.\n :vartype response: "ResponseObject"\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseIncompleteEvent + + def _make_ResponseInProgressEvent(): + class ResponseInProgressEvent(TypedDict, total=False): + """Emitted when the response is in progress. + + :ivar type: The type of the event. Always ``response.in_progress``. Required. + RESPONSE_IN_PROGRESS. + :vartype type: Literal["response.in_progress"] + :ivar response: The response that is in progress. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.in_progress']] + 'The type of the event. Always ``response.in_progress``. Required. RESPONSE_IN_PROGRESS.' + response: Required['_types.ResponseObject'] + 'The response that is in progress. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseInProgressEvent.__qualname__ = 'ResponseInProgressEvent' + if _version_info < (3, 13): + ResponseInProgressEvent.__doc__ = 'Emitted when the response is in progress.\n\n :ivar type: The type of the event. Always ``response.in_progress``. Required.\n RESPONSE_IN_PROGRESS.\n :vartype type: Literal["response.in_progress"]\n :ivar response: The response that is in progress. Required.\n :vartype response: "ResponseObject"\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseInProgressEvent + + def _make_ResponseLogProb(): + class ResponseLogProb(TypedDict, total=False): + """A logprob is the logarithmic probability that the model assigns to producing a particular token + at a given position in the sequence. Less-negative (higher) logprob values indicate greater + model confidence in that token choice. + + :ivar token: A possible text token. Required. + :vartype token: str + :ivar logprob: The log probability of this token. Required. + :vartype logprob: float + :ivar top_logprobs: The log probabilities of up to 20 of the most likely tokens. + :vartype top_logprobs: list["ResponseLogProbTopLogprobs"] + """ + token: Required[str] + 'A possible text token. Required.' + logprob: Required[float] + 'The log probability of this token. Required.' + top_logprobs: list['_types.ResponseLogProbTopLogprobs'] + 'The log probabilities of up to 20 of the most likely tokens.' + ResponseLogProb.__qualname__ = 'ResponseLogProb' + if _version_info < (3, 13): + ResponseLogProb.__doc__ = 'A logprob is the logarithmic probability that the model assigns to producing a particular token\n at a given position in the sequence. Less-negative (higher) logprob values indicate greater\n model confidence in that token choice.\n\n :ivar token: A possible text token. Required.\n :vartype token: str\n :ivar logprob: The log probability of this token. Required.\n :vartype logprob: float\n :ivar top_logprobs: The log probabilities of up to 20 of the most likely tokens.\n :vartype top_logprobs: list["ResponseLogProbTopLogprobs"]\n ' + return ResponseLogProb + + def _make_ResponseLogProbTopLogprobs(): + class ResponseLogProbTopLogprobs(TypedDict, total=False): + """ResponseLogProbTopLogprobs. + + :ivar token: + :vartype token: str + :ivar logprob: + :vartype logprob: float + """ + token: str + logprob: float + ResponseLogProbTopLogprobs.__qualname__ = 'ResponseLogProbTopLogprobs' + if _version_info < (3, 13): + ResponseLogProbTopLogprobs.__doc__ = 'ResponseLogProbTopLogprobs.\n\n :ivar token:\n :vartype token: str\n :ivar logprob:\n :vartype logprob: float\n ' + return ResponseLogProbTopLogprobs + + def _make_ResponseMCPCallArgumentsDeltaEvent(): + class ResponseMCPCallArgumentsDeltaEvent(TypedDict, total=False): + """ResponseMCPCallArgumentsDeltaEvent. + + :ivar type: The type of the event. Always 'response.mcp_call_arguments.delta'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DELTA. + :vartype type: Literal["response.mcp_call_arguments.delta"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + :ivar delta: A JSON string containing the partial update to the arguments for the MCP tool + call. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_call_arguments.delta']] + "The type of the event. Always 'response.mcp_call_arguments.delta'. Required.\n RESPONSE_MCP_CALL_ARGUMENTS_DELTA." + output_index: Required[int] + "The index of the output item in the response's output array. Required." + item_id: Required[str] + 'The unique identifier of the MCP tool call item being processed. Required.' + delta: Required[str] + 'A JSON string containing the partial update to the arguments for the MCP tool call. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPCallArgumentsDeltaEvent.__qualname__ = 'ResponseMCPCallArgumentsDeltaEvent' + if _version_info < (3, 13): + ResponseMCPCallArgumentsDeltaEvent.__doc__ = 'ResponseMCPCallArgumentsDeltaEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_call_arguments.delta\'. Required.\n RESPONSE_MCP_CALL_ARGUMENTS_DELTA.\n :vartype type: Literal["response.mcp_call_arguments.delta"]\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the MCP tool call item being processed. Required.\n :vartype item_id: str\n :ivar delta: A JSON string containing the partial update to the arguments for the MCP tool\n call. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPCallArgumentsDeltaEvent + + def _make_ResponseMCPCallArgumentsDoneEvent(): + class ResponseMCPCallArgumentsDoneEvent(TypedDict, total=False): + """ResponseMCPCallArgumentsDoneEvent. + + :ivar type: The type of the event. Always 'response.mcp_call_arguments.done'. Required. + RESPONSE_MCP_CALL_ARGUMENTS_DONE. + :vartype type: Literal["response.mcp_call_arguments.done"] + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + :ivar arguments: A JSON string containing the finalized arguments for the MCP tool call. + Required. + :vartype arguments: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_call_arguments.done']] + "The type of the event. Always 'response.mcp_call_arguments.done'. Required.\n RESPONSE_MCP_CALL_ARGUMENTS_DONE." + output_index: Required[int] + "The index of the output item in the response's output array. Required." + item_id: Required[str] + 'The unique identifier of the MCP tool call item being processed. Required.' + arguments: Required[str] + 'A JSON string containing the finalized arguments for the MCP tool call. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPCallArgumentsDoneEvent.__qualname__ = 'ResponseMCPCallArgumentsDoneEvent' + if _version_info < (3, 13): + ResponseMCPCallArgumentsDoneEvent.__doc__ = 'ResponseMCPCallArgumentsDoneEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_call_arguments.done\'. Required.\n RESPONSE_MCP_CALL_ARGUMENTS_DONE.\n :vartype type: Literal["response.mcp_call_arguments.done"]\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the MCP tool call item being processed. Required.\n :vartype item_id: str\n :ivar arguments: A JSON string containing the finalized arguments for the MCP tool call.\n Required.\n :vartype arguments: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPCallArgumentsDoneEvent + + def _make_ResponseMCPCallCompletedEvent(): + class ResponseMCPCallCompletedEvent(TypedDict, total=False): + """ResponseMCPCallCompletedEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.completed'. Required. + RESPONSE_MCP_CALL_COMPLETED. + :vartype type: Literal["response.mcp_call.completed"] + :ivar item_id: The ID of the MCP tool call item that completed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that completed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_call.completed']] + "The type of the event. Always 'response.mcp_call.completed'. Required.\n RESPONSE_MCP_CALL_COMPLETED." + item_id: Required[str] + 'The ID of the MCP tool call item that completed. Required.' + output_index: Required[int] + 'The index of the output item that completed. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPCallCompletedEvent.__qualname__ = 'ResponseMCPCallCompletedEvent' + if _version_info < (3, 13): + ResponseMCPCallCompletedEvent.__doc__ = 'ResponseMCPCallCompletedEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_call.completed\'. Required.\n RESPONSE_MCP_CALL_COMPLETED.\n :vartype type: Literal["response.mcp_call.completed"]\n :ivar item_id: The ID of the MCP tool call item that completed. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that completed. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPCallCompletedEvent + + def _make_ResponseMCPCallFailedEvent(): + class ResponseMCPCallFailedEvent(TypedDict, total=False): + """ResponseMCPCallFailedEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.failed'. Required. + RESPONSE_MCP_CALL_FAILED. + :vartype type: Literal["response.mcp_call.failed"] + :ivar item_id: The ID of the MCP tool call item that failed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that failed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_call.failed']] + "The type of the event. Always 'response.mcp_call.failed'. Required. RESPONSE_MCP_CALL_FAILED." + item_id: Required[str] + 'The ID of the MCP tool call item that failed. Required.' + output_index: Required[int] + 'The index of the output item that failed. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPCallFailedEvent.__qualname__ = 'ResponseMCPCallFailedEvent' + if _version_info < (3, 13): + ResponseMCPCallFailedEvent.__doc__ = 'ResponseMCPCallFailedEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_call.failed\'. Required.\n RESPONSE_MCP_CALL_FAILED.\n :vartype type: Literal["response.mcp_call.failed"]\n :ivar item_id: The ID of the MCP tool call item that failed. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that failed. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPCallFailedEvent + + def _make_ResponseMCPCallInProgressEvent(): + class ResponseMCPCallInProgressEvent(TypedDict, total=False): + """ResponseMCPCallInProgressEvent. + + :ivar type: The type of the event. Always 'response.mcp_call.in_progress'. Required. + RESPONSE_MCP_CALL_IN_PROGRESS. + :vartype type: Literal["response.mcp_call.in_progress"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar item_id: The unique identifier of the MCP tool call item being processed. Required. + :vartype item_id: str + """ + type: Required[Literal['response.mcp_call.in_progress']] + "The type of the event. Always 'response.mcp_call.in_progress'. Required.\n RESPONSE_MCP_CALL_IN_PROGRESS." + sequence_number: Required[int] + 'The sequence number of this event. Required.' + output_index: Required[int] + "The index of the output item in the response's output array. Required." + item_id: Required[str] + 'The unique identifier of the MCP tool call item being processed. Required.' + ResponseMCPCallInProgressEvent.__qualname__ = 'ResponseMCPCallInProgressEvent' + if _version_info < (3, 13): + ResponseMCPCallInProgressEvent.__doc__ = 'ResponseMCPCallInProgressEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_call.in_progress\'. Required.\n RESPONSE_MCP_CALL_IN_PROGRESS.\n :vartype type: Literal["response.mcp_call.in_progress"]\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar item_id: The unique identifier of the MCP tool call item being processed. Required.\n :vartype item_id: str\n ' + return ResponseMCPCallInProgressEvent + + def _make_ResponseMCPListToolsCompletedEvent(): + class ResponseMCPListToolsCompletedEvent(TypedDict, total=False): + """ResponseMCPListToolsCompletedEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.completed'. Required. + RESPONSE_MCP_LIST_TOOLS_COMPLETED. + :vartype type: Literal["response.mcp_list_tools.completed"] + :ivar item_id: The ID of the MCP tool call item that produced this output. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that was processed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_list_tools.completed']] + "The type of the event. Always 'response.mcp_list_tools.completed'. Required.\n RESPONSE_MCP_LIST_TOOLS_COMPLETED." + item_id: Required[str] + 'The ID of the MCP tool call item that produced this output. Required.' + output_index: Required[int] + 'The index of the output item that was processed. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPListToolsCompletedEvent.__qualname__ = 'ResponseMCPListToolsCompletedEvent' + if _version_info < (3, 13): + ResponseMCPListToolsCompletedEvent.__doc__ = 'ResponseMCPListToolsCompletedEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_list_tools.completed\'. Required.\n RESPONSE_MCP_LIST_TOOLS_COMPLETED.\n :vartype type: Literal["response.mcp_list_tools.completed"]\n :ivar item_id: The ID of the MCP tool call item that produced this output. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that was processed. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPListToolsCompletedEvent + + def _make_ResponseMCPListToolsFailedEvent(): + class ResponseMCPListToolsFailedEvent(TypedDict, total=False): + """ResponseMCPListToolsFailedEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.failed'. Required. + RESPONSE_MCP_LIST_TOOLS_FAILED. + :vartype type: Literal["response.mcp_list_tools.failed"] + :ivar item_id: The ID of the MCP tool call item that failed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that failed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_list_tools.failed']] + "The type of the event. Always 'response.mcp_list_tools.failed'. Required.\n RESPONSE_MCP_LIST_TOOLS_FAILED." + item_id: Required[str] + 'The ID of the MCP tool call item that failed. Required.' + output_index: Required[int] + 'The index of the output item that failed. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPListToolsFailedEvent.__qualname__ = 'ResponseMCPListToolsFailedEvent' + if _version_info < (3, 13): + ResponseMCPListToolsFailedEvent.__doc__ = 'ResponseMCPListToolsFailedEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_list_tools.failed\'. Required.\n RESPONSE_MCP_LIST_TOOLS_FAILED.\n :vartype type: Literal["response.mcp_list_tools.failed"]\n :ivar item_id: The ID of the MCP tool call item that failed. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that failed. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPListToolsFailedEvent + + def _make_ResponseMCPListToolsInProgressEvent(): + class ResponseMCPListToolsInProgressEvent(TypedDict, total=False): + """ResponseMCPListToolsInProgressEvent. + + :ivar type: The type of the event. Always 'response.mcp_list_tools.in_progress'. Required. + RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS. + :vartype type: Literal["response.mcp_list_tools.in_progress"] + :ivar item_id: The ID of the MCP tool call item that is being processed. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that is being processed. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.mcp_list_tools.in_progress']] + "The type of the event. Always 'response.mcp_list_tools.in_progress'. Required.\n RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS." + item_id: Required[str] + 'The ID of the MCP tool call item that is being processed. Required.' + output_index: Required[int] + 'The index of the output item that is being processed. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseMCPListToolsInProgressEvent.__qualname__ = 'ResponseMCPListToolsInProgressEvent' + if _version_info < (3, 13): + ResponseMCPListToolsInProgressEvent.__doc__ = 'ResponseMCPListToolsInProgressEvent.\n\n :ivar type: The type of the event. Always \'response.mcp_list_tools.in_progress\'. Required.\n RESPONSE_MCP_LIST_TOOLS_IN_PROGRESS.\n :vartype type: Literal["response.mcp_list_tools.in_progress"]\n :ivar item_id: The ID of the MCP tool call item that is being processed. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that is being processed. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseMCPListToolsInProgressEvent + + def _make_ResponseObject(): + class ResponseObject(TypedDict, total=False): + """The response object. + + :ivar metadata: + :vartype metadata: "Metadata" + :ivar top_logprobs: + :vartype top_logprobs: int + :ivar temperature: + :vartype temperature: float + :ivar top_p: + :vartype top_p: float + :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use + ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your + end-users. Used to boost cache hit rates by better bucketing similar requests and to help + OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers. + :vartype user: str + :ivar safety_identifier: + :vartype safety_identifier: str + :ivar prompt_cache_key: + :vartype prompt_cache_key: str + :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type. + :vartype prompt_cache_retention: Literal["in_memory", "24h"] + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar model: The model deployment to use for the creation of this response. + :vartype model: str + :ivar background: + :vartype background: bool + :ivar max_tool_calls: + :vartype max_tool_calls: int + :ivar text: + :vartype text: "ResponseTextParam" + :ivar tools: + :vartype tools: list["Tool"] + :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type. + :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"] + :ivar prompt: + :vartype prompt: "Prompt" + :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"], + Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"] + :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast", + "ultrafast"] + :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type. + :vartype truncation: Literal["auto", "disabled"] + :ivar id: Unique identifier for this Response. Required. + :vartype id: str + :ivar object: The object type of this resource - always set to ``response``. Required. Default + value is "response". + :vartype object: Literal["response"] + :ivar status: The status of the response generation. One of ``completed``, ``failed``, + ``in_progress``, ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types: + Literal["completed"], Literal["failed"], Literal["in_progress"], Literal["cancelled"], + Literal["queued"], Literal["incomplete"] + :vartype status: Literal["completed", "failed", "in_progress", "cancelled", "queued", + "incomplete"] + :ivar created_at: Unix timestamp (in seconds) of when this Response was created. Required. + :vartype created_at: int + :ivar completed_at: + :vartype completed_at: int + :ivar error: Required. + :vartype error: "ResponseErrorInfo" + :ivar incomplete_details: Required. + :vartype incomplete_details: "ResponseIncompleteDetails" + :ivar output: An array of content items generated by the model. The length and order of items + depends on the model response. Use the output_text property instead of assuming the first item + is an assistant message. Required. + :vartype output: list["OutputItem"] + :ivar reasoning: + :vartype reasoning: "Reasoning" + :ivar instructions: Required. Is either a str type or a [Item] type. + :vartype instructions: Union[str, list["Item"]] + :ivar output_text: + :vartype output_text: str + :ivar usage: + :vartype usage: "ResponseUsage" + :ivar prompt_cache_options: + :vartype prompt_cache_options: "PromptCacheOptions" + :ivar moderation: + :vartype moderation: "Moderation" + :ivar parallel_tool_calls: Whether to allow the model to run tool calls in parallel. Required. + :vartype parallel_tool_calls: bool + :ivar conversation: + :vartype conversation: "ConversationReference" + :ivar max_output_tokens: + :vartype max_output_tokens: int + :ivar agent_reference: The agent used for this response. Required. + :vartype agent_reference: "AgentReference" + """ + metadata: Optional['_types.Metadata'] + top_logprobs: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + user: str + 'This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use\n ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your\n end-users. Used to boost cache hit rates by better bucketing similar requests and to help\n OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.' + safety_identifier: Optional[str] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[Literal['in_memory', '24h']] + 'Is either a Literal["in_memory"] type or a Literal["24h"] type.' + previous_response_id: Optional[str] + model: str + 'The model deployment to use for the creation of this response.' + background: Optional[bool] + max_tool_calls: Optional[int] + text: '_types.ResponseTextParam' + tools: list['_types.Tool'] + tool_choice: Union[_resolve('ToolChoiceOptions'), '_types.ToolChoiceParam'] + 'Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.' + prompt: '_types.Prompt' + service_tier: Optional[Literal['auto', 'default', 'flex', 'scale', 'priority', 'fast', 'ultrafast']] + 'Is one of the following types: Literal["auto"], Literal["default"], Literal["flex"],\n Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"]' + truncation: Optional[Literal['auto', 'disabled']] + 'Is either a Literal["auto"] type or a Literal["disabled"] type.' + id: Required[str] + 'Unique identifier for this Response. Required.' + object: Required[Literal['response']] + 'The object type of this resource - always set to ``response``. Required. Default value is\n "response".' + status: Literal['completed', 'failed', 'in_progress', 'cancelled', 'queued', 'incomplete'] + 'The status of the response generation. One of ``completed``, ``failed``, ``in_progress``,\n ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types:\n Literal["completed"], Literal["failed"], Literal["in_progress"], Literal["cancelled"],\n Literal["queued"], Literal["incomplete"]' + created_at: Required[int] + 'Unix timestamp (in seconds) of when this Response was created. Required.' + completed_at: Optional[int] + error: Required[Optional['_types.ResponseErrorInfo']] + 'Required.' + incomplete_details: Required[Optional['_types.ResponseIncompleteDetails']] + 'Required.' + output: Required[list['_types.OutputItem']] + 'An array of content items generated by the model. The length and order of items depends on the\n model response. Use the output_text property instead of assuming the first item is an assistant\n message. Required.' + reasoning: Optional['_types.Reasoning'] + instructions: Required[Optional[Union[str, list['_types.Item']]]] + 'Required. Is either a str type or a [Item] type.' + output_text: Optional[str] + usage: '_types.ResponseUsage' + prompt_cache_options: '_types.PromptCacheOptions' + moderation: Optional['_types.Moderation'] + parallel_tool_calls: Required[bool] + 'Whether to allow the model to run tool calls in parallel. Required.' + conversation: Optional['_types.ConversationReference'] + max_output_tokens: Optional[int] + agent_reference: Required[Optional['_types.AgentReference']] + 'The agent used for this response. Required.' + ResponseObject.__qualname__ = 'ResponseObject' + if _version_info < (3, 13): + ResponseObject.__doc__ = 'The response object.\n\n :ivar metadata:\n :vartype metadata: "Metadata"\n :ivar top_logprobs:\n :vartype top_logprobs: int\n :ivar temperature:\n :vartype temperature: float\n :ivar top_p:\n :vartype top_p: float\n :ivar user: This field is being replaced by ``safety_identifier`` and ``prompt_cache_key``. Use\n ``prompt_cache_key`` instead to maintain caching optimizations. A stable identifier for your\n end-users. Used to boost cache hit rates by better bucketing similar requests and to help\n OpenAI detect and prevent abuse. Learn more: /docs/guides/safety-best-practices#safety-identifiers.\n :vartype user: str\n :ivar safety_identifier:\n :vartype safety_identifier: str\n :ivar prompt_cache_key:\n :vartype prompt_cache_key: str\n :ivar prompt_cache_retention: Is either a Literal["in_memory"] type or a Literal["24h"] type.\n :vartype prompt_cache_retention: Literal["in_memory", "24h"]\n :ivar previous_response_id:\n :vartype previous_response_id: str\n :ivar model: The model deployment to use for the creation of this response.\n :vartype model: str\n :ivar background:\n :vartype background: bool\n :ivar max_tool_calls:\n :vartype max_tool_calls: int\n :ivar text:\n :vartype text: "ResponseTextParam"\n :ivar tools:\n :vartype tools: list["Tool"]\n :ivar tool_choice: Is either a types.ToolChoiceOptions type or a ToolChoiceParam type.\n :vartype tool_choice: Union[ToolChoiceOptions, "ToolChoiceParam"]\n :ivar prompt:\n :vartype prompt: "Prompt"\n :ivar service_tier: Is one of the following types: Literal["auto"], Literal["default"],\n Literal["flex"], Literal["scale"], Literal["priority"], Literal["fast"], Literal["ultrafast"]\n :vartype service_tier: Literal["auto", "default", "flex", "scale", "priority", "fast",\n "ultrafast"]\n :ivar truncation: Is either a Literal["auto"] type or a Literal["disabled"] type.\n :vartype truncation: Literal["auto", "disabled"]\n :ivar id: Unique identifier for this Response. Required.\n :vartype id: str\n :ivar object: The object type of this resource - always set to ``response``. Required. Default\n value is "response".\n :vartype object: Literal["response"]\n :ivar status: The status of the response generation. One of ``completed``, ``failed``,\n ``in_progress``, ``cancelled``, ``queued``, or ``incomplete``. Is one of the following types:\n Literal["completed"], Literal["failed"], Literal["in_progress"], Literal["cancelled"],\n Literal["queued"], Literal["incomplete"]\n :vartype status: Literal["completed", "failed", "in_progress", "cancelled", "queued",\n "incomplete"]\n :ivar created_at: Unix timestamp (in seconds) of when this Response was created. Required.\n :vartype created_at: int\n :ivar completed_at:\n :vartype completed_at: int\n :ivar error: Required.\n :vartype error: "ResponseErrorInfo"\n :ivar incomplete_details: Required.\n :vartype incomplete_details: "ResponseIncompleteDetails"\n :ivar output: An array of content items generated by the model. The length and order of items\n depends on the model response. Use the output_text property instead of assuming the first item\n is an assistant message. Required.\n :vartype output: list["OutputItem"]\n :ivar reasoning:\n :vartype reasoning: "Reasoning"\n :ivar instructions: Required. Is either a str type or a [Item] type.\n :vartype instructions: Union[str, list["Item"]]\n :ivar output_text:\n :vartype output_text: str\n :ivar usage:\n :vartype usage: "ResponseUsage"\n :ivar prompt_cache_options:\n :vartype prompt_cache_options: "PromptCacheOptions"\n :ivar moderation:\n :vartype moderation: "Moderation"\n :ivar parallel_tool_calls: Whether to allow the model to run tool calls in parallel. Required.\n :vartype parallel_tool_calls: bool\n :ivar conversation:\n :vartype conversation: "ConversationReference"\n :ivar max_output_tokens:\n :vartype max_output_tokens: int\n :ivar agent_reference: The agent used for this response. Required.\n :vartype agent_reference: "AgentReference"\n ' + return ResponseObject + + def _make_ResponseOutputItemAddedEvent(): + class ResponseOutputItemAddedEvent(TypedDict, total=False): + """Emitted when a new output item is added. + + :ivar type: The type of the event. Always ``response.output_item.added``. Required. + RESPONSE_OUTPUT_ITEM_ADDED. + :vartype type: Literal["response.output_item.added"] + :ivar output_index: The index of the output item that was added. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item: The output item that was added. For reasoning items, ``encrypted_content`` may be + incomplete while the item is in progress. Use the reasoning item from the corresponding + ``response.output_item.done`` event when passing it as input to a subsequent request. Required. + :vartype item: "OutputItem" + """ + type: Required[Literal['response.output_item.added']] + 'The type of the event. Always ``response.output_item.added``. Required.\n RESPONSE_OUTPUT_ITEM_ADDED.' + output_index: Required[int] + 'The index of the output item that was added. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + item: Required['_types.OutputItem'] + 'The output item that was added. For reasoning items, ``encrypted_content`` may be incomplete\n while the item is in progress. Use the reasoning item from the corresponding\n ``response.output_item.done`` event when passing it as input to a subsequent request. Required.' + ResponseOutputItemAddedEvent.__qualname__ = 'ResponseOutputItemAddedEvent' + if _version_info < (3, 13): + ResponseOutputItemAddedEvent.__doc__ = 'Emitted when a new output item is added.\n\n :ivar type: The type of the event. Always ``response.output_item.added``. Required.\n RESPONSE_OUTPUT_ITEM_ADDED.\n :vartype type: Literal["response.output_item.added"]\n :ivar output_index: The index of the output item that was added. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar item: The output item that was added. For reasoning items, ``encrypted_content`` may be\n incomplete while the item is in progress. Use the reasoning item from the corresponding\n ``response.output_item.done`` event when passing it as input to a subsequent request. Required.\n :vartype item: "OutputItem"\n ' + return ResponseOutputItemAddedEvent + + def _make_ResponseOutputItemDoneEvent(): + class ResponseOutputItemDoneEvent(TypedDict, total=False): + """Emitted when an output item is marked done. + + :ivar type: The type of the event. Always ``response.output_item.done``. Required. + RESPONSE_OUTPUT_ITEM_DONE. + :vartype type: Literal["response.output_item.done"] + :ivar output_index: The index of the output item that was marked done. Required. + :vartype output_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar item: The output item that was marked done. Required. + :vartype item: "OutputItem" + """ + type: Required[Literal['response.output_item.done']] + 'The type of the event. Always ``response.output_item.done``. Required.\n RESPONSE_OUTPUT_ITEM_DONE.' + output_index: Required[int] + 'The index of the output item that was marked done. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + item: Required['_types.OutputItem'] + 'The output item that was marked done. Required.' + ResponseOutputItemDoneEvent.__qualname__ = 'ResponseOutputItemDoneEvent' + if _version_info < (3, 13): + ResponseOutputItemDoneEvent.__doc__ = 'Emitted when an output item is marked done.\n\n :ivar type: The type of the event. Always ``response.output_item.done``. Required.\n RESPONSE_OUTPUT_ITEM_DONE.\n :vartype type: Literal["response.output_item.done"]\n :ivar output_index: The index of the output item that was marked done. Required.\n :vartype output_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar item: The output item that was marked done. Required.\n :vartype item: "OutputItem"\n ' + return ResponseOutputItemDoneEvent + + def _make_ResponseOutputTextAnnotationAddedEvent(): + class ResponseOutputTextAnnotationAddedEvent(TypedDict, total=False): + """ResponseOutputTextAnnotationAddedEvent. + + :ivar type: The type of the event. Always 'response.output_text.annotation.added'. Required. + RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED. + :vartype type: Literal["response.output_text.annotation.added"] + :ivar item_id: The unique identifier of the item to which the annotation is being added. + Required. + :vartype item_id: str + :ivar output_index: The index of the output item in the response's output array. Required. + :vartype output_index: int + :ivar content_index: The index of the content part within the output item. Required. + :vartype content_index: int + :ivar annotation_index: The index of the annotation within the content part. Required. + :vartype annotation_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar annotation: The annotation object being added. (See annotation schema for details.). + Required. + :vartype annotation: "Annotation" + """ + type: Required[Literal['response.output_text.annotation.added']] + "The type of the event. Always 'response.output_text.annotation.added'. Required.\n RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED." + item_id: Required[str] + 'The unique identifier of the item to which the annotation is being added. Required.' + output_index: Required[int] + "The index of the output item in the response's output array. Required." + content_index: Required[int] + 'The index of the content part within the output item. Required.' + annotation_index: Required[int] + 'The index of the annotation within the content part. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + annotation: Required['_types.Annotation'] + 'The annotation object being added. (See annotation schema for details.). Required.' + ResponseOutputTextAnnotationAddedEvent.__qualname__ = 'ResponseOutputTextAnnotationAddedEvent' + if _version_info < (3, 13): + ResponseOutputTextAnnotationAddedEvent.__doc__ = 'ResponseOutputTextAnnotationAddedEvent.\n\n :ivar type: The type of the event. Always \'response.output_text.annotation.added\'. Required.\n RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED.\n :vartype type: Literal["response.output_text.annotation.added"]\n :ivar item_id: The unique identifier of the item to which the annotation is being added.\n Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item in the response\'s output array. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part within the output item. Required.\n :vartype content_index: int\n :ivar annotation_index: The index of the annotation within the content part. Required.\n :vartype annotation_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar annotation: The annotation object being added. (See annotation schema for details.).\n Required.\n :vartype annotation: "Annotation"\n ' + return ResponseOutputTextAnnotationAddedEvent + + def _make_ResponsePromptVariables(): + class ResponsePromptVariables(TypedDict, total=False): + """Prompt Variables.""" + ResponsePromptVariables.__qualname__ = 'ResponsePromptVariables' + if _version_info < (3, 13): + ResponsePromptVariables.__doc__ = 'Prompt Variables.' + return ResponsePromptVariables + + def _make_ResponseQueuedEvent(): + class ResponseQueuedEvent(TypedDict, total=False): + """ResponseQueuedEvent. + + :ivar type: The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED. + :vartype type: Literal["response.queued"] + :ivar response: The full response object that is queued. Required. + :vartype response: "ResponseObject" + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.queued']] + "The type of the event. Always 'response.queued'. Required. RESPONSE_QUEUED." + response: Required['_types.ResponseObject'] + 'The full response object that is queued. Required.' + sequence_number: Required[int] + 'The sequence number for this event. Required.' + ResponseQueuedEvent.__qualname__ = 'ResponseQueuedEvent' + if _version_info < (3, 13): + ResponseQueuedEvent.__doc__ = 'ResponseQueuedEvent.\n\n :ivar type: The type of the event. Always \'response.queued\'. Required. RESPONSE_QUEUED.\n :vartype type: Literal["response.queued"]\n :ivar response: The full response object that is queued. Required.\n :vartype response: "ResponseObject"\n :ivar sequence_number: The sequence number for this event. Required.\n :vartype sequence_number: int\n ' + return ResponseQueuedEvent + + def _make_ResponseReasoningSummaryPartAddedEvent(): + class ResponseReasoningSummaryPartAddedEvent(TypedDict, total=False): + """Emitted when a new reasoning summary part is added. + + :ivar type: The type of the event. Always ``response.reasoning_summary_part.added``. Required. + RESPONSE_REASONING_SUMMARY_PART_ADDED. + :vartype type: Literal["response.reasoning_summary_part.added"] + :ivar item_id: The ID of the item this summary part is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary part is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The summary part that was added. Required. + :vartype part: "ResponseReasoningSummaryPartAddedEventPart" + """ + type: Required[Literal['response.reasoning_summary_part.added']] + 'The type of the event. Always ``response.reasoning_summary_part.added``. Required.\n RESPONSE_REASONING_SUMMARY_PART_ADDED.' + item_id: Required[str] + 'The ID of the item this summary part is associated with. Required.' + output_index: Required[int] + 'The index of the output item this summary part is associated with. Required.' + summary_index: Required[int] + 'The index of the summary part within the reasoning summary. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + part: Required['_types.ResponseReasoningSummaryPartAddedEventPart'] + 'The summary part that was added. Required.' + ResponseReasoningSummaryPartAddedEvent.__qualname__ = 'ResponseReasoningSummaryPartAddedEvent' + if _version_info < (3, 13): + ResponseReasoningSummaryPartAddedEvent.__doc__ = 'Emitted when a new reasoning summary part is added.\n\n :ivar type: The type of the event. Always ``response.reasoning_summary_part.added``. Required.\n RESPONSE_REASONING_SUMMARY_PART_ADDED.\n :vartype type: Literal["response.reasoning_summary_part.added"]\n :ivar item_id: The ID of the item this summary part is associated with. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item this summary part is associated with.\n Required.\n :vartype output_index: int\n :ivar summary_index: The index of the summary part within the reasoning summary. Required.\n :vartype summary_index: int\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar part: The summary part that was added. Required.\n :vartype part: "ResponseReasoningSummaryPartAddedEventPart"\n ' + return ResponseReasoningSummaryPartAddedEvent + + def _make_ResponseReasoningSummaryPartAddedEventPart(): + class ResponseReasoningSummaryPartAddedEventPart(TypedDict, total=False): + """ResponseReasoningSummaryPartAddedEventPart. + + :ivar type: Required. Default value is "summary_text". + :vartype type: Literal["summary_text"] + :ivar text: Required. + :vartype text: str + """ + type: Required[Literal['summary_text']] + 'Required. Default value is "summary_text".' + text: Required[str] + 'Required.' + ResponseReasoningSummaryPartAddedEventPart.__qualname__ = 'ResponseReasoningSummaryPartAddedEventPart' + if _version_info < (3, 13): + ResponseReasoningSummaryPartAddedEventPart.__doc__ = 'ResponseReasoningSummaryPartAddedEventPart.\n\n :ivar type: Required. Default value is "summary_text".\n :vartype type: Literal["summary_text"]\n :ivar text: Required.\n :vartype text: str\n ' + return ResponseReasoningSummaryPartAddedEventPart + + def _make_ResponseReasoningSummaryPartDoneEvent(): + class ResponseReasoningSummaryPartDoneEvent(TypedDict, total=False): + """Emitted when a reasoning summary part is completed. + + :ivar type: The type of the event. Always ``response.reasoning_summary_part.done``. Required. + RESPONSE_REASONING_SUMMARY_PART_DONE. + :vartype type: Literal["response.reasoning_summary_part.done"] + :ivar item_id: The ID of the item this summary part is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary part is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar status: The completion status of the summary part. Omitted when the part completed + normally and set to ``incomplete`` when generation was interrupted. Default value is + "incomplete". + :vartype status: Literal["incomplete"] + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + :ivar part: The completed summary part. Required. + :vartype part: "ResponseReasoningSummaryPartDoneEventPart" + """ + type: Required[Literal['response.reasoning_summary_part.done']] + 'The type of the event. Always ``response.reasoning_summary_part.done``. Required.\n RESPONSE_REASONING_SUMMARY_PART_DONE.' + item_id: Required[str] + 'The ID of the item this summary part is associated with. Required.' + output_index: Required[int] + 'The index of the output item this summary part is associated with. Required.' + summary_index: Required[int] + 'The index of the summary part within the reasoning summary. Required.' + status: Literal['incomplete'] + 'The completion status of the summary part. Omitted when the part completed normally and set to\n ``incomplete`` when generation was interrupted. Default value is "incomplete".' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + part: Required['_types.ResponseReasoningSummaryPartDoneEventPart'] + 'The completed summary part. Required.' + ResponseReasoningSummaryPartDoneEvent.__qualname__ = 'ResponseReasoningSummaryPartDoneEvent' + if _version_info < (3, 13): + ResponseReasoningSummaryPartDoneEvent.__doc__ = 'Emitted when a reasoning summary part is completed.\n\n :ivar type: The type of the event. Always ``response.reasoning_summary_part.done``. Required.\n RESPONSE_REASONING_SUMMARY_PART_DONE.\n :vartype type: Literal["response.reasoning_summary_part.done"]\n :ivar item_id: The ID of the item this summary part is associated with. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item this summary part is associated with.\n Required.\n :vartype output_index: int\n :ivar summary_index: The index of the summary part within the reasoning summary. Required.\n :vartype summary_index: int\n :ivar status: The completion status of the summary part. Omitted when the part completed\n normally and set to ``incomplete`` when generation was interrupted. Default value is\n "incomplete".\n :vartype status: Literal["incomplete"]\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n :ivar part: The completed summary part. Required.\n :vartype part: "ResponseReasoningSummaryPartDoneEventPart"\n ' + return ResponseReasoningSummaryPartDoneEvent + + def _make_ResponseReasoningSummaryPartDoneEventPart(): + class ResponseReasoningSummaryPartDoneEventPart(TypedDict, total=False): + """ResponseReasoningSummaryPartDoneEventPart. + + :ivar type: Required. Default value is "summary_text". + :vartype type: Literal["summary_text"] + :ivar text: Required. + :vartype text: str + """ + type: Required[Literal['summary_text']] + 'Required. Default value is "summary_text".' + text: Required[str] + 'Required.' + ResponseReasoningSummaryPartDoneEventPart.__qualname__ = 'ResponseReasoningSummaryPartDoneEventPart' + if _version_info < (3, 13): + ResponseReasoningSummaryPartDoneEventPart.__doc__ = 'ResponseReasoningSummaryPartDoneEventPart.\n\n :ivar type: Required. Default value is "summary_text".\n :vartype type: Literal["summary_text"]\n :ivar text: Required.\n :vartype text: str\n ' + return ResponseReasoningSummaryPartDoneEventPart + + def _make_ResponseReasoningSummaryTextDeltaEvent(): + class ResponseReasoningSummaryTextDeltaEvent(TypedDict, total=False): + """Emitted when a delta is added to a reasoning summary text. + + :ivar type: The type of the event. Always ``response.reasoning_summary_text.delta``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DELTA. + :vartype type: Literal["response.reasoning_summary_text.delta"] + :ivar item_id: The ID of the item this summary text delta is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary text delta is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar delta: The text delta that was added to the summary. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.reasoning_summary_text.delta']] + 'The type of the event. Always ``response.reasoning_summary_text.delta``. Required.\n RESPONSE_REASONING_SUMMARY_TEXT_DELTA.' + item_id: Required[str] + 'The ID of the item this summary text delta is associated with. Required.' + output_index: Required[int] + 'The index of the output item this summary text delta is associated with. Required.' + summary_index: Required[int] + 'The index of the summary part within the reasoning summary. Required.' + delta: Required[str] + 'The text delta that was added to the summary. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseReasoningSummaryTextDeltaEvent.__qualname__ = 'ResponseReasoningSummaryTextDeltaEvent' + if _version_info < (3, 13): + ResponseReasoningSummaryTextDeltaEvent.__doc__ = 'Emitted when a delta is added to a reasoning summary text.\n\n :ivar type: The type of the event. Always ``response.reasoning_summary_text.delta``. Required.\n RESPONSE_REASONING_SUMMARY_TEXT_DELTA.\n :vartype type: Literal["response.reasoning_summary_text.delta"]\n :ivar item_id: The ID of the item this summary text delta is associated with. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item this summary text delta is associated with.\n Required.\n :vartype output_index: int\n :ivar summary_index: The index of the summary part within the reasoning summary. Required.\n :vartype summary_index: int\n :ivar delta: The text delta that was added to the summary. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseReasoningSummaryTextDeltaEvent + + def _make_ResponseReasoningSummaryTextDoneEvent(): + class ResponseReasoningSummaryTextDoneEvent(TypedDict, total=False): + """Emitted when a reasoning summary text is completed. + + :ivar type: The type of the event. Always ``response.reasoning_summary_text.done``. Required. + RESPONSE_REASONING_SUMMARY_TEXT_DONE. + :vartype type: Literal["response.reasoning_summary_text.done"] + :ivar item_id: The ID of the item this summary text is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this summary text is associated with. + Required. + :vartype output_index: int + :ivar summary_index: The index of the summary part within the reasoning summary. Required. + :vartype summary_index: int + :ivar text: The full text of the completed reasoning summary. Required. + :vartype text: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.reasoning_summary_text.done']] + 'The type of the event. Always ``response.reasoning_summary_text.done``. Required.\n RESPONSE_REASONING_SUMMARY_TEXT_DONE.' + item_id: Required[str] + 'The ID of the item this summary text is associated with. Required.' + output_index: Required[int] + 'The index of the output item this summary text is associated with. Required.' + summary_index: Required[int] + 'The index of the summary part within the reasoning summary. Required.' + text: Required[str] + 'The full text of the completed reasoning summary. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseReasoningSummaryTextDoneEvent.__qualname__ = 'ResponseReasoningSummaryTextDoneEvent' + if _version_info < (3, 13): + ResponseReasoningSummaryTextDoneEvent.__doc__ = 'Emitted when a reasoning summary text is completed.\n\n :ivar type: The type of the event. Always ``response.reasoning_summary_text.done``. Required.\n RESPONSE_REASONING_SUMMARY_TEXT_DONE.\n :vartype type: Literal["response.reasoning_summary_text.done"]\n :ivar item_id: The ID of the item this summary text is associated with. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item this summary text is associated with.\n Required.\n :vartype output_index: int\n :ivar summary_index: The index of the summary part within the reasoning summary. Required.\n :vartype summary_index: int\n :ivar text: The full text of the completed reasoning summary. Required.\n :vartype text: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseReasoningSummaryTextDoneEvent + + def _make_ResponseReasoningTextDeltaEvent(): + class ResponseReasoningTextDeltaEvent(TypedDict, total=False): + """Emitted when a delta is added to a reasoning text. + + :ivar type: The type of the event. Always ``response.reasoning_text.delta``. Required. + RESPONSE_REASONING_TEXT_DELTA. + :vartype type: Literal["response.reasoning_text.delta"] + :ivar item_id: The ID of the item this reasoning text delta is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this reasoning text delta is associated with. + Required. + :vartype output_index: int + :ivar content_index: The index of the reasoning content part this delta is associated with. + Required. + :vartype content_index: int + :ivar delta: The text delta that was added to the reasoning content. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.reasoning_text.delta']] + 'The type of the event. Always ``response.reasoning_text.delta``. Required.\n RESPONSE_REASONING_TEXT_DELTA.' + item_id: Required[str] + 'The ID of the item this reasoning text delta is associated with. Required.' + output_index: Required[int] + 'The index of the output item this reasoning text delta is associated with. Required.' + content_index: Required[int] + 'The index of the reasoning content part this delta is associated with. Required.' + delta: Required[str] + 'The text delta that was added to the reasoning content. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseReasoningTextDeltaEvent.__qualname__ = 'ResponseReasoningTextDeltaEvent' + if _version_info < (3, 13): + ResponseReasoningTextDeltaEvent.__doc__ = 'Emitted when a delta is added to a reasoning text.\n\n :ivar type: The type of the event. Always ``response.reasoning_text.delta``. Required.\n RESPONSE_REASONING_TEXT_DELTA.\n :vartype type: Literal["response.reasoning_text.delta"]\n :ivar item_id: The ID of the item this reasoning text delta is associated with. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item this reasoning text delta is associated with.\n Required.\n :vartype output_index: int\n :ivar content_index: The index of the reasoning content part this delta is associated with.\n Required.\n :vartype content_index: int\n :ivar delta: The text delta that was added to the reasoning content. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseReasoningTextDeltaEvent + + def _make_ResponseReasoningTextDoneEvent(): + class ResponseReasoningTextDoneEvent(TypedDict, total=False): + """Emitted when a reasoning text is completed. + + :ivar type: The type of the event. Always ``response.reasoning_text.done``. Required. + RESPONSE_REASONING_TEXT_DONE. + :vartype type: Literal["response.reasoning_text.done"] + :ivar item_id: The ID of the item this reasoning text is associated with. Required. + :vartype item_id: str + :ivar output_index: The index of the output item this reasoning text is associated with. + Required. + :vartype output_index: int + :ivar content_index: The index of the reasoning content part. Required. + :vartype content_index: int + :ivar text: The full text of the completed reasoning content. Required. + :vartype text: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.reasoning_text.done']] + 'The type of the event. Always ``response.reasoning_text.done``. Required.\n RESPONSE_REASONING_TEXT_DONE.' + item_id: Required[str] + 'The ID of the item this reasoning text is associated with. Required.' + output_index: Required[int] + 'The index of the output item this reasoning text is associated with. Required.' + content_index: Required[int] + 'The index of the reasoning content part. Required.' + text: Required[str] + 'The full text of the completed reasoning content. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseReasoningTextDoneEvent.__qualname__ = 'ResponseReasoningTextDoneEvent' + if _version_info < (3, 13): + ResponseReasoningTextDoneEvent.__doc__ = 'Emitted when a reasoning text is completed.\n\n :ivar type: The type of the event. Always ``response.reasoning_text.done``. Required.\n RESPONSE_REASONING_TEXT_DONE.\n :vartype type: Literal["response.reasoning_text.done"]\n :ivar item_id: The ID of the item this reasoning text is associated with. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item this reasoning text is associated with.\n Required.\n :vartype output_index: int\n :ivar content_index: The index of the reasoning content part. Required.\n :vartype content_index: int\n :ivar text: The full text of the completed reasoning content. Required.\n :vartype text: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseReasoningTextDoneEvent + + def _make_ResponseRefusalDeltaEvent(): + class ResponseRefusalDeltaEvent(TypedDict, total=False): + """Emitted when there is a partial refusal text. + + :ivar type: The type of the event. Always ``response.refusal.delta``. Required. + RESPONSE_REFUSAL_DELTA. + :vartype type: Literal["response.refusal.delta"] + :ivar item_id: The ID of the output item that the refusal text is added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the refusal text is added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the refusal text is added to. Required. + :vartype content_index: int + :ivar delta: The refusal text that is added. Required. + :vartype delta: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.refusal.delta']] + 'The type of the event. Always ``response.refusal.delta``. Required. RESPONSE_REFUSAL_DELTA.' + item_id: Required[str] + 'The ID of the output item that the refusal text is added to. Required.' + output_index: Required[int] + 'The index of the output item that the refusal text is added to. Required.' + content_index: Required[int] + 'The index of the content part that the refusal text is added to. Required.' + delta: Required[str] + 'The refusal text that is added. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseRefusalDeltaEvent.__qualname__ = 'ResponseRefusalDeltaEvent' + if _version_info < (3, 13): + ResponseRefusalDeltaEvent.__doc__ = 'Emitted when there is a partial refusal text.\n\n :ivar type: The type of the event. Always ``response.refusal.delta``. Required.\n RESPONSE_REFUSAL_DELTA.\n :vartype type: Literal["response.refusal.delta"]\n :ivar item_id: The ID of the output item that the refusal text is added to. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the refusal text is added to. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part that the refusal text is added to. Required.\n :vartype content_index: int\n :ivar delta: The refusal text that is added. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseRefusalDeltaEvent + + def _make_ResponseRefusalDoneEvent(): + class ResponseRefusalDoneEvent(TypedDict, total=False): + """Emitted when refusal text is finalized. + + :ivar type: The type of the event. Always ``response.refusal.done``. Required. + RESPONSE_REFUSAL_DONE. + :vartype type: Literal["response.refusal.done"] + :ivar item_id: The ID of the output item that the refusal text is finalized. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the refusal text is finalized. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the refusal text is finalized. + Required. + :vartype content_index: int + :ivar refusal: The refusal text that is finalized. Required. + :vartype refusal: str + :ivar sequence_number: The sequence number of this event. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.refusal.done']] + 'The type of the event. Always ``response.refusal.done``. Required. RESPONSE_REFUSAL_DONE.' + item_id: Required[str] + 'The ID of the output item that the refusal text is finalized. Required.' + output_index: Required[int] + 'The index of the output item that the refusal text is finalized. Required.' + content_index: Required[int] + 'The index of the content part that the refusal text is finalized. Required.' + refusal: Required[str] + 'The refusal text that is finalized. Required.' + sequence_number: Required[int] + 'The sequence number of this event. Required.' + ResponseRefusalDoneEvent.__qualname__ = 'ResponseRefusalDoneEvent' + if _version_info < (3, 13): + ResponseRefusalDoneEvent.__doc__ = 'Emitted when refusal text is finalized.\n\n :ivar type: The type of the event. Always ``response.refusal.done``. Required.\n RESPONSE_REFUSAL_DONE.\n :vartype type: Literal["response.refusal.done"]\n :ivar item_id: The ID of the output item that the refusal text is finalized. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the refusal text is finalized. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part that the refusal text is finalized.\n Required.\n :vartype content_index: int\n :ivar refusal: The refusal text that is finalized. Required.\n :vartype refusal: str\n :ivar sequence_number: The sequence number of this event. Required.\n :vartype sequence_number: int\n ' + return ResponseRefusalDoneEvent + + def _make_ResponseStreamOptions(): + class ResponseStreamOptions(TypedDict, total=False): + """Options for streaming responses. Only set this when you set ``stream: true``. + + :ivar include_obfuscation: When true, stream obfuscation will be enabled. Stream obfuscation + adds random characters to an ``obfuscation`` field on streaming delta events to normalize + payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are + included by default, but add a small amount of overhead to the data stream. You can set + ``include_obfuscation`` to false to optimize for bandwidth if you trust the network links + between your application and the OpenAI API. + :vartype include_obfuscation: bool + """ + include_obfuscation: bool + 'When true, stream obfuscation will be enabled. Stream obfuscation adds random characters to an\n ``obfuscation`` field on streaming delta events to normalize payload sizes as a mitigation to\n certain side-channel attacks. These obfuscation fields are included by default, but add a small\n amount of overhead to the data stream. You can set ``include_obfuscation`` to false to optimize\n for bandwidth if you trust the network links between your application and the OpenAI API.' + ResponseStreamOptions.__qualname__ = 'ResponseStreamOptions' + if _version_info < (3, 13): + ResponseStreamOptions.__doc__ = 'Options for streaming responses. Only set this when you set ``stream: true``.\n\n :ivar include_obfuscation: When true, stream obfuscation will be enabled. Stream obfuscation\n adds random characters to an ``obfuscation`` field on streaming delta events to normalize\n payload sizes as a mitigation to certain side-channel attacks. These obfuscation fields are\n included by default, but add a small amount of overhead to the data stream. You can set\n ``include_obfuscation`` to false to optimize for bandwidth if you trust the network links\n between your application and the OpenAI API.\n :vartype include_obfuscation: bool\n ' + return ResponseStreamOptions + + def _make_ResponseTextDeltaEvent(): + class ResponseTextDeltaEvent(TypedDict, total=False): + """Emitted when there is an additional text delta. + + :ivar type: The type of the event. Always ``response.output_text.delta``. Required. + RESPONSE_OUTPUT_TEXT_DELTA. + :vartype type: Literal["response.output_text.delta"] + :ivar item_id: The ID of the output item that the text delta was added to. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the text delta was added to. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the text delta was added to. Required. + :vartype content_index: int + :ivar delta: The text delta that was added. Required. + :vartype delta: str + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + :ivar logprobs: The log probabilities of the tokens in the delta. Required. + :vartype logprobs: list["ResponseLogProb"] + """ + type: Required[Literal['response.output_text.delta']] + 'The type of the event. Always ``response.output_text.delta``. Required.\n RESPONSE_OUTPUT_TEXT_DELTA.' + item_id: Required[str] + 'The ID of the output item that the text delta was added to. Required.' + output_index: Required[int] + 'The index of the output item that the text delta was added to. Required.' + content_index: Required[int] + 'The index of the content part that the text delta was added to. Required.' + delta: Required[str] + 'The text delta that was added. Required.' + sequence_number: Required[int] + 'The sequence number for this event. Required.' + logprobs: Required[list['_types.ResponseLogProb']] + 'The log probabilities of the tokens in the delta. Required.' + ResponseTextDeltaEvent.__qualname__ = 'ResponseTextDeltaEvent' + if _version_info < (3, 13): + ResponseTextDeltaEvent.__doc__ = 'Emitted when there is an additional text delta.\n\n :ivar type: The type of the event. Always ``response.output_text.delta``. Required.\n RESPONSE_OUTPUT_TEXT_DELTA.\n :vartype type: Literal["response.output_text.delta"]\n :ivar item_id: The ID of the output item that the text delta was added to. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the text delta was added to. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part that the text delta was added to. Required.\n :vartype content_index: int\n :ivar delta: The text delta that was added. Required.\n :vartype delta: str\n :ivar sequence_number: The sequence number for this event. Required.\n :vartype sequence_number: int\n :ivar logprobs: The log probabilities of the tokens in the delta. Required.\n :vartype logprobs: list["ResponseLogProb"]\n ' + return ResponseTextDeltaEvent + + def _make_ResponseTextDoneEvent(): + class ResponseTextDoneEvent(TypedDict, total=False): + """Emitted when text content is finalized. + + :ivar type: The type of the event. Always ``response.output_text.done``. Required. + RESPONSE_OUTPUT_TEXT_DONE. + :vartype type: Literal["response.output_text.done"] + :ivar item_id: The ID of the output item that the text content is finalized. Required. + :vartype item_id: str + :ivar output_index: The index of the output item that the text content is finalized. Required. + :vartype output_index: int + :ivar content_index: The index of the content part that the text content is finalized. + Required. + :vartype content_index: int + :ivar text: The text content that is finalized. Required. + :vartype text: str + :ivar sequence_number: The sequence number for this event. Required. + :vartype sequence_number: int + :ivar logprobs: The log probabilities of the tokens in the delta. Required. + :vartype logprobs: list["ResponseLogProb"] + """ + type: Required[Literal['response.output_text.done']] + 'The type of the event. Always ``response.output_text.done``. Required.\n RESPONSE_OUTPUT_TEXT_DONE.' + item_id: Required[str] + 'The ID of the output item that the text content is finalized. Required.' + output_index: Required[int] + 'The index of the output item that the text content is finalized. Required.' + content_index: Required[int] + 'The index of the content part that the text content is finalized. Required.' + text: Required[str] + 'The text content that is finalized. Required.' + sequence_number: Required[int] + 'The sequence number for this event. Required.' + logprobs: Required[list['_types.ResponseLogProb']] + 'The log probabilities of the tokens in the delta. Required.' + ResponseTextDoneEvent.__qualname__ = 'ResponseTextDoneEvent' + if _version_info < (3, 13): + ResponseTextDoneEvent.__doc__ = 'Emitted when text content is finalized.\n\n :ivar type: The type of the event. Always ``response.output_text.done``. Required.\n RESPONSE_OUTPUT_TEXT_DONE.\n :vartype type: Literal["response.output_text.done"]\n :ivar item_id: The ID of the output item that the text content is finalized. Required.\n :vartype item_id: str\n :ivar output_index: The index of the output item that the text content is finalized. Required.\n :vartype output_index: int\n :ivar content_index: The index of the content part that the text content is finalized.\n Required.\n :vartype content_index: int\n :ivar text: The text content that is finalized. Required.\n :vartype text: str\n :ivar sequence_number: The sequence number for this event. Required.\n :vartype sequence_number: int\n :ivar logprobs: The log probabilities of the tokens in the delta. Required.\n :vartype logprobs: list["ResponseLogProb"]\n ' + return ResponseTextDoneEvent + + def _make_ResponseTextParam(): + class ResponseTextParam(TypedDict, total=False): + """Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + + * [Text inputs and outputs](/docs/guides/text) + * [Structured Outputs](/docs/guides/structured-outputs). + + :ivar format: + :vartype format: "TextResponseFormatConfiguration" + :ivar verbosity: Is one of the following types: Literal["low"], Literal["medium"], + Literal["high"] + :vartype verbosity: Literal["low", "medium", "high"] + """ + format: '_types.TextResponseFormatConfiguration' + verbosity: Optional[Literal['low', 'medium', 'high']] + 'Is one of the following types: Literal["low"], Literal["medium"], Literal["high"]' + ResponseTextParam.__qualname__ = 'ResponseTextParam' + if _version_info < (3, 13): + ResponseTextParam.__doc__ = 'Configuration options for a text response from the model. Can be plain\n text or structured JSON data. Learn more:\n\n * [Text inputs and outputs](/docs/guides/text)\n * [Structured Outputs](/docs/guides/structured-outputs).\n\n :ivar format:\n :vartype format: "TextResponseFormatConfiguration"\n :ivar verbosity: Is one of the following types: Literal["low"], Literal["medium"],\n Literal["high"]\n :vartype verbosity: Literal["low", "medium", "high"]\n ' + return ResponseTextParam + + def _make_ResponseUsage(): + class ResponseUsage(TypedDict, total=False): + """Represents token usage details including input tokens, output tokens, a breakdown of output + tokens, and the total tokens used. + + :ivar input_tokens: The number of input tokens. Required. + :vartype input_tokens: int + :ivar input_tokens_details: A detailed breakdown of the input tokens. Required. + :vartype input_tokens_details: "ResponseUsageInputTokensDetails" + :ivar output_tokens: The number of output tokens. Required. + :vartype output_tokens: int + :ivar output_tokens_details: A detailed breakdown of the output tokens. Required. + :vartype output_tokens_details: "ResponseUsageOutputTokensDetails" + :ivar total_tokens: The total number of tokens used. Required. + :vartype total_tokens: int + """ + input_tokens: Required[int] + 'The number of input tokens. Required.' + input_tokens_details: Required['_types.ResponseUsageInputTokensDetails'] + 'A detailed breakdown of the input tokens. Required.' + output_tokens: Required[int] + 'The number of output tokens. Required.' + output_tokens_details: Required['_types.ResponseUsageOutputTokensDetails'] + 'A detailed breakdown of the output tokens. Required.' + total_tokens: Required[int] + 'The total number of tokens used. Required.' + ResponseUsage.__qualname__ = 'ResponseUsage' + if _version_info < (3, 13): + ResponseUsage.__doc__ = 'Represents token usage details including input tokens, output tokens, a breakdown of output\n tokens, and the total tokens used.\n\n :ivar input_tokens: The number of input tokens. Required.\n :vartype input_tokens: int\n :ivar input_tokens_details: A detailed breakdown of the input tokens. Required.\n :vartype input_tokens_details: "ResponseUsageInputTokensDetails"\n :ivar output_tokens: The number of output tokens. Required.\n :vartype output_tokens: int\n :ivar output_tokens_details: A detailed breakdown of the output tokens. Required.\n :vartype output_tokens_details: "ResponseUsageOutputTokensDetails"\n :ivar total_tokens: The total number of tokens used. Required.\n :vartype total_tokens: int\n ' + return ResponseUsage + + def _make_ResponseUsageInputTokensDetails(): + class ResponseUsageInputTokensDetails(TypedDict, total=False): + """ResponseUsageInputTokensDetails. + + :ivar cached_tokens: Required. + :vartype cached_tokens: int + :ivar cache_write_tokens: Required. + :vartype cache_write_tokens: int + """ + cached_tokens: Required[int] + 'Required.' + cache_write_tokens: Required[int] + 'Required.' + ResponseUsageInputTokensDetails.__qualname__ = 'ResponseUsageInputTokensDetails' + if _version_info < (3, 13): + ResponseUsageInputTokensDetails.__doc__ = 'ResponseUsageInputTokensDetails.\n\n :ivar cached_tokens: Required.\n :vartype cached_tokens: int\n :ivar cache_write_tokens: Required.\n :vartype cache_write_tokens: int\n ' + return ResponseUsageInputTokensDetails + + def _make_ResponseUsageOutputTokensDetails(): + class ResponseUsageOutputTokensDetails(TypedDict, total=False): + """ResponseUsageOutputTokensDetails. + + :ivar reasoning_tokens: Required. + :vartype reasoning_tokens: int + """ + reasoning_tokens: Required[int] + 'Required.' + ResponseUsageOutputTokensDetails.__qualname__ = 'ResponseUsageOutputTokensDetails' + if _version_info < (3, 13): + ResponseUsageOutputTokensDetails.__doc__ = 'ResponseUsageOutputTokensDetails.\n\n :ivar reasoning_tokens: Required.\n :vartype reasoning_tokens: int\n ' + return ResponseUsageOutputTokensDetails + + def _make_ResponseWebSearchCallCompletedEvent(): + class ResponseWebSearchCallCompletedEvent(TypedDict, total=False): + """Emitted when a web search call is completed. + + :ivar type: The type of the event. Always ``response.web_search_call.completed``. Required. + RESPONSE_WEB_SEARCH_CALL_COMPLETED. + :vartype type: Literal["response.web_search_call.completed"] + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.web_search_call.completed']] + 'The type of the event. Always ``response.web_search_call.completed``. Required.\n RESPONSE_WEB_SEARCH_CALL_COMPLETED.' + output_index: Required[int] + 'The index of the output item that the web search call is associated with. Required.' + item_id: Required[str] + 'Unique ID for the output item associated with the web search call. Required.' + sequence_number: Required[int] + 'The sequence number of the web search call being processed. Required.' + ResponseWebSearchCallCompletedEvent.__qualname__ = 'ResponseWebSearchCallCompletedEvent' + if _version_info < (3, 13): + ResponseWebSearchCallCompletedEvent.__doc__ = 'Emitted when a web search call is completed.\n\n :ivar type: The type of the event. Always ``response.web_search_call.completed``. Required.\n RESPONSE_WEB_SEARCH_CALL_COMPLETED.\n :vartype type: Literal["response.web_search_call.completed"]\n :ivar output_index: The index of the output item that the web search call is associated with.\n Required.\n :vartype output_index: int\n :ivar item_id: Unique ID for the output item associated with the web search call. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of the web search call being processed. Required.\n :vartype sequence_number: int\n ' + return ResponseWebSearchCallCompletedEvent + + def _make_ResponseWebSearchCallInProgressEvent(): + class ResponseWebSearchCallInProgressEvent(TypedDict, total=False): + """Emitted when a web search call is initiated. + + :ivar type: The type of the event. Always ``response.web_search_call.in_progress``. Required. + RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS. + :vartype type: Literal["response.web_search_call.in_progress"] + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.web_search_call.in_progress']] + 'The type of the event. Always ``response.web_search_call.in_progress``. Required.\n RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS.' + output_index: Required[int] + 'The index of the output item that the web search call is associated with. Required.' + item_id: Required[str] + 'Unique ID for the output item associated with the web search call. Required.' + sequence_number: Required[int] + 'The sequence number of the web search call being processed. Required.' + ResponseWebSearchCallInProgressEvent.__qualname__ = 'ResponseWebSearchCallInProgressEvent' + if _version_info < (3, 13): + ResponseWebSearchCallInProgressEvent.__doc__ = 'Emitted when a web search call is initiated.\n\n :ivar type: The type of the event. Always ``response.web_search_call.in_progress``. Required.\n RESPONSE_WEB_SEARCH_CALL_IN_PROGRESS.\n :vartype type: Literal["response.web_search_call.in_progress"]\n :ivar output_index: The index of the output item that the web search call is associated with.\n Required.\n :vartype output_index: int\n :ivar item_id: Unique ID for the output item associated with the web search call. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of the web search call being processed. Required.\n :vartype sequence_number: int\n ' + return ResponseWebSearchCallInProgressEvent + + def _make_ResponseWebSearchCallSearchingEvent(): + class ResponseWebSearchCallSearchingEvent(TypedDict, total=False): + """Emitted when a web search call is executing. + + :ivar type: The type of the event. Always ``response.web_search_call.searching``. Required. + RESPONSE_WEB_SEARCH_CALL_SEARCHING. + :vartype type: Literal["response.web_search_call.searching"] + :ivar output_index: The index of the output item that the web search call is associated with. + Required. + :vartype output_index: int + :ivar item_id: Unique ID for the output item associated with the web search call. Required. + :vartype item_id: str + :ivar sequence_number: The sequence number of the web search call being processed. Required. + :vartype sequence_number: int + """ + type: Required[Literal['response.web_search_call.searching']] + 'The type of the event. Always ``response.web_search_call.searching``. Required.\n RESPONSE_WEB_SEARCH_CALL_SEARCHING.' + output_index: Required[int] + 'The index of the output item that the web search call is associated with. Required.' + item_id: Required[str] + 'Unique ID for the output item associated with the web search call. Required.' + sequence_number: Required[int] + 'The sequence number of the web search call being processed. Required.' + ResponseWebSearchCallSearchingEvent.__qualname__ = 'ResponseWebSearchCallSearchingEvent' + if _version_info < (3, 13): + ResponseWebSearchCallSearchingEvent.__doc__ = 'Emitted when a web search call is executing.\n\n :ivar type: The type of the event. Always ``response.web_search_call.searching``. Required.\n RESPONSE_WEB_SEARCH_CALL_SEARCHING.\n :vartype type: Literal["response.web_search_call.searching"]\n :ivar output_index: The index of the output item that the web search call is associated with.\n Required.\n :vartype output_index: int\n :ivar item_id: Unique ID for the output item associated with the web search call. Required.\n :vartype item_id: str\n :ivar sequence_number: The sequence number of the web search call being processed. Required.\n :vartype sequence_number: int\n ' + return ResponseWebSearchCallSearchingEvent + + def _make_ScreenshotParam(): + class ScreenshotParam(TypedDict, total=False): + """Screenshot. + + :ivar type: Specifies the event type. For a screenshot action, this property is always set to + ``screenshot``. Required. SCREENSHOT. + :vartype type: Literal["screenshot"] + """ + type: Required[Literal['screenshot']] + 'Specifies the event type. For a screenshot action, this property is always set to\n ``screenshot``. Required. SCREENSHOT.' + ScreenshotParam.__qualname__ = 'ScreenshotParam' + if _version_info < (3, 13): + ScreenshotParam.__doc__ = 'Screenshot.\n\n :ivar type: Specifies the event type. For a screenshot action, this property is always set to\n ``screenshot``. Required. SCREENSHOT.\n :vartype type: Literal["screenshot"]\n ' + return ScreenshotParam + + def _make_ScrollParam(): + class ScrollParam(TypedDict, total=False): + """Scroll. + + :ivar type: Specifies the event type. For a scroll action, this property is always set to + ``scroll``. Required. SCROLL. + :vartype type: Literal["scroll"] + :ivar x: The x-coordinate where the scroll occurred. Required. + :vartype x: int + :ivar y: The y-coordinate where the scroll occurred. Required. + :vartype y: int + :ivar scroll_x: The horizontal scroll distance. Required. + :vartype scroll_x: int + :ivar scroll_y: The vertical scroll distance. Required. + :vartype scroll_y: int + :ivar keys: + :vartype keys: list[str] + """ + type: Required[Literal['scroll']] + 'Specifies the event type. For a scroll action, this property is always set to ``scroll``.\n Required. SCROLL.' + x: Required[int] + 'The x-coordinate where the scroll occurred. Required.' + y: Required[int] + 'The y-coordinate where the scroll occurred. Required.' + scroll_x: Required[int] + 'The horizontal scroll distance. Required.' + scroll_y: Required[int] + 'The vertical scroll distance. Required.' + keys: Optional[list[str]] + ScrollParam.__qualname__ = 'ScrollParam' + if _version_info < (3, 13): + ScrollParam.__doc__ = 'Scroll.\n\n :ivar type: Specifies the event type. For a scroll action, this property is always set to\n ``scroll``. Required. SCROLL.\n :vartype type: Literal["scroll"]\n :ivar x: The x-coordinate where the scroll occurred. Required.\n :vartype x: int\n :ivar y: The y-coordinate where the scroll occurred. Required.\n :vartype y: int\n :ivar scroll_x: The horizontal scroll distance. Required.\n :vartype scroll_x: int\n :ivar scroll_y: The vertical scroll distance. Required.\n :vartype scroll_y: int\n :ivar keys:\n :vartype keys: list[str]\n ' + return ScrollParam + + def _make_SharepointGroundingToolCall(): + class SharepointGroundingToolCall(TypedDict, total=False): + """A SharePoint grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL. + :vartype type: Literal["sharepoint_grounding_preview_call"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar arguments: A JSON string of the arguments to pass to the tool. Required. + :vartype arguments: str + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['sharepoint_grounding_preview_call']] + 'Required. SHAREPOINT_GROUNDING_PREVIEW_CALL.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + arguments: Required[str] + 'A JSON string of the arguments to pass to the tool. Required.' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + SharepointGroundingToolCall.__qualname__ = 'SharepointGroundingToolCall' + if _version_info < (3, 13): + SharepointGroundingToolCall.__doc__ = 'A SharePoint grounding tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL.\n :vartype type: Literal["sharepoint_grounding_preview_call"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar arguments: A JSON string of the arguments to pass to the tool. Required.\n :vartype arguments: str\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return SharepointGroundingToolCall + + def _make_SharepointGroundingToolCallOutput(): + class SharepointGroundingToolCallOutput(TypedDict, total=False): + """The output of a SharePoint grounding tool call. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT. + :vartype type: Literal["sharepoint_grounding_preview_call_output"] + :ivar call_id: The unique ID of the tool call generated by the model. Required. + :vartype call_id: str + :ivar output: The output from the SharePoint grounding tool call. Is one of the following + types: {str: Any}, str, [Any] + :vartype output: "_unions.ToolCallOutputContent" + :ivar status: The status of the tool call. Required. Known values are: "in_progress", + "completed", "incomplete", and "failed". + :vartype status: ToolCallStatus + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['sharepoint_grounding_preview_call_output']] + 'Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.' + call_id: Required[str] + 'The unique ID of the tool call generated by the model. Required.' + output: '_unions.ToolCallOutputContent' + 'The output from the SharePoint grounding tool call. Is one of the following types: {str: Any},\n str, [Any]' + status: Required[_resolve('ToolCallStatus')] + 'The status of the tool call. Required. Known values are: "in_progress", "completed",\n "incomplete", and "failed".' + id: Required[str] + 'Required.' + SharepointGroundingToolCallOutput.__qualname__ = 'SharepointGroundingToolCallOutput' + if _version_info < (3, 13): + SharepointGroundingToolCallOutput.__doc__ = 'The output of a SharePoint grounding tool call.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. SHAREPOINT_GROUNDING_PREVIEW_CALL_OUTPUT.\n :vartype type: Literal["sharepoint_grounding_preview_call_output"]\n :ivar call_id: The unique ID of the tool call generated by the model. Required.\n :vartype call_id: str\n :ivar output: The output from the SharePoint grounding tool call. Is one of the following\n types: {str: Any}, str, [Any]\n :vartype output: "_unions.ToolCallOutputContent"\n :ivar status: The status of the tool call. Required. Known values are: "in_progress",\n "completed", "incomplete", and "failed".\n :vartype status: ToolCallStatus\n :ivar id: Required.\n :vartype id: str\n ' + return SharepointGroundingToolCallOutput + + def _make_SharepointGroundingToolParameters(): + class SharepointGroundingToolParameters(TypedDict, total=False): + """The sharepoint grounding tool parameters. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connections: The project connections attached to this tool. There can be a + maximum of 1 connection resource attached to the tool. + :vartype project_connections: list["ToolProjectConnection"] + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connections: list['_types.ToolProjectConnection'] + 'The project connections attached to this tool. There can be a maximum of 1 connection resource\n attached to the tool.' + SharepointGroundingToolParameters.__qualname__ = 'SharepointGroundingToolParameters' + if _version_info < (3, 13): + SharepointGroundingToolParameters.__doc__ = 'The sharepoint grounding tool parameters.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connections: The project connections attached to this tool. There can be a\n maximum of 1 connection resource attached to the tool.\n :vartype project_connections: list["ToolProjectConnection"]\n ' + return SharepointGroundingToolParameters + + def _make_SharepointPreviewTool(): + class SharepointPreviewTool(TypedDict, total=False): + """The input definition information for a sharepoint tool as used to configure an agent. + + :ivar type: The object type, which is always 'sharepoint_grounding_preview'. Required. + SHAREPOINT_GROUNDING_PREVIEW. + :vartype type: Literal["sharepoint_grounding_preview"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required. + :vartype sharepoint_grounding_preview: "SharepointGroundingToolParameters" + """ + type: Required[Literal['sharepoint_grounding_preview']] + "The object type, which is always 'sharepoint_grounding_preview'. Required.\n SHAREPOINT_GROUNDING_PREVIEW." + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + sharepoint_grounding_preview: Required['_types.SharepointGroundingToolParameters'] + 'The sharepoint grounding tool parameters. Required.' + SharepointPreviewTool.__qualname__ = 'SharepointPreviewTool' + if _version_info < (3, 13): + SharepointPreviewTool.__doc__ = 'The input definition information for a sharepoint tool as used to configure an agent.\n\n :ivar type: The object type, which is always \'sharepoint_grounding_preview\'. Required.\n SHAREPOINT_GROUNDING_PREVIEW.\n :vartype type: Literal["sharepoint_grounding_preview"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar sharepoint_grounding_preview: The sharepoint grounding tool parameters. Required.\n :vartype sharepoint_grounding_preview: "SharepointGroundingToolParameters"\n ' + return SharepointPreviewTool + + def _make_SkillReferenceParam(): + class SkillReferenceParam(TypedDict, total=False): + """SkillReferenceParam. + + :ivar type: References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE. + :vartype type: Literal["skill_reference"] + :ivar skill_id: The ID of the referenced skill. Required. + :vartype skill_id: str + :ivar version: Optional skill version. Use a positive integer or 'latest'. Omit for default. + :vartype version: str + """ + type: Required[Literal['skill_reference']] + 'References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE.' + skill_id: Required[str] + 'The ID of the referenced skill. Required.' + version: str + "Optional skill version. Use a positive integer or 'latest'. Omit for default." + SkillReferenceParam.__qualname__ = 'SkillReferenceParam' + if _version_info < (3, 13): + SkillReferenceParam.__doc__ = 'SkillReferenceParam.\n\n :ivar type: References a skill created with the /v1/skills endpoint. Required. SKILL_REFERENCE.\n :vartype type: Literal["skill_reference"]\n :ivar skill_id: The ID of the referenced skill. Required.\n :vartype skill_id: str\n :ivar version: Optional skill version. Use a positive integer or \'latest\'. Omit for default.\n :vartype version: str\n ' + return SkillReferenceParam + + def _make_SpecificApplyPatchParam(): + class SpecificApplyPatchParam(TypedDict, total=False): + """Specific apply patch tool choice. + + :ivar type: The tool to call. Always ``apply_patch``. Required. APPLY_PATCH. + :vartype type: Literal["apply_patch"] + """ + type: Required[Literal['apply_patch']] + 'The tool to call. Always ``apply_patch``. Required. APPLY_PATCH.' + SpecificApplyPatchParam.__qualname__ = 'SpecificApplyPatchParam' + if _version_info < (3, 13): + SpecificApplyPatchParam.__doc__ = 'Specific apply patch tool choice.\n\n :ivar type: The tool to call. Always ``apply_patch``. Required. APPLY_PATCH.\n :vartype type: Literal["apply_patch"]\n ' + return SpecificApplyPatchParam + + def _make_SpecificFunctionShellParam(): + class SpecificFunctionShellParam(TypedDict, total=False): + """Specific shell tool choice. + + :ivar type: The tool to call. Always ``shell``. Required. SHELL. + :vartype type: Literal["shell"] + """ + type: Required[Literal['shell']] + 'The tool to call. Always ``shell``. Required. SHELL.' + SpecificFunctionShellParam.__qualname__ = 'SpecificFunctionShellParam' + if _version_info < (3, 13): + SpecificFunctionShellParam.__doc__ = 'Specific shell tool choice.\n\n :ivar type: The tool to call. Always ``shell``. Required. SHELL.\n :vartype type: Literal["shell"]\n ' + return SpecificFunctionShellParam + + def _make_SpecificProgrammaticToolCallingParam(): + class SpecificProgrammaticToolCallingParam(TypedDict, total=False): + """SpecificProgrammaticToolCallingParam. + + :ivar type: The tool to call. Always ``programmatic_tool_calling``. Required. + PROGRAMMATIC_TOOL_CALLING. + :vartype type: Literal["programmatic_tool_calling"] + """ + type: Required[Literal['programmatic_tool_calling']] + 'The tool to call. Always ``programmatic_tool_calling``. Required. PROGRAMMATIC_TOOL_CALLING.' + SpecificProgrammaticToolCallingParam.__qualname__ = 'SpecificProgrammaticToolCallingParam' + if _version_info < (3, 13): + SpecificProgrammaticToolCallingParam.__doc__ = 'SpecificProgrammaticToolCallingParam.\n\n :ivar type: The tool to call. Always ``programmatic_tool_calling``. Required.\n PROGRAMMATIC_TOOL_CALLING.\n :vartype type: Literal["programmatic_tool_calling"]\n ' + return SpecificProgrammaticToolCallingParam + + def _make_StructuredOutputDefinition(): + class StructuredOutputDefinition(TypedDict, total=False): + """A structured output that can be produced by the agent. + + :ivar name: The name of the structured output. Required. + :vartype name: str + :ivar description: A description of the output to emit. Used by the model to determine when to + emit the output. Required. + :vartype description: str + :ivar schema: The JSON schema for the structured output. Required. + :vartype schema: dict[str, Any] + :ivar strict: Whether to enforce strict validation. Default ``true``. Required. + :vartype strict: bool + """ + name: Required[str] + 'The name of the structured output. Required.' + description: Required[str] + 'A description of the output to emit. Used by the model to determine when to emit the output.\n Required.' + schema: Required[dict[str, Any]] + 'The JSON schema for the structured output. Required.' + strict: Required[Optional[bool]] + 'Whether to enforce strict validation. Default ``true``. Required.' + StructuredOutputDefinition.__qualname__ = 'StructuredOutputDefinition' + if _version_info < (3, 13): + StructuredOutputDefinition.__doc__ = 'A structured output that can be produced by the agent.\n\n :ivar name: The name of the structured output. Required.\n :vartype name: str\n :ivar description: A description of the output to emit. Used by the model to determine when to\n emit the output. Required.\n :vartype description: str\n :ivar schema: The JSON schema for the structured output. Required.\n :vartype schema: dict[str, Any]\n :ivar strict: Whether to enforce strict validation. Default ``true``. Required.\n :vartype strict: bool\n ' + return StructuredOutputDefinition + + def _make_StructuredOutputsOutputItem(): + class StructuredOutputsOutputItem(TypedDict, total=False): + """StructuredOutputsOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. STRUCTURED_OUTPUTS. + :vartype type: Literal["structured_outputs"] + :ivar output: The structured output captured during the response. Required. + :vartype output: Any + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['structured_outputs']] + 'Required. STRUCTURED_OUTPUTS.' + output: Required[Any] + 'The structured output captured during the response. Required.' + id: Required[str] + 'Required.' + StructuredOutputsOutputItem.__qualname__ = 'StructuredOutputsOutputItem' + if _version_info < (3, 13): + StructuredOutputsOutputItem.__doc__ = 'StructuredOutputsOutputItem.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. STRUCTURED_OUTPUTS.\n :vartype type: Literal["structured_outputs"]\n :ivar output: The structured output captured during the response. Required.\n :vartype output: Any\n :ivar id: Required.\n :vartype id: str\n ' + return StructuredOutputsOutputItem + + def _make_SummaryTextContent(): + class SummaryTextContent(TypedDict, total=False): + """Summary text. + + :ivar type: The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT. + :vartype type: Literal["summary_text"] + :ivar text: A summary of the reasoning output from the model so far. Required. + :vartype text: str + """ + type: Required[Literal['summary_text']] + 'The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT.' + text: Required[str] + 'A summary of the reasoning output from the model so far. Required.' + SummaryTextContent.__qualname__ = 'SummaryTextContent' + if _version_info < (3, 13): + SummaryTextContent.__doc__ = 'Summary text.\n\n :ivar type: The type of the object. Always ``summary_text``. Required. SUMMARY_TEXT.\n :vartype type: Literal["summary_text"]\n :ivar text: A summary of the reasoning output from the model so far. Required.\n :vartype text: str\n ' + return SummaryTextContent + + def _make_TextContent(): + class TextContent(TypedDict, total=False): + """Text Content. + + :ivar type: Required. TEXT. + :vartype type: Literal["text"] + :ivar text: Required. + :vartype text: str + """ + type: Required[Literal['text']] + 'Required. TEXT.' + text: Required[str] + 'Required.' + TextContent.__qualname__ = 'TextContent' + if _version_info < (3, 13): + TextContent.__doc__ = 'Text Content.\n\n :ivar type: Required. TEXT.\n :vartype type: Literal["text"]\n :ivar text: Required.\n :vartype text: str\n ' + return TextContent + + def _make_TextResponseFormatConfigurationResponseFormatJsonObject(): + class TextResponseFormatConfigurationResponseFormatJsonObject(TypedDict, total=False): + """JSON object. + + :ivar type: The type of response format being defined. Always ``json_object``. Required. + JSON_OBJECT. + :vartype type: Literal["json_object"] + """ + type: Required[Literal['json_object']] + 'The type of response format being defined. Always ``json_object``. Required. JSON_OBJECT.' + TextResponseFormatConfigurationResponseFormatJsonObject.__qualname__ = 'TextResponseFormatConfigurationResponseFormatJsonObject' + if _version_info < (3, 13): + TextResponseFormatConfigurationResponseFormatJsonObject.__doc__ = 'JSON object.\n\n :ivar type: The type of response format being defined. Always ``json_object``. Required.\n JSON_OBJECT.\n :vartype type: Literal["json_object"]\n ' + return TextResponseFormatConfigurationResponseFormatJsonObject + + def _make_TextResponseFormatConfigurationResponseFormatText(): + class TextResponseFormatConfigurationResponseFormatText(TypedDict, total=False): + """Text. + + :ivar type: The type of response format being defined. Always ``text``. Required. TEXT. + :vartype type: Literal["text"] + """ + type: Required[Literal['text']] + 'The type of response format being defined. Always ``text``. Required. TEXT.' + TextResponseFormatConfigurationResponseFormatText.__qualname__ = 'TextResponseFormatConfigurationResponseFormatText' + if _version_info < (3, 13): + TextResponseFormatConfigurationResponseFormatText.__doc__ = 'Text.\n\n :ivar type: The type of response format being defined. Always ``text``. Required. TEXT.\n :vartype type: Literal["text"]\n ' + return TextResponseFormatConfigurationResponseFormatText + + def _make_TextResponseFormatJsonSchema(): + class TextResponseFormatJsonSchema(TypedDict, total=False): + """JSON schema. + + :ivar type: The type of response format being defined. Always ``json_schema``. Required. + JSON_SCHEMA. + :vartype type: Literal["json_schema"] + :ivar description: A description of what the response format is for, used by the model to + determine how to respond in the format. + :vartype description: str + :ivar name: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and + dashes, with a maximum length of 64. Required. + :vartype name: str + :ivar schema: Required. + :vartype schema: "ResponseFormatJsonSchemaSchema" + :ivar strict: + :vartype strict: bool + """ + type: Required[Literal['json_schema']] + 'The type of response format being defined. Always ``json_schema``. Required. JSON_SCHEMA.' + description: str + 'A description of what the response format is for, used by the model to determine how to respond\n in the format.' + name: Required[str] + 'The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with\n a maximum length of 64. Required.' + schema: Required['_types.ResponseFormatJsonSchemaSchema'] + 'Required.' + strict: Optional[bool] + TextResponseFormatJsonSchema.__qualname__ = 'TextResponseFormatJsonSchema' + if _version_info < (3, 13): + TextResponseFormatJsonSchema.__doc__ = 'JSON schema.\n\n :ivar type: The type of response format being defined. Always ``json_schema``. Required.\n JSON_SCHEMA.\n :vartype type: Literal["json_schema"]\n :ivar description: A description of what the response format is for, used by the model to\n determine how to respond in the format.\n :vartype description: str\n :ivar name: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and\n dashes, with a maximum length of 64. Required.\n :vartype name: str\n :ivar schema: Required.\n :vartype schema: "ResponseFormatJsonSchemaSchema"\n :ivar strict:\n :vartype strict: bool\n ' + return TextResponseFormatJsonSchema + + def _make_ToolChoiceAllowed(): + class ToolChoiceAllowed(TypedDict, total=False): + """Allowed tools. + + :ivar type: Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS. + :vartype type: Literal["allowed_tools"] + :ivar mode: Constrains the tools available to the model to a pre-defined set. ``auto`` allows + the model to pick from among the allowed tools and generate a message. ``required`` requires + the model to call one or more of the allowed tools. Required. Is either a Literal["auto"] type + or a Literal["required"] type. + :vartype mode: Literal["auto", "required"] + :ivar tools: Required. A list of tool definitions that the model should be allowed to call. For + the Responses API, the list of tool definitions might look like: + + .. code-block:: json + + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + :vartype tools: list[dict[str, Any]] + """ + type: Required[Literal['allowed_tools']] + 'Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS.' + mode: Required[Literal['auto', 'required']] + 'Constrains the tools available to the model to a pre-defined set. ``auto`` allows the model to\n pick from among the allowed tools and generate a message. ``required`` requires the model to\n call one or more of the allowed tools. Required. Is either a Literal["auto"] type or a\n Literal["required"] type.' + tools: Required[list[dict[str, Any]]] + 'Required. A list of tool definitions that the model should be allowed to call. For the\n Responses API, the list of tool definitions might look like:\n\n .. code-block:: json\n\n [\n { "type": "function", "name": "get_weather" },\n { "type": "mcp", "server_label": "deepwiki" },\n { "type": "image_generation" }\n ]' + ToolChoiceAllowed.__qualname__ = 'ToolChoiceAllowed' + if _version_info < (3, 13): + ToolChoiceAllowed.__doc__ = 'Allowed tools.\n\n :ivar type: Allowed tool configuration type. Always ``allowed_tools``. Required. ALLOWED_TOOLS.\n :vartype type: Literal["allowed_tools"]\n :ivar mode: Constrains the tools available to the model to a pre-defined set. ``auto`` allows\n the model to pick from among the allowed tools and generate a message. ``required`` requires\n the model to call one or more of the allowed tools. Required. Is either a Literal["auto"] type\n or a Literal["required"] type.\n :vartype mode: Literal["auto", "required"]\n :ivar tools: Required. A list of tool definitions that the model should be allowed to call. For\n the Responses API, the list of tool definitions might look like:\n\n .. code-block:: json\n\n [\n { "type": "function", "name": "get_weather" },\n { "type": "mcp", "server_label": "deepwiki" },\n { "type": "image_generation" }\n ]\n :vartype tools: list[dict[str, Any]]\n ' + return ToolChoiceAllowed + + def _make_ToolChoiceCodeInterpreter(): + class ToolChoiceCodeInterpreter(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. CODE_INTERPRETER. + :vartype type: Literal["code_interpreter"] + """ + type: Required[Literal['code_interpreter']] + 'Required. CODE_INTERPRETER.' + ToolChoiceCodeInterpreter.__qualname__ = 'ToolChoiceCodeInterpreter' + if _version_info < (3, 13): + ToolChoiceCodeInterpreter.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. CODE_INTERPRETER.\n :vartype type: Literal["code_interpreter"]\n ' + return ToolChoiceCodeInterpreter + + def _make_ToolChoiceComputer(): + class ToolChoiceComputer(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. COMPUTER. + :vartype type: Literal["computer"] + """ + type: Required[Literal['computer']] + 'Required. COMPUTER.' + ToolChoiceComputer.__qualname__ = 'ToolChoiceComputer' + if _version_info < (3, 13): + ToolChoiceComputer.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. COMPUTER.\n :vartype type: Literal["computer"]\n ' + return ToolChoiceComputer + + def _make_ToolChoiceComputerUse(): + class ToolChoiceComputerUse(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. COMPUTER_USE. + :vartype type: Literal["computer_use"] + """ + type: Required[Literal['computer_use']] + 'Required. COMPUTER_USE.' + ToolChoiceComputerUse.__qualname__ = 'ToolChoiceComputerUse' + if _version_info < (3, 13): + ToolChoiceComputerUse.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. COMPUTER_USE.\n :vartype type: Literal["computer_use"]\n ' + return ToolChoiceComputerUse + + def _make_ToolChoiceComputerUsePreview(): + class ToolChoiceComputerUsePreview(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. COMPUTER_USE_PREVIEW. + :vartype type: Literal["computer_use_preview"] + """ + type: Required[Literal['computer_use_preview']] + 'Required. COMPUTER_USE_PREVIEW.' + ToolChoiceComputerUsePreview.__qualname__ = 'ToolChoiceComputerUsePreview' + if _version_info < (3, 13): + ToolChoiceComputerUsePreview.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. COMPUTER_USE_PREVIEW.\n :vartype type: Literal["computer_use_preview"]\n ' + return ToolChoiceComputerUsePreview + + def _make_ToolChoiceCustom(): + class ToolChoiceCustom(TypedDict, total=False): + """Custom tool. + + :ivar type: For custom tool calling, the type is always ``custom``. Required. CUSTOM. + :vartype type: Literal["custom"] + :ivar name: The name of the custom tool to call. Required. + :vartype name: str + """ + type: Required[Literal['custom']] + 'For custom tool calling, the type is always ``custom``. Required. CUSTOM.' + name: Required[str] + 'The name of the custom tool to call. Required.' + ToolChoiceCustom.__qualname__ = 'ToolChoiceCustom' + if _version_info < (3, 13): + ToolChoiceCustom.__doc__ = 'Custom tool.\n\n :ivar type: For custom tool calling, the type is always ``custom``. Required. CUSTOM.\n :vartype type: Literal["custom"]\n :ivar name: The name of the custom tool to call. Required.\n :vartype name: str\n ' + return ToolChoiceCustom + + def _make_ToolChoiceFileSearch(): + class ToolChoiceFileSearch(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. FILE_SEARCH. + :vartype type: Literal["file_search"] + """ + type: Required[Literal['file_search']] + 'Required. FILE_SEARCH.' + ToolChoiceFileSearch.__qualname__ = 'ToolChoiceFileSearch' + if _version_info < (3, 13): + ToolChoiceFileSearch.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. FILE_SEARCH.\n :vartype type: Literal["file_search"]\n ' + return ToolChoiceFileSearch + + def _make_ToolChoiceFunction(): + class ToolChoiceFunction(TypedDict, total=False): + """Function tool. + + :ivar type: For function calling, the type is always ``function``. Required. FUNCTION. + :vartype type: Literal["function"] + :ivar name: The name of the function to call. Required. + :vartype name: str + """ + type: Required[Literal['function']] + 'For function calling, the type is always ``function``. Required. FUNCTION.' + name: Required[str] + 'The name of the function to call. Required.' + ToolChoiceFunction.__qualname__ = 'ToolChoiceFunction' + if _version_info < (3, 13): + ToolChoiceFunction.__doc__ = 'Function tool.\n\n :ivar type: For function calling, the type is always ``function``. Required. FUNCTION.\n :vartype type: Literal["function"]\n :ivar name: The name of the function to call. Required.\n :vartype name: str\n ' + return ToolChoiceFunction + + def _make_ToolChoiceImageGeneration(): + class ToolChoiceImageGeneration(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. IMAGE_GENERATION. + :vartype type: Literal["image_generation"] + """ + type: Required[Literal['image_generation']] + 'Required. IMAGE_GENERATION.' + ToolChoiceImageGeneration.__qualname__ = 'ToolChoiceImageGeneration' + if _version_info < (3, 13): + ToolChoiceImageGeneration.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. IMAGE_GENERATION.\n :vartype type: Literal["image_generation"]\n ' + return ToolChoiceImageGeneration + + def _make_ToolChoiceMCP(): + class ToolChoiceMCP(TypedDict, total=False): + """MCP tool. + + :ivar type: For MCP tools, the type is always ``mcp``. Required. MCP. + :vartype type: Literal["mcp"] + :ivar server_label: The label of the MCP server to use. Required. + :vartype server_label: str + :ivar name: + :vartype name: str + """ + type: Required[Literal['mcp']] + 'For MCP tools, the type is always ``mcp``. Required. MCP.' + server_label: Required[str] + 'The label of the MCP server to use. Required.' + name: Optional[str] + ToolChoiceMCP.__qualname__ = 'ToolChoiceMCP' + if _version_info < (3, 13): + ToolChoiceMCP.__doc__ = 'MCP tool.\n\n :ivar type: For MCP tools, the type is always ``mcp``. Required. MCP.\n :vartype type: Literal["mcp"]\n :ivar server_label: The label of the MCP server to use. Required.\n :vartype server_label: str\n :ivar name:\n :vartype name: str\n ' + return ToolChoiceMCP + + def _make_ToolChoiceWebSearchPreview(): + class ToolChoiceWebSearchPreview(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. WEB_SEARCH_PREVIEW. + :vartype type: Literal["web_search_preview"] + """ + type: Required[Literal['web_search_preview']] + 'Required. WEB_SEARCH_PREVIEW.' + ToolChoiceWebSearchPreview.__qualname__ = 'ToolChoiceWebSearchPreview' + if _version_info < (3, 13): + ToolChoiceWebSearchPreview.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. WEB_SEARCH_PREVIEW.\n :vartype type: Literal["web_search_preview"]\n ' + return ToolChoiceWebSearchPreview + + def _make_ToolChoiceWebSearchPreview20250311(): + class ToolChoiceWebSearchPreview20250311(TypedDict, total=False): + """Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools. + + :ivar type: Required. WEB_SEARCH_PREVIEW2025_03_11. + :vartype type: Literal["web_search_preview_2025_03_11"] + """ + type: Required[Literal['web_search_preview_2025_03_11']] + 'Required. WEB_SEARCH_PREVIEW2025_03_11.' + ToolChoiceWebSearchPreview20250311.__qualname__ = 'ToolChoiceWebSearchPreview20250311' + if _version_info < (3, 13): + ToolChoiceWebSearchPreview20250311.__doc__ = 'Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools: https://platform.openai.com/docs/guides/tools.\n\n :ivar type: Required. WEB_SEARCH_PREVIEW2025_03_11.\n :vartype type: Literal["web_search_preview_2025_03_11"]\n ' + return ToolChoiceWebSearchPreview20250311 + + def _make_ToolProjectConnection(): + class ToolProjectConnection(TypedDict, total=False): + """A project connection resource. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: A project connection in a ToolProjectConnectionList attached to + this tool. Required. + :vartype project_connection_id: str + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connection_id: Required[str] + 'A project connection in a ToolProjectConnectionList attached to this tool. Required.' + ToolProjectConnection.__qualname__ = 'ToolProjectConnection' + if _version_info < (3, 13): + ToolProjectConnection.__doc__ = 'A project connection resource.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connection_id: A project connection in a ToolProjectConnectionList attached to\n this tool. Required.\n :vartype project_connection_id: str\n ' + return ToolProjectConnection + + def _make_ToolSearchCallItemParam(): + class ToolSearchCallItemParam(TypedDict, total=False): + """ToolSearchCallItemParam. + + :ivar id: + :vartype id: str + :ivar call_id: + :vartype call_id: str + :ivar type: The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL. + :vartype type: Literal["tool_search_call"] + :ivar execution: Whether tool search was executed by the server or by the client. Known values + are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar arguments: The arguments supplied to the tool search call. Required. + :vartype arguments: "EmptyModelParam" + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + id: Optional[str] + call_id: Optional[str] + type: Required[Literal['tool_search_call']] + 'The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.' + execution: _resolve('ToolSearchExecutionType') + 'Whether tool search was executed by the server or by the client. Known values are: "server"\n and "client".' + arguments: Required['_types.EmptyModelParam'] + 'The arguments supplied to the tool search call. Required.' + status: Optional[_resolve('FunctionCallItemStatus')] + 'Known values are: "in_progress", "completed", and "incomplete".' + ToolSearchCallItemParam.__qualname__ = 'ToolSearchCallItemParam' + if _version_info < (3, 13): + ToolSearchCallItemParam.__doc__ = 'ToolSearchCallItemParam.\n\n :ivar id:\n :vartype id: str\n :ivar call_id:\n :vartype call_id: str\n :ivar type: The item type. Always ``tool_search_call``. Required. TOOL_SEARCH_CALL.\n :vartype type: Literal["tool_search_call"]\n :ivar execution: Whether tool search was executed by the server or by the client. Known values\n are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar arguments: The arguments supplied to the tool search call. Required.\n :vartype arguments: "EmptyModelParam"\n :ivar status: Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallItemStatus\n ' + return ToolSearchCallItemParam + + def _make_ToolSearchOutputItemParam(): + class ToolSearchOutputItemParam(TypedDict, total=False): + """ToolSearchOutputItemParam. + + :ivar id: + :vartype id: str + :ivar call_id: + :vartype call_id: str + :ivar type: The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT. + :vartype type: Literal["tool_search_output"] + :ivar execution: Whether tool search was executed by the server or by the client. Known values + are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar tools: The loaded tool definitions returned by the tool search output. Required. + :vartype tools: list["Tool"] + :ivar status: Known values are: "in_progress", "completed", and "incomplete". + :vartype status: FunctionCallItemStatus + """ + id: Optional[str] + call_id: Optional[str] + type: Required[Literal['tool_search_output']] + 'The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.' + execution: _resolve('ToolSearchExecutionType') + 'Whether tool search was executed by the server or by the client. Known values are: "server"\n and "client".' + tools: Required[list['_types.Tool']] + 'The loaded tool definitions returned by the tool search output. Required.' + status: Optional[_resolve('FunctionCallItemStatus')] + 'Known values are: "in_progress", "completed", and "incomplete".' + ToolSearchOutputItemParam.__qualname__ = 'ToolSearchOutputItemParam' + if _version_info < (3, 13): + ToolSearchOutputItemParam.__doc__ = 'ToolSearchOutputItemParam.\n\n :ivar id:\n :vartype id: str\n :ivar call_id:\n :vartype call_id: str\n :ivar type: The item type. Always ``tool_search_output``. Required. TOOL_SEARCH_OUTPUT.\n :vartype type: Literal["tool_search_output"]\n :ivar execution: Whether tool search was executed by the server or by the client. Known values\n are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar tools: The loaded tool definitions returned by the tool search output. Required.\n :vartype tools: list["Tool"]\n :ivar status: Known values are: "in_progress", "completed", and "incomplete".\n :vartype status: FunctionCallItemStatus\n ' + return ToolSearchOutputItemParam + + def _make_ToolSearchToolParam(): + class ToolSearchToolParam(TypedDict, total=False): + """Tool search tool. + + :ivar type: The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH. + :vartype type: Literal["tool_search"] + :ivar execution: Whether tool search is executed by the server or by the client. Known values + are: "server" and "client". + :vartype execution: ToolSearchExecutionType + :ivar description: + :vartype description: str + :ivar parameters: + :vartype parameters: "EmptyModelParam" + """ + type: Required[Literal['tool_search']] + 'The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH.' + execution: _resolve('ToolSearchExecutionType') + 'Whether tool search is executed by the server or by the client. Known values are: "server"\n and "client".' + description: Optional[str] + parameters: Optional['_types.EmptyModelParam'] + ToolSearchToolParam.__qualname__ = 'ToolSearchToolParam' + if _version_info < (3, 13): + ToolSearchToolParam.__doc__ = 'Tool search tool.\n\n :ivar type: The type of the tool. Always ``tool_search``. Required. TOOL_SEARCH.\n :vartype type: Literal["tool_search"]\n :ivar execution: Whether tool search is executed by the server or by the client. Known values\n are: "server" and "client".\n :vartype execution: ToolSearchExecutionType\n :ivar description:\n :vartype description: str\n :ivar parameters:\n :vartype parameters: "EmptyModelParam"\n ' + return ToolSearchToolParam + + def _make_TopLogProb(): + class TopLogProb(TypedDict, total=False): + """Top log probability. + + :ivar token: Required. + :vartype token: str + :ivar logprob: Required. + :vartype logprob: float + :ivar bytes: Required. + :vartype bytes: list[int] + """ + token: Required[str] + 'Required.' + logprob: Required[float] + 'Required.' + bytes: Required[list[int]] + 'Required.' + TopLogProb.__qualname__ = 'TopLogProb' + if _version_info < (3, 13): + TopLogProb.__doc__ = 'Top log probability.\n\n :ivar token: Required.\n :vartype token: str\n :ivar logprob: Required.\n :vartype logprob: float\n :ivar bytes: Required.\n :vartype bytes: list[int]\n ' + return TopLogProb + + def _make_TypeParam(): + class TypeParam(TypedDict, total=False): + """Type. + + :ivar type: Specifies the event type. For a type action, this property is always set to + ``type``. Required. TYPE. + :vartype type: Literal["type"] + :ivar text: The text to type. Required. + :vartype text: str + """ + type: Required[Literal['type']] + 'Specifies the event type. For a type action, this property is always set to ``type``. Required.\n TYPE.' + text: Required[str] + 'The text to type. Required.' + TypeParam.__qualname__ = 'TypeParam' + if _version_info < (3, 13): + TypeParam.__doc__ = 'Type.\n\n :ivar type: Specifies the event type. For a type action, this property is always set to\n ``type``. Required. TYPE.\n :vartype type: Literal["type"]\n :ivar text: The text to type. Required.\n :vartype text: str\n ' + return TypeParam + + def _make_UrlCitationBody(): + class UrlCitationBody(TypedDict, total=False): + """URL citation. + + :ivar type: The type of the URL citation. Always ``url_citation``. Required. URL_CITATION. + :vartype type: Literal["url_citation"] + :ivar url: The URL of the web resource. Required. + :vartype url: str + :ivar start_index: The index of the first character of the URL citation in the message. + Required. + :vartype start_index: int + :ivar end_index: The index of the last character of the URL citation in the message. Required. + :vartype end_index: int + :ivar title: The title of the web resource. Required. + :vartype title: str + """ + type: Required[Literal['url_citation']] + 'The type of the URL citation. Always ``url_citation``. Required. URL_CITATION.' + url: Required[str] + 'The URL of the web resource. Required.' + start_index: Required[int] + 'The index of the first character of the URL citation in the message. Required.' + end_index: Required[int] + 'The index of the last character of the URL citation in the message. Required.' + title: Required[str] + 'The title of the web resource. Required.' + UrlCitationBody.__qualname__ = 'UrlCitationBody' + if _version_info < (3, 13): + UrlCitationBody.__doc__ = 'URL citation.\n\n :ivar type: The type of the URL citation. Always ``url_citation``. Required. URL_CITATION.\n :vartype type: Literal["url_citation"]\n :ivar url: The URL of the web resource. Required.\n :vartype url: str\n :ivar start_index: The index of the first character of the URL citation in the message.\n Required.\n :vartype start_index: int\n :ivar end_index: The index of the last character of the URL citation in the message. Required.\n :vartype end_index: int\n :ivar title: The title of the web resource. Required.\n :vartype title: str\n ' + return UrlCitationBody + + def _make_UserProfileMemoryItem(): + class UserProfileMemoryItem(TypedDict, total=False): + """A memory item specifically containing user profile information extracted from conversations, + such as preferences, interests, and personal details. + + :ivar memory_id: The unique ID of the memory item. Required. + :vartype memory_id: str + :ivar updated_at: The last update time of the memory item. Required. + :vartype updated_at: int + :ivar scope: The namespace that logically groups and isolates memories, such as a user ID. + Required. + :vartype scope: str + :ivar content: The content of the memory. Required. + :vartype content: str + :ivar kind: The kind of the memory item. Required. User profile information extracted from + conversations. + :vartype kind: Literal["user_profile"] + """ + memory_id: Required[str] + 'The unique ID of the memory item. Required.' + updated_at: Required[int] + 'The last update time of the memory item. Required.' + scope: Required[str] + 'The namespace that logically groups and isolates memories, such as a user ID. Required.' + content: Required[str] + 'The content of the memory. Required.' + kind: Required[Literal['user_profile']] + 'The kind of the memory item. Required. User profile information extracted from conversations.' + UserProfileMemoryItem.__qualname__ = 'UserProfileMemoryItem' + if _version_info < (3, 13): + UserProfileMemoryItem.__doc__ = 'A memory item specifically containing user profile information extracted from conversations,\n such as preferences, interests, and personal details.\n\n :ivar memory_id: The unique ID of the memory item. Required.\n :vartype memory_id: str\n :ivar updated_at: The last update time of the memory item. Required.\n :vartype updated_at: int\n :ivar scope: The namespace that logically groups and isolates memories, such as a user ID.\n Required.\n :vartype scope: str\n :ivar content: The content of the memory. Required.\n :vartype content: str\n :ivar kind: The kind of the memory item. Required. User profile information extracted from\n conversations.\n :vartype kind: Literal["user_profile"]\n ' + return UserProfileMemoryItem + + def _make_VectorStoreFileAttributes(): + class VectorStoreFileAttributes(TypedDict, total=False): + """Set of 16 key-value pairs that can be attached to an object. This can be useful for storing + additional information about the object in a structured format, and querying for objects via + API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are + strings with a maximum length of 512 characters, booleans, or numbers. + + """ + VectorStoreFileAttributes.__qualname__ = 'VectorStoreFileAttributes' + if _version_info < (3, 13): + VectorStoreFileAttributes.__doc__ = 'Set of 16 key-value pairs that can be attached to an object. This can be useful for storing\n additional information about the object in a structured format, and querying for objects via\n API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are\n strings with a maximum length of 512 characters, booleans, or numbers.\n\n ' + return VectorStoreFileAttributes + + def _make_WaitParam(): + class WaitParam(TypedDict, total=False): + """Wait. + + :ivar type: Specifies the event type. For a wait action, this property is always set to + ``wait``. Required. WAIT. + :vartype type: Literal["wait"] + """ + type: Required[Literal['wait']] + 'Specifies the event type. For a wait action, this property is always set to ``wait``. Required.\n WAIT.' + WaitParam.__qualname__ = 'WaitParam' + if _version_info < (3, 13): + WaitParam.__doc__ = 'Wait.\n\n :ivar type: Specifies the event type. For a wait action, this property is always set to\n ``wait``. Required. WAIT.\n :vartype type: Literal["wait"]\n ' + return WaitParam + + def _make_WebSearchActionFind(): + class WebSearchActionFind(TypedDict, total=False): + """Find action. + + :ivar type: The action type. Required. Default value is "find_in_page". + :vartype type: Literal["find_in_page"] + :ivar url: The URL of the page searched for the pattern. Required. + :vartype url: str + :ivar pattern: The pattern or text to search for within the page. Required. + :vartype pattern: str + """ + type: Required[Literal['find_in_page']] + 'The action type. Required. Default value is "find_in_page".' + url: Required[str] + 'The URL of the page searched for the pattern. Required.' + pattern: Required[str] + 'The pattern or text to search for within the page. Required.' + WebSearchActionFind.__qualname__ = 'WebSearchActionFind' + if _version_info < (3, 13): + WebSearchActionFind.__doc__ = 'Find action.\n\n :ivar type: The action type. Required. Default value is "find_in_page".\n :vartype type: Literal["find_in_page"]\n :ivar url: The URL of the page searched for the pattern. Required.\n :vartype url: str\n :ivar pattern: The pattern or text to search for within the page. Required.\n :vartype pattern: str\n ' + return WebSearchActionFind + + def _make_WebSearchActionOpenPage(): + class WebSearchActionOpenPage(TypedDict, total=False): + """Open page action. + + :ivar type: The action type. Required. Default value is "open_page". + :vartype type: Literal["open_page"] + :ivar url: The URL opened by the model. + :vartype url: str + """ + type: Required[Literal['open_page']] + 'The action type. Required. Default value is "open_page".' + url: Optional[str] + 'The URL opened by the model.' + WebSearchActionOpenPage.__qualname__ = 'WebSearchActionOpenPage' + if _version_info < (3, 13): + WebSearchActionOpenPage.__doc__ = 'Open page action.\n\n :ivar type: The action type. Required. Default value is "open_page".\n :vartype type: Literal["open_page"]\n :ivar url: The URL opened by the model.\n :vartype url: str\n ' + return WebSearchActionOpenPage + + def _make_WebSearchActionSearch(): + class WebSearchActionSearch(TypedDict, total=False): + """Search action. + + :ivar type: The action type. Required. Default value is "search". + :vartype type: Literal["search"] + :ivar query: The search query. + :vartype query: str + :ivar queries: Search queries. + :vartype queries: list[str] + :ivar sources: Web search sources. + :vartype sources: list["WebSearchActionSearchSources"] + """ + type: Required[Literal['search']] + 'The action type. Required. Default value is "search".' + query: str + 'The search query.' + queries: list[str] + 'Search queries.' + sources: list['_types.WebSearchActionSearchSources'] + 'Web search sources.' + WebSearchActionSearch.__qualname__ = 'WebSearchActionSearch' + if _version_info < (3, 13): + WebSearchActionSearch.__doc__ = 'Search action.\n\n :ivar type: The action type. Required. Default value is "search".\n :vartype type: Literal["search"]\n :ivar query: The search query.\n :vartype query: str\n :ivar queries: Search queries.\n :vartype queries: list[str]\n :ivar sources: Web search sources.\n :vartype sources: list["WebSearchActionSearchSources"]\n ' + return WebSearchActionSearch + + def _make_WebSearchActionSearchSources(): + class WebSearchActionSearchSources(TypedDict, total=False): + """WebSearchActionSearchSources. + + :ivar type: Required. Default value is "url". + :vartype type: Literal["url"] + :ivar url: Required. + :vartype url: str + """ + type: Required[Literal['url']] + 'Required. Default value is "url".' + url: Required[str] + 'Required.' + WebSearchActionSearchSources.__qualname__ = 'WebSearchActionSearchSources' + if _version_info < (3, 13): + WebSearchActionSearchSources.__doc__ = 'WebSearchActionSearchSources.\n\n :ivar type: Required. Default value is "url".\n :vartype type: Literal["url"]\n :ivar url: Required.\n :vartype url: str\n ' + return WebSearchActionSearchSources + + def _make_WebSearchApproximateLocation(): + class WebSearchApproximateLocation(TypedDict, total=False): + """Web search approximate location. + + :ivar type: The type of location approximation. Always ``approximate``. Required. Default value + is "approximate". + :vartype type: Literal["approximate"] + :ivar country: + :vartype country: str + :ivar region: + :vartype region: str + :ivar city: + :vartype city: str + :ivar timezone: + :vartype timezone: str + """ + type: Required[Literal['approximate']] + 'The type of location approximation. Always ``approximate``. Required. Default value is\n "approximate".' + country: Optional[str] + region: Optional[str] + city: Optional[str] + timezone: Optional[str] + WebSearchApproximateLocation.__qualname__ = 'WebSearchApproximateLocation' + if _version_info < (3, 13): + WebSearchApproximateLocation.__doc__ = 'Web search approximate location.\n\n :ivar type: The type of location approximation. Always ``approximate``. Required. Default value\n is "approximate".\n :vartype type: Literal["approximate"]\n :ivar country:\n :vartype country: str\n :ivar region:\n :vartype region: str\n :ivar city:\n :vartype city: str\n :ivar timezone:\n :vartype timezone: str\n ' + return WebSearchApproximateLocation + + def _make_WebSearchConfiguration(): + class WebSearchConfiguration(TypedDict, total=False): + """A web search configuration for bing custom search. + + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar project_connection_id: Project connection id for grounding with bing custom search. + Required. + :vartype project_connection_id: str + :ivar instance_name: Name of the custom configuration instance given to config. Required. + :vartype instance_name: str + """ + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + project_connection_id: Required[str] + 'Project connection id for grounding with bing custom search. Required.' + instance_name: Required[str] + 'Name of the custom configuration instance given to config. Required.' + WebSearchConfiguration.__qualname__ = 'WebSearchConfiguration' + if _version_info < (3, 13): + WebSearchConfiguration.__doc__ = 'A web search configuration for bing custom search.\n\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar project_connection_id: Project connection id for grounding with bing custom search.\n Required.\n :vartype project_connection_id: str\n :ivar instance_name: Name of the custom configuration instance given to config. Required.\n :vartype instance_name: str\n ' + return WebSearchConfiguration + + def _make_WebSearchPreviewTool(): + class WebSearchPreviewTool(TypedDict, total=False): + """Web search preview. + + :ivar type: The type of the web search tool. One of ``web_search_preview`` or + ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW. + :vartype type: Literal["web_search_preview"] + :ivar user_location: + :vartype user_location: "ApproximateLocation" + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Known + values are: "low", "medium", and "high". + :vartype search_context_size: SearchContextSize + :ivar search_content_types: + :vartype search_content_types: list[SearchContentType] + """ + type: Required[Literal['web_search_preview']] + 'The type of the web search tool. One of ``web_search_preview`` or\n ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW.' + user_location: Optional['_types.ApproximateLocation'] + search_context_size: _resolve('SearchContextSize') + 'High level guidance for the amount of context window space to use for the search. One of\n ``low``, ``medium``, or ``high``. ``medium`` is the default. Known values are: "low",\n "medium", and "high".' + search_content_types: list[_resolve('SearchContentType')] + WebSearchPreviewTool.__qualname__ = 'WebSearchPreviewTool' + if _version_info < (3, 13): + WebSearchPreviewTool.__doc__ = 'Web search preview.\n\n :ivar type: The type of the web search tool. One of ``web_search_preview`` or\n ``web_search_preview_2025_03_11``. Required. WEB_SEARCH_PREVIEW.\n :vartype type: Literal["web_search_preview"]\n :ivar user_location:\n :vartype user_location: "ApproximateLocation"\n :ivar search_context_size: High level guidance for the amount of context window space to use\n for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Known\n values are: "low", "medium", and "high".\n :vartype search_context_size: SearchContextSize\n :ivar search_content_types:\n :vartype search_content_types: list[SearchContentType]\n ' + return WebSearchPreviewTool + + def _make_WebSearchTool(): + class WebSearchTool(TypedDict, total=False): + """Web search. + + :ivar type: The type of the web search tool. One of ``web_search`` or + ``web_search_2025_08_26``. Required. WEB_SEARCH. + :vartype type: Literal["web_search"] + :ivar external_web_access: Allow live internet access for web search. Defaults to true when + omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new + external content. + :vartype external_web_access: bool + :ivar filters: + :vartype filters: "WebSearchToolFilters" + :ivar user_location: + :vartype user_location: "WebSearchApproximateLocation" + :ivar search_context_size: High level guidance for the amount of context window space to use + for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of + the following types: Literal["low"], Literal["medium"], Literal["high"] + :vartype search_context_size: Literal["low", "medium", "high"] + :ivar name: Optional user-defined name for this tool or configuration. + :vartype name: str + :ivar description: Optional user-defined description for this tool or configuration. + :vartype description: str + :ivar custom_search_configuration: The project connections attached to this tool. There can be + a maximum of 1 connection resource attached to the tool. + :vartype custom_search_configuration: "WebSearchConfiguration" + """ + type: Required[Literal['web_search']] + 'The type of the web search tool. One of ``web_search`` or ``web_search_2025_08_26``. Required.\n WEB_SEARCH.' + external_web_access: bool + 'Allow live internet access for web search. Defaults to true when omitted. When false, the web\n search tool runs in offline/cache-only mode and will not fetch new external content.' + filters: Optional['_types.WebSearchToolFilters'] + user_location: Optional['_types.WebSearchApproximateLocation'] + search_context_size: Literal['low', 'medium', 'high'] + 'High level guidance for the amount of context window space to use for the search. One of\n ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of the following types:\n Literal["low"], Literal["medium"], Literal["high"]' + name: str + 'Optional user-defined name for this tool or configuration.' + description: str + 'Optional user-defined description for this tool or configuration.' + custom_search_configuration: '_types.WebSearchConfiguration' + 'The project connections attached to this tool. There can be a maximum of 1 connection resource\n attached to the tool.' + WebSearchTool.__qualname__ = 'WebSearchTool' + if _version_info < (3, 13): + WebSearchTool.__doc__ = 'Web search.\n\n :ivar type: The type of the web search tool. One of ``web_search`` or\n ``web_search_2025_08_26``. Required. WEB_SEARCH.\n :vartype type: Literal["web_search"]\n :ivar external_web_access: Allow live internet access for web search. Defaults to true when\n omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new\n external content.\n :vartype external_web_access: bool\n :ivar filters:\n :vartype filters: "WebSearchToolFilters"\n :ivar user_location:\n :vartype user_location: "WebSearchApproximateLocation"\n :ivar search_context_size: High level guidance for the amount of context window space to use\n for the search. One of ``low``, ``medium``, or ``high``. ``medium`` is the default. Is one of\n the following types: Literal["low"], Literal["medium"], Literal["high"]\n :vartype search_context_size: Literal["low", "medium", "high"]\n :ivar name: Optional user-defined name for this tool or configuration.\n :vartype name: str\n :ivar description: Optional user-defined description for this tool or configuration.\n :vartype description: str\n :ivar custom_search_configuration: The project connections attached to this tool. There can be\n a maximum of 1 connection resource attached to the tool.\n :vartype custom_search_configuration: "WebSearchConfiguration"\n ' + return WebSearchTool + + def _make_WebSearchToolFilters(): + class WebSearchToolFilters(TypedDict, total=False): + """WebSearchToolFilters. + + :ivar allowed_domains: + :vartype allowed_domains: list[str] + """ + allowed_domains: Optional[list[str]] + WebSearchToolFilters.__qualname__ = 'WebSearchToolFilters' + if _version_info < (3, 13): + WebSearchToolFilters.__doc__ = 'WebSearchToolFilters.\n\n :ivar allowed_domains:\n :vartype allowed_domains: list[str]\n ' + return WebSearchToolFilters + + def _make_WorkflowActionOutputItem(): + class WorkflowActionOutputItem(TypedDict, total=False): + """WorkflowActionOutputItem. + + :ivar agent_reference: The agent that created the item. + :vartype agent_reference: "AgentReference" + :ivar response_id: The response on which the item is created. + :vartype response_id: str + :ivar type: Required. WORKFLOW_ACTION. + :vartype type: Literal["workflow_action"] + :ivar kind: The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required. + :vartype kind: str + :ivar action_id: Unique identifier for the action. Required. + :vartype action_id: str + :ivar parent_action_id: ID of the parent action if this is a nested action. + :vartype parent_action_id: str + :ivar previous_action_id: ID of the previous action if this action follows another. + :vartype previous_action_id: str + :ivar status: Status of the action (e.g., 'in_progress', 'completed', 'failed', 'cancelled'). + Required. Is one of the following types: Literal["completed"], Literal["failed"], + Literal["in_progress"], Literal["cancelled"] + :vartype status: Literal["completed", "failed", "in_progress", "cancelled"] + :ivar id: Required. + :vartype id: str + """ + agent_reference: '_types.AgentReference' + 'The agent that created the item.' + response_id: str + 'The response on which the item is created.' + type: Required[Literal['workflow_action']] + 'Required. WORKFLOW_ACTION.' + kind: Required[str] + "The kind of CSDL action (e.g., 'SetVariable', 'InvokeAzureAgent'). Required." + action_id: Required[str] + 'Unique identifier for the action. Required.' + parent_action_id: str + 'ID of the parent action if this is a nested action.' + previous_action_id: str + 'ID of the previous action if this action follows another.' + status: Required[Literal['completed', 'failed', 'in_progress', 'cancelled']] + 'Status of the action (e.g., \'in_progress\', \'completed\', \'failed\', \'cancelled\'). Required. Is\n one of the following types: Literal["completed"], Literal["failed"],\n Literal["in_progress"], Literal["cancelled"]' + id: Required[str] + 'Required.' + WorkflowActionOutputItem.__qualname__ = 'WorkflowActionOutputItem' + if _version_info < (3, 13): + WorkflowActionOutputItem.__doc__ = 'WorkflowActionOutputItem.\n\n :ivar agent_reference: The agent that created the item.\n :vartype agent_reference: "AgentReference"\n :ivar response_id: The response on which the item is created.\n :vartype response_id: str\n :ivar type: Required. WORKFLOW_ACTION.\n :vartype type: Literal["workflow_action"]\n :ivar kind: The kind of CSDL action (e.g., \'SetVariable\', \'InvokeAzureAgent\'). Required.\n :vartype kind: str\n :ivar action_id: Unique identifier for the action. Required.\n :vartype action_id: str\n :ivar parent_action_id: ID of the parent action if this is a nested action.\n :vartype parent_action_id: str\n :ivar previous_action_id: ID of the previous action if this action follows another.\n :vartype previous_action_id: str\n :ivar status: Status of the action (e.g., \'in_progress\', \'completed\', \'failed\', \'cancelled\').\n Required. Is one of the following types: Literal["completed"], Literal["failed"],\n Literal["in_progress"], Literal["cancelled"]\n :vartype status: Literal["completed", "failed", "in_progress", "cancelled"]\n :ivar id: Required.\n :vartype id: str\n ' + return WorkflowActionOutputItem + + def _make_WorkIQPreviewTool(): + class WorkIQPreviewTool(TypedDict, total=False): + """A WorkIQ server-side tool. + + :ivar type: The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW. + :vartype type: Literal["work_iq_preview"] + :ivar work_iq_preview: The WorkIQ tool parameters. Required. + :vartype work_iq_preview: "WorkIQPreviewToolParameters" + """ + type: Required[Literal['work_iq_preview']] + "The object type, which is always 'work_iq_preview'. Required. WORK_IQ_PREVIEW." + work_iq_preview: Required['_types.WorkIQPreviewToolParameters'] + 'The WorkIQ tool parameters. Required.' + WorkIQPreviewTool.__qualname__ = 'WorkIQPreviewTool' + if _version_info < (3, 13): + WorkIQPreviewTool.__doc__ = 'A WorkIQ server-side tool.\n\n :ivar type: The object type, which is always \'work_iq_preview\'. Required. WORK_IQ_PREVIEW.\n :vartype type: Literal["work_iq_preview"]\n :ivar work_iq_preview: The WorkIQ tool parameters. Required.\n :vartype work_iq_preview: "WorkIQPreviewToolParameters"\n ' + return WorkIQPreviewTool + + def _make_WorkIQPreviewToolParameters(): + class WorkIQPreviewToolParameters(TypedDict, total=False): + """The WorkIQ tool parameters. + + :ivar project_connection_id: The ID of the WorkIQ project connection. Required. + :vartype project_connection_id: str + """ + project_connection_id: Required[str] + 'The ID of the WorkIQ project connection. Required.' + WorkIQPreviewToolParameters.__qualname__ = 'WorkIQPreviewToolParameters' + if _version_info < (3, 13): + WorkIQPreviewToolParameters.__doc__ = 'The WorkIQ tool parameters.\n\n :ivar project_connection_id: The ID of the WorkIQ project connection. Required.\n :vartype project_connection_id: str\n ' + return WorkIQPreviewToolParameters + + def _make_CompactResponseMethodPublicBody(): + class CompactResponseMethodPublicBody(TypedDict, total=False): + """CompactResponseMethodPublicBody. + + :ivar model: Required. Known values are: "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", + "gpt-5.5", "gpt-5.5-2026-04-23", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano", + "gpt-5.4-mini-2026-03-17", "gpt-5.4-nano-2026-03-17", "gpt-5.3-chat-latest", "gpt-5.2", + "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11", + "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", "gpt-5.1-mini", "gpt-5.1-chat-latest", + "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", + "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4.1-nano-2025-04-14", "o4-mini", + "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1", + "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", + "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", + "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17", + "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview", + "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview", + "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11", + "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18", + "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview", + "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k", + "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301", + "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613", + "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research", + "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", + "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5.5-pro", + "gpt-5.5-pro-2026-04-23", "gpt-5-codex", "gpt-5-pro", "gpt-5-pro-2025-10-06", + "gpt-5.1-codex-max", "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest", and + "gpt-5.6-cyber". + :vartype model: ModelIdsCompaction + :ivar input: Is either a str type or a [Item] type. + :vartype input: Union[str, list["Item"]] + :ivar previous_response_id: + :vartype previous_response_id: str + :ivar instructions: + :vartype instructions: str + :ivar prompt_cache_key: + :vartype prompt_cache_key: str + :ivar prompt_cache_retention: Known values are: "in_memory" and "24h". + :vartype prompt_cache_retention: PromptCacheRetentionEnum + :ivar prompt_cache_options: + :vartype prompt_cache_options: "PromptCacheOptionsParam" + :ivar service_tier: Known values are: "auto", "default", "fast", "flex", and "priority". + :vartype service_tier: ServiceTierEnum + """ + model: Required[Optional[_resolve('ModelIdsCompaction')]] + 'Required. Known values are: "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5",\n "gpt-5.5-2026-04-23", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano",\n "gpt-5.4-mini-2026-03-17", "gpt-5.4-nano-2026-03-17", "gpt-5.3-chat-latest", "gpt-5.2",\n "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11",\n "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", "gpt-5.1-mini",\n "gpt-5.1-chat-latest", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07",\n "gpt-5-mini-2025-08-07", "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1",\n "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14",\n "gpt-4.1-nano-2025-04-14", "o4-mini", "o4-mini-2025-04-16", "o3", "o3-2025-04-16",\n "o3-mini", "o3-mini-2025-01-31", "o1", "o1-2024-12-17", "o1-preview",\n "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "gpt-4o",\n "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13", "gpt-4o-audio-preview",\n "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17",\n "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview",\n "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview",\n "gpt-4o-mini-search-preview", "gpt-4o-search-preview-2025-03-11",\n "gpt-4o-mini-search-preview-2025-03-11", "chatgpt-4o-latest", "codex-mini-latest",\n "gpt-4o-mini", "gpt-4o-mini-2024-07-18", "gpt-4-turbo", "gpt-4-turbo-2024-04-09",\n "gpt-4-0125-preview", "gpt-4-turbo-preview", "gpt-4-1106-preview",\n "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k",\n "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k",\n "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125",\n "gpt-3.5-turbo-16k-0613", "o1-pro", "o1-pro-2025-03-19", "o3-pro",\n "o3-pro-2025-06-10", "o3-deep-research", "o3-deep-research-2025-06-26",\n "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26", "computer-use-preview",\n "computer-use-preview-2025-03-11", "gpt-5.5-pro", "gpt-5.5-pro-2026-04-23",\n "gpt-5-codex", "gpt-5-pro", "gpt-5-pro-2025-10-06", "gpt-5.1-codex-max",\n "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest", and "gpt-5.6-cyber".' + input: Optional[Union[str, list['_types.Item']]] + 'Is either a str type or a [Item] type.' + previous_response_id: Optional[str] + instructions: Optional[str] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[_resolve('PromptCacheRetentionEnum')] + 'Known values are: "in_memory" and "24h".' + prompt_cache_options: Optional['_types.PromptCacheOptionsParam'] + service_tier: Optional[_resolve('ServiceTierEnum')] + 'Known values are: "auto", "default", "fast", "flex", and "priority".' + CompactResponseMethodPublicBody.__qualname__ = 'CompactResponseMethodPublicBody' + if _version_info < (3, 13): + CompactResponseMethodPublicBody.__doc__ = 'CompactResponseMethodPublicBody.\n\n :ivar model: Required. Known values are: "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna",\n "gpt-5.5", "gpt-5.5-2026-04-23", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano",\n "gpt-5.4-mini-2026-03-17", "gpt-5.4-nano-2026-03-17", "gpt-5.3-chat-latest", "gpt-5.2",\n "gpt-5.2-2025-12-11", "gpt-5.2-chat-latest", "gpt-5.2-pro", "gpt-5.2-pro-2025-12-11",\n "gpt-5.1", "gpt-5.1-2025-11-13", "gpt-5.1-codex", "gpt-5.1-mini", "gpt-5.1-chat-latest",\n "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5-2025-08-07", "gpt-5-mini-2025-08-07",\n "gpt-5-nano-2025-08-07", "gpt-5-chat-latest", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano",\n "gpt-4.1-2025-04-14", "gpt-4.1-mini-2025-04-14", "gpt-4.1-nano-2025-04-14", "o4-mini",\n "o4-mini-2025-04-16", "o3", "o3-2025-04-16", "o3-mini", "o3-mini-2025-01-31", "o1",\n "o1-2024-12-17", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12",\n "gpt-4o", "gpt-4o-2024-11-20", "gpt-4o-2024-08-06", "gpt-4o-2024-05-13",\n "gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01", "gpt-4o-audio-preview-2024-12-17",\n "gpt-4o-audio-preview-2025-06-03", "gpt-4o-mini-audio-preview",\n "gpt-4o-mini-audio-preview-2024-12-17", "gpt-4o-search-preview", "gpt-4o-mini-search-preview",\n "gpt-4o-search-preview-2025-03-11", "gpt-4o-mini-search-preview-2025-03-11",\n "chatgpt-4o-latest", "codex-mini-latest", "gpt-4o-mini", "gpt-4o-mini-2024-07-18",\n "gpt-4-turbo", "gpt-4-turbo-2024-04-09", "gpt-4-0125-preview", "gpt-4-turbo-preview",\n "gpt-4-1106-preview", "gpt-4-vision-preview", "gpt-4", "gpt-4-0314", "gpt-4-0613", "gpt-4-32k",\n "gpt-4-32k-0314", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0301",\n "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-16k-0613",\n "o1-pro", "o1-pro-2025-03-19", "o3-pro", "o3-pro-2025-06-10", "o3-deep-research",\n "o3-deep-research-2025-06-26", "o4-mini-deep-research", "o4-mini-deep-research-2025-06-26",\n "computer-use-preview", "computer-use-preview-2025-03-11", "gpt-5.5-pro",\n "gpt-5.5-pro-2026-04-23", "gpt-5-codex", "gpt-5-pro", "gpt-5-pro-2025-10-06",\n "gpt-5.1-codex-max", "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest", and\n "gpt-5.6-cyber".\n :vartype model: ModelIdsCompaction\n :ivar input: Is either a str type or a [Item] type.\n :vartype input: Union[str, list["Item"]]\n :ivar previous_response_id:\n :vartype previous_response_id: str\n :ivar instructions:\n :vartype instructions: str\n :ivar prompt_cache_key:\n :vartype prompt_cache_key: str\n :ivar prompt_cache_retention: Known values are: "in_memory" and "24h".\n :vartype prompt_cache_retention: PromptCacheRetentionEnum\n :ivar prompt_cache_options:\n :vartype prompt_cache_options: "PromptCacheOptionsParam"\n :ivar service_tier: Known values are: "auto", "default", "fast", "flex", and "priority".\n :vartype service_tier: ServiceTierEnum\n ' + return CompactResponseMethodPublicBody + + def _make_Tool(): + return Union[_resolve('A2APreviewTool'), _resolve('ApplyPatchToolParam'), _resolve('AzureAISearchTool'), _resolve('AzureFunctionTool'), _resolve('BingCustomSearchPreviewTool'), _resolve('BingGroundingTool'), _resolve('BrowserAutomationPreviewTool'), _resolve('CaptureStructuredOutputsTool'), _resolve('CodeInterpreterTool'), _resolve('ComputerTool'), _resolve('ComputerUsePreviewTool'), _resolve('CustomToolParam'), _resolve('MicrosoftFabricPreviewTool'), _resolve('FileSearchTool'), _resolve('FunctionTool'), _resolve('ImageGenTool'), _resolve('LocalShellToolParam'), _resolve('MCPTool'), _resolve('MemorySearchPreviewTool'), _resolve('NamespaceToolParam'), _resolve('OpenApiTool'), _resolve('ProgrammaticToolCallingParam'), _resolve('SharepointPreviewTool'), _resolve('FunctionShellToolParam'), _resolve('ToolSearchToolParam'), _resolve('WebSearchTool'), _resolve('WebSearchPreviewTool'), _resolve('WorkIQPreviewTool')] + + def _make_OutputItem(): + return Union[_resolve('A2AToolCall'), _resolve('A2AToolCallOutput'), _resolve('OutputItemAdditionalTools'), _resolve('OutputItemApplyPatchToolCall'), _resolve('OutputItemApplyPatchToolCallOutput'), _resolve('AzureAISearchToolCall'), _resolve('AzureAISearchToolCallOutput'), _resolve('AzureFunctionToolCall'), _resolve('AzureFunctionToolCallOutput'), _resolve('BingCustomSearchToolCall'), _resolve('BingCustomSearchToolCallOutput'), _resolve('BingGroundingToolCall'), _resolve('BingGroundingToolCallOutput'), _resolve('BrowserAutomationToolCall'), _resolve('BrowserAutomationToolCallOutput'), _resolve('OutputItemCodeInterpreterToolCall'), _resolve('OutputItemCompactionBody'), _resolve('OutputItemComputerToolCall'), _resolve('OutputItemComputerToolCallOutput'), _resolve('CustomToolCallResource'), _resolve('CustomToolCallOutputResource'), _resolve('FabricDataAgentToolCall'), _resolve('FabricDataAgentToolCallOutput'), _resolve('OutputItemFileSearchToolCall'), _resolve('OutputItemFunctionToolCall'), _resolve('OutputItemFunctionToolCallOutput'), _resolve('OutputItemImageGenToolCall'), _resolve('OutputItemLocalShellToolCall'), _resolve('OutputItemLocalShellToolCallOutput'), _resolve('OutputItemMcpApprovalRequest'), _resolve('OutputItemMcpApprovalResponseResource'), _resolve('OutputItemMcpToolCall'), _resolve('OutputItemMcpListTools'), _resolve('MemorySearchToolCallItemResource'), _resolve('OutputItemMessage'), _resolve('OAuthConsentRequestOutputItem'), _resolve('OpenApiToolCall'), _resolve('OpenApiToolCallOutput'), _resolve('OutputItemOutputMessage'), _resolve('OutputItemProgram'), _resolve('OutputItemProgramOutput'), _resolve('OutputItemReasoningItem'), _resolve('SharepointGroundingToolCall'), _resolve('SharepointGroundingToolCallOutput'), _resolve('OutputItemFunctionShellCall'), _resolve('OutputItemFunctionShellCallOutput'), _resolve('StructuredOutputsOutputItem'), _resolve('OutputItemToolSearchCall'), _resolve('OutputItemToolSearchOutput'), _resolve('OutputItemWebSearchToolCall'), _resolve('WorkflowActionOutputItem')] + + def _make_Item(): + return Union[_resolve('AdditionalToolsItemParam'), _resolve('ApplyPatchToolCallItemParam'), _resolve('ApplyPatchToolCallOutputItemParam'), _resolve('ItemCodeInterpreterToolCall'), _resolve('CompactionSummaryItemParam'), _resolve('ItemComputerToolCall'), _resolve('ComputerCallOutputItemParam'), _resolve('ItemCustomToolCall'), _resolve('ItemCustomToolCallOutput'), _resolve('ItemFileSearchToolCall'), _resolve('ItemFunctionToolCall'), _resolve('FunctionCallOutputItemParam'), _resolve('ItemImageGenToolCall'), _resolve('ItemReferenceParam'), _resolve('ItemLocalShellToolCall'), _resolve('ItemLocalShellToolCallOutput'), _resolve('ItemMcpApprovalRequest'), _resolve('MCPApprovalResponse'), _resolve('ItemMcpToolCall'), _resolve('ItemMcpListTools'), _resolve('MemorySearchToolCallItemParam'), _resolve('ItemMessage'), _resolve('ItemOutputMessage'), _resolve('ItemProgram'), _resolve('ItemProgramOutput'), _resolve('ItemReasoningItem'), _resolve('FunctionShellCallItemParam'), _resolve('FunctionShellCallOutputItemParam'), _resolve('ToolSearchCallItemParam'), _resolve('ToolSearchOutputItemParam'), _resolve('ItemWebSearchToolCall')] + + def _make_Annotation(): + return Union[_resolve('ContainerFileCitationBody'), _resolve('FileCitationBody'), _resolve('FilePath'), _resolve('UrlCitationBody')] + + def _make_ApplyPatchFileOperation(): + return Union[_resolve('ApplyPatchCreateFileOperation'), _resolve('ApplyPatchDeleteFileOperation'), _resolve('ApplyPatchUpdateFileOperation')] + + def _make_ApplyPatchOperationParam(): + return Union[_resolve('ApplyPatchCreateFileOperationParam'), _resolve('ApplyPatchDeleteFileOperationParam'), _resolve('ApplyPatchUpdateFileOperationParam')] + + def _make_MemoryItem(): + return Union[_resolve('ChatSummaryMemoryItem'), _resolve('UserProfileMemoryItem')] + + def _make_ComputerAction(): + return Union[_resolve('ClickParam'), _resolve('DoubleClickAction'), _resolve('DragParam'), _resolve('KeyPressAction'), _resolve('MoveParam'), _resolve('ScreenshotParam'), _resolve('ScrollParam'), _resolve('TypeParam'), _resolve('WaitParam')] + + def _make_MessageContent(): + return Union[_resolve('ComputerScreenshotContent'), _resolve('MessageContentInputFileContent'), _resolve('MessageContentInputImageContent'), _resolve('MessageContentInputTextContent'), _resolve('MessageContentOutputTextContent'), _resolve('MessageContentReasoningTextContent'), _resolve('MessageContentRefusalContent'), _resolve('SummaryTextContent'), _resolve('TextContent')] + + def _make_FunctionShellToolParamEnvironment(): + return Union[_resolve('ContainerAutoParam'), _resolve('FunctionShellToolParamEnvironmentContainerReferenceParam'), _resolve('FunctionShellToolParamEnvironmentLocalEnvironmentParam')] + + def _make_ContainerNetworkPolicyParam(): + return Union[_resolve('ContainerNetworkPolicyAllowlistParam'), _resolve('ContainerNetworkPolicyDisabledParam')] + + def _make_FunctionShellCallEnvironment(): + return Union[_resolve('ContainerReferenceResource'), _resolve('LocalEnvironmentResource')] + + def _make_ContainerSkill(): + return Union[_resolve('InlineSkillParam'), _resolve('SkillReferenceParam')] + + def _make_CustomToolParamFormat(): + return Union[_resolve('CustomGrammarFormatParam'), _resolve('CustomTextFormatParam')] + + def _make_ToolCallCaller(): + return Union[_resolve('DirectToolCallCaller'), _resolve('ProgramToolCallCaller')] + + def _make_ToolCallCallerParam(): + return Union[_resolve('DirectToolCallCallerParam'), _resolve('ProgramToolCallCallerParam')] + + def _make_FunctionAndCustomToolCallOutput(): + return Union[_resolve('FunctionAndCustomToolCallOutputInputFileContent'), _resolve('FunctionAndCustomToolCallOutputInputImageContent'), _resolve('FunctionAndCustomToolCallOutputInputTextContent')] + + def _make_FunctionShellCallItemParamEnvironment(): + return Union[_resolve('FunctionShellCallItemParamEnvironmentContainerReferenceParam'), _resolve('FunctionShellCallItemParamEnvironmentLocalEnvironmentParam')] + + def _make_FunctionShellCallOutputOutcome(): + return Union[_resolve('FunctionShellCallOutputExitOutcome'), _resolve('FunctionShellCallOutputTimeoutOutcome')] + + def _make_FunctionShellCallOutputOutcomeParam(): + return Union[_resolve('FunctionShellCallOutputExitOutcomeParam'), _resolve('FunctionShellCallOutputTimeoutOutcomeParam')] + + def _make_ItemField(): + return Union[_resolve('ItemFieldAdditionalTools'), _resolve('ItemFieldApplyPatchToolCall'), _resolve('ItemFieldApplyPatchToolCallOutput'), _resolve('ItemFieldCodeInterpreterToolCall'), _resolve('ItemFieldCompactionBody'), _resolve('ItemFieldComputerToolCall'), _resolve('ItemFieldComputerToolCallOutput'), _resolve('ItemFieldCustomToolCall'), _resolve('ItemFieldCustomToolCallOutput'), _resolve('ItemFieldFileSearchToolCall'), _resolve('ItemFieldFunctionToolCall'), _resolve('ItemFieldFunctionToolCallOutput'), _resolve('ItemFieldImageGenToolCall'), _resolve('ItemFieldLocalShellToolCall'), _resolve('ItemFieldLocalShellToolCallOutput'), _resolve('ItemFieldMcpApprovalRequest'), _resolve('ItemFieldMcpApprovalResponseResource'), _resolve('ItemFieldMcpToolCall'), _resolve('ItemFieldMcpListTools'), _resolve('ItemFieldMessage'), _resolve('ItemFieldProgram'), _resolve('ItemFieldProgramOutput'), _resolve('ItemFieldReasoningItem'), _resolve('ItemFieldFunctionShellCall'), _resolve('ItemFieldFunctionShellCallOutput'), _resolve('ItemFieldToolSearchCall'), _resolve('ItemFieldToolSearchOutput'), _resolve('ItemFieldWebSearchToolCall')] + + def _make_ModerationEntry(): + return Union[_resolve('ModerationErrorBody'), _resolve('ModerationResultBody')] + + def _make_OpenApiAuthDetails(): + return Union[_resolve('OpenApiAnonymousAuthDetails'), _resolve('OpenApiManagedAuthDetails'), _resolve('OpenApiProjectConnectionAuthDetails')] + + def _make_OutputContent(): + return Union[_resolve('OutputContentOutputTextContent'), _resolve('OutputContentReasoningTextContent'), _resolve('OutputContentRefusalContent')] + + def _make_OutputMessageContent(): + return Union[_resolve('OutputMessageContentOutputTextContent'), _resolve('OutputMessageContentRefusalContent')] + + def _make_RealtimeMCPError(): + return Union[_resolve('RealtimeMCPHTTPError'), _resolve('RealtimeMCPProtocolError'), _resolve('RealtimeMCPToolExecutionError')] + + def _make_ResponseStreamEvent(): + return Union[_resolve('ResponseErrorEvent'), _resolve('ResponseAudioDeltaEvent'), _resolve('ResponseAudioDoneEvent'), _resolve('ResponseAudioTranscriptDeltaEvent'), _resolve('ResponseAudioTranscriptDoneEvent'), _resolve('ResponseCodeInterpreterCallCompletedEvent'), _resolve('ResponseCodeInterpreterCallInProgressEvent'), _resolve('ResponseCodeInterpreterCallInterpretingEvent'), _resolve('ResponseCodeInterpreterCallCodeDeltaEvent'), _resolve('ResponseCodeInterpreterCallCodeDoneEvent'), _resolve('ResponseCompletedEvent'), _resolve('ResponseContentPartAddedEvent'), _resolve('ResponseContentPartDoneEvent'), _resolve('ResponseCreatedEvent'), _resolve('ResponseCustomToolCallInputDeltaEvent'), _resolve('ResponseCustomToolCallInputDoneEvent'), _resolve('ResponseFailedEvent'), _resolve('ResponseFileSearchCallCompletedEvent'), _resolve('ResponseFileSearchCallInProgressEvent'), _resolve('ResponseFileSearchCallSearchingEvent'), _resolve('ResponseFunctionCallArgumentsDeltaEvent'), _resolve('ResponseFunctionCallArgumentsDoneEvent'), _resolve('ResponseImageGenCallCompletedEvent'), _resolve('ResponseImageGenCallGeneratingEvent'), _resolve('ResponseImageGenCallInProgressEvent'), _resolve('ResponseImageGenCallPartialImageEvent'), _resolve('ResponseInProgressEvent'), _resolve('ResponseIncompleteEvent'), _resolve('ResponseMCPCallCompletedEvent'), _resolve('ResponseMCPCallFailedEvent'), _resolve('ResponseMCPCallInProgressEvent'), _resolve('ResponseMCPCallArgumentsDeltaEvent'), _resolve('ResponseMCPCallArgumentsDoneEvent'), _resolve('ResponseMCPListToolsCompletedEvent'), _resolve('ResponseMCPListToolsFailedEvent'), _resolve('ResponseMCPListToolsInProgressEvent'), _resolve('ResponseOutputItemAddedEvent'), _resolve('ResponseOutputItemDoneEvent'), _resolve('ResponseOutputTextAnnotationAddedEvent'), _resolve('ResponseTextDeltaEvent'), _resolve('ResponseTextDoneEvent'), _resolve('ResponseQueuedEvent'), _resolve('ResponseReasoningSummaryPartAddedEvent'), _resolve('ResponseReasoningSummaryPartDoneEvent'), _resolve('ResponseReasoningSummaryTextDeltaEvent'), _resolve('ResponseReasoningSummaryTextDoneEvent'), _resolve('ResponseReasoningTextDeltaEvent'), _resolve('ResponseReasoningTextDoneEvent'), _resolve('ResponseRefusalDeltaEvent'), _resolve('ResponseRefusalDoneEvent'), _resolve('ResponseWebSearchCallCompletedEvent'), _resolve('ResponseWebSearchCallInProgressEvent'), _resolve('ResponseWebSearchCallSearchingEvent')] + + def _make_ToolChoiceParam(): + return Union[_resolve('ToolChoiceAllowed'), _resolve('SpecificApplyPatchParam'), _resolve('ToolChoiceCodeInterpreter'), _resolve('ToolChoiceComputer'), _resolve('ToolChoiceComputerUse'), _resolve('ToolChoiceComputerUsePreview'), _resolve('ToolChoiceCustom'), _resolve('ToolChoiceFileSearch'), _resolve('ToolChoiceFunction'), _resolve('ToolChoiceImageGeneration'), _resolve('ToolChoiceMCP'), _resolve('SpecificProgrammaticToolCallingParam'), _resolve('SpecificFunctionShellParam'), _resolve('ToolChoiceWebSearchPreview'), _resolve('ToolChoiceWebSearchPreview20250311')] + + def _make_TextResponseFormatConfiguration(): + return Union[_resolve('TextResponseFormatConfigurationResponseFormatJsonObject'), _resolve('TextResponseFormatJsonSchema'), _resolve('TextResponseFormatConfigurationResponseFormatText')] + + _FACTORIES = { + 'AnnotationType': _make_AnnotationType, + 'ApplyPatchCallOutputStatus': _make_ApplyPatchCallOutputStatus, + 'ApplyPatchCallOutputStatusParam': _make_ApplyPatchCallOutputStatusParam, + 'ApplyPatchCallStatus': _make_ApplyPatchCallStatus, + 'ApplyPatchCallStatusParam': _make_ApplyPatchCallStatusParam, + 'ApplyPatchFileOperationType': _make_ApplyPatchFileOperationType, + 'ApplyPatchOperationParamType': _make_ApplyPatchOperationParamType, + 'AzureAISearchQueryType': _make_AzureAISearchQueryType, + 'CallableToolAllowedCaller': _make_CallableToolAllowedCaller, + 'ClickButtonType': _make_ClickButtonType, + 'ComputerActionType': _make_ComputerActionType, + 'ComputerEnvironment': _make_ComputerEnvironment, + 'ContainerMemoryLimit': _make_ContainerMemoryLimit, + 'ContainerNetworkPolicyParamType': _make_ContainerNetworkPolicyParamType, + 'ContainerSkillType': _make_ContainerSkillType, + 'CustomToolParamFormatType': _make_CustomToolParamFormatType, + 'DetailEnum': _make_DetailEnum, + 'FileInputDetail': _make_FileInputDetail, + 'FunctionAndCustomToolCallOutputType': _make_FunctionAndCustomToolCallOutputType, + 'FunctionCallItemStatus': _make_FunctionCallItemStatus, + 'FunctionCallOutputStatusEnum': _make_FunctionCallOutputStatusEnum, + 'FunctionCallStatus': _make_FunctionCallStatus, + 'FunctionShellCallEnvironmentType': _make_FunctionShellCallEnvironmentType, + 'FunctionShellCallItemParamEnvironmentType': _make_FunctionShellCallItemParamEnvironmentType, + 'FunctionShellCallItemStatus': _make_FunctionShellCallItemStatus, + 'FunctionShellCallOutputOutcomeParamType': _make_FunctionShellCallOutputOutcomeParamType, + 'FunctionShellCallOutputOutcomeType': _make_FunctionShellCallOutputOutcomeType, + 'FunctionShellCallOutputStatusEnum': _make_FunctionShellCallOutputStatusEnum, + 'FunctionShellCallStatus': _make_FunctionShellCallStatus, + 'FunctionShellToolParamEnvironmentType': _make_FunctionShellToolParamEnvironmentType, + 'GrammarSyntax1': _make_GrammarSyntax1, + 'ImageDetail': _make_ImageDetail, + 'ImageGenActionEnum': _make_ImageGenActionEnum, + 'IncludeEnum': _make_IncludeEnum, + 'InputFidelity': _make_InputFidelity, + 'ItemFieldType': _make_ItemFieldType, + 'ItemType': _make_ItemType, + 'MCPToolCallStatus': _make_MCPToolCallStatus, + 'MemoryItemKind': _make_MemoryItemKind, + 'MessageContentType': _make_MessageContentType, + 'MessagePhase': _make_MessagePhase, + 'MessageRole': _make_MessageRole, + 'MessageStatus': _make_MessageStatus, + 'ModelIdsCompaction': _make_ModelIdsCompaction, + 'ModerationEntryType': _make_ModerationEntryType, + 'ModerationInputType': _make_ModerationInputType, + 'ModerationMode': _make_ModerationMode, + 'OpenApiAuthType': _make_OpenApiAuthType, + 'OutputContentType': _make_OutputContentType, + 'OutputItemType': _make_OutputItemType, + 'OutputMessageContentType': _make_OutputMessageContentType, + 'PageOrder': _make_PageOrder, + 'ProgramOutputStatus': _make_ProgramOutputStatus, + 'PromptCacheModeEnum': _make_PromptCacheModeEnum, + 'PromptCacheRetentionEnum': _make_PromptCacheRetentionEnum, + 'PromptCacheTTLEnum': _make_PromptCacheTTLEnum, + 'RankerVersionType': _make_RankerVersionType, + 'RealtimeMcpErrorType': _make_RealtimeMcpErrorType, + 'ReasoningEffort': _make_ReasoningEffort, + 'ReasoningModeEnum': _make_ReasoningModeEnum, + 'ResponseErrorCode': _make_ResponseErrorCode, + 'ResponseStreamEventType': _make_ResponseStreamEventType, + 'SearchContentType': _make_SearchContentType, + 'SearchContextSize': _make_SearchContextSize, + 'ServiceTierEnum': _make_ServiceTierEnum, + 'TextResponseFormatConfigurationType': _make_TextResponseFormatConfigurationType, + 'ToolCallCallerParamType': _make_ToolCallCallerParamType, + 'ToolCallCallerType': _make_ToolCallCallerType, + 'ToolCallStatus': _make_ToolCallStatus, + 'ToolChoiceOptions': _make_ToolChoiceOptions, + 'ToolChoiceParamType': _make_ToolChoiceParamType, + 'ToolSearchExecutionType': _make_ToolSearchExecutionType, + 'ToolType': _make_ToolType, + 'A2APreviewTool': _make_A2APreviewTool, + 'A2AToolCall': _make_A2AToolCall, + 'A2AToolCallOutput': _make_A2AToolCallOutput, + 'AdditionalToolsItemParam': _make_AdditionalToolsItemParam, + 'AgentReference': _make_AgentReference, + 'AISearchIndexResource': _make_AISearchIndexResource, + 'ApiErrorResponse': _make_ApiErrorResponse, + 'ApplyPatchCreateFileOperation': _make_ApplyPatchCreateFileOperation, + 'ApplyPatchCreateFileOperationParam': _make_ApplyPatchCreateFileOperationParam, + 'ApplyPatchDeleteFileOperation': _make_ApplyPatchDeleteFileOperation, + 'ApplyPatchDeleteFileOperationParam': _make_ApplyPatchDeleteFileOperationParam, + 'ApplyPatchToolCallItemParam': _make_ApplyPatchToolCallItemParam, + 'ApplyPatchToolCallOutputItemParam': _make_ApplyPatchToolCallOutputItemParam, + 'ApplyPatchToolParam': _make_ApplyPatchToolParam, + 'ApplyPatchUpdateFileOperation': _make_ApplyPatchUpdateFileOperation, + 'ApplyPatchUpdateFileOperationParam': _make_ApplyPatchUpdateFileOperationParam, + 'ApproximateLocation': _make_ApproximateLocation, + 'AutoCodeInterpreterToolParam': _make_AutoCodeInterpreterToolParam, + 'AzureAISearchTool': _make_AzureAISearchTool, + 'AzureAISearchToolCall': _make_AzureAISearchToolCall, + 'AzureAISearchToolCallOutput': _make_AzureAISearchToolCallOutput, + 'AzureAISearchToolResource': _make_AzureAISearchToolResource, + 'AzureFunctionBinding': _make_AzureFunctionBinding, + 'AzureFunctionDefinition': _make_AzureFunctionDefinition, + 'AzureFunctionDefinitionFunction': _make_AzureFunctionDefinitionFunction, + 'AzureFunctionStorageQueue': _make_AzureFunctionStorageQueue, + 'AzureFunctionTool': _make_AzureFunctionTool, + 'AzureFunctionToolCall': _make_AzureFunctionToolCall, + 'AzureFunctionToolCallOutput': _make_AzureFunctionToolCallOutput, + 'BingCustomSearchConfiguration': _make_BingCustomSearchConfiguration, + 'BingCustomSearchPreviewTool': _make_BingCustomSearchPreviewTool, + 'BingCustomSearchToolCall': _make_BingCustomSearchToolCall, + 'BingCustomSearchToolCallOutput': _make_BingCustomSearchToolCallOutput, + 'BingCustomSearchToolParameters': _make_BingCustomSearchToolParameters, + 'BingGroundingSearchConfiguration': _make_BingGroundingSearchConfiguration, + 'BingGroundingSearchToolParameters': _make_BingGroundingSearchToolParameters, + 'BingGroundingTool': _make_BingGroundingTool, + 'BingGroundingToolCall': _make_BingGroundingToolCall, + 'BingGroundingToolCallOutput': _make_BingGroundingToolCallOutput, + 'BrowserAutomationPreviewTool': _make_BrowserAutomationPreviewTool, + 'BrowserAutomationToolCall': _make_BrowserAutomationToolCall, + 'BrowserAutomationToolCallOutput': _make_BrowserAutomationToolCallOutput, + 'BrowserAutomationToolConnectionParameters': _make_BrowserAutomationToolConnectionParameters, + 'BrowserAutomationToolParameters': _make_BrowserAutomationToolParameters, + 'CaptureStructuredOutputsTool': _make_CaptureStructuredOutputsTool, + 'ChatSummaryMemoryItem': _make_ChatSummaryMemoryItem, + 'ClickParam': _make_ClickParam, + 'CodeInterpreterOutputImage': _make_CodeInterpreterOutputImage, + 'CodeInterpreterOutputLogs': _make_CodeInterpreterOutputLogs, + 'CodeInterpreterTool': _make_CodeInterpreterTool, + 'CompactionSummaryItemParam': _make_CompactionSummaryItemParam, + 'CompactResource': _make_CompactResource, + 'ComparisonFilter': _make_ComparisonFilter, + 'CompoundFilter': _make_CompoundFilter, + 'ComputerCallOutputItemParam': _make_ComputerCallOutputItemParam, + 'ComputerCallSafetyCheckParam': _make_ComputerCallSafetyCheckParam, + 'ComputerScreenshotContent': _make_ComputerScreenshotContent, + 'ComputerScreenshotImage': _make_ComputerScreenshotImage, + 'ComputerTool': _make_ComputerTool, + 'ComputerUsePreviewTool': _make_ComputerUsePreviewTool, + 'ContainerAutoParam': _make_ContainerAutoParam, + 'ContainerFileCitationBody': _make_ContainerFileCitationBody, + 'ContainerNetworkPolicyAllowlistParam': _make_ContainerNetworkPolicyAllowlistParam, + 'ContainerNetworkPolicyDisabledParam': _make_ContainerNetworkPolicyDisabledParam, + 'ContainerNetworkPolicyDomainSecretParam': _make_ContainerNetworkPolicyDomainSecretParam, + 'ContainerReferenceResource': _make_ContainerReferenceResource, + 'ContextManagementParam': _make_ContextManagementParam, + 'ConversationParam_2': _make_ConversationParam_2, + 'ConversationReference': _make_ConversationReference, + 'CoordParam': _make_CoordParam, + 'CreateResponse': _make_CreateResponse, + 'CustomGrammarFormatParam': _make_CustomGrammarFormatParam, + 'CustomTextFormatParam': _make_CustomTextFormatParam, + 'CustomToolCallOutputResource': _make_CustomToolCallOutputResource, + 'CustomToolCallResource': _make_CustomToolCallResource, + 'CustomToolParam': _make_CustomToolParam, + 'DeleteResponseResult': _make_DeleteResponseResult, + 'DirectToolCallCaller': _make_DirectToolCallCaller, + 'DirectToolCallCallerParam': _make_DirectToolCallCallerParam, + 'DoubleClickAction': _make_DoubleClickAction, + 'DragParam': _make_DragParam, + 'EmptyModelParam': _make_EmptyModelParam, + 'Error': _make_Error, + 'FabricDataAgentToolCall': _make_FabricDataAgentToolCall, + 'FabricDataAgentToolCallOutput': _make_FabricDataAgentToolCallOutput, + 'FabricDataAgentToolParameters': _make_FabricDataAgentToolParameters, + 'FileCitationBody': _make_FileCitationBody, + 'FilePath': _make_FilePath, + 'FileSearchTool': _make_FileSearchTool, + 'FileSearchToolCallResults': _make_FileSearchToolCallResults, + 'FunctionAndCustomToolCallOutputInputFileContent': _make_FunctionAndCustomToolCallOutputInputFileContent, + 'FunctionAndCustomToolCallOutputInputImageContent': _make_FunctionAndCustomToolCallOutputInputImageContent, + 'FunctionAndCustomToolCallOutputInputTextContent': _make_FunctionAndCustomToolCallOutputInputTextContent, + 'FunctionCallOutputItemParam': _make_FunctionCallOutputItemParam, + 'FunctionShellAction': _make_FunctionShellAction, + 'FunctionShellActionParam': _make_FunctionShellActionParam, + 'FunctionShellCallItemParam': _make_FunctionShellCallItemParam, + 'FunctionShellCallItemParamEnvironmentContainerReferenceParam': _make_FunctionShellCallItemParamEnvironmentContainerReferenceParam, + 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam': _make_FunctionShellCallItemParamEnvironmentLocalEnvironmentParam, + 'FunctionShellCallOutputContent': _make_FunctionShellCallOutputContent, + 'FunctionShellCallOutputContentParam': _make_FunctionShellCallOutputContentParam, + 'FunctionShellCallOutputExitOutcome': _make_FunctionShellCallOutputExitOutcome, + 'FunctionShellCallOutputExitOutcomeParam': _make_FunctionShellCallOutputExitOutcomeParam, + 'FunctionShellCallOutputItemParam': _make_FunctionShellCallOutputItemParam, + 'FunctionShellCallOutputTimeoutOutcome': _make_FunctionShellCallOutputTimeoutOutcome, + 'FunctionShellCallOutputTimeoutOutcomeParam': _make_FunctionShellCallOutputTimeoutOutcomeParam, + 'FunctionShellToolParam': _make_FunctionShellToolParam, + 'FunctionShellToolParamEnvironmentContainerReferenceParam': _make_FunctionShellToolParamEnvironmentContainerReferenceParam, + 'FunctionShellToolParamEnvironmentLocalEnvironmentParam': _make_FunctionShellToolParamEnvironmentLocalEnvironmentParam, + 'FunctionTool': _make_FunctionTool, + 'FunctionToolParam': _make_FunctionToolParam, + 'HybridSearchOptions': _make_HybridSearchOptions, + 'ImageGenTool': _make_ImageGenTool, + 'ImageGenToolInputImageMask': _make_ImageGenToolInputImageMask, + 'InlineSkillParam': _make_InlineSkillParam, + 'InlineSkillSourceParam': _make_InlineSkillSourceParam, + 'InputFileContent': _make_InputFileContent, + 'InputFileContentParam': _make_InputFileContentParam, + 'InputImageContent': _make_InputImageContent, + 'InputImageContentParamAutoParam': _make_InputImageContentParamAutoParam, + 'InputTextContent': _make_InputTextContent, + 'InputTextContentParam': _make_InputTextContentParam, + 'ItemCodeInterpreterToolCall': _make_ItemCodeInterpreterToolCall, + 'ItemComputerToolCall': _make_ItemComputerToolCall, + 'ItemCustomToolCall': _make_ItemCustomToolCall, + 'ItemCustomToolCallOutput': _make_ItemCustomToolCallOutput, + 'ItemFieldAdditionalTools': _make_ItemFieldAdditionalTools, + 'ItemFieldApplyPatchToolCall': _make_ItemFieldApplyPatchToolCall, + 'ItemFieldApplyPatchToolCallOutput': _make_ItemFieldApplyPatchToolCallOutput, + 'ItemFieldCodeInterpreterToolCall': _make_ItemFieldCodeInterpreterToolCall, + 'ItemFieldCompactionBody': _make_ItemFieldCompactionBody, + 'ItemFieldComputerToolCall': _make_ItemFieldComputerToolCall, + 'ItemFieldComputerToolCallOutput': _make_ItemFieldComputerToolCallOutput, + 'ItemFieldCustomToolCall': _make_ItemFieldCustomToolCall, + 'ItemFieldCustomToolCallOutput': _make_ItemFieldCustomToolCallOutput, + 'ItemFieldFileSearchToolCall': _make_ItemFieldFileSearchToolCall, + 'ItemFieldFunctionShellCall': _make_ItemFieldFunctionShellCall, + 'ItemFieldFunctionShellCallOutput': _make_ItemFieldFunctionShellCallOutput, + 'ItemFieldFunctionToolCall': _make_ItemFieldFunctionToolCall, + 'ItemFieldFunctionToolCallOutput': _make_ItemFieldFunctionToolCallOutput, + 'ItemFieldImageGenToolCall': _make_ItemFieldImageGenToolCall, + 'ItemFieldLocalShellToolCall': _make_ItemFieldLocalShellToolCall, + 'ItemFieldLocalShellToolCallOutput': _make_ItemFieldLocalShellToolCallOutput, + 'ItemFieldMcpApprovalRequest': _make_ItemFieldMcpApprovalRequest, + 'ItemFieldMcpApprovalResponseResource': _make_ItemFieldMcpApprovalResponseResource, + 'ItemFieldMcpListTools': _make_ItemFieldMcpListTools, + 'ItemFieldMcpToolCall': _make_ItemFieldMcpToolCall, + 'ItemFieldMessage': _make_ItemFieldMessage, + 'ItemFieldProgram': _make_ItemFieldProgram, + 'ItemFieldProgramOutput': _make_ItemFieldProgramOutput, + 'ItemFieldReasoningItem': _make_ItemFieldReasoningItem, + 'ItemFieldToolSearchCall': _make_ItemFieldToolSearchCall, + 'ItemFieldToolSearchOutput': _make_ItemFieldToolSearchOutput, + 'ItemFieldWebSearchToolCall': _make_ItemFieldWebSearchToolCall, + 'ItemFileSearchToolCall': _make_ItemFileSearchToolCall, + 'ItemFunctionToolCall': _make_ItemFunctionToolCall, + 'ItemImageGenToolCall': _make_ItemImageGenToolCall, + 'ItemLocalShellToolCall': _make_ItemLocalShellToolCall, + 'ItemLocalShellToolCallOutput': _make_ItemLocalShellToolCallOutput, + 'ItemMcpApprovalRequest': _make_ItemMcpApprovalRequest, + 'ItemMcpListTools': _make_ItemMcpListTools, + 'ItemMcpToolCall': _make_ItemMcpToolCall, + 'ItemMessage': _make_ItemMessage, + 'ItemOutputMessage': _make_ItemOutputMessage, + 'ItemProgram': _make_ItemProgram, + 'ItemProgramOutput': _make_ItemProgramOutput, + 'ItemReasoningItem': _make_ItemReasoningItem, + 'ItemReferenceParam': _make_ItemReferenceParam, + 'ItemWebSearchToolCall': _make_ItemWebSearchToolCall, + 'KeyPressAction': _make_KeyPressAction, + 'LocalEnvironmentResource': _make_LocalEnvironmentResource, + 'LocalShellExecAction': _make_LocalShellExecAction, + 'LocalShellToolParam': _make_LocalShellToolParam, + 'LocalSkillParam': _make_LocalSkillParam, + 'LogProb': _make_LogProb, + 'MCPApprovalResponse': _make_MCPApprovalResponse, + 'MCPListToolsTool': _make_MCPListToolsTool, + 'MCPListToolsToolAnnotations': _make_MCPListToolsToolAnnotations, + 'MCPListToolsToolInputSchema': _make_MCPListToolsToolInputSchema, + 'MCPTool': _make_MCPTool, + 'MCPToolFilter': _make_MCPToolFilter, + 'MCPToolRequireApproval': _make_MCPToolRequireApproval, + 'MemorySearchItem': _make_MemorySearchItem, + 'MemorySearchOptions': _make_MemorySearchOptions, + 'MemorySearchPreviewTool': _make_MemorySearchPreviewTool, + 'MemorySearchToolCallItemParam': _make_MemorySearchToolCallItemParam, + 'MemorySearchToolCallItemResource': _make_MemorySearchToolCallItemResource, + 'MessageContentInputFileContent': _make_MessageContentInputFileContent, + 'MessageContentInputImageContent': _make_MessageContentInputImageContent, + 'MessageContentInputTextContent': _make_MessageContentInputTextContent, + 'MessageContentOutputTextContent': _make_MessageContentOutputTextContent, + 'MessageContentReasoningTextContent': _make_MessageContentReasoningTextContent, + 'MessageContentRefusalContent': _make_MessageContentRefusalContent, + 'Metadata': _make_Metadata, + 'MicrosoftFabricPreviewTool': _make_MicrosoftFabricPreviewTool, + 'Moderation': _make_Moderation, + 'ModerationConfigParam': _make_ModerationConfigParam, + 'ModerationErrorBody': _make_ModerationErrorBody, + 'ModerationParam': _make_ModerationParam, + 'ModerationPolicyParam': _make_ModerationPolicyParam, + 'ModerationResultBody': _make_ModerationResultBody, + 'MoveParam': _make_MoveParam, + 'NamespaceToolParam': _make_NamespaceToolParam, + 'OAuthConsentRequestOutputItem': _make_OAuthConsentRequestOutputItem, + 'OpenApiAnonymousAuthDetails': _make_OpenApiAnonymousAuthDetails, + 'OpenApiFunctionDefinition': _make_OpenApiFunctionDefinition, + 'OpenApiFunctionDefinitionFunction': _make_OpenApiFunctionDefinitionFunction, + 'OpenApiManagedAuthDetails': _make_OpenApiManagedAuthDetails, + 'OpenApiManagedSecurityScheme': _make_OpenApiManagedSecurityScheme, + 'OpenApiProjectConnectionAuthDetails': _make_OpenApiProjectConnectionAuthDetails, + 'OpenApiProjectConnectionSecurityScheme': _make_OpenApiProjectConnectionSecurityScheme, + 'OpenApiTool': _make_OpenApiTool, + 'OpenApiToolCall': _make_OpenApiToolCall, + 'OpenApiToolCallOutput': _make_OpenApiToolCallOutput, + 'OutputContentOutputTextContent': _make_OutputContentOutputTextContent, + 'OutputContentReasoningTextContent': _make_OutputContentReasoningTextContent, + 'OutputContentRefusalContent': _make_OutputContentRefusalContent, + 'OutputItemAdditionalTools': _make_OutputItemAdditionalTools, + 'OutputItemApplyPatchToolCall': _make_OutputItemApplyPatchToolCall, + 'OutputItemApplyPatchToolCallOutput': _make_OutputItemApplyPatchToolCallOutput, + 'OutputItemCodeInterpreterToolCall': _make_OutputItemCodeInterpreterToolCall, + 'OutputItemCompactionBody': _make_OutputItemCompactionBody, + 'OutputItemComputerToolCall': _make_OutputItemComputerToolCall, + 'OutputItemComputerToolCallOutput': _make_OutputItemComputerToolCallOutput, + 'OutputItemFileSearchToolCall': _make_OutputItemFileSearchToolCall, + 'OutputItemFunctionShellCall': _make_OutputItemFunctionShellCall, + 'OutputItemFunctionShellCallOutput': _make_OutputItemFunctionShellCallOutput, + 'OutputItemFunctionToolCall': _make_OutputItemFunctionToolCall, + 'OutputItemFunctionToolCallOutput': _make_OutputItemFunctionToolCallOutput, + 'OutputItemImageGenToolCall': _make_OutputItemImageGenToolCall, + 'OutputItemLocalShellToolCall': _make_OutputItemLocalShellToolCall, + 'OutputItemLocalShellToolCallOutput': _make_OutputItemLocalShellToolCallOutput, + 'OutputItemMcpApprovalRequest': _make_OutputItemMcpApprovalRequest, + 'OutputItemMcpApprovalResponseResource': _make_OutputItemMcpApprovalResponseResource, + 'OutputItemMcpListTools': _make_OutputItemMcpListTools, + 'OutputItemMcpToolCall': _make_OutputItemMcpToolCall, + 'OutputItemMessage': _make_OutputItemMessage, + 'OutputItemOutputMessage': _make_OutputItemOutputMessage, + 'OutputItemProgram': _make_OutputItemProgram, + 'OutputItemProgramOutput': _make_OutputItemProgramOutput, + 'OutputItemReasoningItem': _make_OutputItemReasoningItem, + 'OutputItemToolSearchCall': _make_OutputItemToolSearchCall, + 'OutputItemToolSearchOutput': _make_OutputItemToolSearchOutput, + 'OutputItemWebSearchToolCall': _make_OutputItemWebSearchToolCall, + 'OutputMessageContentOutputTextContent': _make_OutputMessageContentOutputTextContent, + 'OutputMessageContentRefusalContent': _make_OutputMessageContentRefusalContent, + 'ProgrammaticToolCallingParam': _make_ProgrammaticToolCallingParam, + 'ProgramToolCallCaller': _make_ProgramToolCallCaller, + 'ProgramToolCallCallerParam': _make_ProgramToolCallCallerParam, + 'Prompt': _make_Prompt, + 'PromptCacheBreakpointConfig': _make_PromptCacheBreakpointConfig, + 'PromptCacheBreakpointParam': _make_PromptCacheBreakpointParam, + 'PromptCacheOptions': _make_PromptCacheOptions, + 'PromptCacheOptionsParam': _make_PromptCacheOptionsParam, + 'RankingOptions': _make_RankingOptions, + 'RealtimeMCPHTTPError': _make_RealtimeMCPHTTPError, + 'RealtimeMCPProtocolError': _make_RealtimeMCPProtocolError, + 'RealtimeMCPToolExecutionError': _make_RealtimeMCPToolExecutionError, + 'Reasoning': _make_Reasoning, + 'ReasoningTextContent': _make_ReasoningTextContent, + 'ResponseAudioDeltaEvent': _make_ResponseAudioDeltaEvent, + 'ResponseAudioDoneEvent': _make_ResponseAudioDoneEvent, + 'ResponseAudioTranscriptDeltaEvent': _make_ResponseAudioTranscriptDeltaEvent, + 'ResponseAudioTranscriptDoneEvent': _make_ResponseAudioTranscriptDoneEvent, + 'ResponseCodeInterpreterCallCodeDeltaEvent': _make_ResponseCodeInterpreterCallCodeDeltaEvent, + 'ResponseCodeInterpreterCallCodeDoneEvent': _make_ResponseCodeInterpreterCallCodeDoneEvent, + 'ResponseCodeInterpreterCallCompletedEvent': _make_ResponseCodeInterpreterCallCompletedEvent, + 'ResponseCodeInterpreterCallInProgressEvent': _make_ResponseCodeInterpreterCallInProgressEvent, + 'ResponseCodeInterpreterCallInterpretingEvent': _make_ResponseCodeInterpreterCallInterpretingEvent, + 'ResponseCompletedEvent': _make_ResponseCompletedEvent, + 'ResponseContentPartAddedEvent': _make_ResponseContentPartAddedEvent, + 'ResponseContentPartDoneEvent': _make_ResponseContentPartDoneEvent, + 'ResponseCreatedEvent': _make_ResponseCreatedEvent, + 'ResponseCustomToolCallInputDeltaEvent': _make_ResponseCustomToolCallInputDeltaEvent, + 'ResponseCustomToolCallInputDoneEvent': _make_ResponseCustomToolCallInputDoneEvent, + 'ResponseErrorEvent': _make_ResponseErrorEvent, + 'ResponseErrorInfo': _make_ResponseErrorInfo, + 'ResponseFailedEvent': _make_ResponseFailedEvent, + 'ResponseFileSearchCallCompletedEvent': _make_ResponseFileSearchCallCompletedEvent, + 'ResponseFileSearchCallInProgressEvent': _make_ResponseFileSearchCallInProgressEvent, + 'ResponseFileSearchCallSearchingEvent': _make_ResponseFileSearchCallSearchingEvent, + 'ResponseFormatJsonSchemaSchema': _make_ResponseFormatJsonSchemaSchema, + 'ResponseFunctionCallArgumentsDeltaEvent': _make_ResponseFunctionCallArgumentsDeltaEvent, + 'ResponseFunctionCallArgumentsDoneEvent': _make_ResponseFunctionCallArgumentsDoneEvent, + 'ResponseImageGenCallCompletedEvent': _make_ResponseImageGenCallCompletedEvent, + 'ResponseImageGenCallGeneratingEvent': _make_ResponseImageGenCallGeneratingEvent, + 'ResponseImageGenCallInProgressEvent': _make_ResponseImageGenCallInProgressEvent, + 'ResponseImageGenCallPartialImageEvent': _make_ResponseImageGenCallPartialImageEvent, + 'ResponseIncompleteDetails': _make_ResponseIncompleteDetails, + 'ResponseIncompleteEvent': _make_ResponseIncompleteEvent, + 'ResponseInProgressEvent': _make_ResponseInProgressEvent, + 'ResponseLogProb': _make_ResponseLogProb, + 'ResponseLogProbTopLogprobs': _make_ResponseLogProbTopLogprobs, + 'ResponseMCPCallArgumentsDeltaEvent': _make_ResponseMCPCallArgumentsDeltaEvent, + 'ResponseMCPCallArgumentsDoneEvent': _make_ResponseMCPCallArgumentsDoneEvent, + 'ResponseMCPCallCompletedEvent': _make_ResponseMCPCallCompletedEvent, + 'ResponseMCPCallFailedEvent': _make_ResponseMCPCallFailedEvent, + 'ResponseMCPCallInProgressEvent': _make_ResponseMCPCallInProgressEvent, + 'ResponseMCPListToolsCompletedEvent': _make_ResponseMCPListToolsCompletedEvent, + 'ResponseMCPListToolsFailedEvent': _make_ResponseMCPListToolsFailedEvent, + 'ResponseMCPListToolsInProgressEvent': _make_ResponseMCPListToolsInProgressEvent, + 'ResponseObject': _make_ResponseObject, + 'ResponseOutputItemAddedEvent': _make_ResponseOutputItemAddedEvent, + 'ResponseOutputItemDoneEvent': _make_ResponseOutputItemDoneEvent, + 'ResponseOutputTextAnnotationAddedEvent': _make_ResponseOutputTextAnnotationAddedEvent, + 'ResponsePromptVariables': _make_ResponsePromptVariables, + 'ResponseQueuedEvent': _make_ResponseQueuedEvent, + 'ResponseReasoningSummaryPartAddedEvent': _make_ResponseReasoningSummaryPartAddedEvent, + 'ResponseReasoningSummaryPartAddedEventPart': _make_ResponseReasoningSummaryPartAddedEventPart, + 'ResponseReasoningSummaryPartDoneEvent': _make_ResponseReasoningSummaryPartDoneEvent, + 'ResponseReasoningSummaryPartDoneEventPart': _make_ResponseReasoningSummaryPartDoneEventPart, + 'ResponseReasoningSummaryTextDeltaEvent': _make_ResponseReasoningSummaryTextDeltaEvent, + 'ResponseReasoningSummaryTextDoneEvent': _make_ResponseReasoningSummaryTextDoneEvent, + 'ResponseReasoningTextDeltaEvent': _make_ResponseReasoningTextDeltaEvent, + 'ResponseReasoningTextDoneEvent': _make_ResponseReasoningTextDoneEvent, + 'ResponseRefusalDeltaEvent': _make_ResponseRefusalDeltaEvent, + 'ResponseRefusalDoneEvent': _make_ResponseRefusalDoneEvent, + 'ResponseStreamOptions': _make_ResponseStreamOptions, + 'ResponseTextDeltaEvent': _make_ResponseTextDeltaEvent, + 'ResponseTextDoneEvent': _make_ResponseTextDoneEvent, + 'ResponseTextParam': _make_ResponseTextParam, + 'ResponseUsage': _make_ResponseUsage, + 'ResponseUsageInputTokensDetails': _make_ResponseUsageInputTokensDetails, + 'ResponseUsageOutputTokensDetails': _make_ResponseUsageOutputTokensDetails, + 'ResponseWebSearchCallCompletedEvent': _make_ResponseWebSearchCallCompletedEvent, + 'ResponseWebSearchCallInProgressEvent': _make_ResponseWebSearchCallInProgressEvent, + 'ResponseWebSearchCallSearchingEvent': _make_ResponseWebSearchCallSearchingEvent, + 'ScreenshotParam': _make_ScreenshotParam, + 'ScrollParam': _make_ScrollParam, + 'SharepointGroundingToolCall': _make_SharepointGroundingToolCall, + 'SharepointGroundingToolCallOutput': _make_SharepointGroundingToolCallOutput, + 'SharepointGroundingToolParameters': _make_SharepointGroundingToolParameters, + 'SharepointPreviewTool': _make_SharepointPreviewTool, + 'SkillReferenceParam': _make_SkillReferenceParam, + 'SpecificApplyPatchParam': _make_SpecificApplyPatchParam, + 'SpecificFunctionShellParam': _make_SpecificFunctionShellParam, + 'SpecificProgrammaticToolCallingParam': _make_SpecificProgrammaticToolCallingParam, + 'StructuredOutputDefinition': _make_StructuredOutputDefinition, + 'StructuredOutputsOutputItem': _make_StructuredOutputsOutputItem, + 'SummaryTextContent': _make_SummaryTextContent, + 'TextContent': _make_TextContent, + 'TextResponseFormatConfigurationResponseFormatJsonObject': _make_TextResponseFormatConfigurationResponseFormatJsonObject, + 'TextResponseFormatConfigurationResponseFormatText': _make_TextResponseFormatConfigurationResponseFormatText, + 'TextResponseFormatJsonSchema': _make_TextResponseFormatJsonSchema, + 'ToolChoiceAllowed': _make_ToolChoiceAllowed, + 'ToolChoiceCodeInterpreter': _make_ToolChoiceCodeInterpreter, + 'ToolChoiceComputer': _make_ToolChoiceComputer, + 'ToolChoiceComputerUse': _make_ToolChoiceComputerUse, + 'ToolChoiceComputerUsePreview': _make_ToolChoiceComputerUsePreview, + 'ToolChoiceCustom': _make_ToolChoiceCustom, + 'ToolChoiceFileSearch': _make_ToolChoiceFileSearch, + 'ToolChoiceFunction': _make_ToolChoiceFunction, + 'ToolChoiceImageGeneration': _make_ToolChoiceImageGeneration, + 'ToolChoiceMCP': _make_ToolChoiceMCP, + 'ToolChoiceWebSearchPreview': _make_ToolChoiceWebSearchPreview, + 'ToolChoiceWebSearchPreview20250311': _make_ToolChoiceWebSearchPreview20250311, + 'ToolProjectConnection': _make_ToolProjectConnection, + 'ToolSearchCallItemParam': _make_ToolSearchCallItemParam, + 'ToolSearchOutputItemParam': _make_ToolSearchOutputItemParam, + 'ToolSearchToolParam': _make_ToolSearchToolParam, + 'TopLogProb': _make_TopLogProb, + 'TypeParam': _make_TypeParam, + 'UrlCitationBody': _make_UrlCitationBody, + 'UserProfileMemoryItem': _make_UserProfileMemoryItem, + 'VectorStoreFileAttributes': _make_VectorStoreFileAttributes, + 'WaitParam': _make_WaitParam, + 'WebSearchActionFind': _make_WebSearchActionFind, + 'WebSearchActionOpenPage': _make_WebSearchActionOpenPage, + 'WebSearchActionSearch': _make_WebSearchActionSearch, + 'WebSearchActionSearchSources': _make_WebSearchActionSearchSources, + 'WebSearchApproximateLocation': _make_WebSearchApproximateLocation, + 'WebSearchConfiguration': _make_WebSearchConfiguration, + 'WebSearchPreviewTool': _make_WebSearchPreviewTool, + 'WebSearchTool': _make_WebSearchTool, + 'WebSearchToolFilters': _make_WebSearchToolFilters, + 'WorkflowActionOutputItem': _make_WorkflowActionOutputItem, + 'WorkIQPreviewTool': _make_WorkIQPreviewTool, + 'WorkIQPreviewToolParameters': _make_WorkIQPreviewToolParameters, + 'CompactResponseMethodPublicBody': _make_CompactResponseMethodPublicBody, + 'Tool': _make_Tool, + 'OutputItem': _make_OutputItem, + 'Item': _make_Item, + 'Annotation': _make_Annotation, + 'ApplyPatchFileOperation': _make_ApplyPatchFileOperation, + 'ApplyPatchOperationParam': _make_ApplyPatchOperationParam, + 'MemoryItem': _make_MemoryItem, + 'ComputerAction': _make_ComputerAction, + 'MessageContent': _make_MessageContent, + 'FunctionShellToolParamEnvironment': _make_FunctionShellToolParamEnvironment, + 'ContainerNetworkPolicyParam': _make_ContainerNetworkPolicyParam, + 'FunctionShellCallEnvironment': _make_FunctionShellCallEnvironment, + 'ContainerSkill': _make_ContainerSkill, + 'CustomToolParamFormat': _make_CustomToolParamFormat, + 'ToolCallCaller': _make_ToolCallCaller, + 'ToolCallCallerParam': _make_ToolCallCallerParam, + 'FunctionAndCustomToolCallOutput': _make_FunctionAndCustomToolCallOutput, + 'FunctionShellCallItemParamEnvironment': _make_FunctionShellCallItemParamEnvironment, + 'FunctionShellCallOutputOutcome': _make_FunctionShellCallOutputOutcome, + 'FunctionShellCallOutputOutcomeParam': _make_FunctionShellCallOutputOutcomeParam, + 'ItemField': _make_ItemField, + 'ModerationEntry': _make_ModerationEntry, + 'OpenApiAuthDetails': _make_OpenApiAuthDetails, + 'OutputContent': _make_OutputContent, + 'OutputMessageContent': _make_OutputMessageContent, + 'RealtimeMCPError': _make_RealtimeMCPError, + 'ResponseStreamEvent': _make_ResponseStreamEvent, + 'ToolChoiceParam': _make_ToolChoiceParam, + 'TextResponseFormatConfiguration': _make_TextResponseFormatConfiguration, + } + __all__ = ['Any', 'Literal', 'Optional', 'TYPE_CHECKING', 'Union', 'Required', 'TypedDict', 'AnnotationType', 'ApplyPatchCallOutputStatus', 'ApplyPatchCallOutputStatusParam', 'ApplyPatchCallStatus', 'ApplyPatchCallStatusParam', 'ApplyPatchFileOperationType', 'ApplyPatchOperationParamType', 'AzureAISearchQueryType', 'CallableToolAllowedCaller', 'ClickButtonType', 'ComputerActionType', 'ComputerEnvironment', 'ContainerMemoryLimit', 'ContainerNetworkPolicyParamType', 'ContainerSkillType', 'CustomToolParamFormatType', 'DetailEnum', 'FileInputDetail', 'FunctionAndCustomToolCallOutputType', 'FunctionCallItemStatus', 'FunctionCallOutputStatusEnum', 'FunctionCallStatus', 'FunctionShellCallEnvironmentType', 'FunctionShellCallItemParamEnvironmentType', 'FunctionShellCallItemStatus', 'FunctionShellCallOutputOutcomeParamType', 'FunctionShellCallOutputOutcomeType', 'FunctionShellCallOutputStatusEnum', 'FunctionShellCallStatus', 'FunctionShellToolParamEnvironmentType', 'GrammarSyntax1', 'ImageDetail', 'ImageGenActionEnum', 'IncludeEnum', 'InputFidelity', 'ItemFieldType', 'ItemType', 'MCPToolCallStatus', 'MemoryItemKind', 'MessageContentType', 'MessagePhase', 'MessageRole', 'MessageStatus', 'ModelIdsCompaction', 'ModerationEntryType', 'ModerationInputType', 'ModerationMode', 'OpenApiAuthType', 'OutputContentType', 'OutputItemType', 'OutputMessageContentType', 'PageOrder', 'ProgramOutputStatus', 'PromptCacheModeEnum', 'PromptCacheRetentionEnum', 'PromptCacheTTLEnum', 'RankerVersionType', 'RealtimeMcpErrorType', 'ReasoningEffort', 'ReasoningModeEnum', 'ResponseErrorCode', 'ResponseStreamEventType', 'SearchContentType', 'SearchContextSize', 'ServiceTierEnum', 'TextResponseFormatConfigurationType', 'ToolCallCallerParamType', 'ToolCallCallerType', 'ToolCallStatus', 'ToolChoiceOptions', 'ToolChoiceParamType', 'ToolSearchExecutionType', 'ToolType', 'A2APreviewTool', 'A2AToolCall', 'A2AToolCallOutput', 'AdditionalToolsItemParam', 'AgentReference', 'AISearchIndexResource', 'ApiErrorResponse', 'ApplyPatchCreateFileOperation', 'ApplyPatchCreateFileOperationParam', 'ApplyPatchDeleteFileOperation', 'ApplyPatchDeleteFileOperationParam', 'ApplyPatchToolCallItemParam', 'ApplyPatchToolCallOutputItemParam', 'ApplyPatchToolParam', 'ApplyPatchUpdateFileOperation', 'ApplyPatchUpdateFileOperationParam', 'ApproximateLocation', 'AutoCodeInterpreterToolParam', 'AzureAISearchTool', 'AzureAISearchToolCall', 'AzureAISearchToolCallOutput', 'AzureAISearchToolResource', 'AzureFunctionBinding', 'AzureFunctionDefinition', 'AzureFunctionDefinitionFunction', 'AzureFunctionStorageQueue', 'AzureFunctionTool', 'AzureFunctionToolCall', 'AzureFunctionToolCallOutput', 'BingCustomSearchConfiguration', 'BingCustomSearchPreviewTool', 'BingCustomSearchToolCall', 'BingCustomSearchToolCallOutput', 'BingCustomSearchToolParameters', 'BingGroundingSearchConfiguration', 'BingGroundingSearchToolParameters', 'BingGroundingTool', 'BingGroundingToolCall', 'BingGroundingToolCallOutput', 'BrowserAutomationPreviewTool', 'BrowserAutomationToolCall', 'BrowserAutomationToolCallOutput', 'BrowserAutomationToolConnectionParameters', 'BrowserAutomationToolParameters', 'CaptureStructuredOutputsTool', 'ChatSummaryMemoryItem', 'ClickParam', 'CodeInterpreterOutputImage', 'CodeInterpreterOutputLogs', 'CodeInterpreterTool', 'CompactionSummaryItemParam', 'CompactResource', 'ComparisonFilter', 'CompoundFilter', 'ComputerCallOutputItemParam', 'ComputerCallSafetyCheckParam', 'ComputerScreenshotContent', 'ComputerScreenshotImage', 'ComputerTool', 'ComputerUsePreviewTool', 'ContainerAutoParam', 'ContainerFileCitationBody', 'ContainerNetworkPolicyAllowlistParam', 'ContainerNetworkPolicyDisabledParam', 'ContainerNetworkPolicyDomainSecretParam', 'ContainerReferenceResource', 'ContextManagementParam', 'ConversationParam_2', 'ConversationReference', 'CoordParam', 'CreateResponse', 'CustomGrammarFormatParam', 'CustomTextFormatParam', 'CustomToolCallOutputResource', 'CustomToolCallResource', 'CustomToolParam', 'DeleteResponseResult', 'DirectToolCallCaller', 'DirectToolCallCallerParam', 'DoubleClickAction', 'DragParam', 'EmptyModelParam', 'Error', 'FabricDataAgentToolCall', 'FabricDataAgentToolCallOutput', 'FabricDataAgentToolParameters', 'FileCitationBody', 'FilePath', 'FileSearchTool', 'FileSearchToolCallResults', 'FunctionAndCustomToolCallOutputInputFileContent', 'FunctionAndCustomToolCallOutputInputImageContent', 'FunctionAndCustomToolCallOutputInputTextContent', 'FunctionCallOutputItemParam', 'FunctionShellAction', 'FunctionShellActionParam', 'FunctionShellCallItemParam', 'FunctionShellCallItemParamEnvironmentContainerReferenceParam', 'FunctionShellCallItemParamEnvironmentLocalEnvironmentParam', 'FunctionShellCallOutputContent', 'FunctionShellCallOutputContentParam', 'FunctionShellCallOutputExitOutcome', 'FunctionShellCallOutputExitOutcomeParam', 'FunctionShellCallOutputItemParam', 'FunctionShellCallOutputTimeoutOutcome', 'FunctionShellCallOutputTimeoutOutcomeParam', 'FunctionShellToolParam', 'FunctionShellToolParamEnvironmentContainerReferenceParam', 'FunctionShellToolParamEnvironmentLocalEnvironmentParam', 'FunctionTool', 'FunctionToolParam', 'HybridSearchOptions', 'ImageGenTool', 'ImageGenToolInputImageMask', 'InlineSkillParam', 'InlineSkillSourceParam', 'InputFileContent', 'InputFileContentParam', 'InputImageContent', 'InputImageContentParamAutoParam', 'InputTextContent', 'InputTextContentParam', 'ItemCodeInterpreterToolCall', 'ItemComputerToolCall', 'ItemCustomToolCall', 'ItemCustomToolCallOutput', 'ItemFieldAdditionalTools', 'ItemFieldApplyPatchToolCall', 'ItemFieldApplyPatchToolCallOutput', 'ItemFieldCodeInterpreterToolCall', 'ItemFieldCompactionBody', 'ItemFieldComputerToolCall', 'ItemFieldComputerToolCallOutput', 'ItemFieldCustomToolCall', 'ItemFieldCustomToolCallOutput', 'ItemFieldFileSearchToolCall', 'ItemFieldFunctionShellCall', 'ItemFieldFunctionShellCallOutput', 'ItemFieldFunctionToolCall', 'ItemFieldFunctionToolCallOutput', 'ItemFieldImageGenToolCall', 'ItemFieldLocalShellToolCall', 'ItemFieldLocalShellToolCallOutput', 'ItemFieldMcpApprovalRequest', 'ItemFieldMcpApprovalResponseResource', 'ItemFieldMcpListTools', 'ItemFieldMcpToolCall', 'ItemFieldMessage', 'ItemFieldProgram', 'ItemFieldProgramOutput', 'ItemFieldReasoningItem', 'ItemFieldToolSearchCall', 'ItemFieldToolSearchOutput', 'ItemFieldWebSearchToolCall', 'ItemFileSearchToolCall', 'ItemFunctionToolCall', 'ItemImageGenToolCall', 'ItemLocalShellToolCall', 'ItemLocalShellToolCallOutput', 'ItemMcpApprovalRequest', 'ItemMcpListTools', 'ItemMcpToolCall', 'ItemMessage', 'ItemOutputMessage', 'ItemProgram', 'ItemProgramOutput', 'ItemReasoningItem', 'ItemReferenceParam', 'ItemWebSearchToolCall', 'KeyPressAction', 'LocalEnvironmentResource', 'LocalShellExecAction', 'LocalShellToolParam', 'LocalSkillParam', 'LogProb', 'MCPApprovalResponse', 'MCPListToolsTool', 'MCPListToolsToolAnnotations', 'MCPListToolsToolInputSchema', 'MCPTool', 'MCPToolFilter', 'MCPToolRequireApproval', 'MemorySearchItem', 'MemorySearchOptions', 'MemorySearchPreviewTool', 'MemorySearchToolCallItemParam', 'MemorySearchToolCallItemResource', 'MessageContentInputFileContent', 'MessageContentInputImageContent', 'MessageContentInputTextContent', 'MessageContentOutputTextContent', 'MessageContentReasoningTextContent', 'MessageContentRefusalContent', 'Metadata', 'MicrosoftFabricPreviewTool', 'Moderation', 'ModerationConfigParam', 'ModerationErrorBody', 'ModerationParam', 'ModerationPolicyParam', 'ModerationResultBody', 'MoveParam', 'NamespaceToolParam', 'OAuthConsentRequestOutputItem', 'OpenApiAnonymousAuthDetails', 'OpenApiFunctionDefinition', 'OpenApiFunctionDefinitionFunction', 'OpenApiManagedAuthDetails', 'OpenApiManagedSecurityScheme', 'OpenApiProjectConnectionAuthDetails', 'OpenApiProjectConnectionSecurityScheme', 'OpenApiTool', 'OpenApiToolCall', 'OpenApiToolCallOutput', 'OutputContentOutputTextContent', 'OutputContentReasoningTextContent', 'OutputContentRefusalContent', 'OutputItemAdditionalTools', 'OutputItemApplyPatchToolCall', 'OutputItemApplyPatchToolCallOutput', 'OutputItemCodeInterpreterToolCall', 'OutputItemCompactionBody', 'OutputItemComputerToolCall', 'OutputItemComputerToolCallOutput', 'OutputItemFileSearchToolCall', 'OutputItemFunctionShellCall', 'OutputItemFunctionShellCallOutput', 'OutputItemFunctionToolCall', 'OutputItemFunctionToolCallOutput', 'OutputItemImageGenToolCall', 'OutputItemLocalShellToolCall', 'OutputItemLocalShellToolCallOutput', 'OutputItemMcpApprovalRequest', 'OutputItemMcpApprovalResponseResource', 'OutputItemMcpListTools', 'OutputItemMcpToolCall', 'OutputItemMessage', 'OutputItemOutputMessage', 'OutputItemProgram', 'OutputItemProgramOutput', 'OutputItemReasoningItem', 'OutputItemToolSearchCall', 'OutputItemToolSearchOutput', 'OutputItemWebSearchToolCall', 'OutputMessageContentOutputTextContent', 'OutputMessageContentRefusalContent', 'ProgrammaticToolCallingParam', 'ProgramToolCallCaller', 'ProgramToolCallCallerParam', 'Prompt', 'PromptCacheBreakpointConfig', 'PromptCacheBreakpointParam', 'PromptCacheOptions', 'PromptCacheOptionsParam', 'RankingOptions', 'RealtimeMCPHTTPError', 'RealtimeMCPProtocolError', 'RealtimeMCPToolExecutionError', 'Reasoning', 'ReasoningTextContent', 'ResponseAudioDeltaEvent', 'ResponseAudioDoneEvent', 'ResponseAudioTranscriptDeltaEvent', 'ResponseAudioTranscriptDoneEvent', 'ResponseCodeInterpreterCallCodeDeltaEvent', 'ResponseCodeInterpreterCallCodeDoneEvent', 'ResponseCodeInterpreterCallCompletedEvent', 'ResponseCodeInterpreterCallInProgressEvent', 'ResponseCodeInterpreterCallInterpretingEvent', 'ResponseCompletedEvent', 'ResponseContentPartAddedEvent', 'ResponseContentPartDoneEvent', 'ResponseCreatedEvent', 'ResponseCustomToolCallInputDeltaEvent', 'ResponseCustomToolCallInputDoneEvent', 'ResponseErrorEvent', 'ResponseErrorInfo', 'ResponseFailedEvent', 'ResponseFileSearchCallCompletedEvent', 'ResponseFileSearchCallInProgressEvent', 'ResponseFileSearchCallSearchingEvent', 'ResponseFormatJsonSchemaSchema', 'ResponseFunctionCallArgumentsDeltaEvent', 'ResponseFunctionCallArgumentsDoneEvent', 'ResponseImageGenCallCompletedEvent', 'ResponseImageGenCallGeneratingEvent', 'ResponseImageGenCallInProgressEvent', 'ResponseImageGenCallPartialImageEvent', 'ResponseIncompleteDetails', 'ResponseIncompleteEvent', 'ResponseInProgressEvent', 'ResponseLogProb', 'ResponseLogProbTopLogprobs', 'ResponseMCPCallArgumentsDeltaEvent', 'ResponseMCPCallArgumentsDoneEvent', 'ResponseMCPCallCompletedEvent', 'ResponseMCPCallFailedEvent', 'ResponseMCPCallInProgressEvent', 'ResponseMCPListToolsCompletedEvent', 'ResponseMCPListToolsFailedEvent', 'ResponseMCPListToolsInProgressEvent', 'ResponseObject', 'ResponseOutputItemAddedEvent', 'ResponseOutputItemDoneEvent', 'ResponseOutputTextAnnotationAddedEvent', 'ResponsePromptVariables', 'ResponseQueuedEvent', 'ResponseReasoningSummaryPartAddedEvent', 'ResponseReasoningSummaryPartAddedEventPart', 'ResponseReasoningSummaryPartDoneEvent', 'ResponseReasoningSummaryPartDoneEventPart', 'ResponseReasoningSummaryTextDeltaEvent', 'ResponseReasoningSummaryTextDoneEvent', 'ResponseReasoningTextDeltaEvent', 'ResponseReasoningTextDoneEvent', 'ResponseRefusalDeltaEvent', 'ResponseRefusalDoneEvent', 'ResponseStreamOptions', 'ResponseTextDeltaEvent', 'ResponseTextDoneEvent', 'ResponseTextParam', 'ResponseUsage', 'ResponseUsageInputTokensDetails', 'ResponseUsageOutputTokensDetails', 'ResponseWebSearchCallCompletedEvent', 'ResponseWebSearchCallInProgressEvent', 'ResponseWebSearchCallSearchingEvent', 'ScreenshotParam', 'ScrollParam', 'SharepointGroundingToolCall', 'SharepointGroundingToolCallOutput', 'SharepointGroundingToolParameters', 'SharepointPreviewTool', 'SkillReferenceParam', 'SpecificApplyPatchParam', 'SpecificFunctionShellParam', 'SpecificProgrammaticToolCallingParam', 'StructuredOutputDefinition', 'StructuredOutputsOutputItem', 'SummaryTextContent', 'TextContent', 'TextResponseFormatConfigurationResponseFormatJsonObject', 'TextResponseFormatConfigurationResponseFormatText', 'TextResponseFormatJsonSchema', 'ToolChoiceAllowed', 'ToolChoiceCodeInterpreter', 'ToolChoiceComputer', 'ToolChoiceComputerUse', 'ToolChoiceComputerUsePreview', 'ToolChoiceCustom', 'ToolChoiceFileSearch', 'ToolChoiceFunction', 'ToolChoiceImageGeneration', 'ToolChoiceMCP', 'ToolChoiceWebSearchPreview', 'ToolChoiceWebSearchPreview20250311', 'ToolProjectConnection', 'ToolSearchCallItemParam', 'ToolSearchOutputItemParam', 'ToolSearchToolParam', 'TopLogProb', 'TypeParam', 'UrlCitationBody', 'UserProfileMemoryItem', 'VectorStoreFileAttributes', 'WaitParam', 'WebSearchActionFind', 'WebSearchActionOpenPage', 'WebSearchActionSearch', 'WebSearchActionSearchSources', 'WebSearchApproximateLocation', 'WebSearchConfiguration', 'WebSearchPreviewTool', 'WebSearchTool', 'WebSearchToolFilters', 'WorkflowActionOutputItem', 'WorkIQPreviewTool', 'WorkIQPreviewToolParameters', 'CompactResponseMethodPublicBody', 'Tool', 'OutputItem', 'Item', 'Annotation', 'ApplyPatchFileOperation', 'ApplyPatchOperationParam', 'MemoryItem', 'ComputerAction', 'MessageContent', 'FunctionShellToolParamEnvironment', 'ContainerNetworkPolicyParam', 'FunctionShellCallEnvironment', 'ContainerSkill', 'CustomToolParamFormat', 'ToolCallCaller', 'ToolCallCallerParam', 'FunctionAndCustomToolCallOutput', 'FunctionShellCallItemParamEnvironment', 'FunctionShellCallOutputOutcome', 'FunctionShellCallOutputOutcomeParam', 'ItemField', 'ModerationEntry', 'OpenApiAuthDetails', 'OutputContent', 'OutputMessageContent', 'RealtimeMCPError', 'ResponseStreamEvent', 'ToolChoiceParam', 'TextResponseFormatConfiguration'] + + def _resolve(name): + return _load_model(name, globals(), _FACTORIES, __name__) + + def __getattr__(name): + return _resolve(name) + + def __dir__(): + return sorted(set(globals()) | set(__all__)) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_helpers.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_helpers.py index b6a9385b4f8a..7bb9e48a29a8 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_helpers.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_helpers.py @@ -8,25 +8,17 @@ from ._wire import get_field as _get_field from ._wire import is_type as _is_wire_type -from ._generated import ( - ConversationParam_2, - CreateResponse, - Item, - ItemMessage, - MessageContent, - MessageContentInputTextContent, - OutputItem, - ResponseObject, -) +from . import _generated as _generated_models + -def _is_type(obj: Any, _model_cls: type, type_value: str) -> bool: +def _is_type(obj: Any, _model_cls: object, type_value: str) -> bool: """Check whether *obj* has a matching wire ``type`` discriminator. :param obj: The object to check. :type obj: Any - :param _model_cls: Retained for call-site readability; ignored at runtime. - :type _model_cls: type + :param _model_cls: Retained as a type or qualified name for readability; ignored at runtime. + :type _model_cls: object :param type_value: The string type discriminator to match in dicts. :type type_value: str :returns: True if *obj* matches the wire type value. @@ -68,7 +60,7 @@ def _ensure_item_type(data: dict[str, Any]) -> dict[str, Any]: # --------------------------------------------------------------------------- -def get_conversation_id(request: CreateResponse | ResponseObject) -> Optional[str]: +def get_conversation_id(request: _generated_models.CreateResponse | _generated_models.ResponseObject) -> Optional[str]: """Extract conversation ID from a request or response's ``conversation`` field. If conversation is a plain string, returns it directly. @@ -89,7 +81,7 @@ def get_conversation_id(request: CreateResponse | ResponseObject) -> Optional[st return str(cid) if cid else None -def get_input_expanded(request: CreateResponse) -> list[Item]: +def get_input_expanded(request: _generated_models.CreateResponse) -> list[_generated_models.Item]: """Normalize ``CreateResponse.input`` into a list of :class:`Item`. - If input is ``None``, returns ``[]``. @@ -109,7 +101,7 @@ def get_input_expanded(request: CreateResponse) -> list[Item]: if isinstance(inp, str): return [ cast( - Item, + "_generated_models.Item", { "type": "message", "role": "user", @@ -119,22 +111,24 @@ def get_input_expanded(request: CreateResponse) -> list[Item]: ] # Normalize items: per the OpenAI spec, items without an explicit # ``type`` default to ``"message"`` (C-MSG-01 compliance). - items: list[Item] = [] + items: list[_generated_models.Item] = [] for raw in inp: if isinstance(raw, dict): item_dict = _ensure_item_type(dict(raw)) # Auto-expand string content on message items so downstream consumers # always see list[MessageContent] (matches .NET ExpandContent behaviour). - if _is_type(item_dict, ItemMessage, "message") and isinstance(_get_field(item_dict, "content"), str): - item_dict["content"] = get_content_expanded(cast(ItemMessage, item_dict)) - items.append(cast(Item, item_dict)) + if _is_type(item_dict, "_generated_models.ItemMessage", "message") and isinstance( + _get_field(item_dict, "content"), str + ): + item_dict["content"] = get_content_expanded(cast("_generated_models.ItemMessage", item_dict)) + items.append(cast("_generated_models.Item", item_dict)) else: items.append(raw) return items -def _get_input_text(request: CreateResponse) -> str: +def _get_input_text(request: _generated_models.CreateResponse) -> str: """Extract all text content from ``CreateResponse.input`` as a single string. Internal helper — callers should use :meth:`ResponseContext.get_input_text`. @@ -147,16 +141,16 @@ def _get_input_text(request: CreateResponse) -> str: items = get_input_expanded(request) texts: list[str] = [] for item in items: - if _is_type(item, ItemMessage, "message"): + if _is_type(item, "_generated_models.ItemMessage", "message"): for part in _get_field(item, "content") or []: - if _is_type(part, MessageContentInputTextContent, "input_text"): + if _is_type(part, "_generated_models.MessageContentInputTextContent", "input_text"): text = _get_field(part, "text") if text is not None: texts.append(text) return "\n".join(texts) -def get_tool_choice_expanded(request: CreateResponse) -> dict[str, Any] | None: +def get_tool_choice_expanded(request: _generated_models.CreateResponse) -> dict[str, Any] | None: """Expand ``CreateResponse.tool_choice`` into a tool choice payload. String shorthands (``"auto"``, ``"required"``) are expanded to @@ -186,7 +180,9 @@ def get_tool_choice_expanded(request: CreateResponse) -> dict[str, Any] | None: return None -def get_conversation_expanded(request: CreateResponse) -> Optional[ConversationParam_2]: +def get_conversation_expanded( + request: _generated_models.CreateResponse, +) -> Optional[_generated_models.ConversationParam_2]: """Expand ``CreateResponse.conversation`` into a typed :class:`ConversationParam_2`. A plain string is treated as the conversation ID. @@ -200,9 +196,9 @@ def get_conversation_expanded(request: CreateResponse) -> Optional[ConversationP if conv is None: return None if isinstance(conv, dict) and conv.get("id"): - return cast(ConversationParam_2, conv) + return cast("_generated_models.ConversationParam_2", conv) if isinstance(conv, str): - return cast(ConversationParam_2, {"id": conv}) if conv else None + return cast("_generated_models.ConversationParam_2", {"id": conv}) if conv else None return None @@ -211,7 +207,7 @@ def get_conversation_expanded(request: CreateResponse) -> Optional[ConversationP # --------------------------------------------------------------------------- -def get_instruction_items(response: ResponseObject) -> list[Item]: +def get_instruction_items(response: _generated_models.ResponseObject) -> list[_generated_models.Item]: """Expand ``Response.instructions`` into a list of :class:`Item`. - If instructions is ``None``, returns ``[]``. @@ -243,7 +239,7 @@ def get_instruction_items(response: ResponseObject) -> list[Item]: # --------------------------------------------------------------------------- -def get_output_item_id(item: OutputItem) -> str: +def get_output_item_id(item: _generated_models.OutputItem) -> str: """Extract the ``id`` field from any :class:`OutputItem` subtype. All concrete output item wire payloads must include an ``id`` field. @@ -269,7 +265,7 @@ def get_output_item_id(item: OutputItem) -> str: # --------------------------------------------------------------------------- -def get_content_expanded(message: ItemMessage) -> list[MessageContent]: +def get_content_expanded(message: _generated_models.ItemMessage) -> list[_generated_models.MessageContent]: """Return the typed content list from an :class:`ItemMessage`. If ``content`` is a plain string (the API allows a string shorthand), @@ -286,7 +282,9 @@ def get_content_expanded(message: ItemMessage) -> list[MessageContent]: if content is None: return [] if isinstance(content, str): - return cast(list[MessageContent], [{"type": "input_text", "text": content}]) if content else [] + return ( + cast("list[_generated_models.MessageContent]", [{"type": "input_text", "text": content}]) if content else [] + ) return list(content) @@ -370,7 +368,7 @@ def get_content_expanded(message: ItemMessage) -> list[MessageContent]: ) -def to_output_item(item: Item, response_id: str | None = None) -> OutputItem | None: +def to_output_item(item: _generated_models.Item, response_id: str | None = None) -> _generated_models.OutputItem | None: """Convert an :class:`Item` to the corresponding :class:`OutputItem`. Generates a type-specific ID via :meth:`IdGenerator.new_item_id` and @@ -416,10 +414,10 @@ def to_output_item(item: Item, response_id: str | None = None) -> OutputItem | N elif item_type in _PRESERVE_STATUS_ITEM_TYPES: data.setdefault("status", "completed") - return cast(OutputItem, data) + return cast("_generated_models.OutputItem", data) -def to_item(output_item: OutputItem) -> Item | None: +def to_item(output_item: _generated_models.OutputItem) -> _generated_models.Item | None: """Convert an :class:`OutputItem` back to the corresponding :class:`Item`. Both hierarchies share the same ``type`` discriminator values, so the @@ -436,9 +434,9 @@ def to_item(output_item: OutputItem) -> Item | None: if not isinstance(output_item, dict): return None if output_item.get("type") == "output_message": - return cast(Item, {**output_item, "type": "message"}) + return cast("_generated_models.Item", {**output_item, "type": "message"}) item = _ensure_item_type(dict(output_item)) item_type = item.get("type") if item_type not in _INPUT_ITEM_TYPES: return None - return cast(Item, item) + return cast("_generated_models.Item", item) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_lazy_models.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_lazy_models.py new file mode 100644 index 000000000000..f143ea0f2793 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/_lazy_models.py @@ -0,0 +1,19 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Construct original generated contracts on demand, without substitute model types.""" + +from threading import RLock +from typing import Any, Callable, MutableMapping + +_LOCK = RLock() + + +def load_model( + name: str, namespace: MutableMapping[str, Any], factories: dict[str, Callable[[], Any]], module_name: str +) -> Any: + if name not in factories: + raise AttributeError(f"module '{module_name}' has no attribute '{name}'") + with _LOCK: + if name not in namespace: + namespace[name] = factories[name]() + return namespace[name] diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/runtime.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/runtime.py index 026dab258e5a..a005749ad8f3 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/runtime.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/models/runtime.py @@ -9,10 +9,11 @@ from datetime import datetime, timezone from typing import TYPE_CHECKING, Any, Literal, Mapping, cast + +from . import _generated as _generated_models if TYPE_CHECKING: from .._response_context import ResponseContext from azure.ai.agentserver.core.streaming import EventStream # pylint: disable=import-error,no-name-in-module - from ._generated import AgentReference, OutputItem, ResponseObject, ResponseStreamEvent ResponseStatus = Literal["queued", "in_progress", "completed", "failed", "cancelled", "incomplete"] @@ -66,7 +67,9 @@ def terminal(self) -> bool: } @classmethod - def from_generated(cls, event: ResponseStreamEvent, payload: Mapping[str, Any]) -> "StreamEventRecord": + def from_generated( + cls, event: _generated_models.ResponseStreamEvent, payload: Mapping[str, Any] + ) -> "StreamEventRecord": """Create a stream event record from a generated response stream event model. :param event: The generated response stream event. @@ -94,18 +97,18 @@ def __init__( updated_at: datetime | None = None, completed_at: datetime | None = None, status: ResponseStatus = "in_progress", - response: ResponseObject | None = None, + response: _generated_models.ResponseObject | None = None, execution_task: asyncio.Task[Any] | None = None, cancel_requested: bool = False, client_disconnected: bool = False, response_created_seen: bool = False, subject: "EventStream | None" = None, cancel_signal: asyncio.Event | None = None, - input_items: list[OutputItem] | None = None, + input_items: list[_generated_models.OutputItem] | None = None, previous_response_id: str | None = None, response_context: ResponseContext | None = None, initial_model: str | None = None, - initial_agent_reference: AgentReference | dict[str, Any] | None = None, + initial_agent_reference: _generated_models.AgentReference | dict[str, Any] | None = None, agent_session_id: str | None = None, conversation_id: str | None = None, user_id_key: str | None = None, @@ -123,7 +126,7 @@ def __init__( self.response_created_seen = response_created_seen self.subject = subject self.cancel_signal = cancel_signal if cancel_signal is not None else asyncio.Event() - self.input_items: list[OutputItem] = input_items if input_items is not None else [] + self.input_items: list[_generated_models.OutputItem] = input_items if input_items is not None else [] self.previous_response_id = previous_response_id self.response_context = response_context self.initial_model = initial_model @@ -177,7 +180,7 @@ def is_terminal(self) -> bool: """ return self.status in {"completed", "failed", "cancelled", "incomplete"} - def set_response_snapshot(self, response: ResponseObject) -> None: + def set_response_snapshot(self, response: _generated_models.ResponseObject) -> None: """Replace the current response snapshot from handler-emitted events. :param response: The latest response snapshot to store. @@ -223,7 +226,9 @@ def visible_via_get(self) -> bool: return self.status in ("completed", "failed", "cancelled", "incomplete") return True - def apply_event(self, normalized: ResponseStreamEvent, all_events: list[ResponseStreamEvent]) -> None: + def apply_event( + self, normalized: _generated_models.ResponseStreamEvent, all_events: list[_generated_models.ResponseStreamEvent] + ) -> None: """Apply a normalised stream event — updates self.response and self.status. Does nothing if the execution is already ``"cancelled"``. @@ -254,7 +259,7 @@ def apply_event(self, normalized: ResponseStreamEvent, all_events: list[Response agent_reference=agent_reference, model=model, ) - self.set_response_snapshot(cast("ResponseObject", snapshot)) + self.set_response_snapshot(cast("_generated_models.ResponseObject", snapshot)) resolved = snapshot.get("status") if isinstance(resolved, str): self.status = cast(ResponseStatus, resolved) @@ -279,7 +284,7 @@ def apply_event(self, normalized: ResponseStreamEvent, all_events: list[Response cast(list[Any], output)[output_index] = deepcopy(item_dict) @property - def agent_reference(self) -> AgentReference | dict[str, Any]: + def agent_reference(self) -> _generated_models.AgentReference | dict[str, Any]: """Extract agent_reference from the stored response snapshot. :returns: The agent reference model or dict, or empty dict if no response snapshot is set. @@ -340,10 +345,10 @@ def terminal_event_seen(self) -> bool: def _build_cancelled_response( response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _generated_models.AgentReference | dict[str, Any], model: str | None, created_at: datetime | None = None, -) -> ResponseObject: +) -> _generated_models.ResponseObject: """Build a Response object representing a cancelled terminal state. :param response_id: The response identifier. @@ -368,17 +373,17 @@ def _build_cancelled_response( } if created_at is not None: payload["created_at"] = int(created_at.timestamp()) - return cast("ResponseObject", payload) + return cast("_generated_models.ResponseObject", payload) def _build_failed_response( response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _generated_models.AgentReference | dict[str, Any], model: str | None, created_at: datetime | None = None, error_message: str = "An internal server error occurred.", error_code: str = "server_error", -) -> ResponseObject: +) -> _generated_models.ResponseObject: """Build a ResponseObject representing a failed terminal state. :param response_id: The response identifier. @@ -408,7 +413,7 @@ def _build_failed_response( } if created_at is not None: payload["created_at"] = int(created_at.timestamp()) - return cast("ResponseObject", payload) + return cast("_generated_models.ResponseObject", payload) _DEFAULT_FAILED_ERROR_MESSAGE = "An internal server error occurred." @@ -452,13 +457,13 @@ def _apply_cancelled_terminal(base: Mapping[str, Any]) -> dict[str, Any]: def _resolve_failed_response( base: Mapping[str, Any] | None, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _generated_models.AgentReference | dict[str, Any], model: str | None, *, created_at: datetime | None = None, error_code: str = "server_error", error_message: str = _DEFAULT_FAILED_ERROR_MESSAGE, -) -> ResponseObject: +) -> _generated_models.ResponseObject: """Build a ``failed`` terminal, preserving the handler's response object. :param base: The handler's response snapshot, or ``None`` if none exists. @@ -480,7 +485,7 @@ def _resolve_failed_response( """ if base is not None: return cast( - "ResponseObject", + "_generated_models.ResponseObject", _apply_failed_terminal(base, error={"code": error_code, "message": error_message}), ) return _build_failed_response( @@ -491,11 +496,11 @@ def _resolve_failed_response( def _resolve_cancelled_response( base: Mapping[str, Any] | None, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _generated_models.AgentReference | dict[str, Any], model: str | None, *, created_at: datetime | None = None, -) -> ResponseObject: +) -> _generated_models.ResponseObject: """Build a ``cancelled`` terminal, preserving the handler's response object. :param base: The handler's response snapshot, or ``None`` if none exists. @@ -512,5 +517,5 @@ def _resolve_cancelled_response( :rtype: ResponseObject """ if base is not None: - return cast("ResponseObject", _apply_cancelled_terminal(base)) + return cast("_generated_models.ResponseObject", _apply_cancelled_terminal(base)) return _build_cancelled_response(response_id, agent_reference, model, created_at=created_at) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_base.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_base.py index d4bba871cc8f..807982f4ce19 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_base.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_base.py @@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Iterable, Protocol, runtime_checkable -from ..models._generated import OutputItem, ResponseObject +from ..models import _generated as _generated_models if TYPE_CHECKING: from .._response_context import PlatformContext @@ -57,8 +57,8 @@ class ResponseProviderProtocol(Protocol): async def create_response( self, - response: ResponseObject, - input_items: Iterable[OutputItem] | None, + response: _generated_models.ResponseObject, + input_items: Iterable[_generated_models.OutputItem] | None, history_item_ids: Iterable[str] | None, *, context: PlatformContext | None = None, @@ -76,7 +76,9 @@ async def create_response( :rtype: None """ - async def get_response(self, response_id: str, *, context: PlatformContext | None = None) -> ResponseObject: + async def get_response( + self, response_id: str, *, context: PlatformContext | None = None + ) -> _generated_models.ResponseObject: """Load one response envelope by ID. :param response_id: The unique identifier of the response to retrieve. @@ -89,7 +91,9 @@ async def get_response(self, response_id: str, *, context: PlatformContext | Non """ ... - async def update_response(self, response: ResponseObject, *, context: PlatformContext | None = None) -> None: + async def update_response( + self, response: _generated_models.ResponseObject, *, context: PlatformContext | None = None + ) -> None: """Persist an updated response envelope. :param response: The response envelope with updated fields to persist. @@ -119,7 +123,7 @@ async def get_input_items( before: str | None = None, *, context: PlatformContext | None = None, - ) -> list[OutputItem]: + ) -> list[_generated_models.OutputItem]: """Get response input/history items for one response ID using cursor pagination. :param response_id: The unique identifier of the response whose items to fetch. @@ -141,7 +145,7 @@ async def get_input_items( async def get_items( self, item_ids: Iterable[str], *, context: PlatformContext | None = None - ) -> list[OutputItem | None]: + ) -> list[_generated_models.OutputItem | None]: """Get items by ID (missing IDs produce ``None`` entries). :param item_ids: The item identifiers to look up. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_file.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_file.py index feae0477e650..db9fc24f9134 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_file.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_file.py @@ -79,9 +79,11 @@ from typing import Any, Iterable, cast from .._response_context import PlatformContext -from ..models._generated import OutputItem, ResponseObject + from ..models._helpers import get_conversation_id from ._base import ResponseAlreadyExistsError, ResponseProviderProtocol, ResponseStoreCorruptionError +from ..models import _generated as _generated_models + # Sentinel key marking an ``output[]`` entry as a pointer to an item stored # under ``items/{id}.json`` (spec 028). A real response output item is a typed @@ -145,7 +147,7 @@ def _read_json_or_none(path: Path) -> dict[str, Any] | None: return None -def _deserialize_item(data: dict[str, Any] | None) -> OutputItem | None: +def _deserialize_item(data: dict[str, Any] | None) -> _generated_models.OutputItem | None: """Deserialize a stored item dict into a typed ``OutputItem`` subtype. Items persist to disk as JSON dicts; consumers (and the typed @@ -160,10 +162,10 @@ def _deserialize_item(data: dict[str, Any] | None) -> OutputItem | None: """ if data is None: return None - return cast(OutputItem, data) + return cast("_generated_models.OutputItem", data) -def _response_to_dict(response: ResponseObject) -> dict[str, Any]: +def _response_to_dict(response: _generated_models.ResponseObject) -> dict[str, Any]: """Convert a ``ResponseObject`` to a JSON-safe dict for persistence. :param response: The response object to convert. @@ -179,7 +181,7 @@ def _response_to_dict(response: ResponseObject) -> dict[str, Any]: return json.loads(json.dumps(response, default=str)) -def _dict_to_response(data: dict[str, Any]) -> ResponseObject: +def _dict_to_response(data: dict[str, Any]) -> _generated_models.ResponseObject: """Convert a persisted JSON dict back to a ``ResponseObject``. :param data: The persisted dict. @@ -187,7 +189,7 @@ def _dict_to_response(data: dict[str, Any]) -> ResponseObject: :returns: A reconstructed response object. :rtype: ResponseObject """ - return cast(ResponseObject, data) + return cast("_generated_models.ResponseObject", data) def _item_id(item: Any) -> str | None: @@ -282,8 +284,8 @@ def _conversation_path(self, conversation_id: str) -> Path: async def create_response( self, - response: ResponseObject, - input_items: Iterable[OutputItem] | None, + response: _generated_models.ResponseObject, + input_items: Iterable[_generated_models.OutputItem] | None, history_item_ids: Iterable[str] | None, *, context: PlatformContext | None = None, @@ -345,7 +347,9 @@ async def create_response( if conversation_id is not None: self._add_response_to_conversation_unlocked(conversation_id, response_id) - async def get_response(self, response_id: str, *, context: PlatformContext | None = None) -> ResponseObject: + async def get_response( + self, response_id: str, *, context: PlatformContext | None = None + ) -> _generated_models.ResponseObject: """Retrieve one response envelope by identifier. :param response_id: The response identifier. @@ -366,7 +370,9 @@ async def get_response(self, response_id: str, *, context: PlatformContext | Non raise KeyError(f"response '{response_id}' not found") return _dict_to_response(deepcopy(self._rehydrate_output(data))) - async def update_response(self, response: ResponseObject, *, context: PlatformContext | None = None) -> None: + async def update_response( + self, response: _generated_models.ResponseObject, *, context: PlatformContext | None = None + ) -> None: """Update a stored response envelope. Output items present on the updated response are persisted to the @@ -435,7 +441,7 @@ async def get_input_items( before: str | None = None, *, context: PlatformContext | None = None, - ) -> list[OutputItem]: + ) -> list[_generated_models.OutputItem]: """Retrieve input + history items for a response with cursor paging. Returns the same ordered union of ``history_item_ids`` followed by @@ -486,7 +492,7 @@ async def get_input_items( except ValueError: pass safe_limit = max(1, min(100, int(limit))) - results: list[OutputItem] = [] + results: list[_generated_models.OutputItem] = [] for iid in ordered[:safe_limit]: data = _read_json_or_none(self._global_item_path(iid)) item = _deserialize_item(data) @@ -499,7 +505,7 @@ async def get_items( item_ids: Iterable[str], *, context: PlatformContext | None = None, - ) -> list[OutputItem | None]: + ) -> list[_generated_models.OutputItem | None]: """Retrieve items by id, preserving request order. Missing ids produce ``None`` entries — matches @@ -515,7 +521,7 @@ async def get_items( """ del context async with self._lock: - results: list[OutputItem | None] = [] + results: list[_generated_models.OutputItem | None] = [] for iid in item_ids: data = _read_json_or_none(self._global_item_path(iid)) results.append(_deserialize_item(data)) @@ -606,7 +612,7 @@ def _store_items_unlocked(self, items: Iterable[Any]) -> list[str]: stored_ids.append(iid) return stored_ids - def _store_output_items_unlocked(self, response: ResponseObject) -> list[str]: + def _store_output_items_unlocked(self, response: _generated_models.ResponseObject) -> list[str]: """Extract output items from a response and persist them. Mirrors :meth:`InMemoryResponseProvider._store_output_items_unlocked`. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_provider.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_provider.py index 7199bd0f265f..2736942d0f23 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_provider.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_provider.py @@ -16,7 +16,9 @@ from azure.core.rest import HttpRequest from .._version import VERSION -from ..models._generated import OutputItem, ResponseObject # type: ignore[attr-defined] +from ..models import _generated as _generated_models + +# type: ignore[attr-defined] from ._base import ResponseAlreadyExistsError from ._foundry_errors import FoundryBadRequestError, raise_for_storage_error from ._foundry_logging_policy import FoundryStorageLoggingPolicy @@ -250,8 +252,8 @@ async def _send_storage_request(self, request: HttpRequest) -> Any: async def create_response( self, - response: ResponseObject, - input_items: Iterable[OutputItem] | None, + response: _generated_models.ResponseObject, + input_items: Iterable[_generated_models.OutputItem] | None, history_item_ids: Iterable[str] | None, *, context: PlatformContext | None = None, @@ -284,7 +286,9 @@ async def create_response( raise ResponseAlreadyExistsError(response_id) from exc raise - async def get_response(self, response_id: str, *, context: PlatformContext | None = None) -> ResponseObject: + async def get_response( + self, response_id: str, *, context: PlatformContext | None = None + ) -> _generated_models.ResponseObject: """Retrieve a stored response by its ID. :param response_id: The response identifier. @@ -302,7 +306,9 @@ async def get_response(self, response_id: str, *, context: PlatformContext | Non http_resp = await self._send_storage_request(request) return deserialize_response(http_resp.text()) - async def update_response(self, response: ResponseObject, *, context: PlatformContext | None = None) -> None: + async def update_response( + self, response: _generated_models.ResponseObject, *, context: PlatformContext | None = None + ) -> None: """Persist an updated response snapshot. :param response: The updated response model. Must contain a valid ``id`` field. @@ -343,7 +349,7 @@ async def get_input_items( before: str | None = None, *, context: PlatformContext | None = None, - ) -> list[OutputItem]: + ) -> list[_generated_models.OutputItem]: """Retrieve a page of input items for the given response. :param response_id: The response whose input items are being listed. @@ -380,7 +386,7 @@ async def get_input_items( async def get_items( self, item_ids: Iterable[str], *, context: PlatformContext | None = None - ) -> list[OutputItem | None]: + ) -> list[_generated_models.OutputItem | None]: """Retrieve multiple items by their IDs in a single batch request. Positions in the returned list correspond to positions in *item_ids*. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_serializer.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_serializer.py index ebe65baea3f4..8b61c8e70b31 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_serializer.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_foundry_serializer.py @@ -8,12 +8,13 @@ from typing import Any, Iterable from ..models._wire import to_wire_dict -from ..models import OutputItem, ResponseObject +from .. import models as _public_models + def serialize_create_request( - response: ResponseObject, - input_items: Iterable[OutputItem] | None, + response: _public_models.ResponseObject, + input_items: Iterable[_public_models.OutputItem] | None, history_item_ids: Iterable[str] | None, ) -> bytes: """Serialize a create-response request envelope to JSON bytes. @@ -35,7 +36,7 @@ def serialize_create_request( return json.dumps(payload).encode("utf-8") -def serialize_response(response: ResponseObject) -> bytes: +def serialize_response(response: _public_models.ResponseObject) -> bytes: """Serialize a single :class:`ResponseObject` wire snapshot to JSON bytes. :param response: The response model to encode. @@ -57,7 +58,7 @@ def serialize_batch_request(item_ids: list[str]) -> bytes: return json.dumps({"item_ids": item_ids}).encode("utf-8") -def deserialize_response(body: str) -> ResponseObject: +def deserialize_response(body: str) -> _public_models.ResponseObject: """Deserialize a JSON response body into a response wire payload. :param body: The raw JSON response text from the storage API. @@ -68,7 +69,7 @@ def deserialize_response(body: str) -> ResponseObject: return json.loads(body) -def deserialize_paged_items(body: str) -> list[OutputItem]: +def deserialize_paged_items(body: str) -> list[_public_models.OutputItem]: """Deserialize a paged-response JSON body, extracting the ``data`` array. Items are returned as dict-native ``OutputItem`` wire payloads. @@ -82,7 +83,7 @@ def deserialize_paged_items(body: str) -> list[OutputItem]: return list(data.get("data", [])) -def deserialize_items_array(body: str) -> list[OutputItem | None]: +def deserialize_items_array(body: str) -> list[_public_models.OutputItem | None]: """Deserialize a JSON array of items, preserving ``null`` gaps. Null entries in the array indicate that no item was found for the @@ -94,7 +95,7 @@ def deserialize_items_array(body: str) -> list[OutputItem | None]: :rtype: list[OutputItem | None] """ raw_items: list[dict | None] = json.loads(body) - result: list[OutputItem | None] = [] + result: list[_public_models.OutputItem | None] = [] for item in raw_items: if item is None: result.append(None) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_memory.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_memory.py index a28b3820bb9a..37c6c37dbf75 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_memory.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/store/_memory.py @@ -12,10 +12,12 @@ from typing import Any, AsyncIterator, Dict, Iterable from .._response_context import PlatformContext -from ..models._generated import OutputItem, ResponseObject, ResponseStreamEvent + from ..models._helpers import get_conversation_id from ..models.runtime import ResponseExecution, ResponseModeFlags, ResponseStatus, StreamEventRecord, _StreamReplayState from ._base import ResponseAlreadyExistsError, ResponseProviderProtocol +from ..models import _generated as _generated_models + _DEFAULT_REPLAY_EVENT_TTL_SECONDS: int = 600 """Minimum per-event replay TTL (10 minutes) per spec B35.""" @@ -29,7 +31,7 @@ def __init__( *, execution: ResponseExecution, replay: _StreamReplayState, - response: ResponseObject | None = None, + response: _generated_models.ResponseObject | None = None, input_item_ids: list[str] | None = None, output_item_ids: list[str] | None = None, history_item_ids: list[str] | None = None, @@ -61,9 +63,9 @@ def __init__(self) -> None: """Initialize in-memory state and an async mutation lock.""" self._entries: Dict[str, _StoreEntry] = {} self._lock = asyncio.Lock() - self._item_store: Dict[str, OutputItem] = {} + self._item_store: Dict[str, _generated_models.OutputItem] = {} self._conversation_responses: defaultdict[str, list[str]] = defaultdict(list) - self._stream_events: Dict[str, list[ResponseStreamEvent]] = {} + self._stream_events: Dict[str, list[_generated_models.ResponseStreamEvent]] = {} @contextlib.asynccontextmanager async def _locked(self) -> AsyncIterator[None]: @@ -78,8 +80,8 @@ async def _locked(self) -> AsyncIterator[None]: async def create_response( self, - response: ResponseObject, - input_items: Iterable[OutputItem] | None, + response: _generated_models.ResponseObject, + input_items: Iterable[_generated_models.OutputItem] | None, history_item_ids: Iterable[str] | None, *, context: PlatformContext | None = None, @@ -134,7 +136,9 @@ async def create_response( if conversation_id is not None: self._conversation_responses[conversation_id].append(response_id) - async def get_response(self, response_id: str, *, context: PlatformContext | None = None) -> ResponseObject: + async def get_response( + self, response_id: str, *, context: PlatformContext | None = None + ) -> _generated_models.ResponseObject: """Retrieve one response envelope by identifier. :param response_id: The unique identifier of the response to retrieve. @@ -151,7 +155,9 @@ async def get_response(self, response_id: str, *, context: PlatformContext | Non raise KeyError(f"response '{response_id}' not found") return deepcopy(entry.response) - async def update_response(self, response: ResponseObject, *, context: PlatformContext | None = None) -> None: + async def update_response( + self, response: _generated_models.ResponseObject, *, context: PlatformContext | None = None + ) -> None: """Update a stored response envelope. Replaces the stored response with a deep copy and updates @@ -202,7 +208,7 @@ async def get_input_items( before: str | None = None, *, context: PlatformContext | None = None, - ) -> list[OutputItem]: + ) -> list[_generated_models.OutputItem]: """Retrieve input/history items for a response with basic cursor paging. Returns deep copies of stored items, combining history and input item IDs @@ -261,7 +267,7 @@ async def get_items( item_ids: Iterable[str], *, context: PlatformContext | None = None, - ) -> list[OutputItem | None]: + ) -> list[_generated_models.OutputItem | None]: """Retrieve items by ID, preserving request order. Returns deep copies of stored items. Missing IDs produce ``None`` entries. @@ -367,7 +373,7 @@ async def get_execution(self, response_id: str) -> ResponseExecution | None: async def set_response_snapshot( self, response_id: str, - response: ResponseObject, + response: _generated_models.ResponseObject, *, ttl_seconds: int | None = None, ) -> bool: @@ -589,7 +595,7 @@ def _purge_expired_unlocked(self, *, now: datetime | None = None) -> int: return len(expired_ids) - def _store_output_items_unlocked(self, response: ResponseObject) -> list[str]: + def _store_output_items_unlocked(self, response: _generated_models.ResponseObject) -> list[str]: """Extract output items from a response, store them in the item store, and return their IDs. Must be called while holding ``self._lock``. @@ -631,7 +637,7 @@ def _extract_item_id(item: Any) -> str | None: return str(value) if value is not None else None @staticmethod - def _resolve_mode_flags_from_response(response: ResponseObject) -> ResponseModeFlags: + def _resolve_mode_flags_from_response(response: _generated_models.ResponseObject) -> ResponseModeFlags: """Build mode flags from a response snapshot where available. :param response: The response envelope to extract mode flags from. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_base.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_base.py index c560d5fdfdf1..58e96d9724ce 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_base.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_base.py @@ -4,6 +4,7 @@ from __future__ import annotations + from collections.abc import MutableMapping from copy import deepcopy from enum import Enum @@ -150,7 +151,7 @@ def _emit_added(self, item: dict[str, Any]) -> response_models.ResponseOutputIte item = self._stamp_internal_metadata(item) stamped_item = self._stream._with_output_item_defaults(item) # pylint: disable=protected-access return cast( - response_models.ResponseOutputItemAddedEvent, + "response_models.ResponseOutputItemAddedEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.output_item.added", @@ -173,7 +174,7 @@ def _emit_done(self, item: dict[str, Any]) -> response_models.ResponseOutputItem item = self._stamp_internal_metadata(item) stamped_item = self._stream._with_output_item_defaults(item) # pylint: disable=protected-access return cast( - response_models.ResponseOutputItemDoneEvent, + "response_models.ResponseOutputItemDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.output_item.done", diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_function.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_function.py index 9f237398e835..059c3f567653 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_function.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_function.py @@ -4,6 +4,7 @@ from __future__ import annotations + from copy import deepcopy from typing import TYPE_CHECKING, Iterator, cast @@ -87,7 +88,7 @@ def emit_arguments_delta(self, delta: str) -> response_models.ResponseFunctionCa :rtype: ResponseFunctionCallArgumentsDeltaEvent """ return cast( - response_models.ResponseFunctionCallArgumentsDeltaEvent, + "response_models.ResponseFunctionCallArgumentsDeltaEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.function_call_arguments.delta", @@ -108,7 +109,7 @@ def emit_arguments_done(self, arguments: str) -> response_models.ResponseFunctio """ self._final_arguments = arguments return cast( - response_models.ResponseFunctionCallArgumentsDoneEvent, + "response_models.ResponseFunctionCallArgumentsDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.function_call_arguments.done", diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_message.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_message.py index d94b7fccfd27..40780afc0087 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_message.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_message.py @@ -4,6 +4,7 @@ from __future__ import annotations + from typing import TYPE_CHECKING, Any, Iterator, cast from ... import models as response_models @@ -83,7 +84,7 @@ def emit_added(self) -> response_models.ResponseContentPartAddedEvent: raise ValueError(f"cannot call emit_added in '{self._lifecycle_state.value}' state") self._lifecycle_state = BuilderLifecycleState.ADDED return cast( - response_models.ResponseContentPartAddedEvent, + "response_models.ResponseContentPartAddedEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.content_part.added", @@ -100,7 +101,7 @@ def emit_delta(self, text: str) -> response_models.ResponseTextDeltaEvent: raise ValueError(f"cannot call emit_delta in '{self._lifecycle_state.value}' state") self._delta_fragments.append(text) return cast( - response_models.ResponseTextDeltaEvent, + "response_models.ResponseTextDeltaEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.output_text.delta", @@ -135,7 +136,7 @@ def emit_text_done(self, final_text: str | None = None) -> response_models.Respo merged_text = final_text self._final_text = merged_text return cast( - response_models.ResponseTextDoneEvent, + "response_models.ResponseTextDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.output_text.done", @@ -163,7 +164,7 @@ def emit_done(self) -> response_models.ResponseContentPartDoneEvent: raise ValueError("must call emit_text_done() before emit_done()") self._lifecycle_state = BuilderLifecycleState.DONE return cast( - response_models.ResponseContentPartDoneEvent, + "response_models.ResponseContentPartDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.content_part.done", @@ -195,7 +196,7 @@ def emit_annotation_added( self._annotation_index += 1 annotation_payload = _with_annotation_type(_require_wire_dict(annotation, "annotation")) return cast( - response_models.ResponseOutputTextAnnotationAddedEvent, + "response_models.ResponseOutputTextAnnotationAddedEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.output_text.annotation.added", @@ -265,7 +266,7 @@ def emit_added(self) -> response_models.ResponseContentPartAddedEvent: raise ValueError(f"cannot call emit_added in '{self._lifecycle_state.value}' state") self._lifecycle_state = BuilderLifecycleState.ADDED return cast( - response_models.ResponseContentPartAddedEvent, + "response_models.ResponseContentPartAddedEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.content_part.added", @@ -286,7 +287,7 @@ def emit_delta(self, text: str) -> response_models.ResponseRefusalDeltaEvent: :rtype: ResponseRefusalDeltaEvent """ return cast( - response_models.ResponseRefusalDeltaEvent, + "response_models.ResponseRefusalDeltaEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.refusal.delta", @@ -316,7 +317,7 @@ def emit_refusal_done(self, final_refusal: str) -> response_models.ResponseRefus self._refusal_done = True self._final_refusal = final_refusal return cast( - response_models.ResponseRefusalDoneEvent, + "response_models.ResponseRefusalDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.refusal.done", @@ -343,7 +344,7 @@ def emit_done(self) -> response_models.ResponseContentPartDoneEvent: raise ValueError("must call emit_refusal_done() before emit_done()") self._lifecycle_state = BuilderLifecycleState.DONE return cast( - response_models.ResponseContentPartDoneEvent, + "response_models.ResponseContentPartDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.content_part.done", diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_reasoning.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_reasoning.py index 2aa02627b8dd..48e4e36979c4 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_reasoning.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_reasoning.py @@ -4,6 +4,7 @@ from __future__ import annotations + from typing import TYPE_CHECKING, Iterator, cast from ... import models as response_models @@ -64,7 +65,7 @@ def emit_added(self) -> response_models.ResponseReasoningSummaryPartAddedEvent: raise ValueError(f"cannot call emit_added in '{self._lifecycle_state.value}' state") self._lifecycle_state = BuilderLifecycleState.ADDED return cast( - response_models.ResponseReasoningSummaryPartAddedEvent, + "response_models.ResponseReasoningSummaryPartAddedEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.reasoning_summary_part.added", @@ -85,7 +86,7 @@ def emit_text_delta(self, text: str) -> response_models.ResponseReasoningSummary :rtype: ResponseReasoningSummaryTextDeltaEvent """ return cast( - response_models.ResponseReasoningSummaryTextDeltaEvent, + "response_models.ResponseReasoningSummaryTextDeltaEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.reasoning_summary_text.delta", @@ -107,7 +108,7 @@ def emit_text_done(self, final_text: str) -> response_models.ResponseReasoningSu """ self._final_text = final_text return cast( - response_models.ResponseReasoningSummaryTextDoneEvent, + "response_models.ResponseReasoningSummaryTextDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.reasoning_summary_text.done", @@ -130,7 +131,7 @@ def emit_done(self) -> response_models.ResponseReasoningSummaryPartDoneEvent: raise ValueError(f"cannot call emit_done in '{self._lifecycle_state.value}' state") self._lifecycle_state = BuilderLifecycleState.DONE return cast( - response_models.ResponseReasoningSummaryPartDoneEvent, + "response_models.ResponseReasoningSummaryPartDoneEvent", self._stream._emit_event( # pylint: disable=protected-access { "type": "response.reasoning_summary_part.done", diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_tools.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_tools.py index 1d4a555ed5d6..c0af82463dc3 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_tools.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_tools.py @@ -4,6 +4,7 @@ from __future__ import annotations + from typing import TYPE_CHECKING, Any, Iterator, cast from ... import models as response_models @@ -38,7 +39,7 @@ def emit_in_progress(self) -> response_models.ResponseFileSearchCallInProgressEv :rtype: ResponseFileSearchCallInProgressEvent """ return cast( - response_models.ResponseFileSearchCallInProgressEvent, + "response_models.ResponseFileSearchCallInProgressEvent", self._emit_item_state_event("response.file_search_call.in_progress"), ) @@ -49,7 +50,7 @@ def emit_searching(self) -> response_models.ResponseFileSearchCallSearchingEvent :rtype: ResponseFileSearchCallSearchingEvent """ return cast( - response_models.ResponseFileSearchCallSearchingEvent, + "response_models.ResponseFileSearchCallSearchingEvent", self._emit_item_state_event("response.file_search_call.searching"), ) @@ -60,7 +61,7 @@ def emit_completed(self) -> response_models.ResponseFileSearchCallCompletedEvent :rtype: ResponseFileSearchCallCompletedEvent """ return cast( - response_models.ResponseFileSearchCallCompletedEvent, + "response_models.ResponseFileSearchCallCompletedEvent", self._emit_item_state_event("response.file_search_call.completed"), ) @@ -91,7 +92,7 @@ def emit_in_progress(self) -> response_models.ResponseWebSearchCallInProgressEve :rtype: ResponseWebSearchCallInProgressEvent """ return cast( - response_models.ResponseWebSearchCallInProgressEvent, + "response_models.ResponseWebSearchCallInProgressEvent", self._emit_item_state_event("response.web_search_call.in_progress"), ) @@ -102,7 +103,7 @@ def emit_searching(self) -> response_models.ResponseWebSearchCallSearchingEvent: :rtype: ResponseWebSearchCallSearchingEvent """ return cast( - response_models.ResponseWebSearchCallSearchingEvent, + "response_models.ResponseWebSearchCallSearchingEvent", self._emit_item_state_event("response.web_search_call.searching"), ) @@ -113,7 +114,7 @@ def emit_completed(self) -> response_models.ResponseWebSearchCallCompletedEvent: :rtype: ResponseWebSearchCallCompletedEvent """ return cast( - response_models.ResponseWebSearchCallCompletedEvent, + "response_models.ResponseWebSearchCallCompletedEvent", self._emit_item_state_event("response.web_search_call.completed"), ) @@ -166,7 +167,7 @@ def emit_in_progress(self) -> response_models.ResponseCodeInterpreterCallInProgr :rtype: ResponseCodeInterpreterCallInProgressEvent """ return cast( - response_models.ResponseCodeInterpreterCallInProgressEvent, + "response_models.ResponseCodeInterpreterCallInProgressEvent", self._emit_item_state_event("response.code_interpreter_call.in_progress"), ) @@ -177,7 +178,7 @@ def emit_interpreting(self) -> response_models.ResponseCodeInterpreterCallInterp :rtype: ResponseCodeInterpreterCallInterpretingEvent """ return cast( - response_models.ResponseCodeInterpreterCallInterpretingEvent, + "response_models.ResponseCodeInterpreterCallInterpretingEvent", self._emit_item_state_event("response.code_interpreter_call.interpreting"), ) @@ -190,7 +191,7 @@ def emit_code_delta(self, delta: str) -> response_models.ResponseCodeInterpreter :rtype: ResponseCodeInterpreterCallCodeDeltaEvent """ return cast( - response_models.ResponseCodeInterpreterCallCodeDeltaEvent, + "response_models.ResponseCodeInterpreterCallCodeDeltaEvent", self._emit_item_state_event( "response.code_interpreter_call_code.delta", extra_payload={"delta": delta}, @@ -207,7 +208,7 @@ def emit_code_done(self, code: str) -> response_models.ResponseCodeInterpreterCa """ self._final_code = code return cast( - response_models.ResponseCodeInterpreterCallCodeDoneEvent, + "response_models.ResponseCodeInterpreterCallCodeDoneEvent", self._emit_item_state_event( "response.code_interpreter_call_code.done", extra_payload={"code": code}, @@ -221,7 +222,7 @@ def emit_completed(self) -> response_models.ResponseCodeInterpreterCallCompleted :rtype: ResponseCodeInterpreterCallCompletedEvent """ return cast( - response_models.ResponseCodeInterpreterCallCompletedEvent, + "response_models.ResponseCodeInterpreterCallCompletedEvent", self._emit_item_state_event("response.code_interpreter_call.completed"), ) @@ -297,7 +298,7 @@ def emit_in_progress(self) -> response_models.ResponseImageGenCallInProgressEven :rtype: ResponseImageGenCallInProgressEvent """ return cast( - response_models.ResponseImageGenCallInProgressEvent, + "response_models.ResponseImageGenCallInProgressEvent", self._emit_item_state_event("response.image_generation_call.in_progress"), ) @@ -308,7 +309,7 @@ def emit_generating(self) -> response_models.ResponseImageGenCallGeneratingEvent :rtype: ResponseImageGenCallGeneratingEvent """ return cast( - response_models.ResponseImageGenCallGeneratingEvent, + "response_models.ResponseImageGenCallGeneratingEvent", self._emit_item_state_event("response.image_generation_call.generating"), ) @@ -323,7 +324,7 @@ def emit_partial_image(self, partial_image_b64: str) -> response_models.Response partial_index = self._partial_image_index self._partial_image_index += 1 return cast( - response_models.ResponseImageGenCallPartialImageEvent, + "response_models.ResponseImageGenCallPartialImageEvent", self._emit_item_state_event( "response.image_generation_call.partial_image", extra_payload={"partial_image_index": partial_index, "partial_image_b64": partial_image_b64}, @@ -337,7 +338,7 @@ def emit_completed(self) -> response_models.ResponseImageGenCallCompletedEvent: :rtype: ResponseImageGenCallCompletedEvent """ return cast( - response_models.ResponseImageGenCallCompletedEvent, + "response_models.ResponseImageGenCallCompletedEvent", self._emit_item_state_event("response.image_generation_call.completed"), ) @@ -431,7 +432,7 @@ def emit_in_progress(self) -> response_models.ResponseMCPCallInProgressEvent: :rtype: ResponseMCPCallInProgressEvent """ return cast( - response_models.ResponseMCPCallInProgressEvent, + "response_models.ResponseMCPCallInProgressEvent", self._emit_item_state_event("response.mcp_call.in_progress"), ) @@ -444,7 +445,7 @@ def emit_arguments_delta(self, delta: str) -> response_models.ResponseMCPCallArg :rtype: ResponseMCPCallArgumentsDeltaEvent """ return cast( - response_models.ResponseMCPCallArgumentsDeltaEvent, + "response_models.ResponseMCPCallArgumentsDeltaEvent", self._emit_item_state_event( "response.mcp_call_arguments.delta", extra_payload={"delta": delta}, @@ -461,7 +462,7 @@ def emit_arguments_done(self, arguments: str) -> response_models.ResponseMCPCall """ self._final_arguments = arguments return cast( - response_models.ResponseMCPCallArgumentsDoneEvent, + "response_models.ResponseMCPCallArgumentsDoneEvent", self._emit_item_state_event( "response.mcp_call_arguments.done", extra_payload={"arguments": arguments}, @@ -476,7 +477,7 @@ def emit_completed(self) -> response_models.ResponseMCPCallCompletedEvent: """ self._terminal_status = "completed" return cast( - response_models.ResponseMCPCallCompletedEvent, + "response_models.ResponseMCPCallCompletedEvent", self._emit_item_state_event("response.mcp_call.completed"), ) @@ -488,7 +489,7 @@ def emit_failed(self) -> response_models.ResponseMCPCallFailedEvent: """ self._terminal_status = "failed" return cast( - response_models.ResponseMCPCallFailedEvent, + "response_models.ResponseMCPCallFailedEvent", self._emit_item_state_event("response.mcp_call.failed"), ) @@ -592,7 +593,7 @@ def emit_in_progress(self) -> response_models.ResponseMCPListToolsInProgressEven :rtype: ResponseMCPListToolsInProgressEvent """ return cast( - response_models.ResponseMCPListToolsInProgressEvent, + "response_models.ResponseMCPListToolsInProgressEvent", self._emit_item_state_event("response.mcp_list_tools.in_progress"), ) @@ -603,7 +604,7 @@ def emit_completed(self) -> response_models.ResponseMCPListToolsCompletedEvent: :rtype: ResponseMCPListToolsCompletedEvent """ return cast( - response_models.ResponseMCPListToolsCompletedEvent, + "response_models.ResponseMCPListToolsCompletedEvent", self._emit_item_state_event("response.mcp_list_tools.completed"), ) @@ -614,7 +615,7 @@ def emit_failed(self) -> response_models.ResponseMCPListToolsFailedEvent: :rtype: ResponseMCPListToolsFailedEvent """ return cast( - response_models.ResponseMCPListToolsFailedEvent, + "response_models.ResponseMCPListToolsFailedEvent", self._emit_item_state_event("response.mcp_list_tools.failed"), ) @@ -706,7 +707,7 @@ def emit_input_delta(self, delta: str) -> response_models.ResponseCustomToolCall :rtype: ResponseCustomToolCallInputDeltaEvent """ return cast( - response_models.ResponseCustomToolCallInputDeltaEvent, + "response_models.ResponseCustomToolCallInputDeltaEvent", self._emit_item_state_event( "response.custom_tool_call_input.delta", extra_payload={"delta": delta}, @@ -723,7 +724,7 @@ def emit_input_done(self, input_text: str) -> response_models.ResponseCustomTool """ self._final_input = input_text return cast( - response_models.ResponseCustomToolCallInputDoneEvent, + "response_models.ResponseCustomToolCallInputDoneEvent", self._emit_item_state_event( "response.custom_tool_call_input.done", extra_payload={"input": input_text}, diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_checkpoint.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_checkpoint.py index e75c8c86ac4a..aae4db1b9eee 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_checkpoint.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_checkpoint.py @@ -13,8 +13,10 @@ from typing import TYPE_CHECKING +from ..models import _generated as _generated_models + if TYPE_CHECKING: - from ..models._generated import ResponseObject + pass class ResponseCheckpointEvent: @@ -27,5 +29,5 @@ class ResponseCheckpointEvent: __slots__ = ("response",) - def __init__(self, response: "ResponseObject") -> None: + def __init__(self, response: "_generated_models.ResponseObject") -> None: self.response = response diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_event_stream.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_event_stream.py index 8ed713cb2401..f1e7301aa3f7 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_event_stream.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_event_stream.py @@ -10,7 +10,7 @@ from typing import Any, Iterator, Sequence, cast from .. import models as response_models -from ..models import AgentReference + from .._id_generator import IdGenerator from . import _internals @@ -95,7 +95,7 @@ def __init__( self, *, response_id: str | None = None, - agent_reference: AgentReference | dict[str, Any] | None = None, + agent_reference: response_models.AgentReference | dict[str, Any] | None = None, model: str | None = None, request: response_models.CreateResponse | None = None, response: response_models.ResponseObject | None = None, @@ -117,7 +117,8 @@ def __init__( if request is not None and response is not None: raise ValueError("request and response cannot both be provided") - request_mapping = _internals.coerce_model_mapping(request) + # Request seeding reads only selected fields, copying mutable values below. + request_mapping = request if isinstance(request, dict) else None response_mapping = _internals.coerce_model_mapping(response) resolved_response_id = response_id @@ -132,7 +133,8 @@ def __init__( self._response_id = resolved_response_id if response_mapping is not None: - payload = _MutableResponseDict(deepcopy(response_mapping)) + # Coercion already detached this graph from the caller's recovery seed. + payload = _MutableResponseDict(response_mapping) payload["id"] = self._response_id payload.setdefault("object", "response") payload.setdefault("output", []) @@ -179,7 +181,7 @@ def __init__( _ResponseInternalMetadataView(self._response) self._agent_reference, self._model = _internals.extract_response_fields( - cast(response_models.ResponseObject, self._response) + cast("response_models.ResponseObject", self._response) ) self._events: list[response_models.ResponseStreamEvent] = [] self._validator = EventStreamValidator() @@ -245,7 +247,7 @@ def checkpoint(self) -> "ResponseCheckpointEvent": :returns: The checkpoint event to yield. :rtype: ~azure.ai.agentserver.responses.streaming._checkpoint.ResponseCheckpointEvent """ - return ResponseCheckpointEvent(cast(response_models.ResponseObject, self._response)) + return ResponseCheckpointEvent(cast("response_models.ResponseObject", self._response)) def emit_queued(self) -> response_models.ResponseQueuedEvent: """Emit a ``response.queued`` lifecycle event. @@ -255,7 +257,7 @@ def emit_queued(self) -> response_models.ResponseQueuedEvent: """ self._response["status"] = "queued" return cast( - response_models.ResponseQueuedEvent, + "response_models.ResponseQueuedEvent", self._emit_event( { "type": "response.queued", @@ -274,7 +276,7 @@ def emit_created(self, *, status: str = "in_progress") -> response_models.Respon """ self._response["status"] = status return cast( - response_models.ResponseCreatedEvent, + "response_models.ResponseCreatedEvent", self._emit_event( { "type": "response.created", @@ -291,7 +293,7 @@ def emit_in_progress(self) -> response_models.ResponseInProgressEvent: """ self._response["status"] = "in_progress" return cast( - response_models.ResponseInProgressEvent, + "response_models.ResponseInProgressEvent", self._emit_event( { "type": "response.in_progress", @@ -315,7 +317,7 @@ def emit_completed( self._response["incomplete_details"] = None self._set_terminal_fields(usage=usage) return cast( - response_models.ResponseCompletedEvent, + "response_models.ResponseCompletedEvent", self._emit_event( { "type": "response.completed", @@ -350,7 +352,7 @@ def emit_failed( } self._set_terminal_fields(usage=usage) return cast( - response_models.ResponseFailedEvent, + "response_models.ResponseFailedEvent", self._emit_event( { "type": "response.failed", @@ -383,7 +385,7 @@ def emit_incomplete( self._response["incomplete_details"] = {"reason": _internals.enum_value(reason)} self._set_terminal_fields(usage=usage) return cast( - response_models.ResponseIncompleteEvent, + "response_models.ResponseIncompleteEvent", self._emit_event( { "type": "response.incomplete", @@ -767,7 +769,7 @@ def _emit_event(self, event: dict[str, Any]) -> response_models.ResponseStreamEv candidate["sequence_number"] = len(self._events) # Apply response-level defaults to lifecycle events - typed_candidate = cast(response_models.ResponseStreamEvent, candidate) + typed_candidate = cast("response_models.ResponseStreamEvent", candidate) _internals.apply_common_defaults( [typed_candidate], response_id=self._response_id, @@ -776,7 +778,7 @@ def _emit_event(self, event: dict[str, Any]) -> response_models.ResponseStreamEv ) # Track completed output items on the response envelope _internals.track_completed_output_item( - cast(response_models.ResponseObject, self._response), + cast("response_models.ResponseObject", self._response), typed_candidate, ) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_helpers.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_helpers.py index d880e4509914..c750b212290e 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_helpers.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_helpers.py @@ -9,11 +9,13 @@ from typing import Any, AsyncIterator, cast from .. import models as response_models -from ..models import AgentReference + from . import _internals from ._event_stream import ResponseEventStream from ._internals import _RESPONSE_SNAPSHOT_EVENT_TYPES from ._sse import encode_sse_event +from .. import models as _public_models + def strip_nulls(d: dict) -> dict: @@ -35,7 +37,7 @@ def _build_events( response_id: str, *, include_progress: bool, - agent_reference: AgentReference | dict[str, Any] | None, + agent_reference: _public_models.AgentReference | dict[str, Any] | None, model: str | None, ) -> list[response_models.ResponseStreamEvent]: """Build a minimal lifecycle event sequence for a response. @@ -112,14 +114,14 @@ def _coerce_handler_event( if not isinstance(event_type, str) or not event_type: raise ValueError("handler event must include a non-empty 'type'") - return cast(response_models.ResponseStreamEvent, event_data) + return cast("response_models.ResponseStreamEvent", event_data) def _apply_stream_event_defaults( event: response_models.ResponseStreamEvent, *, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _public_models.AgentReference | dict[str, Any], model: str | None, sequence_number: int | None, agent_session_id: str | None = None, @@ -185,7 +187,7 @@ def _extract_response_snapshot_from_events( events: list[response_models.ResponseStreamEvent], *, response_id: str, - agent_reference: AgentReference | dict[str, Any], + agent_reference: _public_models.AgentReference | dict[str, Any], model: str | None, remove_sequence_number: bool = False, agent_session_id: str | None = None, diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_internals.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_internals.py index 5308f744cce8..d32130c67521 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_internals.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_internals.py @@ -15,7 +15,8 @@ from typing import Any, cast from .. import models as response_models -from ..models import AgentReference +from .. import models as _public_models + # Event types whose ``response`` field is a full Response snapshot. # Only these events should carry id/response_id/object/agent_reference/model. @@ -49,7 +50,7 @@ def construct_event_model(wire_dict: dict[str, Any]) -> response_models.Response :returns: A copied event wire payload. :rtype: ~azure.ai.agentserver.responses.models.ResponseStreamEvent """ - return cast(response_models.ResponseStreamEvent, deepcopy(wire_dict)) + return cast("response_models.ResponseStreamEvent", deepcopy(wire_dict)) def enum_value(value: Any) -> Any: @@ -78,7 +79,7 @@ def coerce_model_mapping(value: Any) -> dict[str, Any] | None: return None -def response_agent_reference(agent_reference: AgentReference | dict[str, Any] | None) -> dict[str, Any]: +def response_agent_reference(agent_reference: _public_models.AgentReference | dict[str, Any] | None) -> dict[str, Any]: """Return a valid response-level agent reference wire payload. An empty dict is still used elsewhere as the sentinel for "do not stamp @@ -129,7 +130,7 @@ def apply_common_defaults( events: list[response_models.ResponseStreamEvent], *, response_id: str, - agent_reference: AgentReference | dict[str, Any] | None, + agent_reference: _public_models.AgentReference | dict[str, Any] | None, model: str | None, agent_session_id: str | None = None, conversation_id: str | None = None, @@ -231,7 +232,7 @@ def track_completed_output_item( while len(output_items) <= output_index: output_items.append(None) - output_items[output_index] = deepcopy(item_dict) + output_items[output_index] = item_dict def coerce_usage( @@ -254,7 +255,7 @@ def coerce_usage( def extract_response_fields( response: response_models.ResponseObject, -) -> tuple[AgentReference | dict[str, Any] | None, str | None]: +) -> tuple[_public_models.AgentReference | dict[str, Any] | None, str | None]: """Pull ``agent_reference`` and ``model`` from a response in one pass. :param response: The response envelope to inspect. @@ -262,13 +263,12 @@ def extract_response_fields( :returns: Tuple of (agent_reference or None, model string or None). :rtype: tuple[~azure.ai.agentserver.responses.models.AgentReference | dict[str, Any] | None, str | None] """ - payload = coerce_model_mapping(response) - if not isinstance(payload, dict): + if not isinstance(response, dict): return None, None - agent_reference = payload.get("agent_reference") - agent_ref: AgentReference | dict[str, Any] | None = ( + agent_reference = response.get("agent_reference") + agent_ref: _public_models.AgentReference | dict[str, Any] | None = ( dict(deepcopy(agent_reference)) if isinstance(agent_reference, MutableMapping) else None ) - model = payload.get("model") + model = response.get("model") model_str = model if isinstance(model, str) and model else None return agent_ref, model_str diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_sse.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_sse.py index cbbce3a4d9bd..4b58c2c519f5 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_sse.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_sse.py @@ -12,8 +12,11 @@ from datetime import date, datetime, time, timedelta from typing import Any, AsyncIterator, Mapping, cast +from anyio import CancelScope + from .._egress import strip_internal_metadata -from ..models._generated import ResponseStreamEvent +from ..models import _generated as _generated_models + _stream_counter_var: ContextVar[itertools.count] = ContextVar("_stream_counter_var") @@ -140,7 +143,7 @@ def _build_sse_frame(event_type: str, payload: dict[str, Any]) -> str: return "\n".join(lines) -def encode_sse_event(event: ResponseStreamEvent) -> str: +def encode_sse_event(event: _generated_models.ResponseStreamEvent) -> str: """Encode a response stream event into SSE wire format. The serialised payload is passed through :func:`strip_internal_metadata` @@ -173,7 +176,7 @@ def encode_sse_event(event: ResponseStreamEvent) -> str: return _build_sse_frame(event_type, frame_payload) -def encode_sse_any_event(event: ResponseStreamEvent) -> str: +def encode_sse_any_event(event: _generated_models.ResponseStreamEvent) -> str: """Encode a ``ResponseStreamEvent`` model instance to SSE format. Delegates to :func:`encode_sse_event`. @@ -257,7 +260,8 @@ async def _pump() -> None: finally: # Stop the pump and any pending get, and await them so the source's finally # (finalize, request-context reset) runs before returning. - pending = [task for task in (pump_task, get_task) if task is not None] - for task in pending: - task.cancel() - await asyncio.gather(*pending, return_exceptions=True) + with CancelScope(shield=True): + pending = [task for task in (pump_task, get_task) if task is not None] + for task in pending: + task.cancel() + await asyncio.gather(*pending, return_exceptions=True) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_state_machine.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_state_machine.py index 5c23c056ac6d..e5b894e89133 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_state_machine.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_state_machine.py @@ -51,6 +51,46 @@ def __init__(self) -> None: def validate_next(self, event: Mapping[str, Any]) -> None: """Validate one new event against accumulated state. + Transactional: if validation fails, every mutable field is restored so + the validator is never left partially advanced ("poisoned"). Without + this, a terminal event that clears the duplicate/ordering checks but + fails a later check (e.g. a status mismatch) would still bump + ``_terminal_count``; the ``_make_failed_event`` fallback's + ``response.failed`` would then trip "multiple terminal lifecycle events" + and could not be emitted. + + :param event: The event mapping to validate. + :type event: Mapping[str, Any] + :rtype: None + :raises ValueError: If any ordering or structural constraint is violated. + """ + snapshot = ( + self._last_stage, + self._terminal_count, + self._terminal_seen, + self._event_count, + self._added_indexes.copy(), + self._done_indexes.copy(), + ) + try: + self._commit_next(event) + except ValueError: + ( + self._last_stage, + self._terminal_count, + self._terminal_seen, + self._event_count, + self._added_indexes, + self._done_indexes, + ) = snapshot + raise + + def _commit_next(self, event: Mapping[str, Any]) -> None: + """Apply validation for one event, advancing state as each check passes. + + Callers must go through :meth:`validate_next`, which wraps this in the + rollback that guarantees no state change on failure. + :param event: The event mapping to validate. :type event: Mapping[str, Any] :rtype: None diff --git a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_text_response.py b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_text_response.py index 09427210374e..ae2db4457c5d 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_text_response.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_text_response.py @@ -15,6 +15,7 @@ from __future__ import annotations + import inspect from collections.abc import AsyncIterable from typing import TYPE_CHECKING, AsyncIterator, Awaitable, Callable, Union, cast @@ -24,7 +25,7 @@ if TYPE_CHECKING: from .._response_context import ResponseContext - from ..models import CreateResponse, ResponseObject + #: Union of all accepted text sources. TextSource = Union[str, Callable[[], Union[str, Awaitable[str]]], AsyncIterable[str]] @@ -76,10 +77,10 @@ async def tokens(): def __init__( self, context: "ResponseContext", - request: "CreateResponse", + request: "response_models.CreateResponse", *, text: TextSource, - configure: Callable[["ResponseObject"], None] | None = None, + configure: Callable[["response_models.ResponseObject"], None] | None = None, ) -> None: self._context = context self._request = request @@ -96,7 +97,7 @@ async def _generate(self) -> AsyncIterator[response_models.ResponseStreamEvent]: ) if self._configure is not None: - self._configure(cast("ResponseObject", stream.response)) + self._configure(cast("response_models.ResponseObject", stream.response)) yield stream.emit_created() yield stream.emit_in_progress() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/docs/runtime-work-reuse.md b/sdk/agentserver/azure-ai-agentserver-responses/docs/runtime-work-reuse.md new file mode 100644 index 000000000000..fd535caf7395 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/docs/runtime-work-reuse.md @@ -0,0 +1,51 @@ + +# Request-local work reuse + +History ID lookups are reused only within a response request and only for the +same provider instance, previous response ID, conversation ID, limit, and +platform identity. Callers receive independent lists. Concurrent successful +lookups share a result; failures and cancellation do not populate the cache. +Concurrent input-reference readers similarly share one successful +materialization, while an unsuccessful owner releases the lock for retry. + +Streaming requests close their request-owned iterators and await telemetry +flushing before the final HTTP body message. Flushing runs off the event loop, +not before the first stream event. Disconnects and cancellation still perform +cleanup and await the Core flush; no exporter work is fire-and-forget. +Non-streaming requests continue to await flushing before returning. + +For non-stored streams, the request owns one producer task, including when +keep-alives are disabled. It closes the pipeline and developer iterator and +awaits asynchronous handler cleanup before orchestration finalization and +flushing. Handler iteration advances only after the preceding event is sent. +Stored and background producers remain independent of the HTTP connection; +closing a disconnected request must not close those producers. + +Event normalization can reuse a privately owned coerced event. Validation still +runs before the event is appended. Public events and response snapshots remain +detached from handler input, completed items, and recovery seeds. Builder +initialization copies the mutable fields it retains rather than unrelated +request fields. + +## Generated model loading + +Public generated models remain real `TypedDict` classes with their canonical +module, name, annotations, dictionary constructors, and pickle identity. Model +classes and aliases are constructed on first access under a shared reentrant +lock. Explicit imports, introspection, and star imports can therefore construct +additional types; internal annotations use module references without requiring +those types at import time. + +`make generate-models` invokes `_scripts/extract_model_contracts.py`, whose +finalization stage runs `_scripts/lazy_model_emitter.py`. The checked-in output +retains the canonical emitter declarations in a `TYPE_CHECKING` block. Do not +edit generated factories directly. After generation, verify deterministic +post-emitter output from the package directory: + +```console +python _scripts/lazy_model_emitter.py --generated-root azure/ai/agentserver/responses/models/_generated --check +``` + +The generator tests cover extraction integration and reproducibility. The +model contract tests cover lazy access, exports, type hints, dictionary +construction, and pickle resolution. diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_eager_history_prefetch.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_eager_history_prefetch.py index 7ef59e6e211b..c0c89cc66963 100644 --- a/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_eager_history_prefetch.py +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_eager_history_prefetch.py @@ -13,6 +13,7 @@ from __future__ import annotations from typing import Any +from unittest.mock import AsyncMock import pytest from starlette.testclient import TestClient @@ -220,6 +221,71 @@ async def _counting_wrapper(*args: Any, **kwargs: Any) -> list[str]: f"Expected get_history_item_ids to be called once (eager), " f"but called {call_count} times" ) + @pytest.mark.parametrize("history_ids", [[], ["history_item"]]) + @pytest.mark.parametrize("background", [False, True]) + def test_stored_stream_reuses_request_local_prefetch( + self, monkeypatch: pytest.MonkeyPatch, history_ids: list[str], background: bool + ) -> None: + provider = InMemoryResponseProvider() + history = AsyncMock(return_value=history_ids) + create = AsyncMock(wraps=provider.create_response) + monkeypatch.setattr(provider, "get_history_item_ids", history) + monkeypatch.setattr(provider, "create_response", create) + app = ResponsesAgentServerHost(options=ResponsesServerOptions(resilient_background=False), store=provider) + app.response_handler(_simple_handler) + client = TestClient(app) + previous = IdGenerator.new_response_id() + for user in ("user-one", "user-two"): + response = client.post( + "/responses", + json={ + "model": "m", + "input": "hi", + "previous_response_id": previous, + "store": True, + "stream": True, + "background": background, + }, + headers={"x-agent-user-id": user}, + ) + assert response.status_code == 200 + assert "response.completed" in response.text + history.assert_awaited_once() + assert history.await_args.kwargs["context"].user_id_key == user + assert create.await_args.args[2] == history_ids + history.reset_mock() + create.reset_mock() + + def test_missing_stream_reference_fails_before_handler(self, monkeypatch: pytest.MonkeyPatch) -> None: + provider = InMemoryResponseProvider() + history = AsyncMock(side_effect=FoundryResourceNotFoundError("missing reference")) + create = AsyncMock() + handler_called = False + + async def handler(request: Any, context: Any, cancellation_signal: Any) -> Any: + nonlocal handler_called + handler_called = True + return await _simple_handler(request, context, cancellation_signal) + + monkeypatch.setattr(provider, "get_history_item_ids", history) + monkeypatch.setattr(provider, "create_response", create) + app = ResponsesAgentServerHost(options=ResponsesServerOptions(resilient_background=False), store=provider) + app.response_handler(handler) + response = TestClient(app).post( + "/responses", + json={ + "model": "m", + "input": "hi", + "previous_response_id": IdGenerator.new_response_id(), + "store": True, + "stream": True, + }, + ) + assert response.status_code == 404 + history.assert_awaited_once() + assert not handler_called + create.assert_not_awaited() + class TestEagerHistoryPrefetchSkipped: """Verify that the prefetch is skipped when no conversation refs exist.""" diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_history_storage_pull_counts.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_history_storage_pull_counts.py new file mode 100644 index 000000000000..80b59cef1379 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/contract/test_history_storage_pull_counts.py @@ -0,0 +1,79 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""All POST modes reuse one validated ID lookup, without dropping storage writes.""" + +import asyncio +import threading +from unittest.mock import AsyncMock + +import pytest +from starlette.testclient import TestClient + +from azure.ai.agentserver.responses import ResponsesAgentServerHost, ResponsesServerOptions +from azure.ai.agentserver.responses._id_generator import IdGenerator +from azure.ai.agentserver.responses.store._file import FileResponseStore +from azure.ai.agentserver.responses.streaming import ResponseEventStream + + +@pytest.mark.parametrize("streaming", [False, True]) +@pytest.mark.parametrize("background", [False, True]) +@pytest.mark.parametrize("resilient", [False, True]) +@pytest.mark.parametrize("empty", [False, True]) +@pytest.mark.parametrize("read_history", [False, True]) +def test_all_modes_share_history_ids_and_keep_materialization_scoped( + monkeypatch, tmp_path, streaming, background, resilient, empty, read_history +): + provider = FileResponseStore(tmp_path / "responses") + history = AsyncMock(return_value=[] if empty else ["history"]) + items = AsyncMock(return_value=[]) + create = AsyncMock(wraps=provider.create_response) + update = AsyncMock(wraps=provider.update_response) + finished = threading.Event() + monkeypatch.setattr(provider, "get_history_item_ids", history) + monkeypatch.setattr(provider, "get_items", items) + monkeypatch.setattr(provider, "create_response", create) + + async def terminal_update(*args, **kwargs): + await update(*args, **kwargs) + finished.set() + + monkeypatch.setattr(provider, "update_response", terminal_update) + app = ResponsesAgentServerHost( + options=ResponsesServerOptions(resilient_background=resilient), + store=provider, + ) + + async def handler(request, context, cancellation_signal): + if read_history: + histories = await asyncio.gather(context.get_history(), context.get_history()) + assert histories[0] is histories[1] + events = ResponseEventStream(response_id=context.response_id, model="m") + yield events.emit_created() + yield events.emit_completed() + + app.response_handler(handler) + with TestClient(app) as client: + response = client.post( + "/responses", + json={ + "model": "m", + "input": "hi", + "previous_response_id": IdGenerator.new_response_id(), + "stream": streaming, + "background": background, + "store": True, + }, + headers={"x-agent-user-id": "user", "x-agent-foundry-call-id": "call"}, + ) + assert response.status_code == 200 + if streaming: + assert "response.completed" in response.text + if background: + assert finished.wait(5), "background terminal write did not complete" + history.assert_awaited_once() + assert history.await_args.kwargs["context"].user_id_key == "user" + assert history.await_args.kwargs["context"].call_id == "call" + assert items.await_count == (1 if read_history and not empty else 0) + create.assert_awaited_once() + assert create.await_args.args[2] == ([] if empty else ["history"]) + update.assert_awaited_once() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_event_copy_reuse.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_event_copy_reuse.py new file mode 100644 index 000000000000..5f97082c478e --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_event_copy_reuse.py @@ -0,0 +1,420 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Ownership and deterministic work bounds for event normalization and seeding.""" + +from __future__ import annotations + +import asyncio +from collections import UserDict +from copy import deepcopy +from datetime import datetime, timezone +import json +from unittest.mock import patch + +import pytest + +from azure.ai.agentserver.responses import ResponsesAgentServerHost, ResponsesServerOptions +from azure.ai.agentserver.responses.hosting import _orchestrator +from azure.ai.agentserver.responses.hosting._execution_context import _ExecutionContext +from azure.ai.agentserver.responses.store._memory import InMemoryResponseProvider +from azure.ai.agentserver.responses.streaming import _internals +from azure.ai.agentserver.responses.streaming._event_stream import ResponseEventStream +from azure.ai.agentserver.responses.streaming._text_response import TextResponse + + +class _CountedTree(dict): + """Retain traversal instrumentation across copies, without sharing payloads.""" + + visits: list[str] = [] + + def __deepcopy__(self, memo): + self.visits.append(self["label"]) + result = type(self)() + memo[id(self)] = result + result.update(deepcopy(dict(self), memo)) + return result + + +def _item(): + return { + "id": "msg_copy_reuse", + "type": "message", + "role": "assistant", + "status": "completed", + "content": [{"type": "output_text", "text": "echo", "annotations": []}], + } + + +def test_completed_item_uses_one_copy_and_detaches_both_directions(): + item = _item() + event = {"type": "response.output_item.done", "output_index": 2, "item": item} + response = {"output": ["retained"]} + with patch.object(_internals, "deepcopy", wraps=deepcopy) as copies: + _internals.track_completed_output_item(response, event) + assert copies.call_count == 1 + assert response["output"] == ["retained", None, item] + event["item"]["content"][0]["text"] = "raw mutation" + assert response["output"][2]["content"][0]["text"] == "echo" + response["output"][2]["content"][0]["annotations"].append({"extra": True}) + assert item["content"][0]["annotations"] == [] + + +@pytest.mark.parametrize("index,item", [(-1, {}), ("0", {}), (None, {}), (0, None), (0, UserDict())]) +def test_completed_item_invalid_values_do_not_change_response(index, item): + response = {"output": ("untouched",)} + with patch.object(_internals, "deepcopy", wraps=deepcopy) as copies: + _internals.track_completed_output_item( + response, {"type": "response.output_item.done", "output_index": index, "item": item} + ) + assert copies.call_count == 0 + assert response == {"output": ("untouched",)} + + +@pytest.mark.parametrize("index", [0, 3, False, True]) +def test_completed_item_retains_sparse_and_bool_index_semantics(index): + response = {"output": None} + _internals.track_completed_output_item( + response, {"type": "response.output_item.done", "output_index": index, "item": {"nested": []}} + ) + assert response == {"output": [None] * index + [{"nested": []}]} + before = deepcopy(response) + _internals.track_completed_output_item(response, {"type": "response.output_item.added", "output_index": 0}) + assert response == before + + +def test_extract_fields_does_not_copy_unrelated_graph(): + response = { + "model": "echo", + "agent_reference": UserDict({"name": "agent", "extension": {"versions": ["1"]}}), + "output": [_CountedTree(label="output", nested=[{}])], + } + _CountedTree.visits = [] + reference, model = _internals.extract_response_fields(response) + assert _CountedTree.visits == [] + assert model == "echo" + assert type(reference) is dict + reference["extension"]["versions"].append("2") + assert response["agent_reference"]["extension"]["versions"] == ["1"] + response["agent_reference"]["extension"]["versions"].append("3") + assert reference["extension"]["versions"] == ["1", "2"] + + +def test_request_seeding_copies_only_used_mutable_fields(): + reference = {"type": "agent_reference", "name": "agent", "extension": {"versions": ["1"]}} + request = { + "input": [_CountedTree(label="input", content=[{"text": "unused"}])], + "tools": [_CountedTree(label="tools", parameters={"properties": {}})], + "metadata": {"origin": "request"}, + "background": True, + "previous_response_id": "resp_previous", + "conversation": {"id": "conv_seed"}, + "model": "echo", + "agent_reference": reference, + } + _CountedTree.visits = [] + stream = ResponseEventStream(response_id="resp_copy_reuse", request=request) + assert _CountedTree.visits == [] + request["metadata"]["origin"] = "raw mutation" + reference["extension"]["versions"].append("raw") + request["conversation"]["id"] = "conv_raw" + assert stream.response["metadata"] == {"origin": "request"} + assert stream.response["conversation"] == {"id": "conv_seed"} + assert stream.response["background"] is True + assert stream.response["previous_response_id"] == "resp_previous" + assert stream.response["model"] == "echo" + assert stream.response["agent_reference"]["extension"]["versions"] == ["1"] + stream.response["agent_reference"]["extension"]["versions"].append("live") + assert stream._agent_reference["extension"]["versions"] == ["1"] + stream._agent_reference["extension"]["versions"].append("cached") + assert stream.response["agent_reference"]["extension"]["versions"] == ["1", "live"] + assert reference["extension"]["versions"] == ["1", "raw"] + + +def test_recovery_seed_is_copied_once_and_remains_independent(): + item = _CountedTree(_item(), label="seed-output") + seed = { + "id": "resp_recovered_copy", + "output": [item], + "model": "echo", + "created_at": datetime(2026, 9, 1, tzinfo=timezone.utc), + "metadata": {"origin": "seed"}, + "agent_reference": {"type": "agent_reference", "name": "agent", "extension": {"versions": ["1"]}}, + "extension": ({"values": [1]},), + } + _CountedTree.visits = [] + stream = ResponseEventStream(response=seed) + assert _CountedTree.visits == ["seed-output"] + created = stream.emit_created() + assert created["response"]["created_at"] == int(seed["created_at"].timestamp()) + assert created["response"]["extension"] == [{"values": [1]}] + assert stream.response["extension"] == ({"values": [1]},) + seed["output"][0]["content"][0]["text"] = "seed mutation" + seed["metadata"]["origin"] = "seed mutation" + seed["agent_reference"]["extension"]["versions"].append("seed") + assert stream.response["output"][0]["content"][0]["text"] == "echo" + assert stream.response["metadata"] == {"origin": "seed"} + stream.response["output"][0]["content"][0]["text"] = "live mutation" + stream.response["extension"][0]["values"].append(2) + stream.response["agent_reference"]["extension"]["versions"].append("live") + assert seed["extension"][0]["values"] == [1] + assert created["response"]["output"][0]["content"][0]["text"] == "echo" + created["response"]["agent_reference"]["extension"]["versions"].append("emitted") + assert stream._agent_reference["extension"]["versions"] == ["1"] + message = stream.add_output_item_message() + added = message.emit_added() + assert added["output_index"] == 1 + assert added["item"]["agent_reference"]["extension"]["versions"] == ["1"] + added["item"]["agent_reference"]["extension"]["versions"].append("added") + assert stream._agent_reference["extension"]["versions"] == ["1"] + + +def test_seeding_preserves_aliases_within_the_detached_response_graph(): + shared = {"values": [1]} + seed = {"id": "resp_alias", "output": [], "left": shared, "right": shared} + stream = ResponseEventStream(response=seed) + assert stream.response["left"] is stream.response["right"] + assert stream.response["left"] is not shared + stream.response["left"]["values"].append(2) + assert seed["left"]["values"] == [1] + + +def test_mapping_acceptance_and_constructor_overrides_are_unchanged(): + mapping = UserDict({"id": "resp_mapping", "model": "ignored", "metadata": {"origin": "ignored"}}) + assert _internals.coerce_model_mapping(mapping) is None + assert _internals.extract_response_fields(mapping) == (None, None) + with pytest.raises(ValueError, match="response_id is required"): + ResponseEventStream(response=mapping) + stream = ResponseEventStream(response_id="resp_explicit", request=mapping) + assert "model" not in stream.response + assert "metadata" not in stream.response + with pytest.raises(ValueError, match="cannot both"): + ResponseEventStream(response_id="resp_explicit", request={}, response={}) + reference = UserDict({"type": "agent_reference", "name": "override", "extension": {"values": []}}) + stream = ResponseEventStream( + response_id="resp_override", + response={"id": "resp_seed", "model": "seed"}, + model="override", + agent_reference=reference, + ) + assert stream.response["id"] == "resp_override" + assert stream.response["model"] == "override" + assert isinstance(stream.response["agent_reference"], UserDict) + reference["extension"]["values"].append("raw") + assert stream.response["agent_reference"]["extension"]["values"] == [] + assert type(stream._agent_reference) is dict + for model in (None, "", 3): + assert _internals.extract_response_fields({"model": model, "agent_reference": []}) == (None, None) + + +def test_materialization_and_remaining_copy_boundaries_are_unchanged(): + stream = ResponseEventStream(response_id="resp_materialize") + mutable_mapping = UserDict({"values": [1]}) + when = datetime(2026, 9, 1, tzinfo=timezone.utc) + stream.response["extension"] = { + "generated": ({"at": when, "tuple": (1, 2)} for _ in range(1)), + "mapping": mutable_mapping, + } + created = stream.emit_created() + assert created["response"]["extension"]["generated"] == [{"at": int(when.timestamp()), "tuple": [1, 2]}] + assert isinstance(created["response"]["extension"]["mapping"], UserDict) + created["response"]["extension"]["mapping"]["values"].append(2) + assert mutable_mapping["values"] == [1] + assert list(stream.response["extension"]["generated"]) == [] + generator = (value for value in [1]) + try: + with pytest.raises(TypeError): + ResponseEventStream(response={"id": "resp_generator", "output": generator}) + finally: + generator.close() + + +def _pipeline(): + orchestrator = object.__new__(_orchestrator._ResponseOrchestrator) + orchestrator._runtime_options = ResponsesServerOptions(resilient_background=False) + orchestrator._shutdown_event = None + ctx = _ExecutionContext( + response_id="resp_copy_reuse", + agent_reference={"type": "agent_reference", "name": "agent"}, + model="echo", + store=False, + background=False, + stream=True, + input_items=[], + previous_response_id=None, + conversation_id=None, + cancellation_signal=asyncio.Event(), + span=None, + parsed={}, + ) + return orchestrator, ctx, _orchestrator._PipelineState() + + +async def _iterate(events): + for event in events: + yield event + + +def _echo_events(): + stream = ResponseEventStream(response_id="resp_copy_reuse") + message = stream.add_output_item_message() + text = message.add_text_content() + return stream, [ + stream.emit_created(), + stream.emit_in_progress(), + message.emit_added(), + text.emit_added(), + text.emit_delta("echo"), + text.emit_text_done(), + text.emit_done(), + message.emit_done(), + stream.emit_completed(), + ] + + +@pytest.mark.asyncio +async def test_drain_coerces_each_event_once_without_changing_output_or_raw_ownership(): + stream, raw = _echo_events() + original = deepcopy(raw) + orchestrator, ctx, state = _pipeline() + _, _, comparator = _pipeline() + expected = [await orchestrator._normalize_and_append(ctx, comparator, event) for event in raw] + with patch.object(_orchestrator, "_coerce_handler_event", wraps=_orchestrator._coerce_handler_event) as copies: + first = await orchestrator._normalize_and_append(ctx, state, raw[0]) + emitted = [first] + [ + event async for event in orchestrator._drain_remaining_events(ctx, state, _iterate(raw[1:])) + ] + assert copies.call_count == len(raw) == 9 + assert emitted + [state.pending_terminal] == expected + assert state.handler_events == expected + assert state.next_seq == 9 + assert raw == original + emitted[2]["item"]["content"].append({"mutated": "emitted"}) + assert raw[2]["item"]["content"] == [] + raw[-2]["item"]["content"][0]["text"] = "raw mutation" + assert emitted[-1]["item"]["content"][0]["text"] == "echo" + assert stream.response["output"][0]["content"][0]["text"] == "echo" + + +@pytest.mark.asyncio +async def test_reused_raw_dict_is_snapshotted_at_each_normalization(): + orchestrator, ctx, state = _pipeline() + stream = ResponseEventStream(response_id=ctx.response_id) + raw = stream.emit_created() + await orchestrator._normalize_and_append(ctx, state, raw) + raw.clear() + raw.update(stream.emit_in_progress()) + emitted = [event async for event in orchestrator._drain_remaining_events(ctx, state, _iterate([raw]))] + raw["response"]["status"] = "raw mutation" + assert state.handler_events[0]["type"] == "response.created" + assert state.handler_events[0]["response"]["status"] != "raw mutation" + assert emitted[0]["response"]["status"] == "in_progress" + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + "bad", + [ + {"type": "response.completed", "response": {"output": [_item()]}}, + {"type": "response.completed", "response": {"output": [_item()], "status": 123}}, + {"type": "response.completed", "response": "not a snapshot"}, + {"type": "response.output_item.added", "output_index": None, "item": _item()}, + {"type": "response.output_item.added", "output_index": 0}, + {"type": ""}, + ], +) +async def test_bad_event_rejected_before_pipeline_state_advances(bad): + orchestrator, ctx, state = _pipeline() + first = ResponseEventStream(response_id=ctx.response_id).emit_created() + await orchestrator._normalize_and_append(ctx, state, first) + prior = deepcopy(state.handler_events) + next_seq = state.next_seq + failed = {"type": "response.failed"} + + async def make_failed(_ctx, checked_state): + assert checked_state.handler_events == prior + assert checked_state.next_seq == next_seq + assert checked_state.captured_error is not None + return failed + + with patch.object(orchestrator, "_make_failed_event", side_effect=make_failed) as rejection: + emitted = [event async for event in orchestrator._drain_remaining_events(ctx, state, _iterate([bad]))] + assert emitted == [] + assert rejection.call_count == 1 + assert state.pending_terminal is failed + assert state.handler_events == prior + + +@pytest.mark.asyncio +async def test_recovered_output_count_and_sequence_baseline_are_preserved(): + orchestrator, ctx, state = _pipeline() + stream = ResponseEventStream(response={"id": ctx.response_id, "output": [_item()]}) + raw = [stream.emit_created(), stream.emit_in_progress(), stream.emit_completed()] + state.next_seq = 12 + await orchestrator._normalize_and_append(ctx, state, raw[0]) + emitted = [event async for event in orchestrator._drain_remaining_events(ctx, state, _iterate(raw[1:]), 1)] + assert state.captured_error is None + assert [event["sequence_number"] for event in state.handler_events] == [12, 13, 14] + assert emitted[0]["response"]["output"] == [_item()] + assert state.pending_terminal["type"] == "response.completed" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("store", [False, True]) +async def test_foreground_echo_asgi_uses_nine_coercions(store): + raw_events = [] + host = ResponsesAgentServerHost( + options=ResponsesServerOptions(resilient_background=False), + store=InMemoryResponseProvider(), + configure_observability=None, + ) + + @host.response_handler + async def echo(request, context, cancellation_signal): + async for event in TextResponse(context, request, text="echo"): + raw_events.append(event) + yield event + + body = json.dumps({"input": "echo", "model": "echo", "stream": True, "store": store}).encode() + sent = False + messages = [] + + async def receive(): + nonlocal sent + if not sent: + sent = True + return {"type": "http.request", "body": body, "more_body": False} + await asyncio.Event().wait() + + async def send(message): + messages.append(message) + + scope = { + "type": "http", + "asgi": {"version": "3.0", "spec_version": "2.4"}, + "http_version": "1.1", + "method": "POST", + "scheme": "http", + "path": "/responses", + "raw_path": b"/responses", + "query_string": b"", + "root_path": "", + "headers": [(b"content-type", b"application/json")], + "server": ("testserver", 80), + "client": ("127.0.0.1", 12345), + } + with patch.object(_orchestrator, "_coerce_handler_event", wraps=_orchestrator._coerce_handler_event) as copies: + async with host.router.lifespan_context(host): + await asyncio.wait_for(host(scope, receive, send), timeout=15) + events = [ + json.loads(line[5:].strip()) + for line in b"".join(message.get("body", b"") for message in messages).decode().splitlines() + if line.startswith("data:") and line[5:].strip() != "[DONE]" + ] + assert messages[0]["status"] == 200 + assert not messages[-1].get("more_body", False) + assert len(events) == len(raw_events) == copies.call_count == 9 + assert [event["type"] for event in events] == [event["type"] for event in raw_events] + assert [event["sequence_number"] for event in events] == list(range(9)) + assert events[-1]["type"] == "response.completed" + assert events[-1]["response"]["output"][0]["content"][0]["text"] == "echo" + assert events[-1]["response"]["output"] == raw_events[-1]["response"]["output"] diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_generated_model_qualification.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_generated_model_qualification.py new file mode 100644 index 000000000000..baf30690937f --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_generated_model_qualification.py @@ -0,0 +1,34 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Guard: no responses module may import generated model types eagerly. + +Enforces the lazy module-alias pattern applied once by +``_scripts/qualify_model_references.py`` so new changes cannot reintroduce +import-time TypedDict construction (cold-start cost). An eager +``from ..models._generated import ResponseObject`` triggers the models package +``__getattr__`` and builds that TypedDict at import; the allowed form binds only +the module (``from ..models import _generated as _generated_models``) and +references types as attributes, constructing nothing at import. + +Runs the codemod's ``--check`` mode as a subprocess so this rides the existing +unit-test CI with no pipeline changes and no runtime/import cost. +""" +import subprocess +import sys +from pathlib import Path + +_SCRIPT = Path(__file__).resolve().parents[2] / "_scripts" / "qualify_model_references.py" + + +def test_no_eager_generated_model_imports(): + result = subprocess.run( + [sys.executable, str(_SCRIPT), "--check"], + capture_output=True, + text=True, + check=False, + ) + assert result.returncode == 0, ( + "Eager generated-model imports detected. Use the lazy module alias, e.g. " + "`from ..models import _generated as _generated_models`, and reference types as " + f"`_generated_models.`.\nstdout:\n{result.stdout}\nstderr:\n{result.stderr}" + ) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_input_singleflight.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_input_singleflight.py new file mode 100644 index 000000000000..8dfc058c47ec --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_input_singleflight.py @@ -0,0 +1,225 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Request-local concurrency contracts for input materialization.""" + +from __future__ import annotations + +import asyncio +from typing import Any, cast +from unittest.mock import AsyncMock + +import pytest + +from azure.ai.agentserver.responses._response_context import PlatformContext, ResponseContext +from azure.ai.agentserver.responses.models import CreateResponse +from azure.ai.agentserver.responses.models.runtime import ResponseModeFlags + + +def _message(item_id: str, text: str = "resolved") -> dict[str, Any]: + return {"id": item_id, "type": "message", "role": "user", "content": [{"type": "input_text", "text": text}]} + + +def _context(provider: Any, *, identity: PlatformContext | None = None) -> ResponseContext: + return ResponseContext( + response_id="resp_singleflight", + mode_flags=ResponseModeFlags(stream=True, store=True, background=False), + request=cast(CreateResponse, {"input": [{"type": "item_reference", "id": "item_ref"}]}), + provider=provider, + platform_context=identity, + ) + + +class _ControlledProvider: + def __init__(self) -> None: + self.started = asyncio.Event() + self.release = asyncio.Event() + self.get_items = AsyncMock(side_effect=self._read) + + async def _read(self, item_ids: list[str], *, context: PlatformContext) -> list[dict[str, Any]]: + self.started.set() + await self.release.wait() + return [_message(item_id) for item_id in item_ids] + + +@pytest.mark.asyncio +async def test_concurrent_public_readers_and_persistence_share_one_batch() -> None: + provider = _ControlledProvider() + ctx = _context(provider) + first = asyncio.create_task(ctx.get_input_items()) + await asyncio.wait_for(provider.started.wait(), 5) + text = asyncio.create_task(ctx.get_input_text()) + persisted = asyncio.create_task(ctx._get_input_items_for_persistence()) + try: + await asyncio.sleep(0) + assert provider.get_items.await_count == 1 + finally: + provider.release.set() + results = await asyncio.gather(first, text, persisted) + + assert len(results[0]) == len(results[2]) == 1 + assert results[1] == "resolved" + provider.get_items.assert_awaited_once_with(["item_ref"], context=ctx.platform_context) + assert await ctx.get_input_items() is results[0] + + +@pytest.mark.asyncio +async def test_cancelled_waiter_does_not_cancel_owner_or_publish_partial_result() -> None: + provider = _ControlledProvider() + ctx = _context(provider) + owner = asyncio.create_task(ctx.get_input_items()) + await asyncio.wait_for(provider.started.wait(), 5) + waiter = asyncio.create_task(ctx.get_input_items()) + try: + await asyncio.sleep(0) + waiter.cancel() + with pytest.raises(asyncio.CancelledError): + await waiter + assert not owner.done() + finally: + provider.release.set() + result = await owner + + assert await ctx.get_input_items() is result + assert provider.get_items.await_count == 1 + + +@pytest.mark.asyncio +async def test_cancelled_owner_releases_waiter_to_retry() -> None: + provider = _ControlledProvider() + ctx = _context(provider) + owner = asyncio.create_task(ctx.get_input_items()) + await asyncio.wait_for(provider.started.wait(), 5) + waiter = asyncio.create_task(ctx.get_input_items()) + try: + await asyncio.sleep(0) + owner.cancel() + with pytest.raises(asyncio.CancelledError): + await owner + finally: + provider.release.set() + result = await asyncio.wait_for(waiter, 5) + + assert len(result) == 1 + assert provider.get_items.await_count == 2 + assert await ctx.get_input_items() is result + + +@pytest.mark.asyncio +async def test_failed_owner_releases_waiter_to_retry() -> None: + started = asyncio.Event() + release = asyncio.Event() + + async def fail(*args: Any, **kwargs: Any) -> None: + started.set() + await release.wait() + raise RuntimeError("storage unavailable") + + provider = AsyncMock() + provider.get_items.side_effect = fail + ctx = _context(provider) + owner = asyncio.create_task(ctx.get_input_items()) + await asyncio.wait_for(started.wait(), 5) + waiter = asyncio.create_task(ctx.get_input_items()) + try: + await asyncio.sleep(0) + provider.get_items.side_effect = None + provider.get_items.return_value = [_message("item_ref")] + finally: + release.set() + with pytest.raises(RuntimeError, match="storage unavailable"): + await owner + result = await asyncio.wait_for(waiter, 5) + + assert len(result) == 1 + assert provider.get_items.await_count == 2 + assert await ctx.get_input_items() is result + + +@pytest.mark.asyncio +@pytest.mark.parametrize("items", [[], [None]]) +async def test_successful_empty_materialization_is_reused(items: list[Any]) -> None: + provider = AsyncMock() + provider.get_items.return_value = items + ctx = _context(provider) + + first, second = await asyncio.gather(ctx.get_input_items(), ctx.get_input_items()) + + assert first == second == () + provider.get_items.assert_awaited_once() + + +@pytest.mark.asyncio +@pytest.mark.parametrize("same_identity", [False, True]) +async def test_different_request_contexts_never_share_materialization(same_identity: bool) -> None: + provider = _ControlledProvider() + first_identity = PlatformContext(user_id_key="user-a", call_id="call-a") + second_identity = first_identity if same_identity else PlatformContext(user_id_key="user-b", call_id="call-b") + first_ctx = _context(provider, identity=first_identity) + second_ctx = _context(provider, identity=second_identity) + first = asyncio.create_task(first_ctx.get_input_items()) + second = asyncio.create_task(second_ctx.get_input_items()) + try: + await asyncio.wait_for(provider.started.wait(), 5) + await asyncio.sleep(0) + assert provider.get_items.await_count == 2 + finally: + provider.release.set() + results = await asyncio.gather(first, second) + + assert results[0] is not results[1] + assert provider.get_items.await_args_list[0].kwargs["context"] is first_identity + assert provider.get_items.await_args_list[1].kwargs["context"] is second_identity + + +@pytest.mark.asyncio +async def test_unresolved_mode_does_not_wait_for_reference_fetch() -> None: + provider = _ControlledProvider() + ctx = _context(provider) + resolved = asyncio.create_task(ctx.get_input_items()) + await asyncio.wait_for(provider.started.wait(), 5) + try: + unresolved = await asyncio.wait_for(ctx.get_input_items(resolve_references=False), 5) + assert unresolved[0]["type"] == "item_reference" + assert not resolved.done() + finally: + provider.release.set() + result = await resolved + + assert result[0]["type"] == "message" + assert provider.get_items.await_count == 1 + + +@pytest.mark.asyncio +async def test_shared_result_preserves_cached_mutation_semantics() -> None: + provider = AsyncMock() + provider.get_items.return_value = [_message("item_ref")] + ctx = _context(provider) + result = await ctx.get_input_items() + result[0]["content"][0]["text"] = "handler mutation" # type: ignore[index] + + assert await ctx.get_input_text() == "handler mutation" + provider.get_items.assert_awaited_once() + + +@pytest.mark.asyncio +async def test_order_duplicates_and_missing_reference_behavior_is_unchanged() -> None: + provider = AsyncMock() + provider.get_items.return_value = [_message("duplicate"), None, _message("duplicate")] + ctx = _context(provider) + ctx.request = cast( + CreateResponse, + { + "input": [ + _message("inline", "inline"), + {"type": "item_reference", "id": "duplicate"}, + {"type": "item_reference", "id": "missing"}, + {"type": "item_reference", "id": "duplicate"}, + ] + }, + ) + + result, text = await asyncio.gather(ctx.get_input_items(), ctx.get_input_text()) + + assert [item["id"] for item in result] == ["inline", "duplicate", "duplicate"] # type: ignore[typeddict-item] + assert text == "inline\nresolved\nresolved" + provider.get_items.assert_awaited_once_with(["duplicate", "missing", "duplicate"], context=ctx.platform_context) diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_lazy_generated_models.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_lazy_generated_models.py new file mode 100644 index 000000000000..fbdbc2c5275d --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_lazy_generated_models.py @@ -0,0 +1,198 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +# cspell:ignore cazure +"""Real-model lazy construction contracts. Functional tests, not hosted latency evidence.""" + +from pathlib import Path +import os +import subprocess +import sys + +import pytest + + +def _fresh(code): + import azure.ai.agentserver.responses as responses + + package_root = Path(responses.__file__).resolve().parents[4] + env = os.environ.copy() + env["PYTHONPATH"] = os.pathsep.join(filter(None, (str(package_root), env.get("PYTHONPATH")))) + env["PYTHONDONTWRITEBYTECODE"] = "1" + result = subprocess.run( + [sys.executable, "-B", "-c", code], + cwd=package_root, + env=env, + capture_output=True, + text=True, + timeout=30, + ) + assert result.returncode == 0, result.stdout + result.stderr + + +def test_echo_imports_construct_only_needed_real_types(): + _fresh(""" +from typing_extensions import is_typeddict +from azure.ai.agentserver.responses import CreateResponse, ResponseContext, ResponsesAgentServerHost, TextResponse +from azure.ai.agentserver.responses.models._generated import types +loaded=[name for name,value in vars(types).items() if not name.startswith('_') and is_typeddict(value)] +assert len(loaded) <= 3, loaded +assert is_typeddict(CreateResponse) +assert CreateResponse.__module__ == types.__name__ +assert CreateResponse.__qualname__ == 'CreateResponse' +assert CreateResponse(model='m', input='hi') == {'model':'m','input':'hi'} +""") + + +def test_public_type_hints_and_cold_pickle_resolution(): + _fresh(""" +import pickle, typing +from azure.ai.agentserver.responses import CreateResponse +from azure.ai.agentserver.responses.models._generated import types +# A normal GLOBAL pickle reference produced by the original class's canonical name. +blob=b'cazure.ai.agentserver.responses.models._generated.types\\nResponseObject\\n.' +cls=pickle.loads(blob) +assert cls is types.ResponseObject +assert pickle.loads(pickle.dumps(cls)) is cls +assert cls.__qualname__ == 'ResponseObject' +assert typing.get_type_hints(CreateResponse)['model'] is str +assert typing.get_type_hints(cls)['model'] is str +assert 'id' in cls.__required_keys__ +""") + + +def test_star_dir_and_original_constructor_behavior(): + _fresh(""" +import ast +from pathlib import Path +from typing_extensions import is_typeddict +import azure.ai.agentserver.responses.models as models +from azure.ai.agentserver.responses.models._generated import types +names=set(dir(types)) +assert {'CreateResponse','ResponseObject','OpenApiTool','ResponseCreatedEvent'} <= names +assert 'OpenApiTool' not in vars(types) +exports={} +exec('from azure.ai.agentserver.responses.models import *', exports) +for name in models.__all__: + assert exports[name] is getattr(models,name) +exec('from azure.ai.agentserver.responses.models._generated.types import *', exports) +tree = ast.parse(Path(types.__file__).read_text(encoding='utf-8')) +contract = next(node for node in tree.body if isinstance(node, ast.If)) +expected = {node.name for node in contract.body if isinstance(node, ast.ClassDef)} +actual = {name for name,value in vars(types).items() if not name.startswith('_') and is_typeddict(value)} +assert actual == expected +assert types.OpenApiTool(type='openapi') == {'type':'openapi'} +try: + types.no_such_contract +except AttributeError: + pass +else: + raise AssertionError('invalid export accepted') +""") + + +def test_concurrent_model_access_preserves_canonical_identity(): + _fresh(""" +from concurrent.futures import ThreadPoolExecutor +import pickle +import threading +import typing +from typing_extensions import is_typeddict +from azure.ai.agentserver.responses import models +from azure.ai.agentserver.responses.models import _generated +from azure.ai.agentserver.responses.models._generated import types +names = ['CreateResponse', 'ResponseObject', 'Item', 'OutputItem'] * 2 +barrier = threading.Barrier(len(names)) +def load(name): + barrier.wait(timeout=10) + value = getattr(types, name) + assert value is getattr(types, name) + assert value is getattr(_generated, name) + assert value is getattr(models, name) + restored = pickle.loads(pickle.dumps(value)) + if name in ('CreateResponse', 'ResponseObject'): + assert is_typeddict(value) + assert restored is value + else: + assert typing.get_origin(value) is typing.Union + assert restored == value + assert typing.get_origin(restored) is typing.get_origin(value) + assert typing.get_args(restored) == typing.get_args(value) + return value +with ThreadPoolExecutor(max_workers=len(names)) as pool: + results = list(pool.map(load, names)) +assert all(results[index] is results[index + 4] for index in range(4)) +""") + + +def test_model_pickle_contracts_survive_typing_cache_pressure(): + _fresh(""" +import pickle +import typing +from typing_extensions import is_typeddict +from azure.ai.agentserver.responses import models +from azure.ai.agentserver.responses.models import _generated +from azure.ai.agentserver.responses.models._generated import types + +names = ('CreateResponse', 'ResponseObject', 'Item', 'OutputItem') +originals = {name: getattr(types, name) for name in names} +payloads = {name: pickle.dumps(value) for name, value in originals.items()} +# Exercise typing's caches using only public APIs. Union reconstruction promises +# equivalent types, not object identity, whether a cache entry survives or not. +pressure = [typing.Union[typing.Literal[index], bytes] for index in range(2048)] +assert len(pressure) == 2048 +for name, value in originals.items(): + restored = pickle.loads(payloads[name]) + assert getattr(types, name) is value + assert getattr(_generated, name) is value + assert getattr(models, name) is value + if name in ('CreateResponse', 'ResponseObject'): + assert is_typeddict(value) + assert restored is value + else: + assert typing.get_origin(value) is typing.Union + assert restored == value + assert typing.get_origin(restored) is typing.get_origin(value) + assert typing.get_args(restored) == typing.get_args(value) +""") + + +def test_generated_output_is_reproducible(): + import importlib.util + + package = Path(__file__).resolve().parents[2] + script = package / "_scripts" / "lazy_model_emitter.py" + spec = importlib.util.spec_from_file_location("lazy_model_emitter_test", script) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + module.emit(package / "azure" / "ai" / "agentserver" / "responses" / "models" / "_generated", check=True) + + +def test_generator_rejects_unsupported_class_semantics(): + import importlib.util + + script = Path(__file__).resolve().parents[2] / "_scripts" / "lazy_model_emitter.py" + spec = importlib.util.spec_from_file_location("lazy_model_emitter_rejection_test", script) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + with pytest.raises(ValueError, match="Unsupported generated model base"): + module.render_module("class Wrong(dict):\n field: str\n", "types", {"Wrong"}) + + +def test_normal_extraction_pipeline_runs_lazy_generation(tmp_path): + from _scripts.extract_model_contracts import finalize + from _scripts.lazy_model_emitter import canonical + + package = Path(__file__).resolve().parents[2] + original = package / "azure" / "ai" / "agentserver" / "responses" / "models" / "_generated" + emitted = tmp_path / "emitter" / "models" + (emitted / "models").mkdir(parents=True) + for name in ("types.py", "_unions.py"): + (emitted / name).write_text(canonical((original / name).read_text(encoding="utf-8")), encoding="utf-8") + (emitted / "py.typed").write_text("") + for name in ("__init__.py", "_patch.py"): + (emitted / "models" / name).write_bytes((original / "models" / name).read_bytes()) + destination = tmp_path / "generated" + finalize(tmp_path / "emitter", destination) + for name in ("types.py", "_unions.py", "_catalog.py", "__init__.py"): + assert (destination / name).read_text(encoding="utf-8") == (original / name).read_text(encoding="utf-8") + diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_request_history_resolution.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_request_history_resolution.py new file mode 100644 index 000000000000..d5dd1a684ff0 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_request_history_resolution.py @@ -0,0 +1,502 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Exact-query request ownership, storage call counts, and cancellation contracts.""" + +from __future__ import annotations + +import asyncio +from unittest.mock import AsyncMock, MagicMock + +import pytest + +from azure.ai.agentserver.responses import ResponsesServerOptions +from azure.ai.agentserver.responses._response_context import ( + PlatformContext, + ResponseContext, + _resolve_history_item_ids, +) +from azure.ai.agentserver.responses.hosting import _orchestrator as orch +from azure.ai.agentserver.responses.hosting._execution_context import _ExecutionContext +from azure.ai.agentserver.responses.hosting._runtime_state import _RuntimeState +from azure.ai.agentserver.responses.models import CreateResponse +from azure.ai.agentserver.responses.models.runtime import ResponseExecution, ResponseModeFlags +from azure.ai.agentserver.responses.store._base import ResponseProviderProtocol +from azure.ai.agentserver.responses.store._foundry_errors import FoundryResourceNotFoundError +from azure.ai.agentserver.responses.streaming import ResponseEventStream + + +def _provider(ids=None): + provider = MagicMock(spec=ResponseProviderProtocol) + provider.get_history_item_ids = AsyncMock(return_value=["history"] if ids is None else ids) + provider.get_items = AsyncMock(return_value=[{"id": "history"}]) + provider.create_response = AsyncMock() + provider.update_response = AsyncMock() + return provider + + +def _context(provider, prefetched=None, *, conversation=None, previous="previous"): + return ResponseContext( + response_id="response", + mode_flags=ResponseModeFlags(stream=True, store=True, background=False), + provider=provider, + input_items=[], + previous_response_id=previous, + conversation_id=conversation, + prefetched_history_ids=prefetched, + platform_context=PlatformContext(user_id_key="user", call_id="call"), + ) + + +async def _resolve(owner, provider, *, previous="previous", conversation=None, limit=100, platform=None): + return await _resolve_history_item_ids( + provider, + previous, + conversation, + limit, + context=platform if platform is not None else (owner.platform_context if owner is not None else None), + request_context=owner, + ) + + +@pytest.mark.parametrize("ids", [[], ["history"]]) +@pytest.mark.parametrize("seeded", [False, True]) +async def test_empty_and_nonempty_snapshots_are_reused_and_defensive(ids, seeded): + ids = list(ids) + provider = _provider(ids) + owner = _context(provider, ids if seeded else None) + first = await _resolve(owner, provider) + first.append("caller-mutation") + assert await _resolve(owner, provider) == ids + ( + provider.get_history_item_ids.assert_not_awaited() + if seeded + else provider.get_history_item_ids.assert_awaited_once() + ) + ids.append("provider-or-prefetch-mutation") + assert "provider-or-prefetch-mutation" not in await _resolve(owner, provider) + + +@pytest.mark.parametrize("difference", ["provider", "previous", "conversation", "limit", "user", "call", "no-platform"]) +async def test_different_queries_or_identities_do_not_hit(difference): + provider = _provider() + owner = _context(provider) + await _resolve(owner, provider) + second_provider = _provider() if difference == "provider" else provider + identity = PlatformContext( + user_id_key="other" if difference == "user" else "user", call_id="other" if difference == "call" else "call" + ) + await _resolve_history_item_ids( + second_provider, + "other" if difference == "previous" else "previous", + "conv" if difference == "conversation" else None, + 1 if difference == "limit" else 100, + context=None if difference == "no-platform" else identity, + request_context=owner, + ) + assert provider.get_history_item_ids.await_count == (1 if difference == "provider" else 2) + if difference == "provider": + second_provider.get_history_item_ids.assert_awaited_once() + # A new PlatformContext with equal values is equivalent, not a new caller. + assert await _resolve(owner, provider, platform=PlatformContext(user_id_key="user", call_id="call")) == ["history"] + assert provider.get_history_item_ids.await_count == (1 if difference == "provider" else 2) + + +async def test_absent_and_empty_identity_values_are_distinct(): + provider = _provider() + owner = _context(provider) + identities = [ + None, + PlatformContext(), + PlatformContext(user_id_key=""), + PlatformContext(call_id=""), + PlatformContext(user_id_key="", call_id=""), + ] + for identity in identities * 2: + await _resolve_history_item_ids(provider, "previous", None, 100, context=identity, request_context=owner) + assert provider.get_history_item_ids.await_count == 5 + + +async def test_no_owner_and_new_request_never_reuse_old_results(): + provider = _provider() + for owner in (None, None, _context(provider), _context(provider)): + await _resolve(owner, provider) + assert provider.get_history_item_ids.await_count == 4 + + +async def test_mutated_identity_during_fetch_does_not_poison_key(): + provider = _provider() + owner = _context(provider) + started, release = asyncio.Event(), asyncio.Event() + + async def fetch(*args, context): + started.set() + await release.wait() + return [context.call_id] + + provider.get_history_item_ids.side_effect = fetch + task = asyncio.create_task(_resolve(owner, provider)) + await started.wait() + owner.platform_context.call_id = "new-call" + release.set() + assert await task == ["call"] + assert await _resolve(owner, provider) == ["new-call"] + assert provider.get_history_item_ids.await_count == 2 + + +async def test_concurrent_equal_lookups_single_flight_and_waiter_cancellation(): + provider = _provider() + owner = _context(provider) + started, release = asyncio.Event(), asyncio.Event() + + async def fetch(*args, **kwargs): + started.set() + await release.wait() + return ["history"] + + provider.get_history_item_ids.side_effect = fetch + leader = asyncio.create_task(_resolve(owner, provider)) + await started.wait() + waiters = [asyncio.create_task(_resolve(owner, provider)) for _ in range(8)] + await asyncio.sleep(0) + waiters[0].cancel() + with pytest.raises(asyncio.CancelledError): + await waiters.pop(0) + assert not leader.done() + release.set() + assert await asyncio.gather(leader, *waiters) == [["history"]] * 8 + provider.get_history_item_ids.assert_awaited_once() + + +@pytest.mark.parametrize("failure", ["cancel", "error"]) +async def test_failed_or_cancelled_leader_releases_lock_and_is_not_cached(failure): + provider = _provider() + owner = _context(provider) + started, release = asyncio.Event(), asyncio.Event() + calls = 0 + + async def fetch(*args, **kwargs): + nonlocal calls + calls += 1 + if calls == 1: + started.set() + await release.wait() + raise FoundryResourceNotFoundError("first lookup failed") + return ["retried"] + + provider.get_history_item_ids.side_effect = fetch + leader = asyncio.create_task(_resolve(owner, provider)) + await started.wait() + waiter = asyncio.create_task(_resolve(owner, provider)) + await asyncio.sleep(0) + if failure == "cancel": + leader.cancel() + else: + release.set() + with pytest.raises(asyncio.CancelledError if failure == "cancel" else FoundryResourceNotFoundError): + await leader + assert await asyncio.wait_for(waiter, 2) == ["retried"] + assert await _resolve(owner, provider) == ["retried"] + assert calls == 2 + + +@pytest.mark.parametrize("difference", ["query", "request"]) +async def test_distinct_queries_or_requests_run_concurrently(difference): + provider = _provider() + owner = _context(provider) + both_started, release = asyncio.Event(), asyncio.Event() + calls = 0 + + async def fetch(*args, **kwargs): + nonlocal calls + calls += 1 + if calls == 2: + both_started.set() + await release.wait() + return ["history"] + + provider.get_history_item_ids.side_effect = fetch + tasks = [ + asyncio.create_task( + _resolve( + owner if difference == "query" else _context(provider), + provider, + limit=limit if difference == "query" else 100, + ) + ) + for limit in (1, 2) + ] + try: + await asyncio.wait_for(both_started.wait(), 2) + finally: + release.set() + await asyncio.gather(*tasks) + assert calls == 2 + + +async def test_concurrent_handler_materialization_and_persistence_share_ids(): + provider = _provider() + owner = _context(provider) + started, release = asyncio.Event(), asyncio.Event() + + async def fetch(*args, **kwargs): + started.set() + await release.wait() + return ["history"] + + provider.get_history_item_ids.side_effect = fetch + materialization = asyncio.create_task(owner.get_history()) + await started.wait() + readers = [asyncio.create_task(owner.get_history()) for _ in range(8)] + persistence_ids = asyncio.create_task(_resolve(owner, provider)) + release.set() + histories = await asyncio.gather(materialization, *readers) + assert await persistence_ids == ["history"] + assert all(value is histories[0] for value in histories) + assert await owner.get_history() is histories[0] + provider.get_history_item_ids.assert_awaited_once() + provider.get_items.assert_awaited_once() + # Arbitrary item batches are not covered by the history cache. + await provider.get_items(["other"]) + await provider.get_items(["other"]) + assert provider.get_items.await_count == 3 + + +@pytest.mark.parametrize("failure", ["cancel", "error"]) +async def test_materialization_failure_retries_without_refetching_successful_ids(failure): + provider = _provider() + owner = _context(provider) + started, release = asyncio.Event(), asyncio.Event() + calls = 0 + + async def items(*args, **kwargs): + nonlocal calls + calls += 1 + if calls == 1: + started.set() + await release.wait() + raise RuntimeError("item retrieval failed") + return [{"id": "history"}] + + provider.get_items.side_effect = items + leader = asyncio.create_task(owner.get_history()) + await started.wait() + waiter = asyncio.create_task(owner.get_history()) + if failure == "cancel": + leader.cancel() + else: + release.set() + with pytest.raises(asyncio.CancelledError if failure == "cancel" else RuntimeError): + await leader + assert await asyncio.wait_for(waiter, 2) == ({"id": "history"},) + provider.get_history_item_ids.assert_awaited_once() + assert provider.get_items.await_count == 2 + + +@pytest.mark.parametrize("difference", ["provider", "previous", "conversation", "limit", "user", "call"]) +async def test_materialized_cache_respects_query_changes(difference): + provider = _provider() + owner = _context(provider) + await owner.get_history() + if difference == "provider": + owner._provider = _provider() + elif difference == "previous": + owner._previous_response_id = "new-previous" + elif difference == "conversation": + owner.conversation_id = "new-conversation" + elif difference == "limit": + owner._history_limit = 1 + elif difference == "user": + owner.platform_context.user_id_key = "" + else: + owner.platform_context.call_id = "" + await owner.get_history() + assert provider.get_history_item_ids.await_count == (1 if difference == "provider" else 2) + assert owner._provider.get_items.await_count == (1 if difference == "provider" else 2) + + +@pytest.mark.parametrize("path", ["bg-created", "bg-terminal", "stream-created", "stream-terminal", "sync"]) +@pytest.mark.parametrize("prefetched", [None, [], ["history"]]) +@pytest.mark.parametrize("with_owner", [False, True]) +@pytest.mark.parametrize("handler_first", [False, True]) +async def test_all_persistence_callsites_use_exact_request_resolver( + monkeypatch, path, prefetched, with_owner, handler_first +): + provider = _provider() + owner = _context(provider, prefetched) if with_owner else None + if owner is not None and handler_first: + await owner.get_history() + options = ResponsesServerOptions(resilient_background=False) + + async def handler(request, context, cancellation_signal): + stream = ResponseEventStream(response_id="response", model="m") + yield stream.emit_created() + yield stream.emit_completed() + + obj = orch._ResponseOrchestrator( + create_fn=handler, + runtime_state=_RuntimeState(), + runtime_options=options, + provider=provider, + ) + obj._safe_emit = AsyncMock() + subject = MagicMock(last_cursor=AsyncMock(return_value=None)) + monkeypatch.setattr(orch.streams, "get_or_create", AsyncMock(return_value=subject)) + background = path.startswith("bg-") + ctx = _ExecutionContext( + response_id="response", + agent_reference={}, + model="m", + store=True, + background=background, + stream=path != "sync", + input_items=[], + previous_response_id="previous", + conversation_id=None, + cancellation_signal=asyncio.Event(), + span=MagicMock(), + parsed=CreateResponse(model="m", input="hi"), + context=owner, + prefetched_history_ids=prefetched, + ) + stream = ResponseEventStream(response_id="response", model="m") + first, terminal = stream.emit_created(), stream.emit_completed() + state = orch._PipelineState() + state.handler_events.extend([first, terminal]) + state.pending_terminal = terminal + record = ResponseExecution( + response_id="response", + mode_flags=ResponseModeFlags(stream=ctx.stream, store=True, background=background), + status="in_progress", + previous_response_id="previous", + input_items=[], + response_context=owner, + ) + snapshot = orch._extract_response_snapshot_from_events( + state.handler_events, + response_id="response", + agent_reference={}, + model="m", + ) + record.set_response_snapshot(snapshot) + if path == "bg-created": + assert await orch._bg_persist_at_created( + record, + store=True, + provider=provider, + context=owner, + response_id="response", + history_limit=100, + initial_snapshot=snapshot, + ) + elif path == "bg-terminal": + await orch._bg_persist_terminal( + record, + store=True, + provider=provider, + context=owner, + response_id="response", + history_limit=100, + exit_for_recovery=False, + provider_created=False, + agent_reference={}, + model="m", + ) + elif path == "stream-created": + await obj._register_bg_execution(ctx, state, first) + elif path == "stream-terminal": + await obj._persist_and_resolve_terminal(ctx, state, record) + else: + await obj._run_sync_inner(ctx, orch._PipelineState()) + provider.create_response.assert_awaited_once() + expected = prefetched if with_owner and prefetched is not None else ["history"] + assert provider.create_response.await_args.args[2] == expected + assert provider.get_history_item_ids.await_count == (0 if with_owner and prefetched is not None else 1) + if with_owner: + # Persistence's fallback lookup is now also shared with subsequent handler reads. + assert await _resolve(owner, provider) == expected + await owner.get_history() + await owner.get_history() + assert provider.get_history_item_ids.await_count == (0 if prefetched is not None else 1) + assert provider.get_items.await_count == (1 if expected else 0) + + +@pytest.mark.parametrize("mode", ["fresh", "resumed", "recovered"]) +async def test_task_handoff_keeps_fresh_cache_but_resets_recovered_lifetime(monkeypatch, mode): + from azure.ai.agentserver.responses.hosting import _resilient_orchestrator as resilient + from azure.ai.agentserver.responses.hosting._resilient_input import ResilientResponseInput, RuntimeRefs + + provider = _provider() + owner = _context(provider, ["history"]) + initial = await owner.get_history() + provider.get_items.return_value = [{"id": "new-lifetime"}] + obj = resilient.ResilientResponseOrchestrator( + create_fn=AsyncMock(), + options=ResponsesServerOptions(), + provider=provider, + runtime_state=_RuntimeState(), + ) + parsed = CreateResponse(model="m", input="hi", previous_response_id="previous", store=True, background=True) + params = ResilientResponseInput( + request=parsed, + response_id="response", + disposition="re-invoke", + user_id_key="user", + call_id="call", + ).to_task_input() + assert "history" not in str(params) + monkeypatch.setitem( + resilient._RUNTIME_REFS, + "response", + RuntimeRefs(record=MagicMock(), context=owner, parsed=parsed, cancel=asyncio.Event()), + ) + seen = [] + + async def run(task_context, record, context, **kwargs): + seen.append(await context.get_history()) + + monkeypatch.setattr(obj, "_run_handler_in_task", run) + monkeypatch.setattr(obj, "_setup_cancel_bridge", MagicMock(return_value=None)) + task_context = MagicMock( + input=params, + entry_mode=mode, + is_steered_turn=False, + pending_input_count=0, + cancel=asyncio.Event(), + shutdown=asyncio.Event(), + ) + await obj._execute_in_task(task_context) + assert len(seen) == 1 + if mode == "recovered": + assert seen[0] == ({"id": "new-lifetime"},) + provider.get_history_item_ids.assert_awaited_once() + assert provider.get_items.await_count == 2 + else: + assert seen[0] is initial + provider.get_history_item_ids.assert_not_awaited() + provider.get_items.assert_awaited_once() + + +async def test_reconstruction_from_serialized_input_never_reuses_previous_lifetime_ids(): + from azure.ai.agentserver.responses.hosting._resilient_orchestrator import _reconstruct_from_params + from azure.ai.agentserver.responses.hosting._resilient_input import ResilientResponseInput + + provider = _provider() + params = ResilientResponseInput( + request=CreateResponse(model="m", input="hi", previous_response_id="previous"), + response_id="response", + disposition="re-invoke", + user_id_key="user", + call_id="call", + ).to_task_input() + for _ in range(2): + _, owner = _reconstruct_from_params( + params=params, + response_id="response", + provider=provider, + runtime_state=_RuntimeState(), + runtime_options=ResponsesServerOptions(), + ) + await owner.get_history() + assert await _resolve(owner, provider) == ["history"] + assert provider.get_history_item_ids.await_count == 2 + assert provider.get_items.await_count == 2 diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_streaming_flush.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_streaming_flush.py new file mode 100644 index 000000000000..65f774893a13 --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_streaming_flush.py @@ -0,0 +1,517 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""ASGI send-order tests; buffered clients are not used to measure first content.""" + +from __future__ import annotations + +import asyncio +import json +import threading +from typing import Any +from unittest.mock import AsyncMock + +import pytest +from starlette.requests import ClientDisconnect + +from azure.ai.agentserver.responses import ResponsesAgentServerHost, ResponsesServerOptions +from azure.ai.agentserver.responses.hosting import _endpoint_handler as endpoint +from azure.ai.agentserver.responses.hosting import _orchestrator as orchestration +from azure.ai.agentserver.responses.store._memory import InMemoryResponseProvider +from azure.ai.agentserver.responses.streaming import ResponseEventStream + + +def _scope(spec: str = "2.4") -> dict[str, Any]: + return { + "type": "http", + "asgi": {"version": "3.0", "spec_version": spec}, + "http_version": "1.1", + "method": "POST", + "scheme": "http", + "path": "/responses", + "raw_path": b"/responses", + "query_string": b"", + "root_path": "", + "headers": [(b"content-type", b"application/json")], + "server": ("testserver", 80), + "client": ("127.0.0.1", 12345), + } + + +async def _never_receive() -> dict[str, Any]: + await asyncio.Event().wait() + raise AssertionError("unreachable") + + +@pytest.mark.parametrize("spec", ["2.3", "2.4"]) +@pytest.mark.parametrize("store", [False, True]) +async def test_real_body_and_ended_span_precede_flush_and_final_send( + monkeypatch: pytest.MonkeyPatch, spec: str, store: bool +) -> None: + events: list[str] = [] + flush_started = asyncio.Event() + release = threading.Event() + loop = asyncio.get_running_loop() + + class Hook: + def on_span_start(self, name: str, tags: dict[str, Any]) -> None: + pass + + def on_span_end(self, name: str, tags: dict[str, Any], error: BaseException | None) -> None: + events.append("span-ended") + + class DelayedExporter: + def force_flush(self, timeout_millis: int) -> None: + assert timeout_millis == 5000 + events.append("flush-start") + loop.call_soon_threadsafe(flush_started.set) + assert release.wait(timeout_millis / 1000), "event loop could not release blocking exporter" + events.append("flush-end") + + monkeypatch.setattr(endpoint, "flush_spans", lambda: DelayedExporter().force_flush(5000)) + + async def handler(request: Any, context: Any, cancellation_signal: Any) -> Any: + stream = ResponseEventStream(response_id=context.response_id, model="m") + yield stream.emit_created() + yield stream.emit_completed() + events.append("handler-ended") + + provider = InMemoryResponseProvider() + original_create = provider.create_response + + async def create(*args: Any, **kwargs: Any) -> None: + await original_create(*args, **kwargs) + events.append("initial-persisted") + + monkeypatch.setattr(provider, "create_response", create) + app = ResponsesAgentServerHost( + options=ResponsesServerOptions(resilient_background=False, create_span_hook=Hook()), + store=provider, + ) + app.response_handler(handler) + payload = json.dumps({"model": "m", "input": "hi", "stream": True, "store": store}).encode() + request_sent = False + + async def receive() -> dict[str, Any]: + nonlocal request_sent + if not request_sent: + request_sent = True + return {"type": "http.request", "body": payload, "more_body": False} + return await _never_receive() + + async def send(message: dict[str, Any]) -> None: + if message["type"] == "http.response.body": + if b"response.created" in message.get("body", b""): + if store: + assert "initial-persisted" in events + events.append("created-body") + if not message.get("more_body", False): + events.append("http-complete") + + task = asyncio.create_task(app(_scope(spec), receive, send)) + try: + await asyncio.wait_for(flush_started.wait(), 10) + assert "created-body" in events + assert "handler-ended" in events + assert "span-ended" in events + assert "flush-end" not in events + assert "http-complete" not in events + # This coroutine is running while the exporter is blocked in a worker. + events.append("event-loop-responsive") + finally: + release.set() + await asyncio.wait_for(task, 10) + assert events.index("created-body") < events.index("flush-start") + assert events.index("span-ended") < events.index("flush-start") + assert events.index("handler-ended") < events.index("flush-start") + assert events.index("flush-end") < events.index("http-complete") + assert events.count("flush-start") == 1 + + +@pytest.mark.parametrize("failure", [False, True]) +async def test_sync_success_and_handler_error_still_flush_before_sending( + monkeypatch: pytest.MonkeyPatch, failure: bool +) -> None: + events: list[str] = [] + monkeypatch.setattr(endpoint, "flush_spans", lambda: events.append("flush")) + + async def handler(request: Any, context: Any, cancellation_signal: Any) -> Any: + if failure: + raise RuntimeError("handler failed") + stream = ResponseEventStream(response_id=context.response_id, model="m") + yield stream.emit_created() + yield stream.emit_completed() + + app = ResponsesAgentServerHost( + options=ResponsesServerOptions(resilient_background=False), store=InMemoryResponseProvider() + ) + app.response_handler(handler) + receive = AsyncMock( + return_value={ + "type": "http.request", + "body": json.dumps({"model": "m", "input": "hi", "stream": False, "store": False}).encode(), + "more_body": False, + } + ) + + async def send(message: dict[str, Any]) -> None: + if message["type"] == "http.response.start": + assert message["status"] == (500 if failure else 200) + events.append("http-start") + + await app(_scope(), receive, send) + assert events == ["flush", "http-start"] + + +@pytest.mark.parametrize("interval", [None, 60]) +@pytest.mark.parametrize("ending", ["empty", "eof", "error", "send-error", "disconnect", "cancel"]) +async def test_stream_cleanup_flushes_once_before_return( + monkeypatch: pytest.MonkeyPatch, interval: float | None, ending: str +) -> None: + events: list[str] = [] + disconnected = asyncio.Event() + monkeypatch.setattr(endpoint, "flush_spans", lambda: events.append("flush")) + + async def source() -> Any: + try: + if ending == "empty": + return + yield 'event: response.created\ndata: {"type":"response.created"}\n\n' + if ending == "error": + raise ValueError("stream failure") + if ending in ("disconnect", "cancel", "send-error"): + await asyncio.Event().wait() + finally: + events.append("closed") + + async def send(message: dict[str, Any]) -> None: + if message["type"] == "http.response.body" and message.get("body"): + events.append("body") + if ending == "send-error": + raise OSError("connection closed") + if ending == "disconnect": + disconnected.set() + if ending == "cancel": + asyncio.current_task().cancel() + if message["type"] == "http.response.body" and not message.get("more_body", False): + events.append("http-complete") + + async def receive() -> dict[str, Any]: + await disconnected.wait() + return {"type": "http.disconnect"} + + response = endpoint._CreateStreamingResponse(source(), interval, headers={}) + expected = {"error": ValueError, "send-error": ClientDisconnect, "cancel": asyncio.CancelledError} + call = response(_scope("2.3" if ending == "disconnect" else "2.4"), receive, send) + if ending in expected: + with pytest.raises(expected[ending]): + await asyncio.wait_for(call, 10) + else: + await asyncio.wait_for(call, 10) + assert events.count("flush") == 1 + assert events.index("closed") < events.index("flush") + if ending in ("empty", "eof"): + assert events.index("flush") < events.index("http-complete") + else: + assert "http-complete" not in events + + +async def test_cancellation_during_flush_drains_exporter(monkeypatch: pytest.MonkeyPatch) -> None: + started = asyncio.Event() + release = threading.Event() + ended = threading.Event() + loop = asyncio.get_running_loop() + + def flush() -> None: + loop.call_soon_threadsafe(started.set) + assert release.wait(5) + ended.set() + + monkeypatch.setattr(endpoint, "flush_spans", flush) + task = asyncio.create_task(endpoint._flush_spans_async()) + try: + await asyncio.wait_for(started.wait(), 5) + task.cancel() + await asyncio.sleep(0) + task.cancel() + await asyncio.sleep(0) + assert not task.done() + assert not ended.is_set() + finally: + release.set() + with pytest.raises(asyncio.CancelledError): + await asyncio.wait_for(task, 5) + assert ended.is_set() + + +@pytest.mark.parametrize("interval", [None, 60]) +@pytest.mark.parametrize("handler_shape", ["async-generator", "coroutine", "async-iterable"]) +@pytest.mark.parametrize( + "ending", + [ + "send-error", + "disconnect", + "cancel", + "disconnect-awaiting-handler", + "handler-error", + "invalid-first", + "empty", + "eof", + ], +) +async def test_real_pipeline_awaits_handler_cleanup_before_flush( + monkeypatch: pytest.MonkeyPatch, interval: float | None, ending: str, handler_shape: str +) -> None: + events: list[str] = [] + cleanup_started = asyncio.Event() + cleanup_complete = asyncio.Event() + release_cleanup = asyncio.Event() + handler_waiting = asyncio.Event() + disconnected = asyncio.Event() + final_states: list[Any] = [] + frames: list[str] = [] + monkeypatch.setattr(endpoint, "flush_spans", lambda: events.append("flush")) + original_finalize = orchestration._ResponseOrchestrator._finalize_stream + + async def finalize(self: Any, ctx: Any, state: Any) -> None: + await original_finalize(self, ctx, state) + final_states.append(state) + events.append("orchestrator-finalized") + + monkeypatch.setattr(orchestration._ResponseOrchestrator, "_finalize_stream", finalize) + + async def handler(request: Any, context: Any, cancellation_signal: Any) -> Any: + try: + stream = ResponseEventStream(response_id=context.response_id, model="m") + if ending == "empty": + return + if ending == "invalid-first": + yield stream.emit_in_progress() + return + yield stream.emit_created() + if ending == "handler-error": + raise ValueError("handler failed after creation") + if ending != "eof": + handler_waiting.set() + await asyncio.Event().wait() + yield stream.emit_completed() + finally: + events.append("handler-cleanup-start") + cleanup_started.set() + await release_cleanup.wait() + events.append("handler-cleanup-complete") + cleanup_complete.set() + + app = ResponsesAgentServerHost( + options=ResponsesServerOptions(resilient_background=False, sse_keep_alive_interval_seconds=interval), + store=InMemoryResponseProvider(), + ) + + async def returning_handler(request: Any, context: Any, cancellation_signal: Any) -> Any: + class HandlerEvents: + def __aiter__(self) -> Any: + return handler(request, context, cancellation_signal) + + if handler_shape == "async-iterable": + return HandlerEvents() + return handler(request, context, cancellation_signal) + + app.response_handler(handler if handler_shape == "async-generator" else returning_handler) + payload = json.dumps({"model": "m", "input": "hi", "stream": True, "store": False}).encode() + request_sent = False + + async def receive() -> dict[str, Any]: + nonlocal request_sent + if not request_sent: + request_sent = True + return {"type": "http.request", "body": payload, "more_body": False} + if ending == "disconnect-awaiting-handler": + await handler_waiting.wait() + else: + await disconnected.wait() + return {"type": "http.disconnect"} + + async def send(message: dict[str, Any]) -> None: + if message["type"] == "http.response.start": + assert message["status"] == 200 + if message["type"] != "http.response.body": + return + body = message.get("body", b"").decode() + frames.extend(line[7:] for line in body.splitlines() if line.startswith("event: ")) + if "response.created" in body: + if ending == "send-error": + raise OSError("connection closed") + if ending == "cancel": + raise asyncio.CancelledError() + if ending == "disconnect": + disconnected.set() + await asyncio.Event().wait() + if not message.get("more_body", False): + events.append("http-complete") + + async def run_request() -> None: + try: + await app(_scope("2.3" if ending.startswith("disconnect") else "2.4"), receive, send) + finally: + events.append("request-returned") + + task = asyncio.create_task(run_request()) + try: + await asyncio.wait_for(cleanup_started.wait(), 5) + assert not task.done(), events + assert "flush" not in events + assert "orchestrator-finalized" not in events + assert "http-complete" not in events + if ending in ("send-error", "disconnect", "cancel"): + assert not handler_waiting.is_set() + release_cleanup.set() + if ending == "send-error": + with pytest.raises(ClientDisconnect): + await asyncio.wait_for(task, 5) + elif ending == "cancel": + with pytest.raises(asyncio.CancelledError): + await asyncio.wait_for(task, 5) + else: + await asyncio.wait_for(task, 5) + assert cleanup_complete.is_set() + assert events.index("handler-cleanup-complete") < events.index("orchestrator-finalized") + assert events.index("orchestrator-finalized") < events.index("flush") + assert events.index("flush") < events.index("request-returned") + assert events.count("flush") == 1 + assert len(final_states) == 1 + if ending in ("empty", "eof", "handler-error", "invalid-first"): + assert events.index("flush") < events.index("http-complete") + expected = { + "empty": ["response.created", "response.in_progress", "response.completed"], + "eof": ["response.created", "response.completed"], + "handler-error": ["response.created", "response.failed"], + "invalid-first": ["error"], + } + assert frames == expected[ending] + else: + assert "http-complete" not in events + assert final_states[0].stream_interrupted + finally: + release_cleanup.set() + if not task.done(): + task.cancel() + await asyncio.gather(task, return_exceptions=True) + + +@pytest.mark.parametrize("interval", [None, 60]) +@pytest.mark.parametrize("background", [False, True]) +@pytest.mark.parametrize("ending", ["send-error", "disconnect"]) +async def test_stored_producer_remains_independent_of_request_cleanup( + monkeypatch: pytest.MonkeyPatch, interval: float | None, background: bool, ending: str +) -> None: + events: list[str] = [] + release_producer = asyncio.Event() + cleanup_started = asyncio.Event() + release_cleanup = asyncio.Event() + cleanup_complete = asyncio.Event() + disconnected = asyncio.Event() + initial_persisted = asyncio.Event() + records: list[Any] = [] + monkeypatch.setattr(endpoint, "flush_spans", lambda: events.append("flush")) + original_start = orchestration._ResponseOrchestrator._start_resilient_background + + async def start(self: Any, ctx: Any, record: Any, fallback: Any, **kwargs: Any) -> None: + await original_start(self, ctx, record, fallback, **kwargs) + records.append(record) + + monkeypatch.setattr(orchestration._ResponseOrchestrator, "_start_resilient_background", start) + provider = InMemoryResponseProvider() + original_create = provider.create_response + + async def create(*args: Any, **kwargs: Any) -> None: + await original_create(*args, **kwargs) + initial_persisted.set() + + monkeypatch.setattr(provider, "create_response", create) + + async def handler(request: Any, context: Any, cancellation_signal: Any) -> Any: + try: + stream = ResponseEventStream(response_id=context.response_id, model="m") + yield stream.emit_created() + await release_producer.wait() + yield stream.emit_completed() + finally: + cleanup_started.set() + await release_cleanup.wait() + cleanup_complete.set() + + app = ResponsesAgentServerHost( + options=ResponsesServerOptions(resilient_background=False, sse_keep_alive_interval_seconds=interval), + store=provider, + ) + app.response_handler(handler) + payload = json.dumps( + {"model": "m", "input": "hi", "stream": True, "store": True, "background": background} + ).encode() + request_sent = False + + async def receive() -> dict[str, Any]: + nonlocal request_sent + if not request_sent: + request_sent = True + return {"type": "http.request", "body": payload, "more_body": False} + await disconnected.wait() + return {"type": "http.disconnect"} + + async def send(message: dict[str, Any]) -> None: + if message["type"] == "http.response.start": + assert message["status"] == 200 + if message["type"] == "http.response.body" and b"response.created" in message.get("body", b""): + assert initial_persisted.is_set() + if ending == "send-error": + raise OSError("connection closed") + disconnected.set() + await asyncio.Event().wait() + + task = asyncio.create_task(app(_scope("2.3" if ending == "disconnect" else "2.4"), receive, send)) + try: + if ending == "send-error": + with pytest.raises(ClientDisconnect): + await asyncio.wait_for(task, 5) + else: + await asyncio.wait_for(task, 5) + assert events == ["flush"] + assert len(records) == 1 + producer = records[0].execution_task + assert producer is not None and not producer.done() + assert not cleanup_started.is_set() + release_producer.set() + await asyncio.wait_for(cleanup_started.wait(), 5) + assert not producer.done() + release_cleanup.set() + await asyncio.wait_for(producer, 5) + assert cleanup_complete.is_set() + stored = await provider.get_response(records[0].response_id) + # Foreground disconnect already signals cancellation; it does not cancel + # the independent task or close the handler before its own work finishes. + assert stored is not None and stored["status"] == ("completed" if background else "cancelled") + finally: + release_producer.set() + release_cleanup.set() + if not task.done(): + task.cancel() + await asyncio.gather(task, return_exceptions=True) + for record in records: + if record.execution_task is not None: + await asyncio.wait_for(asyncio.gather(record.execution_task, return_exceptions=True), 5) + + +async def test_normalized_sync_generator_closes_its_owned_source() -> None: + from azure.ai.agentserver.responses.hosting._routing import _sync_to_async_gen + + closed: list[bool] = [] + + def source() -> Any: + try: + yield {"type": "response.created"} + finally: + closed.append(True) + + iterator = _sync_to_async_gen(source()) + assert await iterator.__anext__() == {"type": "response.created"} + await iterator.aclose() + assert closed == [True] diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_streaming_history_reuse.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_streaming_history_reuse.py new file mode 100644 index 000000000000..eb75d4545f3d --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_streaming_history_reuse.py @@ -0,0 +1,98 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Initial persistence uses only matching request-local history prefetches.""" + +from __future__ import annotations + +import asyncio +from unittest.mock import AsyncMock, MagicMock + +import pytest + +from azure.ai.agentserver.responses import ResponsesServerOptions +from azure.ai.agentserver.responses._response_context import ResponseContext +from azure.ai.agentserver.responses.hosting import _orchestrator as orchestrator +from azure.ai.agentserver.responses.hosting._execution_context import _ExecutionContext +from azure.ai.agentserver.responses.models import CreateResponse +from azure.ai.agentserver.responses.models.runtime import ResponseModeFlags +from azure.ai.agentserver.responses.store._foundry_errors import FoundryResourceNotFoundError +from azure.ai.agentserver.responses.streaming import ResponseEventStream + + +@pytest.mark.parametrize( + "prefetched,previous,conversation,expected,fetches", + [ + (["cached"], "previous", None, ["cached"], 0), + ([], "previous", None, [], 0), + (None, "previous", None, ["fetched"], 1), + (["conversation-item"], None, "conversation", None, 0), + (["conversation-item"], "previous", "conversation", ["fetched"], 1), + (None, None, None, None, 0), + ], +) +@pytest.mark.parametrize("background", [False, True]) +async def test_registration_history( + monkeypatch, prefetched, previous, conversation, expected, fetches, background +) -> None: + provider = MagicMock() + provider.get_history_item_ids = AsyncMock(return_value=["fetched"]) + provider.create_response = AsyncMock() + subject = MagicMock() + subject.last_cursor = AsyncMock(return_value=None) + monkeypatch.setattr(orchestrator.streams, "get_or_create", AsyncMock(return_value=subject)) + obj = object.__new__(orchestrator._ResponseOrchestrator) + obj._provider = provider + obj._runtime_options = ResponsesServerOptions() + obj._runtime_state = MagicMock(add=AsyncMock()) + obj._safe_emit = AsyncMock() + response_context = ResponseContext( + response_id="response", + mode_flags=ResponseModeFlags(stream=True, store=True, background=background), + provider=provider, + input_items=[], + previous_response_id=previous, + conversation_id=conversation, + prefetched_history_ids=prefetched, + ) + ctx = _ExecutionContext( + response_id="response", + agent_reference={}, + model="m", + store=True, + background=background, + stream=True, + input_items=[], + previous_response_id=previous, + conversation_id=conversation, + cancellation_signal=asyncio.Event(), + span=MagicMock(), + parsed=CreateResponse(model="m", input="hi"), + prefetched_history_ids=prefetched, + context=response_context, + ) + first = ResponseEventStream(response_id="response", model="m").emit_created() + state = orchestrator._PipelineState() + state.handler_events.append(first) + await obj._register_bg_execution(ctx, state, first) + assert provider.get_history_item_ids.await_count == fetches + assert provider.create_response.await_args.args[2] == expected + assert state.provider_created + obj._safe_emit.assert_awaited_once() + if fetches: + assert provider.get_history_item_ids.await_args.args == ( + previous, + None, + obj._runtime_options.default_fetch_history_count, + ) + assert provider.get_history_item_ids.await_args.kwargs["context"].user_id_key is None + assert provider.get_history_item_ids.await_args.kwargs["context"].call_id is None + + if previous and prefetched is None: + response_context._reset_history_cache() + provider.get_history_item_ids.side_effect = FoundryResourceNotFoundError("missing previous response") + provider.create_response.reset_mock() + obj._safe_emit.reset_mock() + with pytest.raises(FoundryResourceNotFoundError): + await obj._register_bg_execution(ctx, orchestrator._PipelineState(), first) + provider.create_response.assert_not_awaited() + obj._safe_emit.assert_not_awaited() diff --git a/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_validator_transactional.py b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_validator_transactional.py new file mode 100644 index 000000000000..72797960077f --- /dev/null +++ b/sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_validator_transactional.py @@ -0,0 +1,71 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""``EventStreamValidator.validate_next`` must be transactional. + +A rejected event must not advance any validator state, otherwise the +``_make_failed_event`` fallback (which re-enters the validator with a +``response.failed`` terminal) trips "multiple terminal lifecycle events" and the +intended failure event can never be emitted. +""" +import pytest + +from azure.ai.agentserver.responses.streaming._state_machine import EventStreamValidator + +# Tests intentionally assert on the validator's internal counters. +# pylint: disable=protected-access + + +def _created(): + return {"type": "response.created", "response": {"status": "in_progress"}} + + +def test_rejected_terminal_does_not_poison_validator_and_failed_fallback_succeeds(): + validator = EventStreamValidator() + validator.validate_next(_created()) + + # A terminal whose status contradicts its type is rejected... + bad_terminal = {"type": "response.completed", "response": {"status": "failed"}} + with pytest.raises(ValueError): + validator.validate_next(bad_terminal) + + # ...and leaves NO terminal recorded, so the response.failed fallback is accepted. + assert validator._terminal_count == 0 + assert validator._terminal_seen is False + validator.validate_next({"type": "response.failed", "response": {"status": "failed"}}) + + +def test_rejected_event_restores_all_counters(): + validator = EventStreamValidator() + validator.validate_next(_created()) + before = ( + validator._last_stage, + validator._terminal_count, + validator._terminal_seen, + validator._event_count, + set(validator._added_indexes), + set(validator._done_indexes), + ) + + # Out-of-order output-item done (no preceding added) is rejected. + with pytest.raises(ValueError): + validator.validate_next({"type": "response.output_item.done", "output_index": 3}) + + after = ( + validator._last_stage, + validator._terminal_count, + validator._terminal_seen, + validator._event_count, + set(validator._added_indexes), + set(validator._done_indexes), + ) + assert before == after + + +def test_success_path_still_advances_state(): + validator = EventStreamValidator() + validator.validate_next(_created()) + validator.validate_next({"type": "response.output_item.added", "output_index": 0}) + validator.validate_next({"type": "response.output_item.done", "output_index": 0}) + validator.validate_next({"type": "response.completed", "response": {"status": "completed"}}) + assert validator._terminal_seen is True + assert validator._terminal_count == 1