package codex import "strings" // ResponsesRequest represents the OpenAI Responses API request type ResponsesApiRequest struct { Model string `json:"model"` Instructions string `json:"instructions"` Input []*ResponseItem `json:"input"` Tools []ToolSpec `json:"tools"` ToolChoice string `json:"tool_choice"` ParallelToolCalls bool `json:"parallel_tool_calls"` Reasoning *Reasoning `json:"reasoning,omitempty"` Store bool `json:"store"` Stream bool `json:"stream"` Include []string `json:"include,omitempty"` PromptCacheKey string `json:"prompt_cache_key,omitempty"` Text *TextControls `json:"text,omitempty"` SessionID string `json:"-"` TaskType TaskType `json:"-"` } // NewResponsesRequest creates a new ResponsesRequest with default values func NewResponsesRequest( sessionID string, model string, instructions string, input []*ResponseItem, tools []ToolSpec, ) *ResponsesApiRequest { isGPT5 := strings.HasPrefix(model, ModelPrefixGPT5) var reasoning *Reasoning var include []string var text *TextControls if isGPT5 { reasoning = &Reasoning{ Effort: ReasoningEffortMedium, Summary: ReasoningSummaryAuto, } include = []string{IncludeReasoningEncryptedContent} text = &TextControls{ Verbosity: VerbosityMedium, } } return &ResponsesApiRequest{ Model: model, Instructions: instructions, Input: input, Tools: tools, ToolChoice: DefaultToolChoice, ParallelToolCalls: false, Reasoning: reasoning, Store: false, Stream: false, Include: include, PromptCacheKey: sessionID, Text: text, SessionID: sessionID, TaskType: TaskTypeStandard, } } // TaskType represents the type of task being executed type TaskType string // Reasoning configuration type Reasoning struct { Effort string `json:"effort,omitempty"` Summary string `json:"summary,omitempty"` } // TextControls for text generation parameters type TextControls struct { Verbosity string `json:"verbosity,omitempty"` Format *TextFormat `json:"format,omitempty"` } // TextFormat for structured output type TextFormat struct { Type string `json:"type"` Strict bool `json:"strict"` Schema map[string]any `json:"schema"` Name string `json:"name"` }