mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
Co-authored-by: speakeasybot <bot@speakeasyapi.dev> Co-authored-by: speakeasy-github[bot] <128539517+speakeasy-github[bot]@users.noreply.github.com>
78 lines
5.1 KiB
Python
78 lines
5.1 KiB
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from __future__ import annotations
|
|
from openrouter.types import BaseModel, Nullable, UnrecognizedStr
|
|
from openrouter.utils import validate_open_enum
|
|
from pydantic.functional_validators import PlainValidator
|
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
|
|
|
|
FusionPluginID = Literal["fusion",]
|
|
|
|
|
|
PresetEnum = Union[
|
|
Literal[
|
|
"general-high",
|
|
"general-budget",
|
|
"general-fast",
|
|
],
|
|
UnrecognizedStr,
|
|
]
|
|
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
|
|
|
|
|
class FusionPluginToolTypedDict(TypedDict):
|
|
type: str
|
|
r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\")."""
|
|
parameters: NotRequired[Dict[str, Nullable[Any]]]
|
|
r"""Optional configuration forwarded as the tool's `parameters` object."""
|
|
|
|
|
|
class FusionPluginTool(BaseModel):
|
|
type: str
|
|
r"""Server tool type identifier (e.g. \"openrouter:web_search\", \"openrouter:web_fetch\")."""
|
|
|
|
parameters: Optional[Dict[str, Nullable[Any]]] = None
|
|
r"""Optional configuration forwarded as the tool's `parameters` object."""
|
|
|
|
|
|
class FusionPluginTypedDict(TypedDict):
|
|
id: FusionPluginID
|
|
analysis_models: NotRequired[List[str]]
|
|
r"""Slugs of models to run in parallel as the \"expert panel\" the judge analyzes. Each model receives the same user prompt with web_search + web_fetch enabled. Capped at 8 models to bound cost amplification. When omitted, defaults to the Quality preset from the /labs/fusion UI (~anthropic/claude-opus-latest, ~openai/gpt-latest, ~google/gemini-pro-latest)."""
|
|
enabled: NotRequired[bool]
|
|
r"""Set to false to disable the fusion plugin for this request. Defaults to true."""
|
|
max_tool_calls: NotRequired[int]
|
|
r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16."""
|
|
model: NotRequired[str]
|
|
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
|
|
preset: NotRequired[PresetEnum]
|
|
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
|
tools: NotRequired[List[FusionPluginToolTypedDict]]
|
|
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|
|
|
|
|
|
class FusionPlugin(BaseModel):
|
|
id: FusionPluginID
|
|
|
|
analysis_models: Optional[List[str]] = None
|
|
r"""Slugs of models to run in parallel as the \"expert panel\" the judge analyzes. Each model receives the same user prompt with web_search + web_fetch enabled. Capped at 8 models to bound cost amplification. When omitted, defaults to the Quality preset from the /labs/fusion UI (~anthropic/claude-opus-latest, ~openai/gpt-latest, ~google/gemini-pro-latest)."""
|
|
|
|
enabled: Optional[bool] = None
|
|
r"""Set to false to disable the fusion plugin for this request. Defaults to true."""
|
|
|
|
max_tool_calls: Optional[int] = None
|
|
r"""Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16."""
|
|
|
|
model: Optional[str] = None
|
|
r"""Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset."""
|
|
|
|
preset: Annotated[
|
|
Optional[PresetEnum], PlainValidator(validate_open_enum(False))
|
|
] = None
|
|
r"""A curated OpenRouter fusion preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and judge model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence."""
|
|
|
|
tools: Optional[List[FusionPluginTool]] = None
|
|
r"""Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: \"openrouter:web_search\" }, { type: \"openrouter:web_fetch\" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only)."""
|