Skip to main content

OpenAI Decisions

OpenAI Decisions API adapter built on fastspec.OpenAPIClient for gpt-6-luna.

Loads the bundled offline spec (fastdecisions/specs/openai.json) for POST /v1/decisions and registers openai_provider (OPENAI_API_KEY, default model gpt-6-luna). prep_openai_input converts Msg histories into Decisions message and tool items, wraps structured dicts or lists in input_json parts, forwards detail on input_image parts, and strips Thinking, Msg.raw, and server-executed ToolUse(server=True) together with matching ToolResult items. Non-image media raise ValueError.

Translates noul questions to predicate (folding optional true/false criteria into instructions), raises NotImplementedError on box questions, rejects duplicate or missing answer names with ValueError, and maps per-question refusals to RefusalAnswer.

prep_openai_input

def prep_openai_input(
    state, # String, JSON dict/list, `Msg`, `list[Msg]`, `Part`, or `list[Part]`
    detail:str=None, # Optional OpenAI image detail level (e.g. `'low'`, `'high'`, `'auto'`)
):

Convert canonical state into an OpenAI Decisions input string or item list.