Class: PromptBuilder::Serializers::Gemini::Request
- Defined in:
- lib/prompt_builder/serializers/gemini/request.rb
Overview
Request serializer for the Google Gemini API format.
Unsupported Open Responses features
These session fields are not supported and are silently omitted from the serialized output:
-
background— Gemini has no background/async mode on the generate endpoint -
include— response-field inclusion is an Open Responses-only concept -
max_tool_calls— per-request tool-call caps are not supported -
metadata— arbitrary metadata is not supported -
parallel_tool_calls— parallel tool call control is not supported -
prompt_cache_key/prompt_cache_retention— explicit prompt cache keys are not supported -
safety_identifier— no equivalent user-safety field on the generate endpoint -
stream_options— stream event options are not supported -
truncation— server-side context truncation is not supported
Input content restrictions:
-
InputImagecontent is only supported in user messages (assistant images are omitted) -
InputImagewithimage_urlrequires either base64dataor a URL; content withoutimage_urlorfile_idraises -
InputFilecontent is only supported in user messages (assistant files are omitted) -
InputFilerequiresmedia_typewhenfile_datais provided, or a recognized extension onfilename/file_url -
InputVideorequiresvideo_url -
RefusalContentis dropped silently (a parsed Chat Completions refusal can stay in session history without breaking subsequent request_payload calls) -
redacted_thinkingand unknown reasoning blocks are silently skipped -
Reasoningitems withsummaryblocks have the summary skipped -
FunctionCallOutputarray contents must be text-only; other content is omitted -
CompactionandItemReferenceitems are silently skipped
Features in Gemini not available through Open Responses
The following Gemini parameters cannot be set through the Open Responses canonical format:
-
thinkingConfig.thinkingBudget— usereasoning.budget_tokensinstead -
thinkingConfig.thinkingLevel— usereasoning.effortinstead -
thinkingConfig.includeThoughts— use reasoning.summary = “auto” instead -
topK— top-K sampling parameter -
seed— for reproducible outputs (model-dependent) -
stopSequences— custom stop sequences -
candidateCount— requesting multiple response candidates -
responseModalities— selecting TEXT/IMAGE/AUDIO output channels -
responseJsonSchema— newer JSON Schema variant ofresponseSchema -
safetySettings— configurable harm-category safety thresholds -
mediaResolution— controls token cost of image/video inputs -
audioTimestamp,speechConfig— audio output configuration -
enableEnhancedCivicAnswers -
routingConfig,modelSelectionConfig -
Video metadata controls (
videoMetadataoffset, FPS) on Parts -
Audio input model capability controls (audio can be sent as
InputFilewith an audio MIME type) -
Built-in Gemini tools:
googleSearch/googleSearchRetrieval,codeExecution,urlContext,computerUse,fileSearch,googleMaps,mcpServers -
functionCallingConfig.mode = VALIDATED
-
toolConfig.retrievalConfig,includeServerSideToolInvocations -
cachedContent— referencing a CachedContent resource by name -
Top-level
labels(Vertex flavor only)
Constant Summary collapse
- SUPPORTED_REASONING_EFFORTS =
%w[minimal low medium high].freeze
- SUPPORTED_REASONING_SUMMARIES =
%w[auto].freeze
- SUPPORTED_SERVICE_TIERS =
%w[unspecified standard flex priority].freeze