Skip to main content

Google Gemini

Google Gemini Decisions API adapter built on fastspec.OpenAPIClient.

Loads the bundled offline spec (fastdecisions/specs/gemini.json) for POST /v1beta/decisions and registers gemini_provider (GEMINI_API_KEY, default model gemini-decision-1). prep_gemini_input lowers Msg histories and nested JSON via lower_state into structured JSON while lifting InputImage, InputAudio, InputVideo, and InputFile parts (data URLs or HTTP/HTTPS URIs) into Interactions API blocks with optional resolution.

Translates noul true/false criteria to true_description/false_description and raises NotImplementedError on box questions. Responses omitting model fall back to gemini-decision-1, answers are checked and reordered to match questions, and HTTP 200 responses with prompt_feedback.block_reason raise a non-retryable APIError.

prep_gemini_input

def prep_gemini_input(
    state, # String, JSON dict/list (may contain nested `Msg`/`Part`), `Msg`, `list[Msg]`, `Media`, or mixed list
    resolution:str=None, # Optional `MediaResolution` applied to visual/document blocks
):

Convert Jev-canonical state into a Gemini Decisions input string or Interactions block list.