Documentation
¶
Index ¶
- Constants
- type ChatModel
- type ComparisonFilter
- type ComparisonFilterParam
- type ComparisonFilterType
- type ComparisonFilterValueUnion
- type ComparisonFilterValueUnionParam
- type CompoundFilter
- type CompoundFilterParam
- type CompoundFilterType
- type ComputerTool
- type ComputerToolEnvironment
- type ComputerToolParam
- type EasyInputMessageContentUnionParam
- type EasyInputMessageParam
- type EasyInputMessageRole
- type EasyInputMessageType
- type Error
- type ErrorObject
- type FileSearchTool
- type FileSearchToolFiltersUnion
- type FileSearchToolFiltersUnionParam
- func (u FileSearchToolFiltersUnionParam) GetFilters() []shared.ComparisonFilterParam
- func (u FileSearchToolFiltersUnionParam) GetKey() *string
- func (u FileSearchToolFiltersUnionParam) GetType() *string
- func (u FileSearchToolFiltersUnionParam) GetValue() *shared.ComparisonFilterValueUnionParam
- func (u FileSearchToolFiltersUnionParam) IsPresent() bool
- func (u FileSearchToolFiltersUnionParam) MarshalJSON() ([]byte, error)
- type FileSearchToolParam
- type FileSearchToolRankingOptions
- type FileSearchToolRankingOptionsParam
- type FunctionDefinition
- type FunctionDefinitionParam
- type FunctionParameters
- type FunctionTool
- type FunctionToolParam
- type InputItemListParams
- type InputItemListParamsOrder
- type InputItemService
- func (r *InputItemService) List(ctx context.Context, responseID string, query InputItemListParams, ...) (res *pagination.CursorPage[ResponseItemUnion], err error)
- func (r *InputItemService) ListAutoPaging(ctx context.Context, responseID string, query InputItemListParams, ...) *pagination.CursorPageAutoPager[ResponseItemUnion]
- type Metadata
- type MetadataParam
- type Reasoning
- type ReasoningEffort
- type ReasoningGenerateSummary
- type ReasoningParam
- type Response
- type ResponseAudioDeltaEvent
- type ResponseAudioDoneEvent
- type ResponseAudioTranscriptDeltaEvent
- type ResponseAudioTranscriptDoneEvent
- type ResponseCodeInterpreterCallCodeDeltaEvent
- type ResponseCodeInterpreterCallCodeDoneEvent
- type ResponseCodeInterpreterCallCompletedEvent
- type ResponseCodeInterpreterCallInProgressEvent
- type ResponseCodeInterpreterCallInterpretingEvent
- type ResponseCodeInterpreterToolCall
- type ResponseCodeInterpreterToolCallResultFiles
- type ResponseCodeInterpreterToolCallResultFilesFile
- type ResponseCodeInterpreterToolCallResultLogs
- type ResponseCodeInterpreterToolCallResultUnion
- func (u ResponseCodeInterpreterToolCallResultUnion) AsAny() any
- func (u ResponseCodeInterpreterToolCallResultUnion) AsFiles() (v ResponseCodeInterpreterToolCallResultFiles)
- func (u ResponseCodeInterpreterToolCallResultUnion) AsLogs() (v ResponseCodeInterpreterToolCallResultLogs)
- func (u ResponseCodeInterpreterToolCallResultUnion) RawJSON() string
- func (r *ResponseCodeInterpreterToolCallResultUnion) UnmarshalJSON(data []byte) error
- type ResponseCodeInterpreterToolCallStatus
- type ResponseCompletedEvent
- type ResponseComputerToolCall
- type ResponseComputerToolCallActionClick
- type ResponseComputerToolCallActionClickParam
- type ResponseComputerToolCallActionDoubleClick
- type ResponseComputerToolCallActionDoubleClickParam
- type ResponseComputerToolCallActionDrag
- type ResponseComputerToolCallActionDragParam
- type ResponseComputerToolCallActionDragPath
- type ResponseComputerToolCallActionDragPathParam
- type ResponseComputerToolCallActionKeypress
- type ResponseComputerToolCallActionKeypressParam
- type ResponseComputerToolCallActionMove
- type ResponseComputerToolCallActionMoveParam
- type ResponseComputerToolCallActionScreenshot
- type ResponseComputerToolCallActionScreenshotParam
- type ResponseComputerToolCallActionScroll
- type ResponseComputerToolCallActionScrollParam
- type ResponseComputerToolCallActionType
- type ResponseComputerToolCallActionTypeParam
- type ResponseComputerToolCallActionUnion
- func (u ResponseComputerToolCallActionUnion) AsAny() any
- func (u ResponseComputerToolCallActionUnion) AsClick() (v ResponseComputerToolCallActionClick)
- func (u ResponseComputerToolCallActionUnion) AsDoubleClick() (v ResponseComputerToolCallActionDoubleClick)
- func (u ResponseComputerToolCallActionUnion) AsDrag() (v ResponseComputerToolCallActionDrag)
- func (u ResponseComputerToolCallActionUnion) AsKeypress() (v ResponseComputerToolCallActionKeypress)
- func (u ResponseComputerToolCallActionUnion) AsMove() (v ResponseComputerToolCallActionMove)
- func (u ResponseComputerToolCallActionUnion) AsScreenshot() (v ResponseComputerToolCallActionScreenshot)
- func (u ResponseComputerToolCallActionUnion) AsScroll() (v ResponseComputerToolCallActionScroll)
- func (u ResponseComputerToolCallActionUnion) AsType() (v ResponseComputerToolCallActionType)
- func (u ResponseComputerToolCallActionUnion) AsWait() (v ResponseComputerToolCallActionWait)
- func (u ResponseComputerToolCallActionUnion) RawJSON() string
- func (r *ResponseComputerToolCallActionUnion) UnmarshalJSON(data []byte) error
- type ResponseComputerToolCallActionUnionParam
- func (u ResponseComputerToolCallActionUnionParam) GetButton() *string
- func (u ResponseComputerToolCallActionUnionParam) GetKeys() []string
- func (u ResponseComputerToolCallActionUnionParam) GetPath() []ResponseComputerToolCallActionDragPathParam
- func (u ResponseComputerToolCallActionUnionParam) GetScrollX() *int64
- func (u ResponseComputerToolCallActionUnionParam) GetScrollY() *int64
- func (u ResponseComputerToolCallActionUnionParam) GetText() *string
- func (u ResponseComputerToolCallActionUnionParam) GetType() *string
- func (u ResponseComputerToolCallActionUnionParam) GetX() *int64
- func (u ResponseComputerToolCallActionUnionParam) GetY() *int64
- func (u ResponseComputerToolCallActionUnionParam) IsPresent() bool
- func (u ResponseComputerToolCallActionUnionParam) MarshalJSON() ([]byte, error)
- type ResponseComputerToolCallActionWait
- type ResponseComputerToolCallActionWaitParam
- type ResponseComputerToolCallOutputItem
- type ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck
- type ResponseComputerToolCallOutputItemStatus
- type ResponseComputerToolCallOutputScreenshot
- type ResponseComputerToolCallOutputScreenshotParam
- type ResponseComputerToolCallParam
- type ResponseComputerToolCallPendingSafetyCheck
- type ResponseComputerToolCallPendingSafetyCheckParam
- type ResponseComputerToolCallStatus
- type ResponseComputerToolCallType
- type ResponseContentPartAddedEvent
- type ResponseContentPartAddedEventPartUnion
- func (u ResponseContentPartAddedEventPartUnion) AsAny() any
- func (u ResponseContentPartAddedEventPartUnion) AsOutputText() (v ResponseOutputText)
- func (u ResponseContentPartAddedEventPartUnion) AsRefusal() (v ResponseOutputRefusal)
- func (u ResponseContentPartAddedEventPartUnion) RawJSON() string
- func (r *ResponseContentPartAddedEventPartUnion) UnmarshalJSON(data []byte) error
- type ResponseContentPartDoneEvent
- type ResponseContentPartDoneEventPartUnion
- func (u ResponseContentPartDoneEventPartUnion) AsAny() any
- func (u ResponseContentPartDoneEventPartUnion) AsOutputText() (v ResponseOutputText)
- func (u ResponseContentPartDoneEventPartUnion) AsRefusal() (v ResponseOutputRefusal)
- func (u ResponseContentPartDoneEventPartUnion) RawJSON() string
- func (r *ResponseContentPartDoneEventPartUnion) UnmarshalJSON(data []byte) error
- type ResponseCreatedEvent
- type ResponseError
- type ResponseErrorCode
- type ResponseErrorEvent
- type ResponseFailedEvent
- type ResponseFileSearchCallCompletedEvent
- type ResponseFileSearchCallInProgressEvent
- type ResponseFileSearchCallSearchingEvent
- type ResponseFileSearchToolCall
- type ResponseFileSearchToolCallParam
- type ResponseFileSearchToolCallResult
- type ResponseFileSearchToolCallResultAttributeUnion
- func (u ResponseFileSearchToolCallResultAttributeUnion) AsBool() (v bool)
- func (u ResponseFileSearchToolCallResultAttributeUnion) AsFloat() (v float64)
- func (u ResponseFileSearchToolCallResultAttributeUnion) AsString() (v string)
- func (u ResponseFileSearchToolCallResultAttributeUnion) RawJSON() string
- func (r *ResponseFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error
- type ResponseFileSearchToolCallResultAttributeUnionParam
- type ResponseFileSearchToolCallResultParam
- type ResponseFileSearchToolCallStatus
- type ResponseFormatJSONObject
- type ResponseFormatJSONObjectParam
- type ResponseFormatJSONSchema
- type ResponseFormatJSONSchemaJSONSchema
- type ResponseFormatJSONSchemaJSONSchemaParam
- type ResponseFormatJSONSchemaParam
- type ResponseFormatText
- type ResponseFormatTextConfigUnion
- func (u ResponseFormatTextConfigUnion) AsAny() any
- func (u ResponseFormatTextConfigUnion) AsJSONObject() (v shared.ResponseFormatJSONObject)
- func (u ResponseFormatTextConfigUnion) AsJSONSchema() (v ResponseFormatTextJSONSchemaConfig)
- func (u ResponseFormatTextConfigUnion) AsText() (v shared.ResponseFormatText)
- func (u ResponseFormatTextConfigUnion) RawJSON() string
- func (r ResponseFormatTextConfigUnion) ToParam() ResponseFormatTextConfigUnionParam
- func (r *ResponseFormatTextConfigUnion) UnmarshalJSON(data []byte) error
- type ResponseFormatTextConfigUnionParam
- func (u ResponseFormatTextConfigUnionParam) GetDescription() *string
- func (u ResponseFormatTextConfigUnionParam) GetName() *string
- func (u ResponseFormatTextConfigUnionParam) GetSchema() map[string]interface{}
- func (u ResponseFormatTextConfigUnionParam) GetStrict() *bool
- func (u ResponseFormatTextConfigUnionParam) GetType() *string
- func (u ResponseFormatTextConfigUnionParam) IsPresent() bool
- func (u ResponseFormatTextConfigUnionParam) MarshalJSON() ([]byte, error)
- type ResponseFormatTextJSONSchemaConfig
- type ResponseFormatTextJSONSchemaConfigParam
- type ResponseFormatTextParam
- type ResponseFunctionCallArgumentsDeltaEvent
- type ResponseFunctionCallArgumentsDoneEvent
- type ResponseFunctionToolCall
- type ResponseFunctionToolCallItem
- type ResponseFunctionToolCallOutputItem
- type ResponseFunctionToolCallOutputItemStatus
- type ResponseFunctionToolCallParam
- type ResponseFunctionToolCallStatus
- type ResponseFunctionWebSearch
- type ResponseFunctionWebSearchParam
- type ResponseFunctionWebSearchStatus
- type ResponseGetParams
- type ResponseInProgressEvent
- type ResponseIncludable
- type ResponseIncompleteDetails
- type ResponseIncompleteEvent
- type ResponseInputContentUnion
- func (u ResponseInputContentUnion) AsAny() any
- func (u ResponseInputContentUnion) AsInputFile() (v ResponseInputFile)
- func (u ResponseInputContentUnion) AsInputImage() (v ResponseInputImage)
- func (u ResponseInputContentUnion) AsInputText() (v ResponseInputText)
- func (u ResponseInputContentUnion) RawJSON() string
- func (r ResponseInputContentUnion) ToParam() ResponseInputContentUnionParam
- func (r *ResponseInputContentUnion) UnmarshalJSON(data []byte) error
- type ResponseInputContentUnionParam
- func (u ResponseInputContentUnionParam) GetDetail() *string
- func (u ResponseInputContentUnionParam) GetFileData() *string
- func (u ResponseInputContentUnionParam) GetFileID() *string
- func (u ResponseInputContentUnionParam) GetFilename() *string
- func (u ResponseInputContentUnionParam) GetImageURL() *string
- func (u ResponseInputContentUnionParam) GetText() *string
- func (u ResponseInputContentUnionParam) GetType() *string
- func (u ResponseInputContentUnionParam) IsPresent() bool
- func (u ResponseInputContentUnionParam) MarshalJSON() ([]byte, error)
- type ResponseInputFile
- type ResponseInputFileParam
- type ResponseInputImage
- type ResponseInputImageDetail
- type ResponseInputImageParam
- type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam
- type ResponseInputItemComputerCallOutputParam
- type ResponseInputItemFunctionCallOutputParam
- type ResponseInputItemItemReferenceParam
- type ResponseInputItemMessageParam
- type ResponseInputItemUnionParam
- func ResponseInputItemParamOfComputerCallOutput(callID string, output ResponseComputerToolCallOutputScreenshotParam) ResponseInputItemUnionParam
- func ResponseInputItemParamOfFileSearchCall(id string, queries []string, status ResponseFileSearchToolCallStatus) ResponseInputItemUnionParam
- func ResponseInputItemParamOfFunctionCall(arguments string, callID string, name string) ResponseInputItemUnionParam
- func ResponseInputItemParamOfFunctionCallOutput(callID string, output string) ResponseInputItemUnionParam
- func ResponseInputItemParamOfInputMessage(content ResponseInputMessageContentListParam, role string) ResponseInputItemUnionParam
- func ResponseInputItemParamOfItemReference(id string) ResponseInputItemUnionParam
- func ResponseInputItemParamOfMessage[T string | ResponseInputMessageContentListParam](content T, role EasyInputMessageRole) ResponseInputItemUnionParam
- func ResponseInputItemParamOfOutputMessage(content []ResponseOutputMessageContentUnionParam, id string, ...) ResponseInputItemUnionParam
- func ResponseInputItemParamOfReasoning(id string, summary []ResponseReasoningItemSummaryParam) ResponseInputItemUnionParam
- func ResponseInputItemParamOfWebSearchCall(id string, status ResponseFunctionWebSearchStatus) ResponseInputItemUnionParam
- func (u ResponseInputItemUnionParam) GetAcknowledgedSafetyChecks() []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam
- func (u ResponseInputItemUnionParam) GetAction() *ResponseComputerToolCallActionUnionParam
- func (u ResponseInputItemUnionParam) GetArguments() *string
- func (u ResponseInputItemUnionParam) GetCallID() *string
- func (u ResponseInputItemUnionParam) GetContent() (res responseInputItemUnionParamContent)
- func (u ResponseInputItemUnionParam) GetID() *string
- func (u ResponseInputItemUnionParam) GetName() *string
- func (u ResponseInputItemUnionParam) GetOutput() (res responseInputItemUnionParamOutput)
- func (u ResponseInputItemUnionParam) GetPendingSafetyChecks() []ResponseComputerToolCallPendingSafetyCheckParam
- func (u ResponseInputItemUnionParam) GetQueries() []string
- func (u ResponseInputItemUnionParam) GetResults() []ResponseFileSearchToolCallResultParam
- func (u ResponseInputItemUnionParam) GetRole() *string
- func (u ResponseInputItemUnionParam) GetStatus() *string
- func (u ResponseInputItemUnionParam) GetSummary() []ResponseReasoningItemSummaryParam
- func (u ResponseInputItemUnionParam) GetType() *string
- func (u ResponseInputItemUnionParam) IsPresent() bool
- func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error)
- type ResponseInputMessageContentList
- type ResponseInputMessageContentListParam
- type ResponseInputMessageItem
- type ResponseInputMessageItemRole
- type ResponseInputMessageItemStatus
- type ResponseInputMessageItemType
- type ResponseInputParam
- type ResponseInputText
- type ResponseInputTextParam
- type ResponseItemList
- type ResponseItemUnion
- func (u ResponseItemUnion) AsAny() any
- func (u ResponseItemUnion) AsComputerCall() (v ResponseComputerToolCall)
- func (u ResponseItemUnion) AsComputerCallOutput() (v ResponseComputerToolCallOutputItem)
- func (u ResponseItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)
- func (u ResponseItemUnion) AsFunctionCall() (v ResponseFunctionToolCallItem)
- func (u ResponseItemUnion) AsFunctionCallOutput() (v ResponseFunctionToolCallOutputItem)
- func (u ResponseItemUnion) AsMessage() (v ResponseInputMessageItem)
- func (u ResponseItemUnion) AsOutputMessage() (v ResponseOutputMessage)
- func (u ResponseItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)
- func (u ResponseItemUnion) RawJSON() string
- func (r *ResponseItemUnion) UnmarshalJSON(data []byte) error
- type ResponseItemUnionContent
- type ResponseItemUnionOutput
- type ResponseNewParams
- type ResponseNewParamsInputUnion
- type ResponseNewParamsToolChoiceUnion
- type ResponseNewParamsTruncation
- type ResponseOutputItemAddedEvent
- type ResponseOutputItemDoneEvent
- type ResponseOutputItemUnion
- func (u ResponseOutputItemUnion) AsAny() any
- func (u ResponseOutputItemUnion) AsComputerCall() (v ResponseComputerToolCall)
- func (u ResponseOutputItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)
- func (u ResponseOutputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall)
- func (u ResponseOutputItemUnion) AsMessage() (v ResponseOutputMessage)
- func (u ResponseOutputItemUnion) AsReasoning() (v ResponseReasoningItem)
- func (u ResponseOutputItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)
- func (u ResponseOutputItemUnion) RawJSON() string
- func (r *ResponseOutputItemUnion) UnmarshalJSON(data []byte) error
- type ResponseOutputMessage
- type ResponseOutputMessageContentUnion
- func (u ResponseOutputMessageContentUnion) AsAny() any
- func (u ResponseOutputMessageContentUnion) AsOutputText() (v ResponseOutputText)
- func (u ResponseOutputMessageContentUnion) AsRefusal() (v ResponseOutputRefusal)
- func (u ResponseOutputMessageContentUnion) RawJSON() string
- func (r *ResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error
- type ResponseOutputMessageContentUnionParam
- func (u ResponseOutputMessageContentUnionParam) GetAnnotations() []ResponseOutputTextAnnotationUnionParam
- func (u ResponseOutputMessageContentUnionParam) GetRefusal() *string
- func (u ResponseOutputMessageContentUnionParam) GetText() *string
- func (u ResponseOutputMessageContentUnionParam) GetType() *string
- func (u ResponseOutputMessageContentUnionParam) IsPresent() bool
- func (u ResponseOutputMessageContentUnionParam) MarshalJSON() ([]byte, error)
- type ResponseOutputMessageParam
- type ResponseOutputMessageStatus
- type ResponseOutputRefusal
- type ResponseOutputRefusalParam
- type ResponseOutputText
- type ResponseOutputTextAnnotationFileCitation
- type ResponseOutputTextAnnotationFileCitationParam
- type ResponseOutputTextAnnotationFilePath
- type ResponseOutputTextAnnotationFilePathParam
- type ResponseOutputTextAnnotationURLCitation
- type ResponseOutputTextAnnotationURLCitationParam
- type ResponseOutputTextAnnotationUnion
- func (u ResponseOutputTextAnnotationUnion) AsAny() any
- func (u ResponseOutputTextAnnotationUnion) AsFileCitation() (v ResponseOutputTextAnnotationFileCitation)
- func (u ResponseOutputTextAnnotationUnion) AsFilePath() (v ResponseOutputTextAnnotationFilePath)
- func (u ResponseOutputTextAnnotationUnion) AsURLCitation() (v ResponseOutputTextAnnotationURLCitation)
- func (u ResponseOutputTextAnnotationUnion) RawJSON() string
- func (r *ResponseOutputTextAnnotationUnion) UnmarshalJSON(data []byte) error
- type ResponseOutputTextAnnotationUnionParam
- func (u ResponseOutputTextAnnotationUnionParam) GetEndIndex() *int64
- func (u ResponseOutputTextAnnotationUnionParam) GetFileID() *string
- func (u ResponseOutputTextAnnotationUnionParam) GetIndex() *int64
- func (u ResponseOutputTextAnnotationUnionParam) GetStartIndex() *int64
- func (u ResponseOutputTextAnnotationUnionParam) GetTitle() *string
- func (u ResponseOutputTextAnnotationUnionParam) GetType() *string
- func (u ResponseOutputTextAnnotationUnionParam) GetURL() *string
- func (u ResponseOutputTextAnnotationUnionParam) IsPresent() bool
- func (u ResponseOutputTextAnnotationUnionParam) MarshalJSON() ([]byte, error)
- type ResponseOutputTextParam
- type ResponseReasoningItem
- type ResponseReasoningItemParam
- type ResponseReasoningItemStatus
- type ResponseReasoningItemSummary
- type ResponseReasoningItemSummaryParam
- type ResponseRefusalDeltaEvent
- type ResponseRefusalDoneEvent
- type ResponseService
- func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (err error)
- func (r *ResponseService) Get(ctx context.Context, responseID string, query ResponseGetParams, ...) (res *Response, err error)
- func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *Response, err error)
- func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseStreamEventUnion])
- type ResponseStatus
- type ResponseStreamEventUnion
- func (u ResponseStreamEventUnion) AsAny() any
- func (u ResponseStreamEventUnion) AsError() (v ResponseErrorEvent)
- func (u ResponseStreamEventUnion) AsResponseAudioDelta() (v ResponseAudioDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseAudioDone() (v ResponseAudioDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDelta() (v ResponseAudioTranscriptDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDone() (v ResponseAudioTranscriptDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta() (v ResponseCodeInterpreterCallCodeDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone() (v ResponseCodeInterpreterCallCodeDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted() (v ResponseCodeInterpreterCallCompletedEvent)
- func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress() (v ResponseCodeInterpreterCallInProgressEvent)
- func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting() (v ResponseCodeInterpreterCallInterpretingEvent)
- func (u ResponseStreamEventUnion) AsResponseCompleted() (v ResponseCompletedEvent)
- func (u ResponseStreamEventUnion) AsResponseContentPartAdded() (v ResponseContentPartAddedEvent)
- func (u ResponseStreamEventUnion) AsResponseContentPartDone() (v ResponseContentPartDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseCreated() (v ResponseCreatedEvent)
- func (u ResponseStreamEventUnion) AsResponseFailed() (v ResponseFailedEvent)
- func (u ResponseStreamEventUnion) AsResponseFileSearchCallCompleted() (v ResponseFileSearchCallCompletedEvent)
- func (u ResponseStreamEventUnion) AsResponseFileSearchCallInProgress() (v ResponseFileSearchCallInProgressEvent)
- func (u ResponseStreamEventUnion) AsResponseFileSearchCallSearching() (v ResponseFileSearchCallSearchingEvent)
- func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta() (v ResponseFunctionCallArgumentsDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone() (v ResponseFunctionCallArgumentsDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseInProgress() (v ResponseInProgressEvent)
- func (u ResponseStreamEventUnion) AsResponseIncomplete() (v ResponseIncompleteEvent)
- func (u ResponseStreamEventUnion) AsResponseOutputItemAdded() (v ResponseOutputItemAddedEvent)
- func (u ResponseStreamEventUnion) AsResponseOutputItemDone() (v ResponseOutputItemDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded() (v ResponseTextAnnotationDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseOutputTextDelta() (v ResponseTextDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseOutputTextDone() (v ResponseTextDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseRefusalDelta() (v ResponseRefusalDeltaEvent)
- func (u ResponseStreamEventUnion) AsResponseRefusalDone() (v ResponseRefusalDoneEvent)
- func (u ResponseStreamEventUnion) AsResponseWebSearchCallCompleted() (v ResponseWebSearchCallCompletedEvent)
- func (u ResponseStreamEventUnion) AsResponseWebSearchCallInProgress() (v ResponseWebSearchCallInProgressEvent)
- func (u ResponseStreamEventUnion) AsResponseWebSearchCallSearching() (v ResponseWebSearchCallSearchingEvent)
- func (u ResponseStreamEventUnion) RawJSON() string
- func (r *ResponseStreamEventUnion) UnmarshalJSON(data []byte) error
- type ResponseStreamEventUnionPart
- type ResponseTextAnnotationDeltaEvent
- type ResponseTextAnnotationDeltaEventAnnotationFileCitation
- type ResponseTextAnnotationDeltaEventAnnotationFilePath
- type ResponseTextAnnotationDeltaEventAnnotationURLCitation
- type ResponseTextAnnotationDeltaEventAnnotationUnion
- func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsAny() any
- func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsFileCitation() (v ResponseTextAnnotationDeltaEventAnnotationFileCitation)
- func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsFilePath() (v ResponseTextAnnotationDeltaEventAnnotationFilePath)
- func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsURLCitation() (v ResponseTextAnnotationDeltaEventAnnotationURLCitation)
- func (u ResponseTextAnnotationDeltaEventAnnotationUnion) RawJSON() string
- func (r *ResponseTextAnnotationDeltaEventAnnotationUnion) UnmarshalJSON(data []byte) error
- type ResponseTextConfig
- type ResponseTextConfigParam
- type ResponseTextDeltaEvent
- type ResponseTextDoneEvent
- type ResponseToolChoiceUnion
- func (u ResponseToolChoiceUnion) AsFunctionTool() (v ToolChoiceFunction)
- func (u ResponseToolChoiceUnion) AsHostedTool() (v ToolChoiceTypes)
- func (u ResponseToolChoiceUnion) AsToolChoiceMode() (v ToolChoiceOptions)
- func (u ResponseToolChoiceUnion) RawJSON() string
- func (r *ResponseToolChoiceUnion) UnmarshalJSON(data []byte) error
- type ResponseTruncation
- type ResponseUsage
- type ResponseUsageInputTokensDetails
- type ResponseUsageOutputTokensDetails
- type ResponseWebSearchCallCompletedEvent
- type ResponseWebSearchCallInProgressEvent
- type ResponseWebSearchCallSearchingEvent
- type ResponsesModel
- type ToolChoiceFunction
- type ToolChoiceFunctionParam
- type ToolChoiceOptions
- type ToolChoiceTypes
- type ToolChoiceTypesParam
- type ToolChoiceTypesType
- type ToolUnion
- func (u ToolUnion) AsComputerUsePreview() (v ComputerTool)
- func (u ToolUnion) AsFileSearch() (v FileSearchTool)
- func (u ToolUnion) AsFunction() (v FunctionTool)
- func (u ToolUnion) AsWebSearch() (v WebSearchTool)
- func (u ToolUnion) RawJSON() string
- func (r ToolUnion) ToParam() ToolUnionParam
- func (r *ToolUnion) UnmarshalJSON(data []byte) error
- type ToolUnionParam
- func ToolParamOfComputerUsePreview(displayHeight float64, displayWidth float64, ...) ToolUnionParam
- func ToolParamOfFileSearch(vectorStoreIDs []string) ToolUnionParam
- func ToolParamOfFunction(name string, parameters map[string]interface{}, strict bool) ToolUnionParam
- func ToolParamOfWebSearch(type_ WebSearchToolType) ToolUnionParam
- func (u ToolUnionParam) GetDescription() *string
- func (u ToolUnionParam) GetDisplayHeight() *float64
- func (u ToolUnionParam) GetDisplayWidth() *float64
- func (u ToolUnionParam) GetEnvironment() *string
- func (u ToolUnionParam) GetFilters() *FileSearchToolFiltersUnionParam
- func (u ToolUnionParam) GetMaxNumResults() *int64
- func (u ToolUnionParam) GetName() *string
- func (u ToolUnionParam) GetParameters() map[string]interface{}
- func (u ToolUnionParam) GetRankingOptions() *FileSearchToolRankingOptionsParam
- func (u ToolUnionParam) GetSearchContextSize() *string
- func (u ToolUnionParam) GetStrict() *bool
- func (u ToolUnionParam) GetType() *string
- func (u ToolUnionParam) GetUserLocation() *WebSearchToolUserLocationParam
- func (u ToolUnionParam) GetVectorStoreIDs() []string
- func (u ToolUnionParam) IsPresent() bool
- func (u ToolUnionParam) MarshalJSON() ([]byte, error)
- type WebSearchTool
- type WebSearchToolParam
- type WebSearchToolSearchContextSize
- type WebSearchToolType
- type WebSearchToolUserLocation
- type WebSearchToolUserLocationParam
Constants ¶
const ChatModelChatgpt4oLatest = shared.ChatModelChatgpt4oLatest
Equals "chatgpt-4o-latest"
const ChatModelGPT3_5Turbo = shared.ChatModelGPT3_5Turbo
Equals "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo0125 = shared.ChatModelGPT3_5Turbo0125
Equals "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo0301 = shared.ChatModelGPT3_5Turbo0301
Equals "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 = shared.ChatModelGPT3_5Turbo0613
Equals "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 = shared.ChatModelGPT3_5Turbo1106
Equals "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo16k = shared.ChatModelGPT3_5Turbo16k
Equals "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo16k0613 = shared.ChatModelGPT3_5Turbo16k0613
Equals "gpt-3.5-turbo-16k-0613"
const ChatModelGPT4 = shared.ChatModelGPT4
Equals "gpt-4"
const ChatModelGPT4Turbo = shared.ChatModelGPT4Turbo
Equals "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 = shared.ChatModelGPT4Turbo2024_04_09
Equals "gpt-4-turbo-2024-04-09"
const ChatModelGPT4TurboPreview = shared.ChatModelGPT4TurboPreview
Equals "gpt-4-turbo-preview"
const ChatModelGPT4VisionPreview = shared.ChatModelGPT4VisionPreview
Equals "gpt-4-vision-preview"
const ChatModelGPT4_0125Preview = shared.ChatModelGPT4_0125Preview
Equals "gpt-4-0125-preview"
const ChatModelGPT4_0314 = shared.ChatModelGPT4_0314
Equals "gpt-4-0314"
const ChatModelGPT4_0613 = shared.ChatModelGPT4_0613
Equals "gpt-4-0613"
const ChatModelGPT4_1106Preview = shared.ChatModelGPT4_1106Preview
Equals "gpt-4-1106-preview"
const ChatModelGPT4_32k = shared.ChatModelGPT4_32k
Equals "gpt-4-32k"
const ChatModelGPT4_32k0314 = shared.ChatModelGPT4_32k0314
Equals "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 = shared.ChatModelGPT4_32k0613
Equals "gpt-4-32k-0613"
const ChatModelGPT4o = shared.ChatModelGPT4o
Equals "gpt-4o"
const ChatModelGPT4o2024_05_13 = shared.ChatModelGPT4o2024_05_13
Equals "gpt-4o-2024-05-13"
const ChatModelGPT4o2024_08_06 = shared.ChatModelGPT4o2024_08_06
Equals "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_11_20 = shared.ChatModelGPT4o2024_11_20
Equals "gpt-4o-2024-11-20"
const ChatModelGPT4oAudioPreview = shared.ChatModelGPT4oAudioPreview
Equals "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 = shared.ChatModelGPT4oAudioPreview2024_10_01
Equals "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 = shared.ChatModelGPT4oAudioPreview2024_12_17
Equals "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oMini = shared.ChatModelGPT4oMini
Equals "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 = shared.ChatModelGPT4oMini2024_07_18
Equals "gpt-4o-mini-2024-07-18"
const ChatModelGPT4oMiniAudioPreview = shared.ChatModelGPT4oMiniAudioPreview
Equals "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 = shared.ChatModelGPT4oMiniAudioPreview2024_12_17
Equals "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oMiniSearchPreview = shared.ChatModelGPT4oMiniSearchPreview
Equals "gpt-4o-mini-search-preview"
const ChatModelGPT4oMiniSearchPreview2025_03_11 = shared.ChatModelGPT4oMiniSearchPreview2025_03_11
Equals "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelGPT4oSearchPreview = shared.ChatModelGPT4oSearchPreview
Equals "gpt-4o-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 = shared.ChatModelGPT4oSearchPreview2025_03_11
Equals "gpt-4o-search-preview-2025-03-11"
const ChatModelO1 = shared.ChatModelO1
Equals "o1"
const ChatModelO1Mini = shared.ChatModelO1Mini
Equals "o1-mini"
const ChatModelO1Mini2024_09_12 = shared.ChatModelO1Mini2024_09_12
Equals "o1-mini-2024-09-12"
const ChatModelO1Preview = shared.ChatModelO1Preview
Equals "o1-preview"
const ChatModelO1Preview2024_09_12 = shared.ChatModelO1Preview2024_09_12
Equals "o1-preview-2024-09-12"
const ChatModelO1_2024_12_17 = shared.ChatModelO1_2024_12_17
Equals "o1-2024-12-17"
const ChatModelO3Mini = shared.ChatModelO3Mini
Equals "o3-mini"
const ChatModelO3Mini2025_01_31 = shared.ChatModelO3Mini2025_01_31
Equals "o3-mini-2025-01-31"
const ComparisonFilterTypeEq = shared.ComparisonFilterTypeEq
Equals "eq"
const ComparisonFilterTypeGt = shared.ComparisonFilterTypeGt
Equals "gt"
const ComparisonFilterTypeGte = shared.ComparisonFilterTypeGte
Equals "gte"
const ComparisonFilterTypeLt = shared.ComparisonFilterTypeLt
Equals "lt"
const ComparisonFilterTypeLte = shared.ComparisonFilterTypeLte
Equals "lte"
const ComparisonFilterTypeNe = shared.ComparisonFilterTypeNe
Equals "ne"
const CompoundFilterTypeAnd = shared.CompoundFilterTypeAnd
Equals "and"
const CompoundFilterTypeOr = shared.CompoundFilterTypeOr
Equals "or"
const ReasoningEffortHigh = shared.ReasoningEffortHigh
Equals "high"
const ReasoningEffortLow = shared.ReasoningEffortLow
Equals "low"
const ReasoningEffortMedium = shared.ReasoningEffortMedium
Equals "medium"
const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
Equals "concise"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
Equals "detailed"
const ResponsesModelComputerUsePreview = shared.ResponsesModelComputerUsePreview
Equals "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 = shared.ResponsesModelComputerUsePreview2025_03_11
Equals "computer-use-preview-2025-03-11"
const ResponsesModelO1Pro = shared.ResponsesModelO1Pro
Equals "o1-pro"
const ResponsesModelO1Pro2025_03_19 = shared.ResponsesModelO1Pro2025_03_19
Equals "o1-pro-2025-03-19"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComparisonFilter ¶
type ComparisonFilter = shared.ComparisonFilter
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
This is an alias to an internal type.
type ComparisonFilterParam ¶
type ComparisonFilterParam = shared.ComparisonFilterParam
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
This is an alias to an internal type.
type ComparisonFilterType ¶
type ComparisonFilterType = shared.ComparisonFilterType
Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.
- `eq`: equals - `ne`: not equal - `gt`: greater than - `gte`: greater than or equal - `lt`: less than - `lte`: less than or equal
This is an alias to an internal type.
type ComparisonFilterValueUnion ¶
type ComparisonFilterValueUnion = shared.ComparisonFilterValueUnion
The value to compare against the attribute key; supports string, number, or boolean types.
This is an alias to an internal type.
type ComparisonFilterValueUnionParam ¶
type ComparisonFilterValueUnionParam = shared.ComparisonFilterValueUnionParam
The value to compare against the attribute key; supports string, number, or boolean types.
This is an alias to an internal type.
type CompoundFilter ¶
type CompoundFilter = shared.CompoundFilter
Combine multiple filters using `and` or `or`.
This is an alias to an internal type.
type CompoundFilterParam ¶
type CompoundFilterParam = shared.CompoundFilterParam
Combine multiple filters using `and` or `or`.
This is an alias to an internal type.
type CompoundFilterType ¶
type CompoundFilterType = shared.CompoundFilterType
Type of operation: `and` or `or`.
This is an alias to an internal type.
type ComputerTool ¶
type ComputerTool struct { // The height of the computer display. DisplayHeight float64 `json:"display_height,required"` // The width of the computer display. DisplayWidth float64 `json:"display_width,required"` // The type of computer environment to control. // // Any of "mac", "windows", "ubuntu", "browser". Environment ComputerToolEnvironment `json:"environment,required"` // The type of the computer use tool. Always `computer_use_preview`. Type constant.ComputerUsePreview `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { DisplayHeight resp.Field DisplayWidth resp.Field Environment resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
func (ComputerTool) RawJSON ¶
func (r ComputerTool) RawJSON() string
Returns the unmodified JSON received from the API
func (ComputerTool) ToParam ¶
func (r ComputerTool) ToParam() ComputerToolParam
ToParam converts this ComputerTool to a ComputerToolParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ComputerToolParam.IsOverridden()
func (*ComputerTool) UnmarshalJSON ¶
func (r *ComputerTool) UnmarshalJSON(data []byte) error
type ComputerToolEnvironment ¶
type ComputerToolEnvironment string
The type of computer environment to control.
const ( ComputerToolEnvironmentMac ComputerToolEnvironment = "mac" ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows" ComputerToolEnvironmentUbuntu ComputerToolEnvironment = "ubuntu" ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser" )
type ComputerToolParam ¶
type ComputerToolParam struct { // The height of the computer display. DisplayHeight float64 `json:"display_height,required"` // The width of the computer display. DisplayWidth float64 `json:"display_width,required"` // The type of computer environment to control. // // Any of "mac", "windows", "ubuntu", "browser". Environment ComputerToolEnvironment `json:"environment,omitzero,required"` // The type of the computer use tool. Always `computer_use_preview`. // // This field can be elided, and will marshal its zero value as // "computer_use_preview". Type constant.ComputerUsePreview `json:"type,required"` // contains filtered or unexported fields }
A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
The properties DisplayHeight, DisplayWidth, Environment, Type are required.
func (ComputerToolParam) IsPresent ¶
func (f ComputerToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ComputerToolParam) MarshalJSON ¶
func (r ComputerToolParam) MarshalJSON() (data []byte, err error)
type EasyInputMessageContentUnionParam ¶
type EasyInputMessageContentUnionParam struct { OfString param.Opt[string] `json:",omitzero,inline"` OfInputItemContentList ResponseInputMessageContentListParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (EasyInputMessageContentUnionParam) IsPresent ¶
func (u EasyInputMessageContentUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (EasyInputMessageContentUnionParam) MarshalJSON ¶
func (u EasyInputMessageContentUnionParam) MarshalJSON() ([]byte, error)
type EasyInputMessageParam ¶
type EasyInputMessageParam struct { // Text, image, or audio input to the model, used to generate a response. Can also // contain previous assistant responses. Content EasyInputMessageContentUnionParam `json:"content,omitzero,required"` // The role of the message input. One of `user`, `assistant`, `system`, or // `developer`. // // Any of "user", "assistant", "system", "developer". Role EasyInputMessageRole `json:"role,omitzero,required"` // The type of the message input. Always `message`. // // Any of "message". Type EasyInputMessageType `json:"type,omitzero"` // contains filtered or unexported fields }
A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.
The properties Content, Role are required.
func (EasyInputMessageParam) IsPresent ¶
func (f EasyInputMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (EasyInputMessageParam) MarshalJSON ¶
func (r EasyInputMessageParam) MarshalJSON() (data []byte, err error)
type EasyInputMessageRole ¶
type EasyInputMessageRole string
The role of the message input. One of `user`, `assistant`, `system`, or `developer`.
const ( EasyInputMessageRoleUser EasyInputMessageRole = "user" EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant" EasyInputMessageRoleSystem EasyInputMessageRole = "system" EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer" )
type EasyInputMessageType ¶
type EasyInputMessageType string
The type of the message input. Always `message`.
const (
EasyInputMessageTypeMessage EasyInputMessageType = "message"
)
type FileSearchTool ¶
type FileSearchTool struct { // The type of the file search tool. Always `file_search`. Type constant.FileSearch `json:"type,required"` // The IDs of the vector stores to search. VectorStoreIDs []string `json:"vector_store_ids,required"` // A filter to apply based on file attributes. Filters FileSearchToolFiltersUnion `json:"filters"` // The maximum number of results to return. This number should be between 1 and 50 // inclusive. MaxNumResults int64 `json:"max_num_results"` // Ranking options for search. RankingOptions FileSearchToolRankingOptions `json:"ranking_options"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field VectorStoreIDs resp.Field Filters resp.Field MaxNumResults resp.Field RankingOptions resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
func (FileSearchTool) RawJSON ¶
func (r FileSearchTool) RawJSON() string
Returns the unmodified JSON received from the API
func (FileSearchTool) ToParam ¶
func (r FileSearchTool) ToParam() FileSearchToolParam
ToParam converts this FileSearchTool to a FileSearchToolParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FileSearchToolParam.IsOverridden()
func (*FileSearchTool) UnmarshalJSON ¶
func (r *FileSearchTool) UnmarshalJSON(data []byte) error
type FileSearchToolFiltersUnion ¶
type FileSearchToolFiltersUnion struct { // This field is from variant [shared.ComparisonFilter]. Key string `json:"key"` Type string `json:"type"` // This field is from variant [shared.ComparisonFilter]. Value shared.ComparisonFilterValueUnion `json:"value"` // This field is from variant [shared.CompoundFilter]. Filters []shared.ComparisonFilter `json:"filters"` JSON struct { Key resp.Field Type resp.Field Value resp.Field Filters resp.Field // contains filtered or unexported fields } `json:"-"` }
FileSearchToolFiltersUnion contains all possible properties and values from shared.ComparisonFilter, shared.CompoundFilter.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (FileSearchToolFiltersUnion) AsComparisonFilter ¶
func (u FileSearchToolFiltersUnion) AsComparisonFilter() (v shared.ComparisonFilter)
func (FileSearchToolFiltersUnion) AsCompoundFilter ¶
func (u FileSearchToolFiltersUnion) AsCompoundFilter() (v shared.CompoundFilter)
func (FileSearchToolFiltersUnion) RawJSON ¶
func (u FileSearchToolFiltersUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolFiltersUnion) UnmarshalJSON ¶
func (r *FileSearchToolFiltersUnion) UnmarshalJSON(data []byte) error
type FileSearchToolFiltersUnionParam ¶
type FileSearchToolFiltersUnionParam struct { OfComparisonFilter *shared.ComparisonFilterParam `json:",omitzero,inline"` OfCompoundFilter *shared.CompoundFilterParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (FileSearchToolFiltersUnionParam) GetFilters ¶
func (u FileSearchToolFiltersUnionParam) GetFilters() []shared.ComparisonFilterParam
Returns a pointer to the underlying variant's property, if present.
func (FileSearchToolFiltersUnionParam) GetKey ¶
func (u FileSearchToolFiltersUnionParam) GetKey() *string
Returns a pointer to the underlying variant's property, if present.
func (FileSearchToolFiltersUnionParam) GetType ¶
func (u FileSearchToolFiltersUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (FileSearchToolFiltersUnionParam) GetValue ¶
func (u FileSearchToolFiltersUnionParam) GetValue() *shared.ComparisonFilterValueUnionParam
Returns a pointer to the underlying variant's property, if present.
func (FileSearchToolFiltersUnionParam) IsPresent ¶
func (u FileSearchToolFiltersUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileSearchToolFiltersUnionParam) MarshalJSON ¶
func (u FileSearchToolFiltersUnionParam) MarshalJSON() ([]byte, error)
type FileSearchToolParam ¶
type FileSearchToolParam struct { // The IDs of the vector stores to search. VectorStoreIDs []string `json:"vector_store_ids,omitzero,required"` // The maximum number of results to return. This number should be between 1 and 50 // inclusive. MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"` // A filter to apply based on file attributes. Filters FileSearchToolFiltersUnionParam `json:"filters,omitzero"` // Ranking options for search. RankingOptions FileSearchToolRankingOptionsParam `json:"ranking_options,omitzero"` // The type of the file search tool. Always `file_search`. // // This field can be elided, and will marshal its zero value as "file_search". Type constant.FileSearch `json:"type,required"` // contains filtered or unexported fields }
A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
The properties Type, VectorStoreIDs are required.
func (FileSearchToolParam) IsPresent ¶
func (f FileSearchToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileSearchToolParam) MarshalJSON ¶
func (r FileSearchToolParam) MarshalJSON() (data []byte, err error)
type FileSearchToolRankingOptions ¶
type FileSearchToolRankingOptions struct { // The ranker to use for the file search. // // Any of "auto", "default-2024-11-15". Ranker string `json:"ranker"` // The score threshold for the file search, a number between 0 and 1. Numbers // closer to 1 will attempt to return only the most relevant results, but may // return fewer results. ScoreThreshold float64 `json:"score_threshold"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Ranker resp.Field ScoreThreshold resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Ranking options for search.
func (FileSearchToolRankingOptions) RawJSON ¶
func (r FileSearchToolRankingOptions) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolRankingOptions) UnmarshalJSON ¶
func (r *FileSearchToolRankingOptions) UnmarshalJSON(data []byte) error
type FileSearchToolRankingOptionsParam ¶
type FileSearchToolRankingOptionsParam struct { // The score threshold for the file search, a number between 0 and 1. Numbers // closer to 1 will attempt to return only the most relevant results, but may // return fewer results. ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"` // The ranker to use for the file search. // // Any of "auto", "default-2024-11-15". Ranker string `json:"ranker,omitzero"` // contains filtered or unexported fields }
Ranking options for search.
func (FileSearchToolRankingOptionsParam) IsPresent ¶
func (f FileSearchToolRankingOptionsParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileSearchToolRankingOptionsParam) MarshalJSON ¶
func (r FileSearchToolRankingOptionsParam) MarshalJSON() (data []byte, err error)
type FunctionDefinition ¶
type FunctionDefinition = shared.FunctionDefinition
This is an alias to an internal type.
type FunctionDefinitionParam ¶
type FunctionDefinitionParam = shared.FunctionDefinitionParam
This is an alias to an internal type.
type FunctionParameters ¶
type FunctionParameters = shared.FunctionParameters
The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
Omitting `parameters` defines a function with an empty parameter list.
This is an alias to an internal type.
type FunctionTool ¶
type FunctionTool struct { // The name of the function to call. Name string `json:"name,required"` // A JSON schema object describing the parameters of the function. Parameters map[string]interface{} `json:"parameters,required"` // Whether to enforce strict parameter validation. Default `true`. Strict bool `json:"strict,required"` // The type of the function tool. Always `function`. Type constant.Function `json:"type,required"` // A description of the function. Used by the model to determine whether or not to // call the function. Description string `json:"description,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Name resp.Field Parameters resp.Field Strict resp.Field Type resp.Field Description resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).
func (FunctionTool) RawJSON ¶
func (r FunctionTool) RawJSON() string
Returns the unmodified JSON received from the API
func (FunctionTool) ToParam ¶
func (r FunctionTool) ToParam() FunctionToolParam
ToParam converts this FunctionTool to a FunctionToolParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FunctionToolParam.IsOverridden()
func (*FunctionTool) UnmarshalJSON ¶
func (r *FunctionTool) UnmarshalJSON(data []byte) error
type FunctionToolParam ¶
type FunctionToolParam struct { // The name of the function to call. Name string `json:"name,required"` // A JSON schema object describing the parameters of the function. Parameters map[string]interface{} `json:"parameters,omitzero,required"` // Whether to enforce strict parameter validation. Default `true`. Strict bool `json:"strict,required"` // A description of the function. Used by the model to determine whether or not to // call the function. Description param.Opt[string] `json:"description,omitzero"` // The type of the function tool. Always `function`. // // This field can be elided, and will marshal its zero value as "function". Type constant.Function `json:"type,required"` // contains filtered or unexported fields }
Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).
The properties Name, Parameters, Strict, Type are required.
func (FunctionToolParam) IsPresent ¶
func (f FunctionToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FunctionToolParam) MarshalJSON ¶
func (r FunctionToolParam) MarshalJSON() (data []byte, err error)
type InputItemListParams ¶
type InputItemListParams struct { // An item ID to list items after, used in pagination. After param.Opt[string] `query:"after,omitzero" json:"-"` // An item ID to list items before, used in pagination. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Additional fields to include in the response. See the `include` parameter for // Response creation above for more information. Include []ResponseIncludable `query:"include,omitzero" json:"-"` // The order to return the input items in. Default is `asc`. // // - `asc`: Return the input items in ascending order. // - `desc`: Return the input items in descending order. // // Any of "asc", "desc". Order InputItemListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (InputItemListParams) IsPresent ¶
func (f InputItemListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (InputItemListParams) URLQuery ¶
func (r InputItemListParams) URLQuery() (v url.Values)
URLQuery serializes InputItemListParams's query parameters as `url.Values`.
type InputItemListParamsOrder ¶
type InputItemListParamsOrder string
The order to return the input items in. Default is `asc`.
- `asc`: Return the input items in ascending order. - `desc`: Return the input items in descending order.
const ( InputItemListParamsOrderAsc InputItemListParamsOrder = "asc" InputItemListParamsOrderDesc InputItemListParamsOrder = "desc" )
type InputItemService ¶
type InputItemService struct {
Options []option.RequestOption
}
InputItemService contains methods and other services that help with interacting with the openai API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInputItemService method instead.
func NewInputItemService ¶
func NewInputItemService(opts ...option.RequestOption) (r InputItemService)
NewInputItemService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*InputItemService) List ¶
func (r *InputItemService) List(ctx context.Context, responseID string, query InputItemListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ResponseItemUnion], err error)
Returns a list of input items for a given response.
func (*InputItemService) ListAutoPaging ¶
func (r *InputItemService) ListAutoPaging(ctx context.Context, responseID string, query InputItemListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[ResponseItemUnion]
Returns a list of input items for a given response.
type Metadata ¶
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
This is an alias to an internal type.
type MetadataParam ¶
type MetadataParam = shared.MetadataParam
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
This is an alias to an internal type.
type Reasoning ¶
**o-series models only**
Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
This is an alias to an internal type.
type ReasoningEffort ¶
type ReasoningEffort = shared.ReasoningEffort
**o-series models only**
Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
This is an alias to an internal type.
type ReasoningGenerateSummary ¶
type ReasoningGenerateSummary = shared.ReasoningGenerateSummary
**computer_use_preview only**
A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `concise` or `detailed`.
This is an alias to an internal type.
type ReasoningParam ¶
type ReasoningParam = shared.ReasoningParam
**o-series models only**
Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
This is an alias to an internal type.
type Response ¶
type Response struct { // Unique identifier for this Response. ID string `json:"id,required"` // Unix timestamp (in seconds) of when this Response was created. CreatedAt float64 `json:"created_at,required"` // An error object returned when the model fails to generate a Response. Error ResponseError `json:"error,required"` // Details about why the response is incomplete. IncompleteDetails ResponseIncompleteDetails `json:"incomplete_details,required"` // Inserts a system (or developer) message as the first item in the model's // context. // // When using along with `previous_response_id`, the instructions from a previous // response will not be carried over to the next response. This makes it simple to // swap out system (or developer) messages in new responses. Instructions string `json:"instructions,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.Metadata `json:"metadata,required"` // Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a // wide range of models with different capabilities, performance characteristics, // and price points. Refer to the // [model guide](https://platform.openai.com/docs/models) to browse and compare // available models. Model shared.ResponsesModel `json:"model,required"` // The object type of this resource - always set to `response`. Object constant.Response `json:"object,required"` // An array of content items generated by the model. // // - The length and order of items in the `output` array is dependent on the // model's response. // - Rather than accessing the first item in the `output` array and assuming it's // an `assistant` message with the content generated by the model, you might // consider using the `output_text` property where supported in SDKs. Output []ResponseOutputItemUnion `json:"output,required"` // Whether to allow the model to run tool calls in parallel. ParallelToolCalls bool `json:"parallel_tool_calls,required"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. We generally recommend altering this or `top_p` but // not both. Temperature float64 `json:"temperature,required"` // How the model should select which tool (or tools) to use when generating a // response. See the `tools` parameter to see how to specify which tools the model // can call. ToolChoice ResponseToolChoiceUnion `json:"tool_choice,required"` // An array of tools the model may call while generating a response. You can // specify which tool to use by setting the `tool_choice` parameter. // // The two categories of tools you can provide the model are: // // - **Built-in tools**: Tools that are provided by OpenAI that extend the model's // capabilities, like // [web search](https://platform.openai.com/docs/guides/tools-web-search) or // [file search](https://platform.openai.com/docs/guides/tools-file-search). // Learn more about // [built-in tools](https://platform.openai.com/docs/guides/tools). // - **Function calls (custom tools)**: Functions that are defined by you, enabling // the model to call your own code. Learn more about // [function calling](https://platform.openai.com/docs/guides/function-calling). Tools []ToolUnion `json:"tools,required"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or `temperature` but not both. TopP float64 `json:"top_p,required"` // An upper bound for the number of tokens that can be generated for a response, // including visible output tokens and // [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). MaxOutputTokens int64 `json:"max_output_tokens,nullable"` // The unique ID of the previous response to the model. Use this to create // multi-turn conversations. Learn more about // [conversation state](https://platform.openai.com/docs/guides/conversation-state). PreviousResponseID string `json:"previous_response_id,nullable"` // **o-series models only** // // Configuration options for // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Reasoning shared.Reasoning `json:"reasoning,nullable"` // The status of the response generation. One of `completed`, `failed`, // `in_progress`, or `incomplete`. // // Any of "completed", "failed", "in_progress", "incomplete". Status ResponseStatus `json:"status"` // Configuration options for a text response from the model. Can be plain text or // structured JSON data. Learn more: // // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) // - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) Text ResponseTextConfig `json:"text"` // The truncation strategy to use for the model response. // // - `auto`: If the context of this response and previous ones exceeds the model's // context window size, the model will truncate the response to fit the context // window by dropping input items in the middle of the conversation. // - `disabled` (default): If a model response will exceed the context window size // for a model, the request will fail with a 400 error. // // Any of "auto", "disabled". Truncation ResponseTruncation `json:"truncation,nullable"` // Represents token usage details including input tokens, output tokens, a // breakdown of output tokens, and the total tokens used. Usage ResponseUsage `json:"usage"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User string `json:"user"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Error resp.Field IncompleteDetails resp.Field Instructions resp.Field Metadata resp.Field Model resp.Field Object resp.Field Output resp.Field ParallelToolCalls resp.Field Temperature resp.Field ToolChoice resp.Field Tools resp.Field TopP resp.Field MaxOutputTokens resp.Field PreviousResponseID resp.Field Reasoning resp.Field Status resp.Field Text resp.Field Truncation resp.Field Usage resp.Field User resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (Response) OutputText ¶
func (*Response) UnmarshalJSON ¶
type ResponseAudioDeltaEvent ¶
type ResponseAudioDeltaEvent struct { // A chunk of Base64 encoded response audio bytes. Delta string `json:"delta,required"` // The type of the event. Always `response.audio.delta`. Type constant.ResponseAudioDelta `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Delta resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when there is a partial audio response.
func (ResponseAudioDeltaEvent) RawJSON ¶
func (r ResponseAudioDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseAudioDeltaEvent) UnmarshalJSON ¶
func (r *ResponseAudioDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseAudioDoneEvent ¶
type ResponseAudioDoneEvent struct { // The type of the event. Always `response.audio.done`. Type constant.ResponseAudioDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the audio response is complete.
func (ResponseAudioDoneEvent) RawJSON ¶
func (r ResponseAudioDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseAudioDoneEvent) UnmarshalJSON ¶
func (r *ResponseAudioDoneEvent) UnmarshalJSON(data []byte) error
type ResponseAudioTranscriptDeltaEvent ¶
type ResponseAudioTranscriptDeltaEvent struct { // The partial transcript of the audio response. Delta string `json:"delta,required"` // The type of the event. Always `response.audio.transcript.delta`. Type constant.ResponseAudioTranscriptDelta `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Delta resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when there is a partial transcript of audio.
func (ResponseAudioTranscriptDeltaEvent) RawJSON ¶
func (r ResponseAudioTranscriptDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseAudioTranscriptDeltaEvent) UnmarshalJSON ¶
func (r *ResponseAudioTranscriptDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseAudioTranscriptDoneEvent ¶
type ResponseAudioTranscriptDoneEvent struct { // The type of the event. Always `response.audio.transcript.done`. Type constant.ResponseAudioTranscriptDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the full audio transcript is completed.
func (ResponseAudioTranscriptDoneEvent) RawJSON ¶
func (r ResponseAudioTranscriptDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseAudioTranscriptDoneEvent) UnmarshalJSON ¶
func (r *ResponseAudioTranscriptDoneEvent) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterCallCodeDeltaEvent ¶
type ResponseCodeInterpreterCallCodeDeltaEvent struct { // The partial code snippet added by the code interpreter. Delta string `json:"delta,required"` // The index of the output item that the code interpreter call is in progress. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.code_interpreter_call.code.delta`. Type constant.ResponseCodeInterpreterCallCodeDelta `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Delta resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a partial code snippet is added by the code interpreter.
func (ResponseCodeInterpreterCallCodeDeltaEvent) RawJSON ¶
func (r ResponseCodeInterpreterCallCodeDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterCallCodeDeltaEvent) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterCallCodeDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterCallCodeDoneEvent ¶
type ResponseCodeInterpreterCallCodeDoneEvent struct { // The final code snippet output by the code interpreter. Code string `json:"code,required"` // The index of the output item that the code interpreter call is in progress. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.code_interpreter_call.code.done`. Type constant.ResponseCodeInterpreterCallCodeDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when code snippet output is finalized by the code interpreter.
func (ResponseCodeInterpreterCallCodeDoneEvent) RawJSON ¶
func (r ResponseCodeInterpreterCallCodeDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterCallCodeDoneEvent) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterCallCodeDoneEvent) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterCallCompletedEvent ¶
type ResponseCodeInterpreterCallCompletedEvent struct { // A tool call to run code. CodeInterpreterCall ResponseCodeInterpreterToolCall `json:"code_interpreter_call,required"` // The index of the output item that the code interpreter call is in progress. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.code_interpreter_call.completed`. Type constant.ResponseCodeInterpreterCallCompleted `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CodeInterpreterCall resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the code interpreter call is completed.
func (ResponseCodeInterpreterCallCompletedEvent) RawJSON ¶
func (r ResponseCodeInterpreterCallCompletedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterCallCompletedEvent) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterCallCompletedEvent) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterCallInProgressEvent ¶
type ResponseCodeInterpreterCallInProgressEvent struct { // A tool call to run code. CodeInterpreterCall ResponseCodeInterpreterToolCall `json:"code_interpreter_call,required"` // The index of the output item that the code interpreter call is in progress. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.code_interpreter_call.in_progress`. Type constant.ResponseCodeInterpreterCallInProgress `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CodeInterpreterCall resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a code interpreter call is in progress.
func (ResponseCodeInterpreterCallInProgressEvent) RawJSON ¶
func (r ResponseCodeInterpreterCallInProgressEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterCallInProgressEvent) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterCallInProgressEvent) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterCallInterpretingEvent ¶
type ResponseCodeInterpreterCallInterpretingEvent struct { // A tool call to run code. CodeInterpreterCall ResponseCodeInterpreterToolCall `json:"code_interpreter_call,required"` // The index of the output item that the code interpreter call is in progress. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.code_interpreter_call.interpreting`. Type constant.ResponseCodeInterpreterCallInterpreting `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CodeInterpreterCall resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the code interpreter is actively interpreting the code snippet.
func (ResponseCodeInterpreterCallInterpretingEvent) RawJSON ¶
func (r ResponseCodeInterpreterCallInterpretingEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterCallInterpretingEvent) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterCallInterpretingEvent) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterToolCall ¶
type ResponseCodeInterpreterToolCall struct { // The unique ID of the code interpreter tool call. ID string `json:"id,required"` // The code to run. Code string `json:"code,required"` // The results of the code interpreter tool call. Results []ResponseCodeInterpreterToolCallResultUnion `json:"results,required"` // The status of the code interpreter tool call. // // Any of "in_progress", "interpreting", "completed". Status ResponseCodeInterpreterToolCallStatus `json:"status,required"` // The type of the code interpreter tool call. Always `code_interpreter_call`. Type constant.CodeInterpreterCall `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Code resp.Field Results resp.Field Status resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A tool call to run code.
func (ResponseCodeInterpreterToolCall) RawJSON ¶
func (r ResponseCodeInterpreterToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterToolCall) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterToolCall) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterToolCallResultFiles ¶
type ResponseCodeInterpreterToolCallResultFiles struct { Files []ResponseCodeInterpreterToolCallResultFilesFile `json:"files,required"` // The type of the code interpreter file output. Always `files`. Type constant.Files `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Files resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The output of a code interpreter tool call that is a file.
func (ResponseCodeInterpreterToolCallResultFiles) RawJSON ¶
func (r ResponseCodeInterpreterToolCallResultFiles) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterToolCallResultFiles) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterToolCallResultFiles) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterToolCallResultFilesFile ¶
type ResponseCodeInterpreterToolCallResultFilesFile struct { // The ID of the file. FileID string `json:"file_id,required"` // The MIME type of the file. MimeType string `json:"mime_type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field MimeType resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ResponseCodeInterpreterToolCallResultFilesFile) RawJSON ¶
func (r ResponseCodeInterpreterToolCallResultFilesFile) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterToolCallResultFilesFile) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterToolCallResultFilesFile) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterToolCallResultLogs ¶
type ResponseCodeInterpreterToolCallResultLogs struct { // The logs of the code interpreter tool call. Logs string `json:"logs,required"` // The type of the code interpreter text output. Always `logs`. Type constant.Logs `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Logs resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The output of a code interpreter tool call that is text.
func (ResponseCodeInterpreterToolCallResultLogs) RawJSON ¶
func (r ResponseCodeInterpreterToolCallResultLogs) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterToolCallResultLogs) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterToolCallResultLogs) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterToolCallResultUnion ¶
type ResponseCodeInterpreterToolCallResultUnion struct { // This field is from variant [ResponseCodeInterpreterToolCallResultLogs]. Logs string `json:"logs"` // Any of "logs", "files". Type string `json:"type"` // This field is from variant [ResponseCodeInterpreterToolCallResultFiles]. Files []ResponseCodeInterpreterToolCallResultFilesFile `json:"files"` JSON struct { Logs resp.Field Type resp.Field Files resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseCodeInterpreterToolCallResultUnion contains all possible properties and values from ResponseCodeInterpreterToolCallResultLogs, ResponseCodeInterpreterToolCallResultFiles.
Use the ResponseCodeInterpreterToolCallResultUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseCodeInterpreterToolCallResultUnion) AsAny ¶
func (u ResponseCodeInterpreterToolCallResultUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseCodeInterpreterToolCallResultUnion.AsAny().(type) { case ResponseCodeInterpreterToolCallResultLogs: case ResponseCodeInterpreterToolCallResultFiles: default: fmt.Errorf("no variant present") }
func (ResponseCodeInterpreterToolCallResultUnion) AsFiles ¶
func (u ResponseCodeInterpreterToolCallResultUnion) AsFiles() (v ResponseCodeInterpreterToolCallResultFiles)
func (ResponseCodeInterpreterToolCallResultUnion) AsLogs ¶
func (u ResponseCodeInterpreterToolCallResultUnion) AsLogs() (v ResponseCodeInterpreterToolCallResultLogs)
func (ResponseCodeInterpreterToolCallResultUnion) RawJSON ¶
func (u ResponseCodeInterpreterToolCallResultUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCodeInterpreterToolCallResultUnion) UnmarshalJSON ¶
func (r *ResponseCodeInterpreterToolCallResultUnion) UnmarshalJSON(data []byte) error
type ResponseCodeInterpreterToolCallStatus ¶
type ResponseCodeInterpreterToolCallStatus string
The status of the code interpreter tool call.
const ( ResponseCodeInterpreterToolCallStatusInProgress ResponseCodeInterpreterToolCallStatus = "in_progress" ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting" ResponseCodeInterpreterToolCallStatusCompleted ResponseCodeInterpreterToolCallStatus = "completed" )
type ResponseCompletedEvent ¶
type ResponseCompletedEvent struct { // Properties of the completed response. Response Response `json:"response,required"` // The type of the event. Always `response.completed`. Type constant.ResponseCompleted `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Response resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the model response is complete.
func (ResponseCompletedEvent) RawJSON ¶
func (r ResponseCompletedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCompletedEvent) UnmarshalJSON ¶
func (r *ResponseCompletedEvent) UnmarshalJSON(data []byte) error
type ResponseComputerToolCall ¶
type ResponseComputerToolCall struct { // The unique ID of the computer call. ID string `json:"id,required"` // A click action. Action ResponseComputerToolCallActionUnion `json:"action,required"` // An identifier used when responding to the tool call with output. CallID string `json:"call_id,required"` // The pending safety checks for the computer call. PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks,required"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseComputerToolCallStatus `json:"status,required"` // The type of the computer call. Always `computer_call`. // // Any of "computer_call". Type ResponseComputerToolCallType `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Action resp.Field CallID resp.Field PendingSafetyChecks resp.Field Status resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A tool call to a computer use tool. See the [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.
func (ResponseComputerToolCall) RawJSON ¶
func (r ResponseComputerToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseComputerToolCall) ToParam ¶
func (r ResponseComputerToolCall) ToParam() ResponseComputerToolCallParam
ToParam converts this ResponseComputerToolCall to a ResponseComputerToolCallParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseComputerToolCallParam.IsOverridden()
func (*ResponseComputerToolCall) UnmarshalJSON ¶
func (r *ResponseComputerToolCall) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionClick ¶
type ResponseComputerToolCallActionClick struct { // Indicates which mouse button was pressed during the click. One of `left`, // `right`, `wheel`, `back`, or `forward`. // // Any of "left", "right", "wheel", "back", "forward". Button string `json:"button,required"` // Specifies the event type. For a click action, this property is always set to // `click`. Type constant.Click `json:"type,required"` // The x-coordinate where the click occurred. X int64 `json:"x,required"` // The y-coordinate where the click occurred. Y int64 `json:"y,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Button resp.Field Type resp.Field X resp.Field Y resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A click action.
func (ResponseComputerToolCallActionClick) RawJSON ¶
func (r ResponseComputerToolCallActionClick) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionClick) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionClick) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionClickParam ¶
type ResponseComputerToolCallActionClickParam struct { // Indicates which mouse button was pressed during the click. One of `left`, // `right`, `wheel`, `back`, or `forward`. // // Any of "left", "right", "wheel", "back", "forward". Button string `json:"button,omitzero,required"` // The x-coordinate where the click occurred. X int64 `json:"x,required"` // The y-coordinate where the click occurred. Y int64 `json:"y,required"` // Specifies the event type. For a click action, this property is always set to // `click`. // // This field can be elided, and will marshal its zero value as "click". Type constant.Click `json:"type,required"` // contains filtered or unexported fields }
A click action.
The properties Button, Type, X, Y are required.
func (ResponseComputerToolCallActionClickParam) IsPresent ¶
func (f ResponseComputerToolCallActionClickParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionClickParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionClickParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionDoubleClick ¶
type ResponseComputerToolCallActionDoubleClick struct { // Specifies the event type. For a double click action, this property is always set // to `double_click`. Type constant.DoubleClick `json:"type,required"` // The x-coordinate where the double click occurred. X int64 `json:"x,required"` // The y-coordinate where the double click occurred. Y int64 `json:"y,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field X resp.Field Y resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A double click action.
func (ResponseComputerToolCallActionDoubleClick) RawJSON ¶
func (r ResponseComputerToolCallActionDoubleClick) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionDoubleClick) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionDoubleClick) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionDoubleClickParam ¶
type ResponseComputerToolCallActionDoubleClickParam struct { // The x-coordinate where the double click occurred. X int64 `json:"x,required"` // The y-coordinate where the double click occurred. Y int64 `json:"y,required"` // Specifies the event type. For a double click action, this property is always set // to `double_click`. // // This field can be elided, and will marshal its zero value as "double_click". Type constant.DoubleClick `json:"type,required"` // contains filtered or unexported fields }
A double click action.
The properties Type, X, Y are required.
func (ResponseComputerToolCallActionDoubleClickParam) IsPresent ¶
func (f ResponseComputerToolCallActionDoubleClickParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionDoubleClickParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionDoubleClickParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionDrag ¶
type ResponseComputerToolCallActionDrag struct { // An array of coordinates representing the path of the drag action. Coordinates // will appear as an array of objects, eg // // “` // [ // // { x: 100, y: 200 }, // { x: 200, y: 300 } // // ] // “` Path []ResponseComputerToolCallActionDragPath `json:"path,required"` // Specifies the event type. For a drag action, this property is always set to // `drag`. Type constant.Drag `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Path resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A drag action.
func (ResponseComputerToolCallActionDrag) RawJSON ¶
func (r ResponseComputerToolCallActionDrag) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionDrag) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionDrag) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionDragParam ¶
type ResponseComputerToolCallActionDragParam struct { // An array of coordinates representing the path of the drag action. Coordinates // will appear as an array of objects, eg // // “` // [ // // { x: 100, y: 200 }, // { x: 200, y: 300 } // // ] // “` Path []ResponseComputerToolCallActionDragPathParam `json:"path,omitzero,required"` // Specifies the event type. For a drag action, this property is always set to // `drag`. // // This field can be elided, and will marshal its zero value as "drag". Type constant.Drag `json:"type,required"` // contains filtered or unexported fields }
A drag action.
The properties Path, Type are required.
func (ResponseComputerToolCallActionDragParam) IsPresent ¶
func (f ResponseComputerToolCallActionDragParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionDragParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionDragParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionDragPath ¶
type ResponseComputerToolCallActionDragPath struct { // The x-coordinate. X int64 `json:"x,required"` // The y-coordinate. Y int64 `json:"y,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { X resp.Field Y resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A series of x/y coordinate pairs in the drag path.
func (ResponseComputerToolCallActionDragPath) RawJSON ¶
func (r ResponseComputerToolCallActionDragPath) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionDragPath) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionDragPath) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionDragPathParam ¶
type ResponseComputerToolCallActionDragPathParam struct { // The x-coordinate. X int64 `json:"x,required"` // The y-coordinate. Y int64 `json:"y,required"` // contains filtered or unexported fields }
A series of x/y coordinate pairs in the drag path.
The properties X, Y are required.
func (ResponseComputerToolCallActionDragPathParam) IsPresent ¶
func (f ResponseComputerToolCallActionDragPathParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionDragPathParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionDragPathParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionKeypress ¶
type ResponseComputerToolCallActionKeypress struct { // The combination of keys the model is requesting to be pressed. This is an array // of strings, each representing a key. Keys []string `json:"keys,required"` // Specifies the event type. For a keypress action, this property is always set to // `keypress`. Type constant.Keypress `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Keys resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A collection of keypresses the model would like to perform.
func (ResponseComputerToolCallActionKeypress) RawJSON ¶
func (r ResponseComputerToolCallActionKeypress) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionKeypress) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionKeypress) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionKeypressParam ¶
type ResponseComputerToolCallActionKeypressParam struct { // The combination of keys the model is requesting to be pressed. This is an array // of strings, each representing a key. Keys []string `json:"keys,omitzero,required"` // Specifies the event type. For a keypress action, this property is always set to // `keypress`. // // This field can be elided, and will marshal its zero value as "keypress". Type constant.Keypress `json:"type,required"` // contains filtered or unexported fields }
A collection of keypresses the model would like to perform.
The properties Keys, Type are required.
func (ResponseComputerToolCallActionKeypressParam) IsPresent ¶
func (f ResponseComputerToolCallActionKeypressParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionKeypressParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionKeypressParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionMove ¶
type ResponseComputerToolCallActionMove struct { // Specifies the event type. For a move action, this property is always set to // `move`. Type constant.Move `json:"type,required"` // The x-coordinate to move to. X int64 `json:"x,required"` // The y-coordinate to move to. Y int64 `json:"y,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field X resp.Field Y resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A mouse move action.
func (ResponseComputerToolCallActionMove) RawJSON ¶
func (r ResponseComputerToolCallActionMove) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionMove) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionMove) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionMoveParam ¶
type ResponseComputerToolCallActionMoveParam struct { // The x-coordinate to move to. X int64 `json:"x,required"` // The y-coordinate to move to. Y int64 `json:"y,required"` // Specifies the event type. For a move action, this property is always set to // `move`. // // This field can be elided, and will marshal its zero value as "move". Type constant.Move `json:"type,required"` // contains filtered or unexported fields }
A mouse move action.
The properties Type, X, Y are required.
func (ResponseComputerToolCallActionMoveParam) IsPresent ¶
func (f ResponseComputerToolCallActionMoveParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionMoveParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionMoveParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionScreenshot ¶
type ResponseComputerToolCallActionScreenshot struct { // Specifies the event type. For a screenshot action, this property is always set // to `screenshot`. Type constant.Screenshot `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A screenshot action.
func (ResponseComputerToolCallActionScreenshot) RawJSON ¶
func (r ResponseComputerToolCallActionScreenshot) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionScreenshot) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionScreenshot) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionScreenshotParam ¶
type ResponseComputerToolCallActionScreenshotParam struct { // Specifies the event type. For a screenshot action, this property is always set // to `screenshot`. // // This field can be elided, and will marshal its zero value as "screenshot". Type constant.Screenshot `json:"type,required"` // contains filtered or unexported fields }
A screenshot action.
The property Type is required.
func (ResponseComputerToolCallActionScreenshotParam) IsPresent ¶
func (f ResponseComputerToolCallActionScreenshotParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionScreenshotParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionScreenshotParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionScroll ¶
type ResponseComputerToolCallActionScroll struct { // The horizontal scroll distance. ScrollX int64 `json:"scroll_x,required"` // The vertical scroll distance. ScrollY int64 `json:"scroll_y,required"` // Specifies the event type. For a scroll action, this property is always set to // `scroll`. Type constant.Scroll `json:"type,required"` // The x-coordinate where the scroll occurred. X int64 `json:"x,required"` // The y-coordinate where the scroll occurred. Y int64 `json:"y,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ScrollX resp.Field ScrollY resp.Field Type resp.Field X resp.Field Y resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A scroll action.
func (ResponseComputerToolCallActionScroll) RawJSON ¶
func (r ResponseComputerToolCallActionScroll) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionScroll) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionScroll) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionScrollParam ¶
type ResponseComputerToolCallActionScrollParam struct { // The horizontal scroll distance. ScrollX int64 `json:"scroll_x,required"` // The vertical scroll distance. ScrollY int64 `json:"scroll_y,required"` // The x-coordinate where the scroll occurred. X int64 `json:"x,required"` // The y-coordinate where the scroll occurred. Y int64 `json:"y,required"` // Specifies the event type. For a scroll action, this property is always set to // `scroll`. // // This field can be elided, and will marshal its zero value as "scroll". Type constant.Scroll `json:"type,required"` // contains filtered or unexported fields }
A scroll action.
The properties ScrollX, ScrollY, Type, X, Y are required.
func (ResponseComputerToolCallActionScrollParam) IsPresent ¶
func (f ResponseComputerToolCallActionScrollParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionScrollParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionScrollParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionType ¶
type ResponseComputerToolCallActionType struct { // The text to type. Text string `json:"text,required"` // Specifies the event type. For a type action, this property is always set to // `type`. Type constant.Type `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An action to type in text.
func (ResponseComputerToolCallActionType) RawJSON ¶
func (r ResponseComputerToolCallActionType) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionType) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionType) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionTypeParam ¶
type ResponseComputerToolCallActionTypeParam struct { // The text to type. Text string `json:"text,required"` // Specifies the event type. For a type action, this property is always set to // `type`. // // This field can be elided, and will marshal its zero value as "type". Type constant.Type `json:"type,required"` // contains filtered or unexported fields }
An action to type in text.
The properties Text, Type are required.
func (ResponseComputerToolCallActionTypeParam) IsPresent ¶
func (f ResponseComputerToolCallActionTypeParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionTypeParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionTypeParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallActionUnion ¶
type ResponseComputerToolCallActionUnion struct { // This field is from variant [ResponseComputerToolCallActionClick]. Button string `json:"button"` // Any of "click", "double_click", "drag", "keypress", "move", "screenshot", // "scroll", "type", "wait". Type string `json:"type"` X int64 `json:"x"` Y int64 `json:"y"` // This field is from variant [ResponseComputerToolCallActionDrag]. Path []ResponseComputerToolCallActionDragPath `json:"path"` // This field is from variant [ResponseComputerToolCallActionKeypress]. Keys []string `json:"keys"` // This field is from variant [ResponseComputerToolCallActionScroll]. ScrollX int64 `json:"scroll_x"` // This field is from variant [ResponseComputerToolCallActionScroll]. ScrollY int64 `json:"scroll_y"` // This field is from variant [ResponseComputerToolCallActionType]. Text string `json:"text"` JSON struct { Button resp.Field Type resp.Field X resp.Field Y resp.Field Path resp.Field Keys resp.Field ScrollX resp.Field ScrollY resp.Field Text resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseComputerToolCallActionUnion contains all possible properties and values from ResponseComputerToolCallActionClick, ResponseComputerToolCallActionDoubleClick, ResponseComputerToolCallActionDrag, ResponseComputerToolCallActionKeypress, ResponseComputerToolCallActionMove, ResponseComputerToolCallActionScreenshot, ResponseComputerToolCallActionScroll, ResponseComputerToolCallActionType, ResponseComputerToolCallActionWait.
Use the ResponseComputerToolCallActionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseComputerToolCallActionUnion) AsAny ¶
func (u ResponseComputerToolCallActionUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseComputerToolCallActionUnion.AsAny().(type) { case ResponseComputerToolCallActionClick: case ResponseComputerToolCallActionDoubleClick: case ResponseComputerToolCallActionDrag: case ResponseComputerToolCallActionKeypress: case ResponseComputerToolCallActionMove: case ResponseComputerToolCallActionScreenshot: case ResponseComputerToolCallActionScroll: case ResponseComputerToolCallActionType: case ResponseComputerToolCallActionWait: default: fmt.Errorf("no variant present") }
func (ResponseComputerToolCallActionUnion) AsClick ¶
func (u ResponseComputerToolCallActionUnion) AsClick() (v ResponseComputerToolCallActionClick)
func (ResponseComputerToolCallActionUnion) AsDoubleClick ¶
func (u ResponseComputerToolCallActionUnion) AsDoubleClick() (v ResponseComputerToolCallActionDoubleClick)
func (ResponseComputerToolCallActionUnion) AsDrag ¶
func (u ResponseComputerToolCallActionUnion) AsDrag() (v ResponseComputerToolCallActionDrag)
func (ResponseComputerToolCallActionUnion) AsKeypress ¶
func (u ResponseComputerToolCallActionUnion) AsKeypress() (v ResponseComputerToolCallActionKeypress)
func (ResponseComputerToolCallActionUnion) AsMove ¶
func (u ResponseComputerToolCallActionUnion) AsMove() (v ResponseComputerToolCallActionMove)
func (ResponseComputerToolCallActionUnion) AsScreenshot ¶
func (u ResponseComputerToolCallActionUnion) AsScreenshot() (v ResponseComputerToolCallActionScreenshot)
func (ResponseComputerToolCallActionUnion) AsScroll ¶
func (u ResponseComputerToolCallActionUnion) AsScroll() (v ResponseComputerToolCallActionScroll)
func (ResponseComputerToolCallActionUnion) AsType ¶
func (u ResponseComputerToolCallActionUnion) AsType() (v ResponseComputerToolCallActionType)
func (ResponseComputerToolCallActionUnion) AsWait ¶
func (u ResponseComputerToolCallActionUnion) AsWait() (v ResponseComputerToolCallActionWait)
func (ResponseComputerToolCallActionUnion) RawJSON ¶
func (u ResponseComputerToolCallActionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionUnion) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionUnion) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionUnionParam ¶
type ResponseComputerToolCallActionUnionParam struct { OfClick *ResponseComputerToolCallActionClickParam `json:",omitzero,inline"` OfDoubleClick *ResponseComputerToolCallActionDoubleClickParam `json:",omitzero,inline"` OfDrag *ResponseComputerToolCallActionDragParam `json:",omitzero,inline"` OfKeypress *ResponseComputerToolCallActionKeypressParam `json:",omitzero,inline"` OfMove *ResponseComputerToolCallActionMoveParam `json:",omitzero,inline"` OfScreenshot *ResponseComputerToolCallActionScreenshotParam `json:",omitzero,inline"` OfScroll *ResponseComputerToolCallActionScrollParam `json:",omitzero,inline"` OfType *ResponseComputerToolCallActionTypeParam `json:",omitzero,inline"` OfWait *ResponseComputerToolCallActionWaitParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ResponseComputerToolCallActionUnionParam) GetButton ¶
func (u ResponseComputerToolCallActionUnionParam) GetButton() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetKeys ¶
func (u ResponseComputerToolCallActionUnionParam) GetKeys() []string
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetPath ¶
func (u ResponseComputerToolCallActionUnionParam) GetPath() []ResponseComputerToolCallActionDragPathParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetScrollX ¶
func (u ResponseComputerToolCallActionUnionParam) GetScrollX() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetScrollY ¶
func (u ResponseComputerToolCallActionUnionParam) GetScrollY() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetText ¶
func (u ResponseComputerToolCallActionUnionParam) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetType ¶
func (u ResponseComputerToolCallActionUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetX ¶
func (u ResponseComputerToolCallActionUnionParam) GetX() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) GetY ¶
func (u ResponseComputerToolCallActionUnionParam) GetY() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseComputerToolCallActionUnionParam) IsPresent ¶
func (u ResponseComputerToolCallActionUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionUnionParam) MarshalJSON ¶
func (u ResponseComputerToolCallActionUnionParam) MarshalJSON() ([]byte, error)
type ResponseComputerToolCallActionWait ¶
type ResponseComputerToolCallActionWait struct { // Specifies the event type. For a wait action, this property is always set to // `wait`. Type constant.Wait `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A wait action.
func (ResponseComputerToolCallActionWait) RawJSON ¶
func (r ResponseComputerToolCallActionWait) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallActionWait) UnmarshalJSON ¶
func (r *ResponseComputerToolCallActionWait) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallActionWaitParam ¶
type ResponseComputerToolCallActionWaitParam struct { // Specifies the event type. For a wait action, this property is always set to // `wait`. // // This field can be elided, and will marshal its zero value as "wait". Type constant.Wait `json:"type,required"` // contains filtered or unexported fields }
A wait action.
The property Type is required.
func (ResponseComputerToolCallActionWaitParam) IsPresent ¶
func (f ResponseComputerToolCallActionWaitParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallActionWaitParam) MarshalJSON ¶
func (r ResponseComputerToolCallActionWaitParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallOutputItem ¶
type ResponseComputerToolCallOutputItem struct { // The unique ID of the computer call tool output. ID string `json:"id,required"` // The ID of the computer tool call that produced the output. CallID string `json:"call_id,required"` // A computer screenshot image used with the computer use tool. Output ResponseComputerToolCallOutputScreenshot `json:"output,required"` // The type of the computer tool call output. Always `computer_call_output`. Type constant.ComputerCallOutput `json:"type,required"` // The safety checks reported by the API that have been acknowledged by the // developer. AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"` // The status of the message input. One of `in_progress`, `completed`, or // `incomplete`. Populated when input items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseComputerToolCallOutputItemStatus `json:"status"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CallID resp.Field Output resp.Field Type resp.Field AcknowledgedSafetyChecks resp.Field Status resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ResponseComputerToolCallOutputItem) RawJSON ¶
func (r ResponseComputerToolCallOutputItem) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallOutputItem) UnmarshalJSON ¶
func (r *ResponseComputerToolCallOutputItem) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck ¶
type ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck struct { // The ID of the pending safety check. ID string `json:"id,required"` // The type of the pending safety check. Code string `json:"code,required"` // Details about the pending safety check. Message string `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Code resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A pending safety check for the computer call.
func (ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) RawJSON ¶
func (r ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) UnmarshalJSON ¶
func (r *ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallOutputItemStatus ¶
type ResponseComputerToolCallOutputItemStatus string
The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.
const ( ResponseComputerToolCallOutputItemStatusInProgress ResponseComputerToolCallOutputItemStatus = "in_progress" ResponseComputerToolCallOutputItemStatusCompleted ResponseComputerToolCallOutputItemStatus = "completed" ResponseComputerToolCallOutputItemStatusIncomplete ResponseComputerToolCallOutputItemStatus = "incomplete" )
type ResponseComputerToolCallOutputScreenshot ¶
type ResponseComputerToolCallOutputScreenshot struct { // Specifies the event type. For a computer screenshot, this property is always set // to `computer_screenshot`. Type constant.ComputerScreenshot `json:"type,required"` // The identifier of an uploaded file that contains the screenshot. FileID string `json:"file_id"` // The URL of the screenshot image. ImageURL string `json:"image_url"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field FileID resp.Field ImageURL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A computer screenshot image used with the computer use tool.
func (ResponseComputerToolCallOutputScreenshot) RawJSON ¶
func (r ResponseComputerToolCallOutputScreenshot) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseComputerToolCallOutputScreenshot) ToParam ¶
func (r ResponseComputerToolCallOutputScreenshot) ToParam() ResponseComputerToolCallOutputScreenshotParam
ToParam converts this ResponseComputerToolCallOutputScreenshot to a ResponseComputerToolCallOutputScreenshotParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseComputerToolCallOutputScreenshotParam.IsOverridden()
func (*ResponseComputerToolCallOutputScreenshot) UnmarshalJSON ¶
func (r *ResponseComputerToolCallOutputScreenshot) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallOutputScreenshotParam ¶
type ResponseComputerToolCallOutputScreenshotParam struct { // The identifier of an uploaded file that contains the screenshot. FileID param.Opt[string] `json:"file_id,omitzero"` // The URL of the screenshot image. ImageURL param.Opt[string] `json:"image_url,omitzero"` // Specifies the event type. For a computer screenshot, this property is always set // to `computer_screenshot`. // // This field can be elided, and will marshal its zero value as // "computer_screenshot". Type constant.ComputerScreenshot `json:"type,required"` // contains filtered or unexported fields }
A computer screenshot image used with the computer use tool.
The property Type is required.
func (ResponseComputerToolCallOutputScreenshotParam) IsPresent ¶
func (f ResponseComputerToolCallOutputScreenshotParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallOutputScreenshotParam) MarshalJSON ¶
func (r ResponseComputerToolCallOutputScreenshotParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallParam ¶
type ResponseComputerToolCallParam struct { // The unique ID of the computer call. ID string `json:"id,required"` // A click action. Action ResponseComputerToolCallActionUnionParam `json:"action,omitzero,required"` // An identifier used when responding to the tool call with output. CallID string `json:"call_id,required"` // The pending safety checks for the computer call. PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheckParam `json:"pending_safety_checks,omitzero,required"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseComputerToolCallStatus `json:"status,omitzero,required"` // The type of the computer call. Always `computer_call`. // // Any of "computer_call". Type ResponseComputerToolCallType `json:"type,omitzero,required"` // contains filtered or unexported fields }
A tool call to a computer use tool. See the [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.
The properties ID, Action, CallID, PendingSafetyChecks, Status, Type are required.
func (ResponseComputerToolCallParam) IsPresent ¶
func (f ResponseComputerToolCallParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallParam) MarshalJSON ¶
func (r ResponseComputerToolCallParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallPendingSafetyCheck ¶
type ResponseComputerToolCallPendingSafetyCheck struct { // The ID of the pending safety check. ID string `json:"id,required"` // The type of the pending safety check. Code string `json:"code,required"` // Details about the pending safety check. Message string `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Code resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A pending safety check for the computer call.
func (ResponseComputerToolCallPendingSafetyCheck) RawJSON ¶
func (r ResponseComputerToolCallPendingSafetyCheck) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseComputerToolCallPendingSafetyCheck) UnmarshalJSON ¶
func (r *ResponseComputerToolCallPendingSafetyCheck) UnmarshalJSON(data []byte) error
type ResponseComputerToolCallPendingSafetyCheckParam ¶
type ResponseComputerToolCallPendingSafetyCheckParam struct { // The ID of the pending safety check. ID string `json:"id,required"` // The type of the pending safety check. Code string `json:"code,required"` // Details about the pending safety check. Message string `json:"message,required"` // contains filtered or unexported fields }
A pending safety check for the computer call.
The properties ID, Code, Message are required.
func (ResponseComputerToolCallPendingSafetyCheckParam) IsPresent ¶
func (f ResponseComputerToolCallPendingSafetyCheckParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseComputerToolCallPendingSafetyCheckParam) MarshalJSON ¶
func (r ResponseComputerToolCallPendingSafetyCheckParam) MarshalJSON() (data []byte, err error)
type ResponseComputerToolCallStatus ¶
type ResponseComputerToolCallStatus string
The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
const ( ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress" ResponseComputerToolCallStatusCompleted ResponseComputerToolCallStatus = "completed" ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete" )
type ResponseComputerToolCallType ¶
type ResponseComputerToolCallType string
The type of the computer call. Always `computer_call`.
const (
ResponseComputerToolCallTypeComputerCall ResponseComputerToolCallType = "computer_call"
)
type ResponseContentPartAddedEvent ¶
type ResponseContentPartAddedEvent struct { // The index of the content part that was added. ContentIndex int64 `json:"content_index,required"` // The ID of the output item that the content part was added to. ItemID string `json:"item_id,required"` // The index of the output item that the content part was added to. OutputIndex int64 `json:"output_index,required"` // The content part that was added. Part ResponseContentPartAddedEventPartUnion `json:"part,required"` // The type of the event. Always `response.content_part.added`. Type constant.ResponseContentPartAdded `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ContentIndex resp.Field ItemID resp.Field OutputIndex resp.Field Part resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a new content part is added.
func (ResponseContentPartAddedEvent) RawJSON ¶
func (r ResponseContentPartAddedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseContentPartAddedEvent) UnmarshalJSON ¶
func (r *ResponseContentPartAddedEvent) UnmarshalJSON(data []byte) error
type ResponseContentPartAddedEventPartUnion ¶
type ResponseContentPartAddedEventPartUnion struct { // This field is from variant [ResponseOutputText]. Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"` // This field is from variant [ResponseOutputText]. Text string `json:"text"` // Any of "output_text", "refusal". Type string `json:"type"` // This field is from variant [ResponseOutputRefusal]. Refusal string `json:"refusal"` JSON struct { Annotations resp.Field Text resp.Field Type resp.Field Refusal resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseContentPartAddedEventPartUnion contains all possible properties and values from ResponseOutputText, ResponseOutputRefusal.
Use the ResponseContentPartAddedEventPartUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseContentPartAddedEventPartUnion) AsAny ¶
func (u ResponseContentPartAddedEventPartUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseContentPartAddedEventPartUnion.AsAny().(type) { case ResponseOutputText: case ResponseOutputRefusal: default: fmt.Errorf("no variant present") }
func (ResponseContentPartAddedEventPartUnion) AsOutputText ¶
func (u ResponseContentPartAddedEventPartUnion) AsOutputText() (v ResponseOutputText)
func (ResponseContentPartAddedEventPartUnion) AsRefusal ¶
func (u ResponseContentPartAddedEventPartUnion) AsRefusal() (v ResponseOutputRefusal)
func (ResponseContentPartAddedEventPartUnion) RawJSON ¶
func (u ResponseContentPartAddedEventPartUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseContentPartAddedEventPartUnion) UnmarshalJSON ¶
func (r *ResponseContentPartAddedEventPartUnion) UnmarshalJSON(data []byte) error
type ResponseContentPartDoneEvent ¶
type ResponseContentPartDoneEvent struct { // The index of the content part that is done. ContentIndex int64 `json:"content_index,required"` // The ID of the output item that the content part was added to. ItemID string `json:"item_id,required"` // The index of the output item that the content part was added to. OutputIndex int64 `json:"output_index,required"` // The content part that is done. Part ResponseContentPartDoneEventPartUnion `json:"part,required"` // The type of the event. Always `response.content_part.done`. Type constant.ResponseContentPartDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ContentIndex resp.Field ItemID resp.Field OutputIndex resp.Field Part resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a content part is done.
func (ResponseContentPartDoneEvent) RawJSON ¶
func (r ResponseContentPartDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseContentPartDoneEvent) UnmarshalJSON ¶
func (r *ResponseContentPartDoneEvent) UnmarshalJSON(data []byte) error
type ResponseContentPartDoneEventPartUnion ¶
type ResponseContentPartDoneEventPartUnion struct { // This field is from variant [ResponseOutputText]. Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"` // This field is from variant [ResponseOutputText]. Text string `json:"text"` // Any of "output_text", "refusal". Type string `json:"type"` // This field is from variant [ResponseOutputRefusal]. Refusal string `json:"refusal"` JSON struct { Annotations resp.Field Text resp.Field Type resp.Field Refusal resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseContentPartDoneEventPartUnion contains all possible properties and values from ResponseOutputText, ResponseOutputRefusal.
Use the ResponseContentPartDoneEventPartUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseContentPartDoneEventPartUnion) AsAny ¶
func (u ResponseContentPartDoneEventPartUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseContentPartDoneEventPartUnion.AsAny().(type) { case ResponseOutputText: case ResponseOutputRefusal: default: fmt.Errorf("no variant present") }
func (ResponseContentPartDoneEventPartUnion) AsOutputText ¶
func (u ResponseContentPartDoneEventPartUnion) AsOutputText() (v ResponseOutputText)
func (ResponseContentPartDoneEventPartUnion) AsRefusal ¶
func (u ResponseContentPartDoneEventPartUnion) AsRefusal() (v ResponseOutputRefusal)
func (ResponseContentPartDoneEventPartUnion) RawJSON ¶
func (u ResponseContentPartDoneEventPartUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseContentPartDoneEventPartUnion) UnmarshalJSON ¶
func (r *ResponseContentPartDoneEventPartUnion) UnmarshalJSON(data []byte) error
type ResponseCreatedEvent ¶
type ResponseCreatedEvent struct { // The response that was created. Response Response `json:"response,required"` // The type of the event. Always `response.created`. Type constant.ResponseCreated `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Response resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An event that is emitted when a response is created.
func (ResponseCreatedEvent) RawJSON ¶
func (r ResponseCreatedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseCreatedEvent) UnmarshalJSON ¶
func (r *ResponseCreatedEvent) UnmarshalJSON(data []byte) error
type ResponseError ¶
type ResponseError struct { // The error code for the response. // // Any of "server_error", "rate_limit_exceeded", "invalid_prompt", // "vector_store_timeout", "invalid_image", "invalid_image_format", // "invalid_base64_image", "invalid_image_url", "image_too_large", // "image_too_small", "image_parse_error", "image_content_policy_violation", // "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type", // "empty_image_file", "failed_to_download_image", "image_file_not_found". Code ResponseErrorCode `json:"code,required"` // A human-readable description of the error. Message string `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An error object returned when the model fails to generate a Response.
func (ResponseError) RawJSON ¶
func (r ResponseError) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseError) UnmarshalJSON ¶
func (r *ResponseError) UnmarshalJSON(data []byte) error
type ResponseErrorCode ¶
type ResponseErrorCode string
The error code for the response.
const ( ResponseErrorCodeServerError ResponseErrorCode = "server_error" ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded" ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt" ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout" ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image" ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format" ResponseErrorCodeInvalidBase64Image ResponseErrorCode = "invalid_base64_image" ResponseErrorCodeInvalidImageURL ResponseErrorCode = "invalid_image_url" ResponseErrorCodeImageTooLarge ResponseErrorCode = "image_too_large" ResponseErrorCodeImageTooSmall ResponseErrorCode = "image_too_small" ResponseErrorCodeImageParseError ResponseErrorCode = "image_parse_error" ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation" ResponseErrorCodeInvalidImageMode ResponseErrorCode = "invalid_image_mode" ResponseErrorCodeImageFileTooLarge ResponseErrorCode = "image_file_too_large" ResponseErrorCodeUnsupportedImageMediaType ResponseErrorCode = "unsupported_image_media_type" ResponseErrorCodeEmptyImageFile ResponseErrorCode = "empty_image_file" ResponseErrorCodeFailedToDownloadImage ResponseErrorCode = "failed_to_download_image" ResponseErrorCodeImageFileNotFound ResponseErrorCode = "image_file_not_found" )
type ResponseErrorEvent ¶
type ResponseErrorEvent struct { // The error code. Code string `json:"code,required"` // The error message. Message string `json:"message,required"` // The error parameter. Param string `json:"param,required"` // The type of the event. Always `error`. Type constant.Error `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Message resp.Field Param resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when an error occurs.
func (ResponseErrorEvent) RawJSON ¶
func (r ResponseErrorEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseErrorEvent) UnmarshalJSON ¶
func (r *ResponseErrorEvent) UnmarshalJSON(data []byte) error
type ResponseFailedEvent ¶
type ResponseFailedEvent struct { // The response that failed. Response Response `json:"response,required"` // The type of the event. Always `response.failed`. Type constant.ResponseFailed `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Response resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An event that is emitted when a response fails.
func (ResponseFailedEvent) RawJSON ¶
func (r ResponseFailedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFailedEvent) UnmarshalJSON ¶
func (r *ResponseFailedEvent) UnmarshalJSON(data []byte) error
type ResponseFileSearchCallCompletedEvent ¶
type ResponseFileSearchCallCompletedEvent struct { // The ID of the output item that the file search call is initiated. ItemID string `json:"item_id,required"` // The index of the output item that the file search call is initiated. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.file_search_call.completed`. Type constant.ResponseFileSearchCallCompleted `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a file search call is completed (results found).
func (ResponseFileSearchCallCompletedEvent) RawJSON ¶
func (r ResponseFileSearchCallCompletedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFileSearchCallCompletedEvent) UnmarshalJSON ¶
func (r *ResponseFileSearchCallCompletedEvent) UnmarshalJSON(data []byte) error
type ResponseFileSearchCallInProgressEvent ¶
type ResponseFileSearchCallInProgressEvent struct { // The ID of the output item that the file search call is initiated. ItemID string `json:"item_id,required"` // The index of the output item that the file search call is initiated. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.file_search_call.in_progress`. Type constant.ResponseFileSearchCallInProgress `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a file search call is initiated.
func (ResponseFileSearchCallInProgressEvent) RawJSON ¶
func (r ResponseFileSearchCallInProgressEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFileSearchCallInProgressEvent) UnmarshalJSON ¶
func (r *ResponseFileSearchCallInProgressEvent) UnmarshalJSON(data []byte) error
type ResponseFileSearchCallSearchingEvent ¶
type ResponseFileSearchCallSearchingEvent struct { // The ID of the output item that the file search call is initiated. ItemID string `json:"item_id,required"` // The index of the output item that the file search call is searching. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.file_search_call.searching`. Type constant.ResponseFileSearchCallSearching `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a file search is currently searching.
func (ResponseFileSearchCallSearchingEvent) RawJSON ¶
func (r ResponseFileSearchCallSearchingEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFileSearchCallSearchingEvent) UnmarshalJSON ¶
func (r *ResponseFileSearchCallSearchingEvent) UnmarshalJSON(data []byte) error
type ResponseFileSearchToolCall ¶
type ResponseFileSearchToolCall struct { // The unique ID of the file search tool call. ID string `json:"id,required"` // The queries used to search for files. Queries []string `json:"queries,required"` // The status of the file search tool call. One of `in_progress`, `searching`, // `incomplete` or `failed`, // // Any of "in_progress", "searching", "completed", "incomplete", "failed". Status ResponseFileSearchToolCallStatus `json:"status,required"` // The type of the file search tool call. Always `file_search_call`. Type constant.FileSearchCall `json:"type,required"` // The results of the file search tool call. Results []ResponseFileSearchToolCallResult `json:"results,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Queries resp.Field Status resp.Field Type resp.Field Results resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The results of a file search tool call. See the [file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.
func (ResponseFileSearchToolCall) RawJSON ¶
func (r ResponseFileSearchToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseFileSearchToolCall) ToParam ¶
func (r ResponseFileSearchToolCall) ToParam() ResponseFileSearchToolCallParam
ToParam converts this ResponseFileSearchToolCall to a ResponseFileSearchToolCallParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFileSearchToolCallParam.IsOverridden()
func (*ResponseFileSearchToolCall) UnmarshalJSON ¶
func (r *ResponseFileSearchToolCall) UnmarshalJSON(data []byte) error
type ResponseFileSearchToolCallParam ¶
type ResponseFileSearchToolCallParam struct { // The unique ID of the file search tool call. ID string `json:"id,required"` // The queries used to search for files. Queries []string `json:"queries,omitzero,required"` // The status of the file search tool call. One of `in_progress`, `searching`, // `incomplete` or `failed`, // // Any of "in_progress", "searching", "completed", "incomplete", "failed". Status ResponseFileSearchToolCallStatus `json:"status,omitzero,required"` // The results of the file search tool call. Results []ResponseFileSearchToolCallResultParam `json:"results,omitzero"` // The type of the file search tool call. Always `file_search_call`. // // This field can be elided, and will marshal its zero value as "file_search_call". Type constant.FileSearchCall `json:"type,required"` // contains filtered or unexported fields }
The results of a file search tool call. See the [file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.
The properties ID, Queries, Status, Type are required.
func (ResponseFileSearchToolCallParam) IsPresent ¶
func (f ResponseFileSearchToolCallParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFileSearchToolCallParam) MarshalJSON ¶
func (r ResponseFileSearchToolCallParam) MarshalJSON() (data []byte, err error)
type ResponseFileSearchToolCallResult ¶
type ResponseFileSearchToolCallResult struct { // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. Keys are strings with a maximum // length of 64 characters. Values are strings with a maximum length of 512 // characters, booleans, or numbers. Attributes map[string]ResponseFileSearchToolCallResultAttributeUnion `json:"attributes,nullable"` // The unique ID of the file. FileID string `json:"file_id"` // The name of the file. Filename string `json:"filename"` // The relevance score of the file - a value between 0 and 1. Score float64 `json:"score"` // The text that was retrieved from the file. Text string `json:"text"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Attributes resp.Field FileID resp.Field Filename resp.Field Score resp.Field Text resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ResponseFileSearchToolCallResult) RawJSON ¶
func (r ResponseFileSearchToolCallResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFileSearchToolCallResult) UnmarshalJSON ¶
func (r *ResponseFileSearchToolCallResult) UnmarshalJSON(data []byte) error
type ResponseFileSearchToolCallResultAttributeUnion ¶
type ResponseFileSearchToolCallResultAttributeUnion struct { // This field will be present if the value is a [string] instead of an object. OfString string `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` // This field will be present if the value is a [bool] instead of an object. OfBool bool `json:",inline"` JSON struct { OfString resp.Field OfFloat resp.Field OfBool resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseFileSearchToolCallResultAttributeUnion contains all possible properties and values from [string], [float64], [bool].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]
func (ResponseFileSearchToolCallResultAttributeUnion) AsBool ¶
func (u ResponseFileSearchToolCallResultAttributeUnion) AsBool() (v bool)
func (ResponseFileSearchToolCallResultAttributeUnion) AsFloat ¶
func (u ResponseFileSearchToolCallResultAttributeUnion) AsFloat() (v float64)
func (ResponseFileSearchToolCallResultAttributeUnion) AsString ¶
func (u ResponseFileSearchToolCallResultAttributeUnion) AsString() (v string)
func (ResponseFileSearchToolCallResultAttributeUnion) RawJSON ¶
func (u ResponseFileSearchToolCallResultAttributeUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFileSearchToolCallResultAttributeUnion) UnmarshalJSON ¶
func (r *ResponseFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error
type ResponseFileSearchToolCallResultAttributeUnionParam ¶
type ResponseFileSearchToolCallResultAttributeUnionParam struct { OfString param.Opt[string] `json:",omitzero,inline"` OfFloat param.Opt[float64] `json:",omitzero,inline"` OfBool param.Opt[bool] `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ResponseFileSearchToolCallResultAttributeUnionParam) IsPresent ¶
func (u ResponseFileSearchToolCallResultAttributeUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFileSearchToolCallResultAttributeUnionParam) MarshalJSON ¶
func (u ResponseFileSearchToolCallResultAttributeUnionParam) MarshalJSON() ([]byte, error)
type ResponseFileSearchToolCallResultParam ¶
type ResponseFileSearchToolCallResultParam struct { // The unique ID of the file. FileID param.Opt[string] `json:"file_id,omitzero"` // The name of the file. Filename param.Opt[string] `json:"filename,omitzero"` // The relevance score of the file - a value between 0 and 1. Score param.Opt[float64] `json:"score,omitzero"` // The text that was retrieved from the file. Text param.Opt[string] `json:"text,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. Keys are strings with a maximum // length of 64 characters. Values are strings with a maximum length of 512 // characters, booleans, or numbers. Attributes map[string]ResponseFileSearchToolCallResultAttributeUnionParam `json:"attributes,omitzero"` // contains filtered or unexported fields }
func (ResponseFileSearchToolCallResultParam) IsPresent ¶
func (f ResponseFileSearchToolCallResultParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFileSearchToolCallResultParam) MarshalJSON ¶
func (r ResponseFileSearchToolCallResultParam) MarshalJSON() (data []byte, err error)
type ResponseFileSearchToolCallStatus ¶
type ResponseFileSearchToolCallStatus string
The status of the file search tool call. One of `in_progress`, `searching`, `incomplete` or `failed`,
const ( ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress" ResponseFileSearchToolCallStatusSearching ResponseFileSearchToolCallStatus = "searching" ResponseFileSearchToolCallStatusCompleted ResponseFileSearchToolCallStatus = "completed" ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete" ResponseFileSearchToolCallStatusFailed ResponseFileSearchToolCallStatus = "failed" )
type ResponseFormatJSONObject ¶
type ResponseFormatJSONObject = shared.ResponseFormatJSONObject
JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
This is an alias to an internal type.
type ResponseFormatJSONObjectParam ¶
type ResponseFormatJSONObjectParam = shared.ResponseFormatJSONObjectParam
JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
This is an alias to an internal type.
type ResponseFormatJSONSchema ¶
type ResponseFormatJSONSchema = shared.ResponseFormatJSONSchema
JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
This is an alias to an internal type.
type ResponseFormatJSONSchemaJSONSchema ¶
type ResponseFormatJSONSchemaJSONSchema = shared.ResponseFormatJSONSchemaJSONSchema
Structured Outputs configuration options, including a JSON Schema.
This is an alias to an internal type.
type ResponseFormatJSONSchemaJSONSchemaParam ¶
type ResponseFormatJSONSchemaJSONSchemaParam = shared.ResponseFormatJSONSchemaJSONSchemaParam
Structured Outputs configuration options, including a JSON Schema.
This is an alias to an internal type.
type ResponseFormatJSONSchemaParam ¶
type ResponseFormatJSONSchemaParam = shared.ResponseFormatJSONSchemaParam
JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
This is an alias to an internal type.
type ResponseFormatText ¶
type ResponseFormatText = shared.ResponseFormatText
Default response format. Used to generate text responses.
This is an alias to an internal type.
type ResponseFormatTextConfigUnion ¶
type ResponseFormatTextConfigUnion struct { // Any of "text", "json_schema", "json_object". Type string `json:"type"` // This field is from variant [ResponseFormatTextJSONSchemaConfig]. Name string `json:"name"` // This field is from variant [ResponseFormatTextJSONSchemaConfig]. Schema map[string]interface{} `json:"schema"` // This field is from variant [ResponseFormatTextJSONSchemaConfig]. Description string `json:"description"` // This field is from variant [ResponseFormatTextJSONSchemaConfig]. Strict bool `json:"strict"` JSON struct { Type resp.Field Name resp.Field Schema resp.Field Description resp.Field Strict resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseFormatTextConfigUnion contains all possible properties and values from shared.ResponseFormatText, ResponseFormatTextJSONSchemaConfig, shared.ResponseFormatJSONObject.
Use the ResponseFormatTextConfigUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseFormatTextConfigUnion) AsAny ¶
func (u ResponseFormatTextConfigUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseFormatTextConfigUnion.AsAny().(type) { case shared.ResponseFormatText: case ResponseFormatTextJSONSchemaConfig: case shared.ResponseFormatJSONObject: default: fmt.Errorf("no variant present") }
func (ResponseFormatTextConfigUnion) AsJSONObject ¶
func (u ResponseFormatTextConfigUnion) AsJSONObject() (v shared.ResponseFormatJSONObject)
func (ResponseFormatTextConfigUnion) AsJSONSchema ¶
func (u ResponseFormatTextConfigUnion) AsJSONSchema() (v ResponseFormatTextJSONSchemaConfig)
func (ResponseFormatTextConfigUnion) AsText ¶
func (u ResponseFormatTextConfigUnion) AsText() (v shared.ResponseFormatText)
func (ResponseFormatTextConfigUnion) RawJSON ¶
func (u ResponseFormatTextConfigUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseFormatTextConfigUnion) ToParam ¶
func (r ResponseFormatTextConfigUnion) ToParam() ResponseFormatTextConfigUnionParam
ToParam converts this ResponseFormatTextConfigUnion to a ResponseFormatTextConfigUnionParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFormatTextConfigUnionParam.IsOverridden()
func (*ResponseFormatTextConfigUnion) UnmarshalJSON ¶
func (r *ResponseFormatTextConfigUnion) UnmarshalJSON(data []byte) error
type ResponseFormatTextConfigUnionParam ¶
type ResponseFormatTextConfigUnionParam struct { OfText *shared.ResponseFormatTextParam `json:",omitzero,inline"` OfJSONSchema *ResponseFormatTextJSONSchemaConfigParam `json:",omitzero,inline"` OfJSONObject *shared.ResponseFormatJSONObjectParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ResponseFormatTextConfigParamOfJSONSchema ¶
func ResponseFormatTextConfigParamOfJSONSchema(name string, schema map[string]interface{}) ResponseFormatTextConfigUnionParam
func (ResponseFormatTextConfigUnionParam) GetDescription ¶
func (u ResponseFormatTextConfigUnionParam) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseFormatTextConfigUnionParam) GetName ¶
func (u ResponseFormatTextConfigUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseFormatTextConfigUnionParam) GetSchema ¶
func (u ResponseFormatTextConfigUnionParam) GetSchema() map[string]interface{}
Returns a pointer to the underlying variant's property, if present.
func (ResponseFormatTextConfigUnionParam) GetStrict ¶
func (u ResponseFormatTextConfigUnionParam) GetStrict() *bool
Returns a pointer to the underlying variant's property, if present.
func (ResponseFormatTextConfigUnionParam) GetType ¶
func (u ResponseFormatTextConfigUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseFormatTextConfigUnionParam) IsPresent ¶
func (u ResponseFormatTextConfigUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFormatTextConfigUnionParam) MarshalJSON ¶
func (u ResponseFormatTextConfigUnionParam) MarshalJSON() ([]byte, error)
type ResponseFormatTextJSONSchemaConfig ¶
type ResponseFormatTextJSONSchemaConfig struct { // The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores // and dashes, with a maximum length of 64. Name string `json:"name,required"` // The schema for the response format, described as a JSON Schema object. Learn how // to build JSON schemas [here](https://json-schema.org/). Schema map[string]interface{} `json:"schema,required"` // The type of response format being defined. Always `json_schema`. Type constant.JSONSchema `json:"type,required"` // A description of what the response format is for, used by the model to determine // how to respond in the format. Description string `json:"description"` // Whether to enable strict schema adherence when generating the output. If set to // true, the model will always follow the exact schema defined in the `schema` // field. Only a subset of JSON Schema is supported when `strict` is `true`. To // learn more, read the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). Strict bool `json:"strict,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Name resp.Field Schema resp.Field Type resp.Field Description resp.Field Strict resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
func (ResponseFormatTextJSONSchemaConfig) RawJSON ¶
func (r ResponseFormatTextJSONSchemaConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseFormatTextJSONSchemaConfig) ToParam ¶
func (r ResponseFormatTextJSONSchemaConfig) ToParam() ResponseFormatTextJSONSchemaConfigParam
ToParam converts this ResponseFormatTextJSONSchemaConfig to a ResponseFormatTextJSONSchemaConfigParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFormatTextJSONSchemaConfigParam.IsOverridden()
func (*ResponseFormatTextJSONSchemaConfig) UnmarshalJSON ¶
func (r *ResponseFormatTextJSONSchemaConfig) UnmarshalJSON(data []byte) error
type ResponseFormatTextJSONSchemaConfigParam ¶
type ResponseFormatTextJSONSchemaConfigParam struct { // The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores // and dashes, with a maximum length of 64. Name string `json:"name,required"` // The schema for the response format, described as a JSON Schema object. Learn how // to build JSON schemas [here](https://json-schema.org/). Schema map[string]interface{} `json:"schema,omitzero,required"` // Whether to enable strict schema adherence when generating the output. If set to // true, the model will always follow the exact schema defined in the `schema` // field. Only a subset of JSON Schema is supported when `strict` is `true`. To // learn more, read the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). Strict param.Opt[bool] `json:"strict,omitzero"` // A description of what the response format is for, used by the model to determine // how to respond in the format. Description param.Opt[string] `json:"description,omitzero"` // The type of response format being defined. Always `json_schema`. // // This field can be elided, and will marshal its zero value as "json_schema". Type constant.JSONSchema `json:"type,required"` // contains filtered or unexported fields }
JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
The properties Name, Schema, Type are required.
func (ResponseFormatTextJSONSchemaConfigParam) IsPresent ¶
func (f ResponseFormatTextJSONSchemaConfigParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFormatTextJSONSchemaConfigParam) MarshalJSON ¶
func (r ResponseFormatTextJSONSchemaConfigParam) MarshalJSON() (data []byte, err error)
type ResponseFormatTextParam ¶
type ResponseFormatTextParam = shared.ResponseFormatTextParam
Default response format. Used to generate text responses.
This is an alias to an internal type.
type ResponseFunctionCallArgumentsDeltaEvent ¶
type ResponseFunctionCallArgumentsDeltaEvent struct { // The function-call arguments delta that is added. Delta string `json:"delta,required"` // The ID of the output item that the function-call arguments delta is added to. ItemID string `json:"item_id,required"` // The index of the output item that the function-call arguments delta is added to. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.function_call_arguments.delta`. Type constant.ResponseFunctionCallArgumentsDelta `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Delta resp.Field ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when there is a partial function-call arguments delta.
func (ResponseFunctionCallArgumentsDeltaEvent) RawJSON ¶
func (r ResponseFunctionCallArgumentsDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFunctionCallArgumentsDeltaEvent) UnmarshalJSON ¶
func (r *ResponseFunctionCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseFunctionCallArgumentsDoneEvent ¶
type ResponseFunctionCallArgumentsDoneEvent struct { // The function-call arguments. Arguments string `json:"arguments,required"` // The ID of the item. ItemID string `json:"item_id,required"` // The index of the output item. OutputIndex int64 `json:"output_index,required"` Type constant.ResponseFunctionCallArgumentsDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when function-call arguments are finalized.
func (ResponseFunctionCallArgumentsDoneEvent) RawJSON ¶
func (r ResponseFunctionCallArgumentsDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFunctionCallArgumentsDoneEvent) UnmarshalJSON ¶
func (r *ResponseFunctionCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error
type ResponseFunctionToolCall ¶
type ResponseFunctionToolCall struct { // A JSON string of the arguments to pass to the function. Arguments string `json:"arguments,required"` // The unique ID of the function tool call generated by the model. CallID string `json:"call_id,required"` // The name of the function to run. Name string `json:"name,required"` // The type of the function tool call. Always `function_call`. Type constant.FunctionCall `json:"type,required"` // The unique ID of the function tool call. ID string `json:"id"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseFunctionToolCallStatus `json:"status"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field CallID resp.Field Name resp.Field Type resp.Field ID resp.Field Status resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A tool call to run a function. See the [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.
func (ResponseFunctionToolCall) RawJSON ¶
func (r ResponseFunctionToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseFunctionToolCall) ToParam ¶
func (r ResponseFunctionToolCall) ToParam() ResponseFunctionToolCallParam
ToParam converts this ResponseFunctionToolCall to a ResponseFunctionToolCallParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFunctionToolCallParam.IsOverridden()
func (*ResponseFunctionToolCall) UnmarshalJSON ¶
func (r *ResponseFunctionToolCall) UnmarshalJSON(data []byte) error
type ResponseFunctionToolCallItem ¶
type ResponseFunctionToolCallItem struct { // The unique ID of the function tool call. ID string `json:"id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` ResponseFunctionToolCall }
A tool call to run a function. See the [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.
func (ResponseFunctionToolCallItem) RawJSON ¶
func (r ResponseFunctionToolCallItem) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFunctionToolCallItem) UnmarshalJSON ¶
func (r *ResponseFunctionToolCallItem) UnmarshalJSON(data []byte) error
type ResponseFunctionToolCallOutputItem ¶
type ResponseFunctionToolCallOutputItem struct { // The unique ID of the function call tool output. ID string `json:"id,required"` // The unique ID of the function tool call generated by the model. CallID string `json:"call_id,required"` // A JSON string of the output of the function tool call. Output string `json:"output,required"` // The type of the function tool call output. Always `function_call_output`. Type constant.FunctionCallOutput `json:"type,required"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseFunctionToolCallOutputItemStatus `json:"status"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CallID resp.Field Output resp.Field Type resp.Field Status resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ResponseFunctionToolCallOutputItem) RawJSON ¶
func (r ResponseFunctionToolCallOutputItem) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseFunctionToolCallOutputItem) UnmarshalJSON ¶
func (r *ResponseFunctionToolCallOutputItem) UnmarshalJSON(data []byte) error
type ResponseFunctionToolCallOutputItemStatus ¶
type ResponseFunctionToolCallOutputItemStatus string
The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
const ( ResponseFunctionToolCallOutputItemStatusInProgress ResponseFunctionToolCallOutputItemStatus = "in_progress" ResponseFunctionToolCallOutputItemStatusCompleted ResponseFunctionToolCallOutputItemStatus = "completed" ResponseFunctionToolCallOutputItemStatusIncomplete ResponseFunctionToolCallOutputItemStatus = "incomplete" )
type ResponseFunctionToolCallParam ¶
type ResponseFunctionToolCallParam struct { // A JSON string of the arguments to pass to the function. Arguments string `json:"arguments,required"` // The unique ID of the function tool call generated by the model. CallID string `json:"call_id,required"` // The name of the function to run. Name string `json:"name,required"` // The unique ID of the function tool call. ID param.Opt[string] `json:"id,omitzero"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseFunctionToolCallStatus `json:"status,omitzero"` // The type of the function tool call. Always `function_call`. // // This field can be elided, and will marshal its zero value as "function_call". Type constant.FunctionCall `json:"type,required"` // contains filtered or unexported fields }
A tool call to run a function. See the [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.
The properties Arguments, CallID, Name, Type are required.
func (ResponseFunctionToolCallParam) IsPresent ¶
func (f ResponseFunctionToolCallParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFunctionToolCallParam) MarshalJSON ¶
func (r ResponseFunctionToolCallParam) MarshalJSON() (data []byte, err error)
type ResponseFunctionToolCallStatus ¶
type ResponseFunctionToolCallStatus string
The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
const ( ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress" ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed" ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete" )
type ResponseFunctionWebSearch ¶
type ResponseFunctionWebSearch struct { // The unique ID of the web search tool call. ID string `json:"id,required"` // The status of the web search tool call. // // Any of "in_progress", "searching", "completed", "failed". Status ResponseFunctionWebSearchStatus `json:"status,required"` // The type of the web search tool call. Always `web_search_call`. Type constant.WebSearchCall `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Status resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The results of a web search tool call. See the [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.
func (ResponseFunctionWebSearch) RawJSON ¶
func (r ResponseFunctionWebSearch) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseFunctionWebSearch) ToParam ¶
func (r ResponseFunctionWebSearch) ToParam() ResponseFunctionWebSearchParam
ToParam converts this ResponseFunctionWebSearch to a ResponseFunctionWebSearchParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFunctionWebSearchParam.IsOverridden()
func (*ResponseFunctionWebSearch) UnmarshalJSON ¶
func (r *ResponseFunctionWebSearch) UnmarshalJSON(data []byte) error
type ResponseFunctionWebSearchParam ¶
type ResponseFunctionWebSearchParam struct { // The unique ID of the web search tool call. ID string `json:"id,required"` // The status of the web search tool call. // // Any of "in_progress", "searching", "completed", "failed". Status ResponseFunctionWebSearchStatus `json:"status,omitzero,required"` // The type of the web search tool call. Always `web_search_call`. // // This field can be elided, and will marshal its zero value as "web_search_call". Type constant.WebSearchCall `json:"type,required"` // contains filtered or unexported fields }
The results of a web search tool call. See the [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.
The properties ID, Status, Type are required.
func (ResponseFunctionWebSearchParam) IsPresent ¶
func (f ResponseFunctionWebSearchParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseFunctionWebSearchParam) MarshalJSON ¶
func (r ResponseFunctionWebSearchParam) MarshalJSON() (data []byte, err error)
type ResponseFunctionWebSearchStatus ¶
type ResponseFunctionWebSearchStatus string
The status of the web search tool call.
const ( ResponseFunctionWebSearchStatusInProgress ResponseFunctionWebSearchStatus = "in_progress" ResponseFunctionWebSearchStatusSearching ResponseFunctionWebSearchStatus = "searching" ResponseFunctionWebSearchStatusCompleted ResponseFunctionWebSearchStatus = "completed" ResponseFunctionWebSearchStatusFailed ResponseFunctionWebSearchStatus = "failed" )
type ResponseGetParams ¶
type ResponseGetParams struct { // Additional fields to include in the response. See the `include` parameter for // Response creation above for more information. Include []ResponseIncludable `query:"include,omitzero" json:"-"` // contains filtered or unexported fields }
func (ResponseGetParams) IsPresent ¶
func (f ResponseGetParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseGetParams) URLQuery ¶
func (r ResponseGetParams) URLQuery() (v url.Values)
URLQuery serializes ResponseGetParams's query parameters as `url.Values`.
type ResponseInProgressEvent ¶
type ResponseInProgressEvent struct { // The response that is in progress. Response Response `json:"response,required"` // The type of the event. Always `response.in_progress`. Type constant.ResponseInProgress `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Response resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the response is in progress.
func (ResponseInProgressEvent) RawJSON ¶
func (r ResponseInProgressEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseInProgressEvent) UnmarshalJSON ¶
func (r *ResponseInProgressEvent) UnmarshalJSON(data []byte) error
type ResponseIncludable ¶
type ResponseIncludable string
Specify additional output data to include in the model response. Currently supported values are:
- `file_search_call.results`: Include the search results of the file search tool call.
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer call output.
const ( ResponseIncludableFileSearchCallResults ResponseIncludable = "file_search_call.results" ResponseIncludableMessageInputImageImageURL ResponseIncludable = "message.input_image.image_url" ResponseIncludableComputerCallOutputOutputImageURL ResponseIncludable = "computer_call_output.output.image_url" )
type ResponseIncompleteDetails ¶
type ResponseIncompleteDetails struct { // The reason why the response is incomplete. // // Any of "max_output_tokens", "content_filter". Reason string `json:"reason"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Reason resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details about why the response is incomplete.
func (ResponseIncompleteDetails) RawJSON ¶
func (r ResponseIncompleteDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseIncompleteDetails) UnmarshalJSON ¶
func (r *ResponseIncompleteDetails) UnmarshalJSON(data []byte) error
type ResponseIncompleteEvent ¶
type ResponseIncompleteEvent struct { // The response that was incomplete. Response Response `json:"response,required"` // The type of the event. Always `response.incomplete`. Type constant.ResponseIncomplete `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Response resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An event that is emitted when a response finishes as incomplete.
func (ResponseIncompleteEvent) RawJSON ¶
func (r ResponseIncompleteEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseIncompleteEvent) UnmarshalJSON ¶
func (r *ResponseIncompleteEvent) UnmarshalJSON(data []byte) error
type ResponseInputContentUnion ¶
type ResponseInputContentUnion struct { // This field is from variant [ResponseInputText]. Text string `json:"text"` // Any of "input_text", "input_image", "input_file". Type string `json:"type"` // This field is from variant [ResponseInputImage]. Detail ResponseInputImageDetail `json:"detail"` FileID string `json:"file_id"` // This field is from variant [ResponseInputImage]. ImageURL string `json:"image_url"` // This field is from variant [ResponseInputFile]. FileData string `json:"file_data"` // This field is from variant [ResponseInputFile]. Filename string `json:"filename"` JSON struct { Text resp.Field Type resp.Field Detail resp.Field FileID resp.Field ImageURL resp.Field FileData resp.Field Filename resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseInputContentUnion contains all possible properties and values from ResponseInputText, ResponseInputImage, ResponseInputFile.
Use the ResponseInputContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseInputContentUnion) AsAny ¶
func (u ResponseInputContentUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseInputContentUnion.AsAny().(type) { case ResponseInputText: case ResponseInputImage: case ResponseInputFile: default: fmt.Errorf("no variant present") }
func (ResponseInputContentUnion) AsInputFile ¶
func (u ResponseInputContentUnion) AsInputFile() (v ResponseInputFile)
func (ResponseInputContentUnion) AsInputImage ¶
func (u ResponseInputContentUnion) AsInputImage() (v ResponseInputImage)
func (ResponseInputContentUnion) AsInputText ¶
func (u ResponseInputContentUnion) AsInputText() (v ResponseInputText)
func (ResponseInputContentUnion) RawJSON ¶
func (u ResponseInputContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseInputContentUnion) ToParam ¶
func (r ResponseInputContentUnion) ToParam() ResponseInputContentUnionParam
ToParam converts this ResponseInputContentUnion to a ResponseInputContentUnionParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputContentUnionParam.IsOverridden()
func (*ResponseInputContentUnion) UnmarshalJSON ¶
func (r *ResponseInputContentUnion) UnmarshalJSON(data []byte) error
type ResponseInputContentUnionParam ¶
type ResponseInputContentUnionParam struct { OfInputText *ResponseInputTextParam `json:",omitzero,inline"` OfInputImage *ResponseInputImageParam `json:",omitzero,inline"` OfInputFile *ResponseInputFileParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ResponseInputContentParamOfInputImage ¶
func ResponseInputContentParamOfInputImage(detail ResponseInputImageDetail) ResponseInputContentUnionParam
func ResponseInputContentParamOfInputText ¶
func ResponseInputContentParamOfInputText(text string) ResponseInputContentUnionParam
func (ResponseInputContentUnionParam) GetDetail ¶
func (u ResponseInputContentUnionParam) GetDetail() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) GetFileData ¶
func (u ResponseInputContentUnionParam) GetFileData() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) GetFileID ¶
func (u ResponseInputContentUnionParam) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) GetFilename ¶
func (u ResponseInputContentUnionParam) GetFilename() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) GetImageURL ¶
func (u ResponseInputContentUnionParam) GetImageURL() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) GetText ¶
func (u ResponseInputContentUnionParam) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) GetType ¶
func (u ResponseInputContentUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputContentUnionParam) IsPresent ¶
func (u ResponseInputContentUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputContentUnionParam) MarshalJSON ¶
func (u ResponseInputContentUnionParam) MarshalJSON() ([]byte, error)
type ResponseInputFile ¶
type ResponseInputFile struct { // The type of the input item. Always `input_file`. Type constant.InputFile `json:"type,required"` // The content of the file to be sent to the model. FileData string `json:"file_data"` // The ID of the file to be sent to the model. FileID string `json:"file_id"` // The name of the file to be sent to the model. Filename string `json:"filename"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field FileData resp.Field FileID resp.Field Filename resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A file input to the model.
func (ResponseInputFile) RawJSON ¶
func (r ResponseInputFile) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseInputFile) ToParam ¶
func (r ResponseInputFile) ToParam() ResponseInputFileParam
ToParam converts this ResponseInputFile to a ResponseInputFileParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputFileParam.IsOverridden()
func (*ResponseInputFile) UnmarshalJSON ¶
func (r *ResponseInputFile) UnmarshalJSON(data []byte) error
type ResponseInputFileParam ¶
type ResponseInputFileParam struct { // The content of the file to be sent to the model. FileData param.Opt[string] `json:"file_data,omitzero"` // The ID of the file to be sent to the model. FileID param.Opt[string] `json:"file_id,omitzero"` // The name of the file to be sent to the model. Filename param.Opt[string] `json:"filename,omitzero"` // The type of the input item. Always `input_file`. // // This field can be elided, and will marshal its zero value as "input_file". Type constant.InputFile `json:"type,required"` // contains filtered or unexported fields }
A file input to the model.
The property Type is required.
func (ResponseInputFileParam) IsPresent ¶
func (f ResponseInputFileParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputFileParam) MarshalJSON ¶
func (r ResponseInputFileParam) MarshalJSON() (data []byte, err error)
type ResponseInputImage ¶
type ResponseInputImage struct { // The detail level of the image to be sent to the model. One of `high`, `low`, or // `auto`. Defaults to `auto`. // // Any of "high", "low", "auto". Detail ResponseInputImageDetail `json:"detail,required"` // The type of the input item. Always `input_image`. Type constant.InputImage `json:"type,required"` // The ID of the file to be sent to the model. FileID string `json:"file_id,nullable"` // The URL of the image to be sent to the model. A fully qualified URL or base64 // encoded image in a data URL. ImageURL string `json:"image_url,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Detail resp.Field Type resp.Field FileID resp.Field ImageURL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
func (ResponseInputImage) RawJSON ¶
func (r ResponseInputImage) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseInputImage) ToParam ¶
func (r ResponseInputImage) ToParam() ResponseInputImageParam
ToParam converts this ResponseInputImage to a ResponseInputImageParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputImageParam.IsOverridden()
func (*ResponseInputImage) UnmarshalJSON ¶
func (r *ResponseInputImage) UnmarshalJSON(data []byte) error
type ResponseInputImageDetail ¶
type ResponseInputImageDetail string
The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
const ( ResponseInputImageDetailHigh ResponseInputImageDetail = "high" ResponseInputImageDetailLow ResponseInputImageDetail = "low" ResponseInputImageDetailAuto ResponseInputImageDetail = "auto" )
type ResponseInputImageParam ¶
type ResponseInputImageParam struct { // The detail level of the image to be sent to the model. One of `high`, `low`, or // `auto`. Defaults to `auto`. // // Any of "high", "low", "auto". Detail ResponseInputImageDetail `json:"detail,omitzero,required"` // The ID of the file to be sent to the model. FileID param.Opt[string] `json:"file_id,omitzero"` // The URL of the image to be sent to the model. A fully qualified URL or base64 // encoded image in a data URL. ImageURL param.Opt[string] `json:"image_url,omitzero"` // The type of the input item. Always `input_image`. // // This field can be elided, and will marshal its zero value as "input_image". Type constant.InputImage `json:"type,required"` // contains filtered or unexported fields }
An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
The properties Detail, Type are required.
func (ResponseInputImageParam) IsPresent ¶
func (f ResponseInputImageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputImageParam) MarshalJSON ¶
func (r ResponseInputImageParam) MarshalJSON() (data []byte, err error)
type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam ¶
type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam struct { // The ID of the pending safety check. ID string `json:"id,required"` // The type of the pending safety check. Code string `json:"code,required"` // Details about the pending safety check. Message string `json:"message,required"` // contains filtered or unexported fields }
A pending safety check for the computer call.
The properties ID, Code, Message are required.
func (ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) IsPresent ¶
func (f ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) MarshalJSON ¶
func (r ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) MarshalJSON() (data []byte, err error)
type ResponseInputItemComputerCallOutputParam ¶
type ResponseInputItemComputerCallOutputParam struct { // The ID of the computer tool call that produced the output. CallID string `json:"call_id,required"` // A computer screenshot image used with the computer use tool. Output ResponseComputerToolCallOutputScreenshotParam `json:"output,omitzero,required"` // The ID of the computer tool call output. ID param.Opt[string] `json:"id,omitzero"` // The safety checks reported by the API that have been acknowledged by the // developer. AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam `json:"acknowledged_safety_checks,omitzero"` // The status of the message input. One of `in_progress`, `completed`, or // `incomplete`. Populated when input items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status string `json:"status,omitzero"` // The type of the computer tool call output. Always `computer_call_output`. // // This field can be elided, and will marshal its zero value as // "computer_call_output". Type constant.ComputerCallOutput `json:"type,required"` // contains filtered or unexported fields }
The output of a computer tool call.
The properties CallID, Output, Type are required.
func (ResponseInputItemComputerCallOutputParam) IsPresent ¶
func (f ResponseInputItemComputerCallOutputParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputItemComputerCallOutputParam) MarshalJSON ¶
func (r ResponseInputItemComputerCallOutputParam) MarshalJSON() (data []byte, err error)
type ResponseInputItemFunctionCallOutputParam ¶
type ResponseInputItemFunctionCallOutputParam struct { // The unique ID of the function tool call generated by the model. CallID string `json:"call_id,required"` // A JSON string of the output of the function tool call. Output string `json:"output,required"` // The unique ID of the function tool call output. Populated when this item is // returned via API. ID param.Opt[string] `json:"id,omitzero"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status string `json:"status,omitzero"` // The type of the function tool call output. Always `function_call_output`. // // This field can be elided, and will marshal its zero value as // "function_call_output". Type constant.FunctionCallOutput `json:"type,required"` // contains filtered or unexported fields }
The output of a function tool call.
The properties CallID, Output, Type are required.
func (ResponseInputItemFunctionCallOutputParam) IsPresent ¶
func (f ResponseInputItemFunctionCallOutputParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputItemFunctionCallOutputParam) MarshalJSON ¶
func (r ResponseInputItemFunctionCallOutputParam) MarshalJSON() (data []byte, err error)
type ResponseInputItemItemReferenceParam ¶
type ResponseInputItemItemReferenceParam struct { // The ID of the item to reference. ID string `json:"id,required"` // The type of item to reference. Always `item_reference`. // // This field can be elided, and will marshal its zero value as "item_reference". Type constant.ItemReference `json:"type,required"` // contains filtered or unexported fields }
An internal identifier for an item to reference.
The properties ID, Type are required.
func (ResponseInputItemItemReferenceParam) IsPresent ¶
func (f ResponseInputItemItemReferenceParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputItemItemReferenceParam) MarshalJSON ¶
func (r ResponseInputItemItemReferenceParam) MarshalJSON() (data []byte, err error)
type ResponseInputItemMessageParam ¶
type ResponseInputItemMessageParam struct { // A list of one or many input items to the model, containing different content // types. Content ResponseInputMessageContentListParam `json:"content,omitzero,required"` // The role of the message input. One of `user`, `system`, or `developer`. // // Any of "user", "system", "developer". Role string `json:"role,omitzero,required"` // The status of item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status string `json:"status,omitzero"` // The type of the message input. Always set to `message`. // // Any of "message". Type string `json:"type,omitzero"` // contains filtered or unexported fields }
A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role.
The properties Content, Role are required.
func (ResponseInputItemMessageParam) IsPresent ¶
func (f ResponseInputItemMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputItemMessageParam) MarshalJSON ¶
func (r ResponseInputItemMessageParam) MarshalJSON() (data []byte, err error)
type ResponseInputItemUnionParam ¶
type ResponseInputItemUnionParam struct { OfMessage *EasyInputMessageParam `json:",omitzero,inline"` OfInputMessage *ResponseInputItemMessageParam `json:",omitzero,inline"` OfOutputMessage *ResponseOutputMessageParam `json:",omitzero,inline"` OfFileSearchCall *ResponseFileSearchToolCallParam `json:",omitzero,inline"` OfComputerCall *ResponseComputerToolCallParam `json:",omitzero,inline"` OfComputerCallOutput *ResponseInputItemComputerCallOutputParam `json:",omitzero,inline"` OfWebSearchCall *ResponseFunctionWebSearchParam `json:",omitzero,inline"` OfFunctionCall *ResponseFunctionToolCallParam `json:",omitzero,inline"` OfFunctionCallOutput *ResponseInputItemFunctionCallOutputParam `json:",omitzero,inline"` OfReasoning *ResponseReasoningItemParam `json:",omitzero,inline"` OfItemReference *ResponseInputItemItemReferenceParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ResponseInputItemParamOfComputerCallOutput ¶
func ResponseInputItemParamOfComputerCallOutput(callID string, output ResponseComputerToolCallOutputScreenshotParam) ResponseInputItemUnionParam
func ResponseInputItemParamOfFileSearchCall ¶
func ResponseInputItemParamOfFileSearchCall(id string, queries []string, status ResponseFileSearchToolCallStatus) ResponseInputItemUnionParam
func ResponseInputItemParamOfFunctionCall ¶
func ResponseInputItemParamOfFunctionCall(arguments string, callID string, name string) ResponseInputItemUnionParam
func ResponseInputItemParamOfFunctionCallOutput ¶
func ResponseInputItemParamOfFunctionCallOutput(callID string, output string) ResponseInputItemUnionParam
func ResponseInputItemParamOfInputMessage ¶
func ResponseInputItemParamOfInputMessage(content ResponseInputMessageContentListParam, role string) ResponseInputItemUnionParam
func ResponseInputItemParamOfItemReference ¶
func ResponseInputItemParamOfItemReference(id string) ResponseInputItemUnionParam
func ResponseInputItemParamOfMessage ¶
func ResponseInputItemParamOfMessage[T string | ResponseInputMessageContentListParam](content T, role EasyInputMessageRole) ResponseInputItemUnionParam
func ResponseInputItemParamOfOutputMessage ¶
func ResponseInputItemParamOfOutputMessage(content []ResponseOutputMessageContentUnionParam, id string, status ResponseOutputMessageStatus) ResponseInputItemUnionParam
func ResponseInputItemParamOfReasoning ¶
func ResponseInputItemParamOfReasoning(id string, summary []ResponseReasoningItemSummaryParam) ResponseInputItemUnionParam
func ResponseInputItemParamOfWebSearchCall ¶
func ResponseInputItemParamOfWebSearchCall(id string, status ResponseFunctionWebSearchStatus) ResponseInputItemUnionParam
func (ResponseInputItemUnionParam) GetAcknowledgedSafetyChecks ¶
func (u ResponseInputItemUnionParam) GetAcknowledgedSafetyChecks() []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetAction ¶
func (u ResponseInputItemUnionParam) GetAction() *ResponseComputerToolCallActionUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetArguments ¶
func (u ResponseInputItemUnionParam) GetArguments() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetCallID ¶
func (u ResponseInputItemUnionParam) GetCallID() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetContent ¶
func (u ResponseInputItemUnionParam) GetContent() (res responseInputItemUnionParamContent)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ResponseInputItemUnionParam) GetID ¶
func (u ResponseInputItemUnionParam) GetID() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetName ¶
func (u ResponseInputItemUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetOutput ¶
func (u ResponseInputItemUnionParam) GetOutput() (res responseInputItemUnionParamOutput)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ResponseInputItemUnionParam) GetPendingSafetyChecks ¶
func (u ResponseInputItemUnionParam) GetPendingSafetyChecks() []ResponseComputerToolCallPendingSafetyCheckParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetQueries ¶
func (u ResponseInputItemUnionParam) GetQueries() []string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetResults ¶
func (u ResponseInputItemUnionParam) GetResults() []ResponseFileSearchToolCallResultParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetRole ¶
func (u ResponseInputItemUnionParam) GetRole() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetStatus ¶
func (u ResponseInputItemUnionParam) GetStatus() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetSummary ¶
func (u ResponseInputItemUnionParam) GetSummary() []ResponseReasoningItemSummaryParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) GetType ¶
func (u ResponseInputItemUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseInputItemUnionParam) IsPresent ¶
func (u ResponseInputItemUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputItemUnionParam) MarshalJSON ¶
func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error)
type ResponseInputMessageContentList ¶
type ResponseInputMessageContentList []ResponseInputContentUnion
type ResponseInputMessageContentListParam ¶
type ResponseInputMessageContentListParam []ResponseInputContentUnionParam
type ResponseInputMessageItem ¶
type ResponseInputMessageItem struct { // The unique ID of the message input. ID string `json:"id,required"` // A list of one or many input items to the model, containing different content // types. Content ResponseInputMessageContentList `json:"content,required"` // The role of the message input. One of `user`, `system`, or `developer`. // // Any of "user", "system", "developer". Role ResponseInputMessageItemRole `json:"role,required"` // The status of item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseInputMessageItemStatus `json:"status"` // The type of the message input. Always set to `message`. // // Any of "message". Type ResponseInputMessageItemType `json:"type"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Content resp.Field Role resp.Field Status resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ResponseInputMessageItem) RawJSON ¶
func (r ResponseInputMessageItem) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseInputMessageItem) UnmarshalJSON ¶
func (r *ResponseInputMessageItem) UnmarshalJSON(data []byte) error
type ResponseInputMessageItemRole ¶
type ResponseInputMessageItemRole string
The role of the message input. One of `user`, `system`, or `developer`.
const ( ResponseInputMessageItemRoleUser ResponseInputMessageItemRole = "user" ResponseInputMessageItemRoleSystem ResponseInputMessageItemRole = "system" ResponseInputMessageItemRoleDeveloper ResponseInputMessageItemRole = "developer" )
type ResponseInputMessageItemStatus ¶
type ResponseInputMessageItemStatus string
The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
const ( ResponseInputMessageItemStatusInProgress ResponseInputMessageItemStatus = "in_progress" ResponseInputMessageItemStatusCompleted ResponseInputMessageItemStatus = "completed" ResponseInputMessageItemStatusIncomplete ResponseInputMessageItemStatus = "incomplete" )
type ResponseInputMessageItemType ¶
type ResponseInputMessageItemType string
The type of the message input. Always set to `message`.
const (
ResponseInputMessageItemTypeMessage ResponseInputMessageItemType = "message"
)
type ResponseInputParam ¶
type ResponseInputParam []ResponseInputItemUnionParam
type ResponseInputText ¶
type ResponseInputText struct { // The text input to the model. Text string `json:"text,required"` // The type of the input item. Always `input_text`. Type constant.InputText `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A text input to the model.
func (ResponseInputText) RawJSON ¶
func (r ResponseInputText) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseInputText) ToParam ¶
func (r ResponseInputText) ToParam() ResponseInputTextParam
ToParam converts this ResponseInputText to a ResponseInputTextParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputTextParam.IsOverridden()
func (*ResponseInputText) UnmarshalJSON ¶
func (r *ResponseInputText) UnmarshalJSON(data []byte) error
type ResponseInputTextParam ¶
type ResponseInputTextParam struct { // The text input to the model. Text string `json:"text,required"` // The type of the input item. Always `input_text`. // // This field can be elided, and will marshal its zero value as "input_text". Type constant.InputText `json:"type,required"` // contains filtered or unexported fields }
A text input to the model.
The properties Text, Type are required.
func (ResponseInputTextParam) IsPresent ¶
func (f ResponseInputTextParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseInputTextParam) MarshalJSON ¶
func (r ResponseInputTextParam) MarshalJSON() (data []byte, err error)
type ResponseItemList ¶
type ResponseItemList struct { // A list of items used to generate this response. Data []ResponseItemUnion `json:"data,required"` // The ID of the first item in the list. FirstID string `json:"first_id,required"` // Whether there are more items available. HasMore bool `json:"has_more,required"` // The ID of the last item in the list. LastID string `json:"last_id,required"` // The type of object returned, must be `list`. Object constant.List `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field FirstID resp.Field HasMore resp.Field LastID resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A list of Response items.
func (ResponseItemList) RawJSON ¶
func (r ResponseItemList) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseItemList) UnmarshalJSON ¶
func (r *ResponseItemList) UnmarshalJSON(data []byte) error
type ResponseItemUnion ¶
type ResponseItemUnion struct { ID string `json:"id"` // This field is a union of [ResponseInputMessageContentList], // [[]ResponseOutputMessageContentUnion] Content ResponseItemUnionContent `json:"content"` Role string `json:"role"` Status string `json:"status"` // Any of "message", "message", "file_search_call", "computer_call", // "computer_call_output", "web_search_call", "function_call", // "function_call_output". Type string `json:"type"` // This field is from variant [ResponseFileSearchToolCall]. Queries []string `json:"queries"` // This field is from variant [ResponseFileSearchToolCall]. Results []ResponseFileSearchToolCallResult `json:"results"` // This field is from variant [ResponseComputerToolCall]. Action ResponseComputerToolCallActionUnion `json:"action"` CallID string `json:"call_id"` // This field is from variant [ResponseComputerToolCall]. PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"` // This field is a union of [ResponseComputerToolCallOutputScreenshot], [string] Output ResponseItemUnionOutput `json:"output"` // This field is from variant [ResponseComputerToolCallOutputItem]. AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"` // This field is from variant [ResponseFunctionToolCallItem]. Arguments string `json:"arguments"` // This field is from variant [ResponseFunctionToolCallItem]. Name string `json:"name"` JSON struct { ID resp.Field Content resp.Field Role resp.Field Status resp.Field Type resp.Field Queries resp.Field Results resp.Field Action resp.Field CallID resp.Field PendingSafetyChecks resp.Field Output resp.Field AcknowledgedSafetyChecks resp.Field Arguments resp.Field Name resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseItemUnion contains all possible properties and values from ResponseInputMessageItem, ResponseOutputMessage, ResponseFileSearchToolCall, ResponseComputerToolCall, ResponseComputerToolCallOutputItem, ResponseFunctionWebSearch, ResponseFunctionToolCallItem, ResponseFunctionToolCallOutputItem.
Use the ResponseItemUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseItemUnion) AsAny ¶
func (u ResponseItemUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseItemUnion.AsAny().(type) { case ResponseInputMessageItem: case ResponseOutputMessage: case ResponseFileSearchToolCall: case ResponseComputerToolCall: case ResponseComputerToolCallOutputItem: case ResponseFunctionWebSearch: case ResponseFunctionToolCallItem: case ResponseFunctionToolCallOutputItem: default: fmt.Errorf("no variant present") }
func (ResponseItemUnion) AsComputerCall ¶
func (u ResponseItemUnion) AsComputerCall() (v ResponseComputerToolCall)
func (ResponseItemUnion) AsComputerCallOutput ¶
func (u ResponseItemUnion) AsComputerCallOutput() (v ResponseComputerToolCallOutputItem)
func (ResponseItemUnion) AsFileSearchCall ¶
func (u ResponseItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)
func (ResponseItemUnion) AsFunctionCall ¶
func (u ResponseItemUnion) AsFunctionCall() (v ResponseFunctionToolCallItem)
func (ResponseItemUnion) AsFunctionCallOutput ¶
func (u ResponseItemUnion) AsFunctionCallOutput() (v ResponseFunctionToolCallOutputItem)
func (ResponseItemUnion) AsMessage ¶
func (u ResponseItemUnion) AsMessage() (v ResponseInputMessageItem)
func (ResponseItemUnion) AsOutputMessage ¶
func (u ResponseItemUnion) AsOutputMessage() (v ResponseOutputMessage)
func (ResponseItemUnion) AsWebSearchCall ¶
func (u ResponseItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)
func (ResponseItemUnion) RawJSON ¶
func (u ResponseItemUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseItemUnion) UnmarshalJSON ¶
func (r *ResponseItemUnion) UnmarshalJSON(data []byte) error
type ResponseItemUnionContent ¶
type ResponseItemUnionContent struct { // This field will be present if the value is a [ResponseInputMessageContentList] // instead of an object. OfInputItemContentList ResponseInputMessageContentList `json:",inline"` // This field will be present if the value is a // [[]ResponseOutputMessageContentUnion] instead of an object. OfResponseOutputMessageContent []ResponseOutputMessageContentUnion `json:",inline"` JSON struct { OfInputItemContentList resp.Field OfResponseOutputMessageContent resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseItemUnionContent is an implicit subunion of ResponseItemUnion. ResponseItemUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ResponseItemUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfInputItemContentList OfResponseOutputMessageContent]
func (*ResponseItemUnionContent) UnmarshalJSON ¶
func (r *ResponseItemUnionContent) UnmarshalJSON(data []byte) error
type ResponseItemUnionOutput ¶
type ResponseItemUnionOutput struct { // This field will be present if the value is a [string] instead of an object. OfString string `json:",inline"` // This field is from variant [ResponseComputerToolCallOutputScreenshot]. Type constant.ComputerScreenshot `json:"type"` // This field is from variant [ResponseComputerToolCallOutputScreenshot]. FileID string `json:"file_id"` // This field is from variant [ResponseComputerToolCallOutputScreenshot]. ImageURL string `json:"image_url"` JSON struct { OfString resp.Field Type resp.Field FileID resp.Field ImageURL resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseItemUnionOutput is an implicit subunion of ResponseItemUnion. ResponseItemUnionOutput provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ResponseItemUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfString]
func (*ResponseItemUnionOutput) UnmarshalJSON ¶
func (r *ResponseItemUnionOutput) UnmarshalJSON(data []byte) error
type ResponseNewParams ¶
type ResponseNewParams struct { // Text, image, or file inputs to the model, used to generate a response. // // Learn more: // // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) // - [Image inputs](https://platform.openai.com/docs/guides/images) // - [File inputs](https://platform.openai.com/docs/guides/pdf-files) // - [Conversation state](https://platform.openai.com/docs/guides/conversation-state) // - [Function calling](https://platform.openai.com/docs/guides/function-calling) Input ResponseNewParamsInputUnion `json:"input,omitzero,required"` // Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a // wide range of models with different capabilities, performance characteristics, // and price points. Refer to the // [model guide](https://platform.openai.com/docs/models) to browse and compare // available models. Model shared.ResponsesModel `json:"model,omitzero,required"` // Inserts a system (or developer) message as the first item in the model's // context. // // When using along with `previous_response_id`, the instructions from a previous // response will not be carried over to the next response. This makes it simple to // swap out system (or developer) messages in new responses. Instructions param.Opt[string] `json:"instructions,omitzero"` // An upper bound for the number of tokens that can be generated for a response, // including visible output tokens and // [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). MaxOutputTokens param.Opt[int64] `json:"max_output_tokens,omitzero"` // Whether to allow the model to run tool calls in parallel. ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"` // The unique ID of the previous response to the model. Use this to create // multi-turn conversations. Learn more about // [conversation state](https://platform.openai.com/docs/guides/conversation-state). PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"` // Whether to store the generated model response for later retrieval via API. Store param.Opt[bool] `json:"store,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. We generally recommend altering this or `top_p` but // not both. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or `temperature` but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // Specify additional output data to include in the model response. Currently // supported values are: // // - `file_search_call.results`: Include the search results of the file search tool // call. // - `message.input_image.image_url`: Include image urls from the input message. // - `computer_call_output.output.image_url`: Include image urls from the computer // call output. Include []ResponseIncludable `json:"include,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // The truncation strategy to use for the model response. // // - `auto`: If the context of this response and previous ones exceeds the model's // context window size, the model will truncate the response to fit the context // window by dropping input items in the middle of the conversation. // - `disabled` (default): If a model response will exceed the context window size // for a model, the request will fail with a 400 error. // // Any of "auto", "disabled". Truncation ResponseNewParamsTruncation `json:"truncation,omitzero"` // **o-series models only** // // Configuration options for // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Reasoning shared.ReasoningParam `json:"reasoning,omitzero"` // Configuration options for a text response from the model. Can be plain text or // structured JSON data. Learn more: // // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) // - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) Text ResponseTextConfigParam `json:"text,omitzero"` // How the model should select which tool (or tools) to use when generating a // response. See the `tools` parameter to see how to specify which tools the model // can call. ToolChoice ResponseNewParamsToolChoiceUnion `json:"tool_choice,omitzero"` // An array of tools the model may call while generating a response. You can // specify which tool to use by setting the `tool_choice` parameter. // // The two categories of tools you can provide the model are: // // - **Built-in tools**: Tools that are provided by OpenAI that extend the model's // capabilities, like // [web search](https://platform.openai.com/docs/guides/tools-web-search) or // [file search](https://platform.openai.com/docs/guides/tools-file-search). // Learn more about // [built-in tools](https://platform.openai.com/docs/guides/tools). // - **Function calls (custom tools)**: Functions that are defined by you, enabling // the model to call your own code. Learn more about // [function calling](https://platform.openai.com/docs/guides/function-calling). Tools []ToolUnionParam `json:"tools,omitzero"` // contains filtered or unexported fields }
func (ResponseNewParams) IsPresent ¶
func (f ResponseNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseNewParams) MarshalJSON ¶
func (r ResponseNewParams) MarshalJSON() (data []byte, err error)
type ResponseNewParamsInputUnion ¶
type ResponseNewParamsInputUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfInputItemList ResponseInputParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ResponseNewParamsInputUnion) IsPresent ¶
func (u ResponseNewParamsInputUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseNewParamsInputUnion) MarshalJSON ¶
func (u ResponseNewParamsInputUnion) MarshalJSON() ([]byte, error)
type ResponseNewParamsToolChoiceUnion ¶
type ResponseNewParamsToolChoiceUnion struct { // Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode) OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"` OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"` OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ResponseNewParamsToolChoiceUnion) GetName ¶
func (u ResponseNewParamsToolChoiceUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseNewParamsToolChoiceUnion) GetType ¶
func (u ResponseNewParamsToolChoiceUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseNewParamsToolChoiceUnion) IsPresent ¶
func (u ResponseNewParamsToolChoiceUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseNewParamsToolChoiceUnion) MarshalJSON ¶
func (u ResponseNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error)
type ResponseNewParamsTruncation ¶
type ResponseNewParamsTruncation string
The truncation strategy to use for the model response.
- `auto`: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.
- `disabled` (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
const ( ResponseNewParamsTruncationAuto ResponseNewParamsTruncation = "auto" ResponseNewParamsTruncationDisabled ResponseNewParamsTruncation = "disabled" )
type ResponseOutputItemAddedEvent ¶
type ResponseOutputItemAddedEvent struct { // The output item that was added. Item ResponseOutputItemUnion `json:"item,required"` // The index of the output item that was added. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.output_item.added`. Type constant.ResponseOutputItemAdded `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Item resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a new output item is added.
func (ResponseOutputItemAddedEvent) RawJSON ¶
func (r ResponseOutputItemAddedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputItemAddedEvent) UnmarshalJSON ¶
func (r *ResponseOutputItemAddedEvent) UnmarshalJSON(data []byte) error
type ResponseOutputItemDoneEvent ¶
type ResponseOutputItemDoneEvent struct { // The output item that was marked done. Item ResponseOutputItemUnion `json:"item,required"` // The index of the output item that was marked done. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.output_item.done`. Type constant.ResponseOutputItemDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Item resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when an output item is marked done.
func (ResponseOutputItemDoneEvent) RawJSON ¶
func (r ResponseOutputItemDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputItemDoneEvent) UnmarshalJSON ¶
func (r *ResponseOutputItemDoneEvent) UnmarshalJSON(data []byte) error
type ResponseOutputItemUnion ¶
type ResponseOutputItemUnion struct { ID string `json:"id"` // This field is from variant [ResponseOutputMessage]. Content []ResponseOutputMessageContentUnion `json:"content"` // This field is from variant [ResponseOutputMessage]. Role constant.Assistant `json:"role"` Status string `json:"status"` // Any of "message", "file_search_call", "function_call", "web_search_call", // "computer_call", "reasoning". Type string `json:"type"` // This field is from variant [ResponseFileSearchToolCall]. Queries []string `json:"queries"` // This field is from variant [ResponseFileSearchToolCall]. Results []ResponseFileSearchToolCallResult `json:"results"` // This field is from variant [ResponseFunctionToolCall]. Arguments string `json:"arguments"` CallID string `json:"call_id"` // This field is from variant [ResponseFunctionToolCall]. Name string `json:"name"` // This field is from variant [ResponseComputerToolCall]. Action ResponseComputerToolCallActionUnion `json:"action"` // This field is from variant [ResponseComputerToolCall]. PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"` // This field is from variant [ResponseReasoningItem]. Summary []ResponseReasoningItemSummary `json:"summary"` JSON struct { ID resp.Field Content resp.Field Role resp.Field Status resp.Field Type resp.Field Queries resp.Field Results resp.Field Arguments resp.Field CallID resp.Field Name resp.Field Action resp.Field PendingSafetyChecks resp.Field Summary resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseOutputItemUnion contains all possible properties and values from ResponseOutputMessage, ResponseFileSearchToolCall, ResponseFunctionToolCall, ResponseFunctionWebSearch, ResponseComputerToolCall, ResponseReasoningItem.
Use the ResponseOutputItemUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseOutputItemUnion) AsAny ¶
func (u ResponseOutputItemUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseOutputItemUnion.AsAny().(type) { case ResponseOutputMessage: case ResponseFileSearchToolCall: case ResponseFunctionToolCall: case ResponseFunctionWebSearch: case ResponseComputerToolCall: case ResponseReasoningItem: default: fmt.Errorf("no variant present") }
func (ResponseOutputItemUnion) AsComputerCall ¶
func (u ResponseOutputItemUnion) AsComputerCall() (v ResponseComputerToolCall)
func (ResponseOutputItemUnion) AsFileSearchCall ¶
func (u ResponseOutputItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)
func (ResponseOutputItemUnion) AsFunctionCall ¶
func (u ResponseOutputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall)
func (ResponseOutputItemUnion) AsMessage ¶
func (u ResponseOutputItemUnion) AsMessage() (v ResponseOutputMessage)
func (ResponseOutputItemUnion) AsReasoning ¶
func (u ResponseOutputItemUnion) AsReasoning() (v ResponseReasoningItem)
func (ResponseOutputItemUnion) AsWebSearchCall ¶
func (u ResponseOutputItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)
func (ResponseOutputItemUnion) RawJSON ¶
func (u ResponseOutputItemUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputItemUnion) UnmarshalJSON ¶
func (r *ResponseOutputItemUnion) UnmarshalJSON(data []byte) error
type ResponseOutputMessage ¶
type ResponseOutputMessage struct { // The unique ID of the output message. ID string `json:"id,required"` // The content of the output message. Content []ResponseOutputMessageContentUnion `json:"content,required"` // The role of the output message. Always `assistant`. Role constant.Assistant `json:"role,required"` // The status of the message input. One of `in_progress`, `completed`, or // `incomplete`. Populated when input items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseOutputMessageStatus `json:"status,required"` // The type of the output message. Always `message`. Type constant.Message `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Content resp.Field Role resp.Field Status resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
An output message from the model.
func (ResponseOutputMessage) RawJSON ¶
func (r ResponseOutputMessage) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseOutputMessage) ToParam ¶
func (r ResponseOutputMessage) ToParam() ResponseOutputMessageParam
ToParam converts this ResponseOutputMessage to a ResponseOutputMessageParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseOutputMessageParam.IsOverridden()
func (*ResponseOutputMessage) UnmarshalJSON ¶
func (r *ResponseOutputMessage) UnmarshalJSON(data []byte) error
type ResponseOutputMessageContentUnion ¶
type ResponseOutputMessageContentUnion struct { // This field is from variant [ResponseOutputText]. Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"` // This field is from variant [ResponseOutputText]. Text string `json:"text"` // Any of "output_text", "refusal". Type string `json:"type"` // This field is from variant [ResponseOutputRefusal]. Refusal string `json:"refusal"` JSON struct { Annotations resp.Field Text resp.Field Type resp.Field Refusal resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseOutputMessageContentUnion contains all possible properties and values from ResponseOutputText, ResponseOutputRefusal.
Use the ResponseOutputMessageContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseOutputMessageContentUnion) AsAny ¶
func (u ResponseOutputMessageContentUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseOutputMessageContentUnion.AsAny().(type) { case ResponseOutputText: case ResponseOutputRefusal: default: fmt.Errorf("no variant present") }
func (ResponseOutputMessageContentUnion) AsOutputText ¶
func (u ResponseOutputMessageContentUnion) AsOutputText() (v ResponseOutputText)
func (ResponseOutputMessageContentUnion) AsRefusal ¶
func (u ResponseOutputMessageContentUnion) AsRefusal() (v ResponseOutputRefusal)
func (ResponseOutputMessageContentUnion) RawJSON ¶
func (u ResponseOutputMessageContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputMessageContentUnion) UnmarshalJSON ¶
func (r *ResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error
type ResponseOutputMessageContentUnionParam ¶
type ResponseOutputMessageContentUnionParam struct { OfOutputText *ResponseOutputTextParam `json:",omitzero,inline"` OfRefusal *ResponseOutputRefusalParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ResponseOutputMessageContentUnionParam) GetAnnotations ¶
func (u ResponseOutputMessageContentUnionParam) GetAnnotations() []ResponseOutputTextAnnotationUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputMessageContentUnionParam) GetRefusal ¶
func (u ResponseOutputMessageContentUnionParam) GetRefusal() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputMessageContentUnionParam) GetText ¶
func (u ResponseOutputMessageContentUnionParam) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputMessageContentUnionParam) GetType ¶
func (u ResponseOutputMessageContentUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputMessageContentUnionParam) IsPresent ¶
func (u ResponseOutputMessageContentUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputMessageContentUnionParam) MarshalJSON ¶
func (u ResponseOutputMessageContentUnionParam) MarshalJSON() ([]byte, error)
type ResponseOutputMessageParam ¶
type ResponseOutputMessageParam struct { // The unique ID of the output message. ID string `json:"id,required"` // The content of the output message. Content []ResponseOutputMessageContentUnionParam `json:"content,omitzero,required"` // The status of the message input. One of `in_progress`, `completed`, or // `incomplete`. Populated when input items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseOutputMessageStatus `json:"status,omitzero,required"` // The role of the output message. Always `assistant`. // // This field can be elided, and will marshal its zero value as "assistant". Role constant.Assistant `json:"role,required"` // The type of the output message. Always `message`. // // This field can be elided, and will marshal its zero value as "message". Type constant.Message `json:"type,required"` // contains filtered or unexported fields }
An output message from the model.
The properties ID, Content, Role, Status, Type are required.
func (ResponseOutputMessageParam) IsPresent ¶
func (f ResponseOutputMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputMessageParam) MarshalJSON ¶
func (r ResponseOutputMessageParam) MarshalJSON() (data []byte, err error)
type ResponseOutputMessageStatus ¶
type ResponseOutputMessageStatus string
The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.
const ( ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress" ResponseOutputMessageStatusCompleted ResponseOutputMessageStatus = "completed" ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete" )
type ResponseOutputRefusal ¶
type ResponseOutputRefusal struct { // The refusal explanationfrom the model. Refusal string `json:"refusal,required"` // The type of the refusal. Always `refusal`. Type constant.Refusal `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Refusal resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A refusal from the model.
func (ResponseOutputRefusal) RawJSON ¶
func (r ResponseOutputRefusal) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseOutputRefusal) ToParam ¶
func (r ResponseOutputRefusal) ToParam() ResponseOutputRefusalParam
ToParam converts this ResponseOutputRefusal to a ResponseOutputRefusalParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseOutputRefusalParam.IsOverridden()
func (*ResponseOutputRefusal) UnmarshalJSON ¶
func (r *ResponseOutputRefusal) UnmarshalJSON(data []byte) error
type ResponseOutputRefusalParam ¶
type ResponseOutputRefusalParam struct { // The refusal explanationfrom the model. Refusal string `json:"refusal,required"` // The type of the refusal. Always `refusal`. // // This field can be elided, and will marshal its zero value as "refusal". Type constant.Refusal `json:"type,required"` // contains filtered or unexported fields }
A refusal from the model.
The properties Refusal, Type are required.
func (ResponseOutputRefusalParam) IsPresent ¶
func (f ResponseOutputRefusalParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputRefusalParam) MarshalJSON ¶
func (r ResponseOutputRefusalParam) MarshalJSON() (data []byte, err error)
type ResponseOutputText ¶
type ResponseOutputText struct { // The annotations of the text output. Annotations []ResponseOutputTextAnnotationUnion `json:"annotations,required"` // The text output from the model. Text string `json:"text,required"` // The type of the output text. Always `output_text`. Type constant.OutputText `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Annotations resp.Field Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A text output from the model.
func (ResponseOutputText) RawJSON ¶
func (r ResponseOutputText) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseOutputText) ToParam ¶
func (r ResponseOutputText) ToParam() ResponseOutputTextParam
ToParam converts this ResponseOutputText to a ResponseOutputTextParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseOutputTextParam.IsOverridden()
func (*ResponseOutputText) UnmarshalJSON ¶
func (r *ResponseOutputText) UnmarshalJSON(data []byte) error
type ResponseOutputTextAnnotationFileCitation ¶
type ResponseOutputTextAnnotationFileCitation struct { // The ID of the file. FileID string `json:"file_id,required"` // The index of the file in the list of files. Index int64 `json:"index,required"` // The type of the file citation. Always `file_citation`. Type constant.FileCitation `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Index resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A citation to a file.
func (ResponseOutputTextAnnotationFileCitation) RawJSON ¶
func (r ResponseOutputTextAnnotationFileCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputTextAnnotationFileCitation) UnmarshalJSON ¶
func (r *ResponseOutputTextAnnotationFileCitation) UnmarshalJSON(data []byte) error
type ResponseOutputTextAnnotationFileCitationParam ¶
type ResponseOutputTextAnnotationFileCitationParam struct { // The ID of the file. FileID string `json:"file_id,required"` // The index of the file in the list of files. Index int64 `json:"index,required"` // The type of the file citation. Always `file_citation`. // // This field can be elided, and will marshal its zero value as "file_citation". Type constant.FileCitation `json:"type,required"` // contains filtered or unexported fields }
A citation to a file.
The properties FileID, Index, Type are required.
func (ResponseOutputTextAnnotationFileCitationParam) IsPresent ¶
func (f ResponseOutputTextAnnotationFileCitationParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputTextAnnotationFileCitationParam) MarshalJSON ¶
func (r ResponseOutputTextAnnotationFileCitationParam) MarshalJSON() (data []byte, err error)
type ResponseOutputTextAnnotationFilePath ¶
type ResponseOutputTextAnnotationFilePath struct { // The ID of the file. FileID string `json:"file_id,required"` // The index of the file in the list of files. Index int64 `json:"index,required"` // The type of the file path. Always `file_path`. Type constant.FilePath `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Index resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A path to a file.
func (ResponseOutputTextAnnotationFilePath) RawJSON ¶
func (r ResponseOutputTextAnnotationFilePath) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputTextAnnotationFilePath) UnmarshalJSON ¶
func (r *ResponseOutputTextAnnotationFilePath) UnmarshalJSON(data []byte) error
type ResponseOutputTextAnnotationFilePathParam ¶
type ResponseOutputTextAnnotationFilePathParam struct { // The ID of the file. FileID string `json:"file_id,required"` // The index of the file in the list of files. Index int64 `json:"index,required"` // The type of the file path. Always `file_path`. // // This field can be elided, and will marshal its zero value as "file_path". Type constant.FilePath `json:"type,required"` // contains filtered or unexported fields }
A path to a file.
The properties FileID, Index, Type are required.
func (ResponseOutputTextAnnotationFilePathParam) IsPresent ¶
func (f ResponseOutputTextAnnotationFilePathParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputTextAnnotationFilePathParam) MarshalJSON ¶
func (r ResponseOutputTextAnnotationFilePathParam) MarshalJSON() (data []byte, err error)
type ResponseOutputTextAnnotationURLCitation ¶
type ResponseOutputTextAnnotationURLCitation struct { // The index of the last character of the URL citation in the message. EndIndex int64 `json:"end_index,required"` // The index of the first character of the URL citation in the message. StartIndex int64 `json:"start_index,required"` // The title of the web resource. Title string `json:"title,required"` // The type of the URL citation. Always `url_citation`. Type constant.URLCitation `json:"type,required"` // The URL of the web resource. URL string `json:"url,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { EndIndex resp.Field StartIndex resp.Field Title resp.Field Type resp.Field URL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A citation for a web resource used to generate a model response.
func (ResponseOutputTextAnnotationURLCitation) RawJSON ¶
func (r ResponseOutputTextAnnotationURLCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputTextAnnotationURLCitation) UnmarshalJSON ¶
func (r *ResponseOutputTextAnnotationURLCitation) UnmarshalJSON(data []byte) error
type ResponseOutputTextAnnotationURLCitationParam ¶
type ResponseOutputTextAnnotationURLCitationParam struct { // The index of the last character of the URL citation in the message. EndIndex int64 `json:"end_index,required"` // The index of the first character of the URL citation in the message. StartIndex int64 `json:"start_index,required"` // The title of the web resource. Title string `json:"title,required"` // The URL of the web resource. URL string `json:"url,required"` // The type of the URL citation. Always `url_citation`. // // This field can be elided, and will marshal its zero value as "url_citation". Type constant.URLCitation `json:"type,required"` // contains filtered or unexported fields }
A citation for a web resource used to generate a model response.
The properties EndIndex, StartIndex, Title, Type, URL are required.
func (ResponseOutputTextAnnotationURLCitationParam) IsPresent ¶
func (f ResponseOutputTextAnnotationURLCitationParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputTextAnnotationURLCitationParam) MarshalJSON ¶
func (r ResponseOutputTextAnnotationURLCitationParam) MarshalJSON() (data []byte, err error)
type ResponseOutputTextAnnotationUnion ¶
type ResponseOutputTextAnnotationUnion struct { FileID string `json:"file_id"` Index int64 `json:"index"` // Any of "file_citation", "url_citation", "file_path". Type string `json:"type"` // This field is from variant [ResponseOutputTextAnnotationURLCitation]. EndIndex int64 `json:"end_index"` // This field is from variant [ResponseOutputTextAnnotationURLCitation]. StartIndex int64 `json:"start_index"` // This field is from variant [ResponseOutputTextAnnotationURLCitation]. Title string `json:"title"` // This field is from variant [ResponseOutputTextAnnotationURLCitation]. URL string `json:"url"` JSON struct { FileID resp.Field Index resp.Field Type resp.Field EndIndex resp.Field StartIndex resp.Field Title resp.Field URL resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseOutputTextAnnotationUnion contains all possible properties and values from ResponseOutputTextAnnotationFileCitation, ResponseOutputTextAnnotationURLCitation, ResponseOutputTextAnnotationFilePath.
Use the ResponseOutputTextAnnotationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseOutputTextAnnotationUnion) AsAny ¶
func (u ResponseOutputTextAnnotationUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseOutputTextAnnotationUnion.AsAny().(type) { case ResponseOutputTextAnnotationFileCitation: case ResponseOutputTextAnnotationURLCitation: case ResponseOutputTextAnnotationFilePath: default: fmt.Errorf("no variant present") }
func (ResponseOutputTextAnnotationUnion) AsFileCitation ¶
func (u ResponseOutputTextAnnotationUnion) AsFileCitation() (v ResponseOutputTextAnnotationFileCitation)
func (ResponseOutputTextAnnotationUnion) AsFilePath ¶
func (u ResponseOutputTextAnnotationUnion) AsFilePath() (v ResponseOutputTextAnnotationFilePath)
func (ResponseOutputTextAnnotationUnion) AsURLCitation ¶
func (u ResponseOutputTextAnnotationUnion) AsURLCitation() (v ResponseOutputTextAnnotationURLCitation)
func (ResponseOutputTextAnnotationUnion) RawJSON ¶
func (u ResponseOutputTextAnnotationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseOutputTextAnnotationUnion) UnmarshalJSON ¶
func (r *ResponseOutputTextAnnotationUnion) UnmarshalJSON(data []byte) error
type ResponseOutputTextAnnotationUnionParam ¶
type ResponseOutputTextAnnotationUnionParam struct { OfFileCitation *ResponseOutputTextAnnotationFileCitationParam `json:",omitzero,inline"` OfURLCitation *ResponseOutputTextAnnotationURLCitationParam `json:",omitzero,inline"` OfFilePath *ResponseOutputTextAnnotationFilePathParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ResponseOutputTextAnnotationUnionParam) GetEndIndex ¶
func (u ResponseOutputTextAnnotationUnionParam) GetEndIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) GetFileID ¶
func (u ResponseOutputTextAnnotationUnionParam) GetFileID() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) GetIndex ¶
func (u ResponseOutputTextAnnotationUnionParam) GetIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) GetStartIndex ¶
func (u ResponseOutputTextAnnotationUnionParam) GetStartIndex() *int64
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) GetTitle ¶
func (u ResponseOutputTextAnnotationUnionParam) GetTitle() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) GetType ¶
func (u ResponseOutputTextAnnotationUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) GetURL ¶
func (u ResponseOutputTextAnnotationUnionParam) GetURL() *string
Returns a pointer to the underlying variant's property, if present.
func (ResponseOutputTextAnnotationUnionParam) IsPresent ¶
func (u ResponseOutputTextAnnotationUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputTextAnnotationUnionParam) MarshalJSON ¶
func (u ResponseOutputTextAnnotationUnionParam) MarshalJSON() ([]byte, error)
type ResponseOutputTextParam ¶
type ResponseOutputTextParam struct { // The annotations of the text output. Annotations []ResponseOutputTextAnnotationUnionParam `json:"annotations,omitzero,required"` // The text output from the model. Text string `json:"text,required"` // The type of the output text. Always `output_text`. // // This field can be elided, and will marshal its zero value as "output_text". Type constant.OutputText `json:"type,required"` // contains filtered or unexported fields }
A text output from the model.
The properties Annotations, Text, Type are required.
func (ResponseOutputTextParam) IsPresent ¶
func (f ResponseOutputTextParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseOutputTextParam) MarshalJSON ¶
func (r ResponseOutputTextParam) MarshalJSON() (data []byte, err error)
type ResponseReasoningItem ¶
type ResponseReasoningItem struct { // The unique identifier of the reasoning content. ID string `json:"id,required"` // Reasoning text contents. Summary []ResponseReasoningItemSummary `json:"summary,required"` // The type of the object. Always `reasoning`. Type constant.Reasoning `json:"type,required"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseReasoningItemStatus `json:"status"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Summary resp.Field Type resp.Field Status resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A description of the chain of thought used by a reasoning model while generating a response.
func (ResponseReasoningItem) RawJSON ¶
func (r ResponseReasoningItem) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseReasoningItem) ToParam ¶
func (r ResponseReasoningItem) ToParam() ResponseReasoningItemParam
ToParam converts this ResponseReasoningItem to a ResponseReasoningItemParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseReasoningItemParam.IsOverridden()
func (*ResponseReasoningItem) UnmarshalJSON ¶
func (r *ResponseReasoningItem) UnmarshalJSON(data []byte) error
type ResponseReasoningItemParam ¶
type ResponseReasoningItemParam struct { // The unique identifier of the reasoning content. ID string `json:"id,required"` // Reasoning text contents. Summary []ResponseReasoningItemSummaryParam `json:"summary,omitzero,required"` // The status of the item. One of `in_progress`, `completed`, or `incomplete`. // Populated when items are returned via API. // // Any of "in_progress", "completed", "incomplete". Status ResponseReasoningItemStatus `json:"status,omitzero"` // The type of the object. Always `reasoning`. // // This field can be elided, and will marshal its zero value as "reasoning". Type constant.Reasoning `json:"type,required"` // contains filtered or unexported fields }
A description of the chain of thought used by a reasoning model while generating a response.
The properties ID, Summary, Type are required.
func (ResponseReasoningItemParam) IsPresent ¶
func (f ResponseReasoningItemParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseReasoningItemParam) MarshalJSON ¶
func (r ResponseReasoningItemParam) MarshalJSON() (data []byte, err error)
type ResponseReasoningItemStatus ¶
type ResponseReasoningItemStatus string
The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
const ( ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress" ResponseReasoningItemStatusCompleted ResponseReasoningItemStatus = "completed" ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete" )
type ResponseReasoningItemSummary ¶
type ResponseReasoningItemSummary struct { // A short summary of the reasoning used by the model when generating the response. Text string `json:"text,required"` // The type of the object. Always `summary_text`. Type constant.SummaryText `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ResponseReasoningItemSummary) RawJSON ¶
func (r ResponseReasoningItemSummary) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseReasoningItemSummary) UnmarshalJSON ¶
func (r *ResponseReasoningItemSummary) UnmarshalJSON(data []byte) error
type ResponseReasoningItemSummaryParam ¶
type ResponseReasoningItemSummaryParam struct { // A short summary of the reasoning used by the model when generating the response. Text string `json:"text,required"` // The type of the object. Always `summary_text`. // // This field can be elided, and will marshal its zero value as "summary_text". Type constant.SummaryText `json:"type,required"` // contains filtered or unexported fields }
The properties Text, Type are required.
func (ResponseReasoningItemSummaryParam) IsPresent ¶
func (f ResponseReasoningItemSummaryParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseReasoningItemSummaryParam) MarshalJSON ¶
func (r ResponseReasoningItemSummaryParam) MarshalJSON() (data []byte, err error)
type ResponseRefusalDeltaEvent ¶
type ResponseRefusalDeltaEvent struct { // The index of the content part that the refusal text is added to. ContentIndex int64 `json:"content_index,required"` // The refusal text that is added. Delta string `json:"delta,required"` // The ID of the output item that the refusal text is added to. ItemID string `json:"item_id,required"` // The index of the output item that the refusal text is added to. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.refusal.delta`. Type constant.ResponseRefusalDelta `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ContentIndex resp.Field Delta resp.Field ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when there is a partial refusal text.
func (ResponseRefusalDeltaEvent) RawJSON ¶
func (r ResponseRefusalDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseRefusalDeltaEvent) UnmarshalJSON ¶
func (r *ResponseRefusalDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseRefusalDoneEvent ¶
type ResponseRefusalDoneEvent struct { // The index of the content part that the refusal text is finalized. ContentIndex int64 `json:"content_index,required"` // The ID of the output item that the refusal text is finalized. ItemID string `json:"item_id,required"` // The index of the output item that the refusal text is finalized. OutputIndex int64 `json:"output_index,required"` // The refusal text that is finalized. Refusal string `json:"refusal,required"` // The type of the event. Always `response.refusal.done`. Type constant.ResponseRefusalDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ContentIndex resp.Field ItemID resp.Field OutputIndex resp.Field Refusal resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when refusal text is finalized.
func (ResponseRefusalDoneEvent) RawJSON ¶
func (r ResponseRefusalDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseRefusalDoneEvent) UnmarshalJSON ¶
func (r *ResponseRefusalDoneEvent) UnmarshalJSON(data []byte) error
type ResponseService ¶
type ResponseService struct { Options []option.RequestOption InputItems InputItemService }
ResponseService contains methods and other services that help with interacting with the openai API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewResponseService method instead.
func NewResponseService ¶
func NewResponseService(opts ...option.RequestOption) (r ResponseService)
NewResponseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ResponseService) Delete ¶
func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (err error)
Deletes a model response with the given ID.
func (*ResponseService) Get ¶
func (r *ResponseService) Get(ctx context.Context, responseID string, query ResponseGetParams, opts ...option.RequestOption) (res *Response, err error)
Retrieves a model response with the given ID.
func (*ResponseService) New ¶
func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *Response, err error)
Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or image(https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text) or [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call your own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in [tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search) or [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data as input for the model's response.
func (*ResponseService) NewStreaming ¶
func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseStreamEventUnion])
Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or image(https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text) or [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call your own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in [tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search) or [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data as input for the model's response.
type ResponseStatus ¶
type ResponseStatus string
The status of the response generation. One of `completed`, `failed`, `in_progress`, or `incomplete`.
const ( ResponseStatusCompleted ResponseStatus = "completed" ResponseStatusFailed ResponseStatus = "failed" ResponseStatusInProgress ResponseStatus = "in_progress" ResponseStatusIncomplete ResponseStatus = "incomplete" )
type ResponseStreamEventUnion ¶
type ResponseStreamEventUnion struct { Delta string `json:"delta"` // Any of "response.audio.delta", "response.audio.done", // "response.audio.transcript.delta", "response.audio.transcript.done", // "response.code_interpreter_call.code.delta", // "response.code_interpreter_call.code.done", // "response.code_interpreter_call.completed", // "response.code_interpreter_call.in_progress", // "response.code_interpreter_call.interpreting", "response.completed", // "response.content_part.added", "response.content_part.done", "response.created", // "error", "response.file_search_call.completed", // "response.file_search_call.in_progress", "response.file_search_call.searching", // "response.function_call_arguments.delta", // "response.function_call_arguments.done", "response.in_progress", // "response.failed", "response.incomplete", "response.output_item.added", // "response.output_item.done", "response.refusal.delta", "response.refusal.done", // "response.output_text.annotation.added", "response.output_text.delta", // "response.output_text.done", "response.web_search_call.completed", // "response.web_search_call.in_progress", "response.web_search_call.searching". Type string `json:"type"` OutputIndex int64 `json:"output_index"` Code string `json:"code"` // This field is from variant [ResponseCodeInterpreterCallCompletedEvent]. CodeInterpreterCall ResponseCodeInterpreterToolCall `json:"code_interpreter_call"` // This field is from variant [ResponseCompletedEvent]. Response Response `json:"response"` ContentIndex int64 `json:"content_index"` ItemID string `json:"item_id"` // This field is a union of [ResponseContentPartAddedEventPartUnion], // [ResponseContentPartDoneEventPartUnion] Part ResponseStreamEventUnionPart `json:"part"` // This field is from variant [ResponseErrorEvent]. Message string `json:"message"` // This field is from variant [ResponseErrorEvent]. Param string `json:"param"` // This field is from variant [ResponseFunctionCallArgumentsDoneEvent]. Arguments string `json:"arguments"` // This field is from variant [ResponseOutputItemAddedEvent]. Item ResponseOutputItemUnion `json:"item"` // This field is from variant [ResponseRefusalDoneEvent]. Refusal string `json:"refusal"` // This field is from variant [ResponseTextAnnotationDeltaEvent]. Annotation ResponseTextAnnotationDeltaEventAnnotationUnion `json:"annotation"` // This field is from variant [ResponseTextAnnotationDeltaEvent]. AnnotationIndex int64 `json:"annotation_index"` // This field is from variant [ResponseTextDoneEvent]. Text string `json:"text"` JSON struct { Delta resp.Field Type resp.Field OutputIndex resp.Field Code resp.Field CodeInterpreterCall resp.Field Response resp.Field ContentIndex resp.Field ItemID resp.Field Part resp.Field Message resp.Field Param resp.Field Arguments resp.Field Item resp.Field Refusal resp.Field Annotation resp.Field AnnotationIndex resp.Field Text resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseStreamEventUnion contains all possible properties and values from ResponseAudioDeltaEvent, ResponseAudioDoneEvent, ResponseAudioTranscriptDeltaEvent, ResponseAudioTranscriptDoneEvent, ResponseCodeInterpreterCallCodeDeltaEvent, ResponseCodeInterpreterCallCodeDoneEvent, ResponseCodeInterpreterCallCompletedEvent, ResponseCodeInterpreterCallInProgressEvent, ResponseCodeInterpreterCallInterpretingEvent, ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseContentPartDoneEvent, ResponseCreatedEvent, ResponseErrorEvent, ResponseFileSearchCallCompletedEvent, ResponseFileSearchCallInProgressEvent, ResponseFileSearchCallSearchingEvent, ResponseFunctionCallArgumentsDeltaEvent, ResponseFunctionCallArgumentsDoneEvent, ResponseInProgressEvent, ResponseFailedEvent, ResponseIncompleteEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseRefusalDeltaEvent, ResponseRefusalDoneEvent, ResponseTextAnnotationDeltaEvent, ResponseTextDeltaEvent, ResponseTextDoneEvent, ResponseWebSearchCallCompletedEvent, ResponseWebSearchCallInProgressEvent, ResponseWebSearchCallSearchingEvent.
Use the ResponseStreamEventUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseStreamEventUnion) AsAny ¶
func (u ResponseStreamEventUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseStreamEventUnion.AsAny().(type) { case ResponseAudioDeltaEvent: case ResponseAudioDoneEvent: case ResponseAudioTranscriptDeltaEvent: case ResponseAudioTranscriptDoneEvent: case ResponseCodeInterpreterCallCodeDeltaEvent: case ResponseCodeInterpreterCallCodeDoneEvent: case ResponseCodeInterpreterCallCompletedEvent: case ResponseCodeInterpreterCallInProgressEvent: case ResponseCodeInterpreterCallInterpretingEvent: case ResponseCompletedEvent: case ResponseContentPartAddedEvent: case ResponseContentPartDoneEvent: case ResponseCreatedEvent: case ResponseErrorEvent: case ResponseFileSearchCallCompletedEvent: case ResponseFileSearchCallInProgressEvent: case ResponseFileSearchCallSearchingEvent: case ResponseFunctionCallArgumentsDeltaEvent: case ResponseFunctionCallArgumentsDoneEvent: case ResponseInProgressEvent: case ResponseFailedEvent: case ResponseIncompleteEvent: case ResponseOutputItemAddedEvent: case ResponseOutputItemDoneEvent: case ResponseRefusalDeltaEvent: case ResponseRefusalDoneEvent: case ResponseTextAnnotationDeltaEvent: case ResponseTextDeltaEvent: case ResponseTextDoneEvent: case ResponseWebSearchCallCompletedEvent: case ResponseWebSearchCallInProgressEvent: case ResponseWebSearchCallSearchingEvent: default: fmt.Errorf("no variant present") }
func (ResponseStreamEventUnion) AsError ¶
func (u ResponseStreamEventUnion) AsError() (v ResponseErrorEvent)
func (ResponseStreamEventUnion) AsResponseAudioDelta ¶
func (u ResponseStreamEventUnion) AsResponseAudioDelta() (v ResponseAudioDeltaEvent)
func (ResponseStreamEventUnion) AsResponseAudioDone ¶
func (u ResponseStreamEventUnion) AsResponseAudioDone() (v ResponseAudioDoneEvent)
func (ResponseStreamEventUnion) AsResponseAudioTranscriptDelta ¶
func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDelta() (v ResponseAudioTranscriptDeltaEvent)
func (ResponseStreamEventUnion) AsResponseAudioTranscriptDone ¶
func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDone() (v ResponseAudioTranscriptDoneEvent)
func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta ¶
func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta() (v ResponseCodeInterpreterCallCodeDeltaEvent)
func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone ¶
func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone() (v ResponseCodeInterpreterCallCodeDoneEvent)
func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted ¶
func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted() (v ResponseCodeInterpreterCallCompletedEvent)
func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress ¶
func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress() (v ResponseCodeInterpreterCallInProgressEvent)
func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting ¶
func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting() (v ResponseCodeInterpreterCallInterpretingEvent)
func (ResponseStreamEventUnion) AsResponseCompleted ¶
func (u ResponseStreamEventUnion) AsResponseCompleted() (v ResponseCompletedEvent)
func (ResponseStreamEventUnion) AsResponseContentPartAdded ¶
func (u ResponseStreamEventUnion) AsResponseContentPartAdded() (v ResponseContentPartAddedEvent)
func (ResponseStreamEventUnion) AsResponseContentPartDone ¶
func (u ResponseStreamEventUnion) AsResponseContentPartDone() (v ResponseContentPartDoneEvent)
func (ResponseStreamEventUnion) AsResponseCreated ¶
func (u ResponseStreamEventUnion) AsResponseCreated() (v ResponseCreatedEvent)
func (ResponseStreamEventUnion) AsResponseFailed ¶
func (u ResponseStreamEventUnion) AsResponseFailed() (v ResponseFailedEvent)
func (ResponseStreamEventUnion) AsResponseFileSearchCallCompleted ¶
func (u ResponseStreamEventUnion) AsResponseFileSearchCallCompleted() (v ResponseFileSearchCallCompletedEvent)
func (ResponseStreamEventUnion) AsResponseFileSearchCallInProgress ¶
func (u ResponseStreamEventUnion) AsResponseFileSearchCallInProgress() (v ResponseFileSearchCallInProgressEvent)
func (ResponseStreamEventUnion) AsResponseFileSearchCallSearching ¶
func (u ResponseStreamEventUnion) AsResponseFileSearchCallSearching() (v ResponseFileSearchCallSearchingEvent)
func (ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta ¶
func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta() (v ResponseFunctionCallArgumentsDeltaEvent)
func (ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone ¶
func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone() (v ResponseFunctionCallArgumentsDoneEvent)
func (ResponseStreamEventUnion) AsResponseInProgress ¶
func (u ResponseStreamEventUnion) AsResponseInProgress() (v ResponseInProgressEvent)
func (ResponseStreamEventUnion) AsResponseIncomplete ¶
func (u ResponseStreamEventUnion) AsResponseIncomplete() (v ResponseIncompleteEvent)
func (ResponseStreamEventUnion) AsResponseOutputItemAdded ¶
func (u ResponseStreamEventUnion) AsResponseOutputItemAdded() (v ResponseOutputItemAddedEvent)
func (ResponseStreamEventUnion) AsResponseOutputItemDone ¶
func (u ResponseStreamEventUnion) AsResponseOutputItemDone() (v ResponseOutputItemDoneEvent)
func (ResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded ¶
func (u ResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded() (v ResponseTextAnnotationDeltaEvent)
func (ResponseStreamEventUnion) AsResponseOutputTextDelta ¶
func (u ResponseStreamEventUnion) AsResponseOutputTextDelta() (v ResponseTextDeltaEvent)
func (ResponseStreamEventUnion) AsResponseOutputTextDone ¶
func (u ResponseStreamEventUnion) AsResponseOutputTextDone() (v ResponseTextDoneEvent)
func (ResponseStreamEventUnion) AsResponseRefusalDelta ¶
func (u ResponseStreamEventUnion) AsResponseRefusalDelta() (v ResponseRefusalDeltaEvent)
func (ResponseStreamEventUnion) AsResponseRefusalDone ¶
func (u ResponseStreamEventUnion) AsResponseRefusalDone() (v ResponseRefusalDoneEvent)
func (ResponseStreamEventUnion) AsResponseWebSearchCallCompleted ¶
func (u ResponseStreamEventUnion) AsResponseWebSearchCallCompleted() (v ResponseWebSearchCallCompletedEvent)
func (ResponseStreamEventUnion) AsResponseWebSearchCallInProgress ¶
func (u ResponseStreamEventUnion) AsResponseWebSearchCallInProgress() (v ResponseWebSearchCallInProgressEvent)
func (ResponseStreamEventUnion) AsResponseWebSearchCallSearching ¶
func (u ResponseStreamEventUnion) AsResponseWebSearchCallSearching() (v ResponseWebSearchCallSearchingEvent)
func (ResponseStreamEventUnion) RawJSON ¶
func (u ResponseStreamEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseStreamEventUnion) UnmarshalJSON ¶
func (r *ResponseStreamEventUnion) UnmarshalJSON(data []byte) error
type ResponseStreamEventUnionPart ¶
type ResponseStreamEventUnionPart struct { // This field is from variant [ResponseContentPartAddedEventPartUnion], // [ResponseContentPartDoneEventPartUnion]. Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"` // This field is from variant [ResponseContentPartAddedEventPartUnion], // [ResponseContentPartDoneEventPartUnion]. Text string `json:"text"` Type string `json:"type"` // This field is from variant [ResponseContentPartAddedEventPartUnion], // [ResponseContentPartDoneEventPartUnion]. Refusal string `json:"refusal"` JSON struct { Annotations resp.Field Text resp.Field Type resp.Field Refusal resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseStreamEventUnionPart is an implicit subunion of ResponseStreamEventUnion. ResponseStreamEventUnionPart provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ResponseStreamEventUnion.
func (*ResponseStreamEventUnionPart) UnmarshalJSON ¶
func (r *ResponseStreamEventUnionPart) UnmarshalJSON(data []byte) error
type ResponseTextAnnotationDeltaEvent ¶
type ResponseTextAnnotationDeltaEvent struct { // A citation to a file. Annotation ResponseTextAnnotationDeltaEventAnnotationUnion `json:"annotation,required"` // The index of the annotation that was added. AnnotationIndex int64 `json:"annotation_index,required"` // The index of the content part that the text annotation was added to. ContentIndex int64 `json:"content_index,required"` // The ID of the output item that the text annotation was added to. ItemID string `json:"item_id,required"` // The index of the output item that the text annotation was added to. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.output_text.annotation.added`. Type constant.ResponseOutputTextAnnotationAdded `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Annotation resp.Field AnnotationIndex resp.Field ContentIndex resp.Field ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a text annotation is added.
func (ResponseTextAnnotationDeltaEvent) RawJSON ¶
func (r ResponseTextAnnotationDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextAnnotationDeltaEvent) UnmarshalJSON ¶
func (r *ResponseTextAnnotationDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseTextAnnotationDeltaEventAnnotationFileCitation ¶
type ResponseTextAnnotationDeltaEventAnnotationFileCitation struct { // The ID of the file. FileID string `json:"file_id,required"` // The index of the file in the list of files. Index int64 `json:"index,required"` // The type of the file citation. Always `file_citation`. Type constant.FileCitation `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Index resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A citation to a file.
func (ResponseTextAnnotationDeltaEventAnnotationFileCitation) RawJSON ¶
func (r ResponseTextAnnotationDeltaEventAnnotationFileCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextAnnotationDeltaEventAnnotationFileCitation) UnmarshalJSON ¶
func (r *ResponseTextAnnotationDeltaEventAnnotationFileCitation) UnmarshalJSON(data []byte) error
type ResponseTextAnnotationDeltaEventAnnotationFilePath ¶
type ResponseTextAnnotationDeltaEventAnnotationFilePath struct { // The ID of the file. FileID string `json:"file_id,required"` // The index of the file in the list of files. Index int64 `json:"index,required"` // The type of the file path. Always `file_path`. Type constant.FilePath `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Index resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A path to a file.
func (ResponseTextAnnotationDeltaEventAnnotationFilePath) RawJSON ¶
func (r ResponseTextAnnotationDeltaEventAnnotationFilePath) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextAnnotationDeltaEventAnnotationFilePath) UnmarshalJSON ¶
func (r *ResponseTextAnnotationDeltaEventAnnotationFilePath) UnmarshalJSON(data []byte) error
type ResponseTextAnnotationDeltaEventAnnotationURLCitation ¶
type ResponseTextAnnotationDeltaEventAnnotationURLCitation struct { // The index of the last character of the URL citation in the message. EndIndex int64 `json:"end_index,required"` // The index of the first character of the URL citation in the message. StartIndex int64 `json:"start_index,required"` // The title of the web resource. Title string `json:"title,required"` // The type of the URL citation. Always `url_citation`. Type constant.URLCitation `json:"type,required"` // The URL of the web resource. URL string `json:"url,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { EndIndex resp.Field StartIndex resp.Field Title resp.Field Type resp.Field URL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A citation for a web resource used to generate a model response.
func (ResponseTextAnnotationDeltaEventAnnotationURLCitation) RawJSON ¶
func (r ResponseTextAnnotationDeltaEventAnnotationURLCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextAnnotationDeltaEventAnnotationURLCitation) UnmarshalJSON ¶
func (r *ResponseTextAnnotationDeltaEventAnnotationURLCitation) UnmarshalJSON(data []byte) error
type ResponseTextAnnotationDeltaEventAnnotationUnion ¶
type ResponseTextAnnotationDeltaEventAnnotationUnion struct { FileID string `json:"file_id"` Index int64 `json:"index"` // Any of "file_citation", "url_citation", "file_path". Type string `json:"type"` // This field is from variant // [ResponseTextAnnotationDeltaEventAnnotationURLCitation]. EndIndex int64 `json:"end_index"` // This field is from variant // [ResponseTextAnnotationDeltaEventAnnotationURLCitation]. StartIndex int64 `json:"start_index"` // This field is from variant // [ResponseTextAnnotationDeltaEventAnnotationURLCitation]. Title string `json:"title"` // This field is from variant // [ResponseTextAnnotationDeltaEventAnnotationURLCitation]. URL string `json:"url"` JSON struct { FileID resp.Field Index resp.Field Type resp.Field EndIndex resp.Field StartIndex resp.Field Title resp.Field URL resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseTextAnnotationDeltaEventAnnotationUnion contains all possible properties and values from ResponseTextAnnotationDeltaEventAnnotationFileCitation, ResponseTextAnnotationDeltaEventAnnotationURLCitation, ResponseTextAnnotationDeltaEventAnnotationFilePath.
Use the ResponseTextAnnotationDeltaEventAnnotationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ResponseTextAnnotationDeltaEventAnnotationUnion) AsAny ¶
func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsAny() any
Use the following switch statement to find the correct variant
switch variant := ResponseTextAnnotationDeltaEventAnnotationUnion.AsAny().(type) { case ResponseTextAnnotationDeltaEventAnnotationFileCitation: case ResponseTextAnnotationDeltaEventAnnotationURLCitation: case ResponseTextAnnotationDeltaEventAnnotationFilePath: default: fmt.Errorf("no variant present") }
func (ResponseTextAnnotationDeltaEventAnnotationUnion) AsFileCitation ¶
func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsFileCitation() (v ResponseTextAnnotationDeltaEventAnnotationFileCitation)
func (ResponseTextAnnotationDeltaEventAnnotationUnion) AsFilePath ¶
func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsFilePath() (v ResponseTextAnnotationDeltaEventAnnotationFilePath)
func (ResponseTextAnnotationDeltaEventAnnotationUnion) AsURLCitation ¶
func (u ResponseTextAnnotationDeltaEventAnnotationUnion) AsURLCitation() (v ResponseTextAnnotationDeltaEventAnnotationURLCitation)
func (ResponseTextAnnotationDeltaEventAnnotationUnion) RawJSON ¶
func (u ResponseTextAnnotationDeltaEventAnnotationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextAnnotationDeltaEventAnnotationUnion) UnmarshalJSON ¶
func (r *ResponseTextAnnotationDeltaEventAnnotationUnion) UnmarshalJSON(data []byte) error
type ResponseTextConfig ¶
type ResponseTextConfig struct { // An object specifying the format that the model must output. // // Configuring `{ "type": "json_schema" }` enables Structured Outputs, which // ensures the model will match your supplied JSON schema. Learn more in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // The default format is `{ "type": "text" }` with no additional options. // // **Not recommended for gpt-4o and newer models:** // // Setting to `{ "type": "json_object" }` enables the older JSON mode, which // ensures the message the model generates is valid JSON. Using `json_schema` is // preferred for models that support it. Format ResponseFormatTextConfigUnion `json:"format"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Format resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
func (ResponseTextConfig) RawJSON ¶
func (r ResponseTextConfig) RawJSON() string
Returns the unmodified JSON received from the API
func (ResponseTextConfig) ToParam ¶
func (r ResponseTextConfig) ToParam() ResponseTextConfigParam
ToParam converts this ResponseTextConfig to a ResponseTextConfigParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseTextConfigParam.IsOverridden()
func (*ResponseTextConfig) UnmarshalJSON ¶
func (r *ResponseTextConfig) UnmarshalJSON(data []byte) error
type ResponseTextConfigParam ¶
type ResponseTextConfigParam struct { // An object specifying the format that the model must output. // // Configuring `{ "type": "json_schema" }` enables Structured Outputs, which // ensures the model will match your supplied JSON schema. Learn more in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // The default format is `{ "type": "text" }` with no additional options. // // **Not recommended for gpt-4o and newer models:** // // Setting to `{ "type": "json_object" }` enables the older JSON mode, which // ensures the message the model generates is valid JSON. Using `json_schema` is // preferred for models that support it. Format ResponseFormatTextConfigUnionParam `json:"format,omitzero"` // contains filtered or unexported fields }
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
func (ResponseTextConfigParam) IsPresent ¶
func (f ResponseTextConfigParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ResponseTextConfigParam) MarshalJSON ¶
func (r ResponseTextConfigParam) MarshalJSON() (data []byte, err error)
type ResponseTextDeltaEvent ¶
type ResponseTextDeltaEvent struct { // The index of the content part that the text delta was added to. ContentIndex int64 `json:"content_index,required"` // The text delta that was added. Delta string `json:"delta,required"` // The ID of the output item that the text delta was added to. ItemID string `json:"item_id,required"` // The index of the output item that the text delta was added to. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.output_text.delta`. Type constant.ResponseOutputTextDelta `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ContentIndex resp.Field Delta resp.Field ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when there is an additional text delta.
func (ResponseTextDeltaEvent) RawJSON ¶
func (r ResponseTextDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextDeltaEvent) UnmarshalJSON ¶
func (r *ResponseTextDeltaEvent) UnmarshalJSON(data []byte) error
type ResponseTextDoneEvent ¶
type ResponseTextDoneEvent struct { // The index of the content part that the text content is finalized. ContentIndex int64 `json:"content_index,required"` // The ID of the output item that the text content is finalized. ItemID string `json:"item_id,required"` // The index of the output item that the text content is finalized. OutputIndex int64 `json:"output_index,required"` // The text content that is finalized. Text string `json:"text,required"` // The type of the event. Always `response.output_text.done`. Type constant.ResponseOutputTextDone `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ContentIndex resp.Field ItemID resp.Field OutputIndex resp.Field Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when text content is finalized.
func (ResponseTextDoneEvent) RawJSON ¶
func (r ResponseTextDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseTextDoneEvent) UnmarshalJSON ¶
func (r *ResponseTextDoneEvent) UnmarshalJSON(data []byte) error
type ResponseToolChoiceUnion ¶
type ResponseToolChoiceUnion struct { // This field will be present if the value is a [ToolChoiceOptions] instead of an // object. OfToolChoiceMode ToolChoiceOptions `json:",inline"` Type string `json:"type"` // This field is from variant [ToolChoiceFunction]. Name string `json:"name"` JSON struct { OfToolChoiceMode resp.Field Type resp.Field Name resp.Field // contains filtered or unexported fields } `json:"-"` }
ResponseToolChoiceUnion contains all possible properties and values from ToolChoiceOptions, ToolChoiceTypes, ToolChoiceFunction.
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfToolChoiceMode]
func (ResponseToolChoiceUnion) AsFunctionTool ¶
func (u ResponseToolChoiceUnion) AsFunctionTool() (v ToolChoiceFunction)
func (ResponseToolChoiceUnion) AsHostedTool ¶
func (u ResponseToolChoiceUnion) AsHostedTool() (v ToolChoiceTypes)
func (ResponseToolChoiceUnion) AsToolChoiceMode ¶
func (u ResponseToolChoiceUnion) AsToolChoiceMode() (v ToolChoiceOptions)
func (ResponseToolChoiceUnion) RawJSON ¶
func (u ResponseToolChoiceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseToolChoiceUnion) UnmarshalJSON ¶
func (r *ResponseToolChoiceUnion) UnmarshalJSON(data []byte) error
type ResponseTruncation ¶
type ResponseTruncation string
The truncation strategy to use for the model response.
- `auto`: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.
- `disabled` (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
const ( ResponseTruncationAuto ResponseTruncation = "auto" ResponseTruncationDisabled ResponseTruncation = "disabled" )
type ResponseUsage ¶
type ResponseUsage struct { // The number of input tokens. InputTokens int64 `json:"input_tokens,required"` // A detailed breakdown of the input tokens. InputTokensDetails ResponseUsageInputTokensDetails `json:"input_tokens_details,required"` // The number of output tokens. OutputTokens int64 `json:"output_tokens,required"` // A detailed breakdown of the output tokens. OutputTokensDetails ResponseUsageOutputTokensDetails `json:"output_tokens_details,required"` // The total number of tokens used. TotalTokens int64 `json:"total_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { InputTokens resp.Field InputTokensDetails resp.Field OutputTokens resp.Field OutputTokensDetails resp.Field TotalTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.
func (ResponseUsage) RawJSON ¶
func (r ResponseUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseUsage) UnmarshalJSON ¶
func (r *ResponseUsage) UnmarshalJSON(data []byte) error
type ResponseUsageInputTokensDetails ¶
type ResponseUsageInputTokensDetails struct { // The number of tokens that were retrieved from the cache. // [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching). CachedTokens int64 `json:"cached_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CachedTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A detailed breakdown of the input tokens.
func (ResponseUsageInputTokensDetails) RawJSON ¶
func (r ResponseUsageInputTokensDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseUsageInputTokensDetails) UnmarshalJSON ¶
func (r *ResponseUsageInputTokensDetails) UnmarshalJSON(data []byte) error
type ResponseUsageOutputTokensDetails ¶
type ResponseUsageOutputTokensDetails struct { // The number of reasoning tokens. ReasoningTokens int64 `json:"reasoning_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ReasoningTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A detailed breakdown of the output tokens.
func (ResponseUsageOutputTokensDetails) RawJSON ¶
func (r ResponseUsageOutputTokensDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseUsageOutputTokensDetails) UnmarshalJSON ¶
func (r *ResponseUsageOutputTokensDetails) UnmarshalJSON(data []byte) error
type ResponseWebSearchCallCompletedEvent ¶
type ResponseWebSearchCallCompletedEvent struct { // Unique ID for the output item associated with the web search call. ItemID string `json:"item_id,required"` // The index of the output item that the web search call is associated with. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.web_search_call.completed`. Type constant.ResponseWebSearchCallCompleted `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a web search call is completed.
func (ResponseWebSearchCallCompletedEvent) RawJSON ¶
func (r ResponseWebSearchCallCompletedEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseWebSearchCallCompletedEvent) UnmarshalJSON ¶
func (r *ResponseWebSearchCallCompletedEvent) UnmarshalJSON(data []byte) error
type ResponseWebSearchCallInProgressEvent ¶
type ResponseWebSearchCallInProgressEvent struct { // Unique ID for the output item associated with the web search call. ItemID string `json:"item_id,required"` // The index of the output item that the web search call is associated with. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.web_search_call.in_progress`. Type constant.ResponseWebSearchCallInProgress `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a web search call is initiated.
func (ResponseWebSearchCallInProgressEvent) RawJSON ¶
func (r ResponseWebSearchCallInProgressEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseWebSearchCallInProgressEvent) UnmarshalJSON ¶
func (r *ResponseWebSearchCallInProgressEvent) UnmarshalJSON(data []byte) error
type ResponseWebSearchCallSearchingEvent ¶
type ResponseWebSearchCallSearchingEvent struct { // Unique ID for the output item associated with the web search call. ItemID string `json:"item_id,required"` // The index of the output item that the web search call is associated with. OutputIndex int64 `json:"output_index,required"` // The type of the event. Always `response.web_search_call.searching`. Type constant.ResponseWebSearchCallSearching `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ItemID resp.Field OutputIndex resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when a web search call is executing.
func (ResponseWebSearchCallSearchingEvent) RawJSON ¶
func (r ResponseWebSearchCallSearchingEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ResponseWebSearchCallSearchingEvent) UnmarshalJSON ¶
func (r *ResponseWebSearchCallSearchingEvent) UnmarshalJSON(data []byte) error
type ResponsesModel ¶
type ResponsesModel = shared.ResponsesModel
This is an alias to an internal type.
type ToolChoiceFunction ¶
type ToolChoiceFunction struct { // The name of the function to call. Name string `json:"name,required"` // For function calling, the type is always `function`. Type constant.Function `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Name resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Use this option to force the model to call a specific function.
func (ToolChoiceFunction) RawJSON ¶
func (r ToolChoiceFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (ToolChoiceFunction) ToParam ¶
func (r ToolChoiceFunction) ToParam() ToolChoiceFunctionParam
ToParam converts this ToolChoiceFunction to a ToolChoiceFunctionParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolChoiceFunctionParam.IsOverridden()
func (*ToolChoiceFunction) UnmarshalJSON ¶
func (r *ToolChoiceFunction) UnmarshalJSON(data []byte) error
type ToolChoiceFunctionParam ¶
type ToolChoiceFunctionParam struct { // The name of the function to call. Name string `json:"name,required"` // For function calling, the type is always `function`. // // This field can be elided, and will marshal its zero value as "function". Type constant.Function `json:"type,required"` // contains filtered or unexported fields }
Use this option to force the model to call a specific function.
The properties Name, Type are required.
func (ToolChoiceFunctionParam) IsPresent ¶
func (f ToolChoiceFunctionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ToolChoiceFunctionParam) MarshalJSON ¶
func (r ToolChoiceFunctionParam) MarshalJSON() (data []byte, err error)
type ToolChoiceOptions ¶
type ToolChoiceOptions string
Controls which (if any) tool is called by the model.
`none` means the model will not call any tool and instead generates a message.
`auto` means the model can pick between generating a message or calling one or more tools.
`required` means the model must call one or more tools.
const ( ToolChoiceOptionsNone ToolChoiceOptions = "none" ToolChoiceOptionsAuto ToolChoiceOptions = "auto" ToolChoiceOptionsRequired ToolChoiceOptions = "required" )
type ToolChoiceTypes ¶
type ToolChoiceTypes struct { // The type of hosted tool the model should to use. Learn more about // [built-in tools](https://platform.openai.com/docs/guides/tools). // // Allowed values are: // // - `file_search` // - `web_search_preview` // - `computer_use_preview` // // Any of "file_search", "web_search_preview", "computer_use_preview", // "web_search_preview_2025_03_11". Type ToolChoiceTypesType `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Indicates that the model should use a built-in tool to generate a response. [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
func (ToolChoiceTypes) RawJSON ¶
func (r ToolChoiceTypes) RawJSON() string
Returns the unmodified JSON received from the API
func (ToolChoiceTypes) ToParam ¶
func (r ToolChoiceTypes) ToParam() ToolChoiceTypesParam
ToParam converts this ToolChoiceTypes to a ToolChoiceTypesParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolChoiceTypesParam.IsOverridden()
func (*ToolChoiceTypes) UnmarshalJSON ¶
func (r *ToolChoiceTypes) UnmarshalJSON(data []byte) error
type ToolChoiceTypesParam ¶
type ToolChoiceTypesParam struct { // The type of hosted tool the model should to use. Learn more about // [built-in tools](https://platform.openai.com/docs/guides/tools). // // Allowed values are: // // - `file_search` // - `web_search_preview` // - `computer_use_preview` // // Any of "file_search", "web_search_preview", "computer_use_preview", // "web_search_preview_2025_03_11". Type ToolChoiceTypesType `json:"type,omitzero,required"` // contains filtered or unexported fields }
Indicates that the model should use a built-in tool to generate a response. [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
The property Type is required.
func (ToolChoiceTypesParam) IsPresent ¶
func (f ToolChoiceTypesParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ToolChoiceTypesParam) MarshalJSON ¶
func (r ToolChoiceTypesParam) MarshalJSON() (data []byte, err error)
type ToolChoiceTypesType ¶
type ToolChoiceTypesType string
The type of hosted tool the model should to use. Learn more about [built-in tools](https://platform.openai.com/docs/guides/tools).
Allowed values are:
- `file_search` - `web_search_preview` - `computer_use_preview`
const ( ToolChoiceTypesTypeFileSearch ToolChoiceTypesType = "file_search" ToolChoiceTypesTypeWebSearchPreview ToolChoiceTypesType = "web_search_preview" ToolChoiceTypesTypeComputerUsePreview ToolChoiceTypesType = "computer_use_preview" ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11" )
type ToolUnion ¶
type ToolUnion struct { // Any of "file_search", "function", "computer_use_preview", nil. Type string `json:"type"` // This field is from variant [FileSearchTool]. VectorStoreIDs []string `json:"vector_store_ids"` // This field is from variant [FileSearchTool]. Filters FileSearchToolFiltersUnion `json:"filters"` // This field is from variant [FileSearchTool]. MaxNumResults int64 `json:"max_num_results"` // This field is from variant [FileSearchTool]. RankingOptions FileSearchToolRankingOptions `json:"ranking_options"` // This field is from variant [FunctionTool]. Name string `json:"name"` // This field is from variant [FunctionTool]. Parameters map[string]interface{} `json:"parameters"` // This field is from variant [FunctionTool]. Strict bool `json:"strict"` // This field is from variant [FunctionTool]. Description string `json:"description"` // This field is from variant [ComputerTool]. DisplayHeight float64 `json:"display_height"` // This field is from variant [ComputerTool]. DisplayWidth float64 `json:"display_width"` // This field is from variant [ComputerTool]. Environment ComputerToolEnvironment `json:"environment"` // This field is from variant [WebSearchTool]. SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size"` // This field is from variant [WebSearchTool]. UserLocation WebSearchToolUserLocation `json:"user_location"` JSON struct { Type resp.Field VectorStoreIDs resp.Field Filters resp.Field MaxNumResults resp.Field RankingOptions resp.Field Name resp.Field Parameters resp.Field Strict resp.Field Description resp.Field DisplayHeight resp.Field DisplayWidth resp.Field Environment resp.Field SearchContextSize resp.Field UserLocation resp.Field // contains filtered or unexported fields } `json:"-"` }
ToolUnion contains all possible properties and values from FileSearchTool, FunctionTool, ComputerTool, WebSearchTool.
Use the [ToolUnion.AsAny] method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ToolUnion) AsComputerUsePreview ¶
func (u ToolUnion) AsComputerUsePreview() (v ComputerTool)
func (ToolUnion) AsFileSearch ¶
func (u ToolUnion) AsFileSearch() (v FileSearchTool)
func (ToolUnion) AsFunction ¶
func (u ToolUnion) AsFunction() (v FunctionTool)
func (ToolUnion) AsWebSearch ¶
func (u ToolUnion) AsWebSearch() (v WebSearchTool)
func (ToolUnion) ToParam ¶
func (r ToolUnion) ToParam() ToolUnionParam
ToParam converts this ToolUnion to a ToolUnionParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolUnionParam.IsOverridden()
func (*ToolUnion) UnmarshalJSON ¶
type ToolUnionParam ¶
type ToolUnionParam struct { OfFileSearch *FileSearchToolParam `json:",omitzero,inline"` OfFunction *FunctionToolParam `json:",omitzero,inline"` OfComputerUsePreview *ComputerToolParam `json:",omitzero,inline"` OfWebSearch *WebSearchToolParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func ToolParamOfComputerUsePreview ¶
func ToolParamOfComputerUsePreview(displayHeight float64, displayWidth float64, environment ComputerToolEnvironment) ToolUnionParam
func ToolParamOfFileSearch ¶
func ToolParamOfFileSearch(vectorStoreIDs []string) ToolUnionParam
func ToolParamOfFunction ¶
func ToolParamOfFunction(name string, parameters map[string]interface{}, strict bool) ToolUnionParam
func ToolParamOfWebSearch ¶
func ToolParamOfWebSearch(type_ WebSearchToolType) ToolUnionParam
func (ToolUnionParam) GetDescription ¶
func (u ToolUnionParam) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetDisplayHeight ¶
func (u ToolUnionParam) GetDisplayHeight() *float64
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetDisplayWidth ¶
func (u ToolUnionParam) GetDisplayWidth() *float64
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetEnvironment ¶
func (u ToolUnionParam) GetEnvironment() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetFilters ¶
func (u ToolUnionParam) GetFilters() *FileSearchToolFiltersUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetMaxNumResults ¶
func (u ToolUnionParam) GetMaxNumResults() *int64
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetName ¶
func (u ToolUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetParameters ¶
func (u ToolUnionParam) GetParameters() map[string]interface{}
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetRankingOptions ¶
func (u ToolUnionParam) GetRankingOptions() *FileSearchToolRankingOptionsParam
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetSearchContextSize ¶
func (u ToolUnionParam) GetSearchContextSize() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetStrict ¶
func (u ToolUnionParam) GetStrict() *bool
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetType ¶
func (u ToolUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetUserLocation ¶
func (u ToolUnionParam) GetUserLocation() *WebSearchToolUserLocationParam
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) GetVectorStoreIDs ¶
func (u ToolUnionParam) GetVectorStoreIDs() []string
Returns a pointer to the underlying variant's property, if present.
func (ToolUnionParam) IsPresent ¶
func (u ToolUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ToolUnionParam) MarshalJSON ¶
func (u ToolUnionParam) MarshalJSON() ([]byte, error)
type WebSearchTool ¶
type WebSearchTool struct { // The type of the web search tool. One of: // // - `web_search_preview` // - `web_search_preview_2025_03_11` // // Any of "web_search_preview", "web_search_preview_2025_03_11". Type WebSearchToolType `json:"type,required"` // High level guidance for the amount of context window space to use for the // search. One of `low`, `medium`, or `high`. `medium` is the default. // // Any of "low", "medium", "high". SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size"` UserLocation WebSearchToolUserLocation `json:"user_location,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field SearchContextSize resp.Field UserLocation resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
func (WebSearchTool) RawJSON ¶
func (r WebSearchTool) RawJSON() string
Returns the unmodified JSON received from the API
func (WebSearchTool) ToParam ¶
func (r WebSearchTool) ToParam() WebSearchToolParam
ToParam converts this WebSearchTool to a WebSearchToolParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with WebSearchToolParam.IsOverridden()
func (*WebSearchTool) UnmarshalJSON ¶
func (r *WebSearchTool) UnmarshalJSON(data []byte) error
type WebSearchToolParam ¶
type WebSearchToolParam struct { // The type of the web search tool. One of: // // - `web_search_preview` // - `web_search_preview_2025_03_11` // // Any of "web_search_preview", "web_search_preview_2025_03_11". Type WebSearchToolType `json:"type,omitzero,required"` UserLocation WebSearchToolUserLocationParam `json:"user_location,omitzero"` // High level guidance for the amount of context window space to use for the // search. One of `low`, `medium`, or `high`. `medium` is the default. // // Any of "low", "medium", "high". SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size,omitzero"` // contains filtered or unexported fields }
This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
The property Type is required.
func (WebSearchToolParam) IsPresent ¶
func (f WebSearchToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (WebSearchToolParam) MarshalJSON ¶
func (r WebSearchToolParam) MarshalJSON() (data []byte, err error)
type WebSearchToolSearchContextSize ¶
type WebSearchToolSearchContextSize string
High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.
const ( WebSearchToolSearchContextSizeLow WebSearchToolSearchContextSize = "low" WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium" WebSearchToolSearchContextSizeHigh WebSearchToolSearchContextSize = "high" )
type WebSearchToolType ¶
type WebSearchToolType string
The type of the web search tool. One of:
- `web_search_preview` - `web_search_preview_2025_03_11`
const ( WebSearchToolTypeWebSearchPreview WebSearchToolType = "web_search_preview" WebSearchToolTypeWebSearchPreview2025_03_11 WebSearchToolType = "web_search_preview_2025_03_11" )
type WebSearchToolUserLocation ¶
type WebSearchToolUserLocation struct { // The type of location approximation. Always `approximate`. Type constant.Approximate `json:"type,required"` // Free text input for the city of the user, e.g. `San Francisco`. City string `json:"city"` // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of // the user, e.g. `US`. Country string `json:"country"` // Free text input for the region of the user, e.g. `California`. Region string `json:"region"` // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the // user, e.g. `America/Los_Angeles`. Timezone string `json:"timezone"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field City resp.Field Country resp.Field Region resp.Field Timezone resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (WebSearchToolUserLocation) RawJSON ¶
func (r WebSearchToolUserLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchToolUserLocation) UnmarshalJSON ¶
func (r *WebSearchToolUserLocation) UnmarshalJSON(data []byte) error
type WebSearchToolUserLocationParam ¶
type WebSearchToolUserLocationParam struct { // Free text input for the city of the user, e.g. `San Francisco`. City param.Opt[string] `json:"city,omitzero"` // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of // the user, e.g. `US`. Country param.Opt[string] `json:"country,omitzero"` // Free text input for the region of the user, e.g. `California`. Region param.Opt[string] `json:"region,omitzero"` // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the // user, e.g. `America/Los_Angeles`. Timezone param.Opt[string] `json:"timezone,omitzero"` // The type of location approximation. Always `approximate`. // // This field can be elided, and will marshal its zero value as "approximate". Type constant.Approximate `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (WebSearchToolUserLocationParam) IsPresent ¶
func (f WebSearchToolUserLocationParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (WebSearchToolUserLocationParam) MarshalJSON ¶
func (r WebSearchToolUserLocationParam) MarshalJSON() (data []byte, err error)