Documentation
¶
Index ¶
- Constants
- type AudioTranscription
- type AudioTranscriptionModel
- type AudioTranscriptionParam
- type CallAcceptParams
- type CallReferParams
- type CallRejectParams
- type CallService
- func (r *CallService) Accept(ctx context.Context, callID string, body CallAcceptParams, ...) (err error)
- func (r *CallService) Hangup(ctx context.Context, callID string, opts ...option.RequestOption) (err error)
- func (r *CallService) Refer(ctx context.Context, callID string, body CallReferParams, ...) (err error)
- func (r *CallService) Reject(ctx context.Context, callID string, body CallRejectParams, ...) (err error)
- type ChatModel
- type ClientSecretNewParams
- type ClientSecretNewParamsExpiresAfter
- type ClientSecretNewParamsSessionUnion
- func (u ClientSecretNewParamsSessionUnion) GetAudio() (res clientSecretNewParamsSessionUnionAudio)
- func (u ClientSecretNewParamsSessionUnion) GetInclude() []string
- func (u ClientSecretNewParamsSessionUnion) GetInstructions() *string
- func (u ClientSecretNewParamsSessionUnion) GetMaxOutputTokens() *RealtimeSessionCreateRequestMaxOutputTokensUnionParam
- func (u ClientSecretNewParamsSessionUnion) GetModel() *RealtimeSessionCreateRequestModel
- func (u ClientSecretNewParamsSessionUnion) GetOutputModalities() []string
- func (u ClientSecretNewParamsSessionUnion) GetPrompt() *responses.ResponsePromptParam
- func (u ClientSecretNewParamsSessionUnion) GetToolChoice() *RealtimeToolChoiceConfigUnionParam
- func (u ClientSecretNewParamsSessionUnion) GetTools() RealtimeToolsConfigParam
- func (u ClientSecretNewParamsSessionUnion) GetTracing() *RealtimeTracingConfigUnionParam
- func (u ClientSecretNewParamsSessionUnion) GetTruncation() *RealtimeTruncationUnionParam
- func (u ClientSecretNewParamsSessionUnion) GetType() *string
- func (u ClientSecretNewParamsSessionUnion) MarshalJSON() ([]byte, error)
- func (u *ClientSecretNewParamsSessionUnion) UnmarshalJSON(data []byte) error
- type ClientSecretNewResponse
- type ClientSecretNewResponseSessionUnion
- func (u ClientSecretNewResponseSessionUnion) AsAny() anyClientSecretNewResponseSession
- func (u ClientSecretNewResponseSessionUnion) AsRealtime() (v RealtimeSessionCreateResponse)
- func (u ClientSecretNewResponseSessionUnion) AsTranscription() (v RealtimeTranscriptionSessionCreateResponse)
- func (u ClientSecretNewResponseSessionUnion) RawJSON() string
- func (r *ClientSecretNewResponseSessionUnion) UnmarshalJSON(data []byte) error
- type ClientSecretNewResponseSessionUnionAudio
- type ClientSecretNewResponseSessionUnionAudioInput
- type ClientSecretNewResponseSessionUnionAudioInputNoiseReduction
- type ClientSecretNewResponseSessionUnionAudioInputTurnDetection
- type ClientSecretService
- type ComparisonFilter
- type ComparisonFilterParam
- type ComparisonFilterType
- type ComparisonFilterValueArrayItemUnion
- type ComparisonFilterValueArrayItemUnionParam
- type ComparisonFilterValueUnion
- type ComparisonFilterValueUnionParam
- type CompoundFilter
- type CompoundFilterParam
- type CompoundFilterType
- type CustomToolInputFormatGrammar
- type CustomToolInputFormatGrammarParam
- type CustomToolInputFormatText
- type CustomToolInputFormatTextParam
- type CustomToolInputFormatUnion
- type CustomToolInputFormatUnionParam
- type Error
- type ErrorObject
- type FunctionDefinition
- type FunctionDefinitionParam
- type FunctionParameters
- type Metadata
- type NoiseReductionType
- type RealtimeAudioConfigInputNoiseReductionParam
- type RealtimeAudioConfigInputParam
- type RealtimeAudioConfigOutputParam
- type RealtimeAudioConfigOutputVoice
- type RealtimeAudioConfigParam
- type RealtimeAudioFormatsAudioPCM
- type RealtimeAudioFormatsAudioPCMA
- type RealtimeAudioFormatsAudioPCMAParam
- type RealtimeAudioFormatsAudioPCMParam
- type RealtimeAudioFormatsAudioPCMU
- type RealtimeAudioFormatsAudioPCMUParam
- type RealtimeAudioFormatsUnion
- func (u RealtimeAudioFormatsUnion) AsAny() anyRealtimeAudioFormats
- func (u RealtimeAudioFormatsUnion) AsAudioPCM() (v RealtimeAudioFormatsAudioPCM)
- func (u RealtimeAudioFormatsUnion) AsAudioPCMA() (v RealtimeAudioFormatsAudioPCMA)
- func (u RealtimeAudioFormatsUnion) AsAudioPCMU() (v RealtimeAudioFormatsAudioPCMU)
- func (u RealtimeAudioFormatsUnion) RawJSON() string
- func (r RealtimeAudioFormatsUnion) ToParam() RealtimeAudioFormatsUnionParam
- func (r *RealtimeAudioFormatsUnion) UnmarshalJSON(data []byte) error
- type RealtimeAudioFormatsUnionParam
- type RealtimeAudioInputTurnDetectionSemanticVadParam
- type RealtimeAudioInputTurnDetectionServerVadParam
- type RealtimeAudioInputTurnDetectionUnionParam
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetCreateResponse() *bool
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetEagerness() *string
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs() *int64
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetInterruptResponse() *bool
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs() *int64
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetSilenceDurationMs() *int64
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetThreshold() *float64
- func (u RealtimeAudioInputTurnDetectionUnionParam) GetType() *string
- func (u RealtimeAudioInputTurnDetectionUnionParam) MarshalJSON() ([]byte, error)
- func (u *RealtimeAudioInputTurnDetectionUnionParam) UnmarshalJSON(data []byte) error
- type RealtimeFunctionTool
- type RealtimeFunctionToolParam
- type RealtimeFunctionToolType
- type RealtimeService
- type RealtimeSessionClientSecret
- type RealtimeSessionCreateRequestMaxOutputTokensUnionParam
- type RealtimeSessionCreateRequestModel
- type RealtimeSessionCreateRequestParam
- type RealtimeSessionCreateResponse
- type RealtimeSessionCreateResponseAudio
- type RealtimeSessionCreateResponseAudioInput
- type RealtimeSessionCreateResponseAudioInputNoiseReduction
- type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad
- type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad
- type RealtimeSessionCreateResponseAudioInputTurnDetectionUnion
- func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsAny() anyRealtimeSessionCreateResponseAudioInputTurnDetection
- func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsSemanticVad() (v RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad)
- func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsServerVad() (v RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad)
- func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) UnmarshalJSON(data []byte) error
- type RealtimeSessionCreateResponseAudioOutput
- type RealtimeSessionCreateResponseMaxOutputTokensUnion
- func (u RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInf() (v constant.Inf)
- func (u RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInt() (v int64)
- func (u RealtimeSessionCreateResponseMaxOutputTokensUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseMaxOutputTokensUnion) UnmarshalJSON(data []byte) error
- type RealtimeSessionCreateResponseModel
- type RealtimeSessionCreateResponseToolChoiceUnion
- func (u RealtimeSessionCreateResponseToolChoiceUnion) AsFunctionTool() (v responses.ToolChoiceFunction)
- func (u RealtimeSessionCreateResponseToolChoiceUnion) AsMcpTool() (v responses.ToolChoiceMcp)
- func (u RealtimeSessionCreateResponseToolChoiceUnion) AsToolChoiceMode() (v responses.ToolChoiceOptions)
- func (u RealtimeSessionCreateResponseToolChoiceUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseToolChoiceUnion) UnmarshalJSON(data []byte) error
- type RealtimeSessionCreateResponseToolMcpTool
- type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter
- type RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion
- func (u RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpAllowedTools() (v []string)
- func (u RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpToolFilter() (v RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter)
- func (u RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) UnmarshalJSON(data []byte) error
- type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter
- type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways
- type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever
- type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting
- type RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion
- func (u RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalFilter() (v RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter)
- func (u RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalSetting() (v string)
- func (u RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) UnmarshalJSON(data []byte) error
- type RealtimeSessionCreateResponseToolUnion
- func (u RealtimeSessionCreateResponseToolUnion) AsFunctionTool() (v RealtimeFunctionTool)
- func (u RealtimeSessionCreateResponseToolUnion) AsMcpTool() (v RealtimeSessionCreateResponseToolMcpTool)
- func (u RealtimeSessionCreateResponseToolUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseToolUnion) UnmarshalJSON(data []byte) error
- type RealtimeSessionCreateResponseTracingTracingConfiguration
- type RealtimeSessionCreateResponseTracingUnion
- func (u RealtimeSessionCreateResponseTracingUnion) AsAuto() (v constant.Auto)
- func (u RealtimeSessionCreateResponseTracingUnion) AsTracingConfiguration() (v RealtimeSessionCreateResponseTracingTracingConfiguration)
- func (u RealtimeSessionCreateResponseTracingUnion) RawJSON() string
- func (r *RealtimeSessionCreateResponseTracingUnion) UnmarshalJSON(data []byte) error
- type RealtimeToolChoiceConfigUnionParam
- func (u RealtimeToolChoiceConfigUnionParam) GetName() *string
- func (u RealtimeToolChoiceConfigUnionParam) GetServerLabel() *string
- func (u RealtimeToolChoiceConfigUnionParam) GetType() *string
- func (u RealtimeToolChoiceConfigUnionParam) MarshalJSON() ([]byte, error)
- func (u *RealtimeToolChoiceConfigUnionParam) UnmarshalJSON(data []byte) error
- type RealtimeToolsConfigParam
- type RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam
- type RealtimeToolsConfigUnionMcpAllowedToolsParam
- type RealtimeToolsConfigUnionMcpParam
- type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam
- type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam
- type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam
- type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting
- type RealtimeToolsConfigUnionMcpRequireApprovalParam
- type RealtimeToolsConfigUnionParam
- func (u RealtimeToolsConfigUnionParam) GetAllowedTools() *RealtimeToolsConfigUnionMcpAllowedToolsParam
- func (u RealtimeToolsConfigUnionParam) GetAuthorization() *string
- func (u RealtimeToolsConfigUnionParam) GetConnectorID() *string
- func (u RealtimeToolsConfigUnionParam) GetDescription() *string
- func (u RealtimeToolsConfigUnionParam) GetHeaders() map[string]string
- func (u RealtimeToolsConfigUnionParam) GetName() *string
- func (u RealtimeToolsConfigUnionParam) GetParameters() *any
- func (u RealtimeToolsConfigUnionParam) GetRequireApproval() *RealtimeToolsConfigUnionMcpRequireApprovalParam
- func (u RealtimeToolsConfigUnionParam) GetServerDescription() *string
- func (u RealtimeToolsConfigUnionParam) GetServerLabel() *string
- func (u RealtimeToolsConfigUnionParam) GetServerURL() *string
- func (u RealtimeToolsConfigUnionParam) GetType() *string
- func (u RealtimeToolsConfigUnionParam) MarshalJSON() ([]byte, error)
- func (u *RealtimeToolsConfigUnionParam) UnmarshalJSON(data []byte) error
- type RealtimeTracingConfigTracingConfigurationParam
- type RealtimeTracingConfigUnionParam
- type RealtimeTranscriptionSessionAudioInputNoiseReductionParam
- type RealtimeTranscriptionSessionAudioInputParam
- type RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam
- type RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam
- type RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetCreateResponse() *bool
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetEagerness() *string
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs() *int64
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetInterruptResponse() *bool
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs() *int64
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetSilenceDurationMs() *int64
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetThreshold() *float64
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetType() *string
- func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) MarshalJSON() ([]byte, error)
- func (u *RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) UnmarshalJSON(data []byte) error
- type RealtimeTranscriptionSessionAudioParam
- type RealtimeTranscriptionSessionCreateRequestParam
- type RealtimeTranscriptionSessionCreateResponse
- type RealtimeTranscriptionSessionCreateResponseAudio
- type RealtimeTranscriptionSessionCreateResponseAudioInput
- type RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction
- type RealtimeTranscriptionSessionTurnDetection
- type RealtimeTruncationRealtimeTruncationStrategy
- type RealtimeTruncationRetentionRatio
- type RealtimeTruncationRetentionRatioParam
- type RealtimeTruncationUnion
- func (u RealtimeTruncationUnion) AsRealtimeTruncationStrategy() (v string)
- func (u RealtimeTruncationUnion) AsRetentionRatioTruncation() (v RealtimeTruncationRetentionRatio)
- func (u RealtimeTruncationUnion) RawJSON() string
- func (r RealtimeTruncationUnion) ToParam() RealtimeTruncationUnionParam
- func (r *RealtimeTruncationUnion) UnmarshalJSON(data []byte) error
- type RealtimeTruncationUnionParam
- type Reasoning
- type ReasoningEffort
- type ReasoningGenerateSummary
- type ReasoningParam
- type ReasoningSummary
- type ResponseFormatJSONObject
- type ResponseFormatJSONObjectParam
- type ResponseFormatJSONSchema
- type ResponseFormatJSONSchemaJSONSchema
- type ResponseFormatJSONSchemaJSONSchemaParam
- type ResponseFormatJSONSchemaParam
- type ResponseFormatText
- type ResponseFormatTextParam
- type ResponsesModel
Constants ¶
const ChatModelChatgpt4oLatest = shared.ChatModelChatgpt4oLatest
Equals "chatgpt-4o-latest"
const ChatModelCodexMiniLatest = shared.ChatModelCodexMiniLatest
Equals "codex-mini-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_1 = shared.ChatModelGPT4_1
Equals "gpt-4.1"
const ChatModelGPT4_1106Preview = shared.ChatModelGPT4_1106Preview
Equals "gpt-4-1106-preview"
const ChatModelGPT4_1Mini = shared.ChatModelGPT4_1Mini
Equals "gpt-4.1-mini"
const ChatModelGPT4_1Mini2025_04_14 = shared.ChatModelGPT4_1Mini2025_04_14
Equals "gpt-4.1-mini-2025-04-14"
const ChatModelGPT4_1Nano = shared.ChatModelGPT4_1Nano
Equals "gpt-4.1-nano"
const ChatModelGPT4_1Nano2025_04_14 = shared.ChatModelGPT4_1Nano2025_04_14
Equals "gpt-4.1-nano-2025-04-14"
const ChatModelGPT4_1_2025_04_14 = shared.ChatModelGPT4_1_2025_04_14
Equals "gpt-4.1-2025-04-14"
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 ChatModelGPT4oAudioPreview2025_06_03 = shared.ChatModelGPT4oAudioPreview2025_06_03
Equals "gpt-4o-audio-preview-2025-06-03"
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 ChatModelGPT5 = shared.ChatModelGPT5
Equals "gpt-5"
const ChatModelGPT5ChatLatest = shared.ChatModelGPT5ChatLatest
Equals "gpt-5-chat-latest"
const ChatModelGPT5Mini = shared.ChatModelGPT5Mini
Equals "gpt-5-mini"
const ChatModelGPT5Mini2025_08_07 = shared.ChatModelGPT5Mini2025_08_07
Equals "gpt-5-mini-2025-08-07"
const ChatModelGPT5Nano = shared.ChatModelGPT5Nano
Equals "gpt-5-nano"
const ChatModelGPT5Nano2025_08_07 = shared.ChatModelGPT5Nano2025_08_07
Equals "gpt-5-nano-2025-08-07"
const ChatModelGPT5_2025_08_07 = shared.ChatModelGPT5_2025_08_07
Equals "gpt-5-2025-08-07"
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 ChatModelO3 = shared.ChatModelO3
Equals "o3"
const ChatModelO3Mini = shared.ChatModelO3Mini
Equals "o3-mini"
const ChatModelO3Mini2025_01_31 = shared.ChatModelO3Mini2025_01_31
Equals "o3-mini-2025-01-31"
const ChatModelO3_2025_04_16 = shared.ChatModelO3_2025_04_16
Equals "o3-2025-04-16"
const ChatModelO4Mini = shared.ChatModelO4Mini
Equals "o4-mini"
const ChatModelO4Mini2025_04_16 = shared.ChatModelO4Mini2025_04_16
Equals "o4-mini-2025-04-16"
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 ReasoningEffortMinimal = shared.ReasoningEffortMinimal
Equals "minimal"
const ReasoningGenerateSummaryAuto = shared.ReasoningGenerateSummaryAuto
Equals "auto"
const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
Equals "concise"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
Equals "detailed"
const ReasoningSummaryAuto = shared.ReasoningSummaryAuto
Equals "auto"
const ReasoningSummaryConcise = shared.ReasoningSummaryConcise
Equals "concise"
const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed
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 ResponsesModelGPT5Codex = shared.ResponsesModelGPT5Codex
Equals "gpt-5-codex"
const ResponsesModelGPT5Pro = shared.ResponsesModelGPT5Pro
Equals "gpt-5-pro"
const ResponsesModelGPT5Pro2025_10_06 = shared.ResponsesModelGPT5Pro2025_10_06
Equals "gpt-5-pro-2025-10-06"
const ResponsesModelO1Pro = shared.ResponsesModelO1Pro
Equals "o1-pro"
const ResponsesModelO1Pro2025_03_19 = shared.ResponsesModelO1Pro2025_03_19
Equals "o1-pro-2025-03-19"
const ResponsesModelO3DeepResearch = shared.ResponsesModelO3DeepResearch
Equals "o3-deep-research"
const ResponsesModelO3DeepResearch2025_06_26 = shared.ResponsesModelO3DeepResearch2025_06_26
Equals "o3-deep-research-2025-06-26"
const ResponsesModelO3Pro = shared.ResponsesModelO3Pro
Equals "o3-pro"
const ResponsesModelO3Pro2025_06_10 = shared.ResponsesModelO3Pro2025_06_10
Equals "o3-pro-2025-06-10"
const ResponsesModelO4MiniDeepResearch = shared.ResponsesModelO4MiniDeepResearch
Equals "o4-mini-deep-research"
const ResponsesModelO4MiniDeepResearch2025_06_26 = shared.ResponsesModelO4MiniDeepResearch2025_06_26
Equals "o4-mini-deep-research-2025-06-26"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioTranscription ¶
type AudioTranscription struct {
// The language of the input audio. Supplying the input language in
// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
// format will improve accuracy and latency.
Language string `json:"language"`
// The model to use for transcription. Current options are `whisper-1`,
// `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`.
// Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
//
// Any of "whisper-1", "gpt-4o-mini-transcribe", "gpt-4o-transcribe",
// "gpt-4o-transcribe-diarize".
Model AudioTranscriptionModel `json:"model"`
// An optional text to guide the model's style or continue a previous audio
// segment. For `whisper-1`, the
// [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
// For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the
// prompt is a free text string, for example "expect words related to technology".
Prompt string `json:"prompt"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Language respjson.Field
Model respjson.Field
Prompt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AudioTranscription) RawJSON ¶
func (r AudioTranscription) RawJSON() string
Returns the unmodified JSON received from the API
func (AudioTranscription) ToParam ¶
func (r AudioTranscription) ToParam() AudioTranscriptionParam
ToParam converts this AudioTranscription to a AudioTranscriptionParam.
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 AudioTranscriptionParam.Overrides()
func (*AudioTranscription) UnmarshalJSON ¶
func (r *AudioTranscription) UnmarshalJSON(data []byte) error
type AudioTranscriptionModel ¶
type AudioTranscriptionModel string
The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
const ( AudioTranscriptionModelWhisper1 AudioTranscriptionModel = "whisper-1" AudioTranscriptionModelGPT4oMiniTranscribe AudioTranscriptionModel = "gpt-4o-mini-transcribe" AudioTranscriptionModelGPT4oTranscribe AudioTranscriptionModel = "gpt-4o-transcribe" AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize" )
type AudioTranscriptionParam ¶
type AudioTranscriptionParam struct {
// The language of the input audio. Supplying the input language in
// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
// format will improve accuracy and latency.
Language param.Opt[string] `json:"language,omitzero"`
// An optional text to guide the model's style or continue a previous audio
// segment. For `whisper-1`, the
// [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
// For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the
// prompt is a free text string, for example "expect words related to technology".
Prompt param.Opt[string] `json:"prompt,omitzero"`
// The model to use for transcription. Current options are `whisper-1`,
// `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`.
// Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
//
// Any of "whisper-1", "gpt-4o-mini-transcribe", "gpt-4o-transcribe",
// "gpt-4o-transcribe-diarize".
Model AudioTranscriptionModel `json:"model,omitzero"`
// contains filtered or unexported fields
}
func (AudioTranscriptionParam) MarshalJSON ¶
func (r AudioTranscriptionParam) MarshalJSON() (data []byte, err error)
func (*AudioTranscriptionParam) UnmarshalJSON ¶
func (r *AudioTranscriptionParam) UnmarshalJSON(data []byte) error
type CallAcceptParams ¶ added in v3.1.0
type CallAcceptParams struct {
// Realtime session object configuration.
RealtimeSessionCreateRequest RealtimeSessionCreateRequestParam
// contains filtered or unexported fields
}
func (CallAcceptParams) MarshalJSON ¶ added in v3.1.0
func (r CallAcceptParams) MarshalJSON() (data []byte, err error)
func (*CallAcceptParams) UnmarshalJSON ¶ added in v3.1.0
func (r *CallAcceptParams) UnmarshalJSON(data []byte) error
type CallReferParams ¶ added in v3.1.0
type CallReferParams struct {
// URI that should appear in the SIP Refer-To header. Supports values like
// `tel:+14155550123` or `sip:agent@example.com`.
TargetUri string `json:"target_uri,required"`
// contains filtered or unexported fields
}
func (CallReferParams) MarshalJSON ¶ added in v3.1.0
func (r CallReferParams) MarshalJSON() (data []byte, err error)
func (*CallReferParams) UnmarshalJSON ¶ added in v3.1.0
func (r *CallReferParams) UnmarshalJSON(data []byte) error
type CallRejectParams ¶ added in v3.1.0
type CallRejectParams struct {
// SIP response code to send back to the caller. Defaults to `603` (Decline) when
// omitted.
StatusCode param.Opt[int64] `json:"status_code,omitzero"`
// contains filtered or unexported fields
}
func (CallRejectParams) MarshalJSON ¶ added in v3.1.0
func (r CallRejectParams) MarshalJSON() (data []byte, err error)
func (*CallRejectParams) UnmarshalJSON ¶ added in v3.1.0
func (r *CallRejectParams) UnmarshalJSON(data []byte) error
type CallService ¶ added in v3.1.0
type CallService struct {
Options []option.RequestOption
}
CallService 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 NewCallService method instead.
func NewCallService ¶ added in v3.1.0
func NewCallService(opts ...option.RequestOption) (r CallService)
NewCallService 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 (*CallService) Accept ¶ added in v3.1.0
func (r *CallService) Accept(ctx context.Context, callID string, body CallAcceptParams, opts ...option.RequestOption) (err error)
Accept an incoming SIP call and configure the realtime session that will handle it.
func (*CallService) Hangup ¶ added in v3.1.0
func (r *CallService) Hangup(ctx context.Context, callID string, opts ...option.RequestOption) (err error)
End an active Realtime API call, whether it was initiated over SIP or WebRTC.
func (*CallService) Refer ¶ added in v3.1.0
func (r *CallService) Refer(ctx context.Context, callID string, body CallReferParams, opts ...option.RequestOption) (err error)
Transfer an active SIP call to a new destination using the SIP REFER verb.
func (*CallService) Reject ¶ added in v3.1.0
func (r *CallService) Reject(ctx context.Context, callID string, body CallRejectParams, opts ...option.RequestOption) (err error)
Decline an incoming SIP call by returning a SIP status code to the caller.
type ClientSecretNewParams ¶
type ClientSecretNewParams struct {
// Configuration for the client secret expiration. Expiration refers to the time
// after which a client secret will no longer be valid for creating sessions. The
// session itself may continue after that time once started. A secret can be used
// to create multiple sessions until it expires.
ExpiresAfter ClientSecretNewParamsExpiresAfter `json:"expires_after,omitzero"`
// Session configuration to use for the client secret. Choose either a realtime
// session or a transcription session.
Session ClientSecretNewParamsSessionUnion `json:"session,omitzero"`
// contains filtered or unexported fields
}
func (ClientSecretNewParams) MarshalJSON ¶
func (r ClientSecretNewParams) MarshalJSON() (data []byte, err error)
func (*ClientSecretNewParams) UnmarshalJSON ¶
func (r *ClientSecretNewParams) UnmarshalJSON(data []byte) error
type ClientSecretNewParamsExpiresAfter ¶
type ClientSecretNewParamsExpiresAfter struct {
// The number of seconds from the anchor point to the expiration. Select a value
// between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if
// not specified.
Seconds param.Opt[int64] `json:"seconds,omitzero"`
// The anchor point for the client secret expiration, meaning that `seconds` will
// be added to the `created_at` time of the client secret to produce an expiration
// timestamp. Only `created_at` is currently supported.
//
// Any of "created_at".
Anchor string `json:"anchor,omitzero"`
// contains filtered or unexported fields
}
Configuration for the client secret expiration. Expiration refers to the time after which a client secret will no longer be valid for creating sessions. The session itself may continue after that time once started. A secret can be used to create multiple sessions until it expires.
func (ClientSecretNewParamsExpiresAfter) MarshalJSON ¶
func (r ClientSecretNewParamsExpiresAfter) MarshalJSON() (data []byte, err error)
func (*ClientSecretNewParamsExpiresAfter) UnmarshalJSON ¶
func (r *ClientSecretNewParamsExpiresAfter) UnmarshalJSON(data []byte) error
type ClientSecretNewParamsSessionUnion ¶
type ClientSecretNewParamsSessionUnion struct {
OfRealtime *RealtimeSessionCreateRequestParam `json:",omitzero,inline"`
OfTranscription *RealtimeTranscriptionSessionCreateRequestParam `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 (ClientSecretNewParamsSessionUnion) GetAudio ¶
func (u ClientSecretNewParamsSessionUnion) GetAudio() (res clientSecretNewParamsSessionUnionAudio)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ClientSecretNewParamsSessionUnion) GetInclude ¶
func (u ClientSecretNewParamsSessionUnion) GetInclude() []string
Returns a pointer to the underlying variant's Include property, if present.
func (ClientSecretNewParamsSessionUnion) GetInstructions ¶
func (u ClientSecretNewParamsSessionUnion) GetInstructions() *string
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetMaxOutputTokens ¶
func (u ClientSecretNewParamsSessionUnion) GetMaxOutputTokens() *RealtimeSessionCreateRequestMaxOutputTokensUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetModel ¶
func (u ClientSecretNewParamsSessionUnion) GetModel() *RealtimeSessionCreateRequestModel
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetOutputModalities ¶
func (u ClientSecretNewParamsSessionUnion) GetOutputModalities() []string
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetPrompt ¶
func (u ClientSecretNewParamsSessionUnion) GetPrompt() *responses.ResponsePromptParam
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetToolChoice ¶
func (u ClientSecretNewParamsSessionUnion) GetToolChoice() *RealtimeToolChoiceConfigUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetTools ¶
func (u ClientSecretNewParamsSessionUnion) GetTools() RealtimeToolsConfigParam
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetTracing ¶
func (u ClientSecretNewParamsSessionUnion) GetTracing() *RealtimeTracingConfigUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetTruncation ¶
func (u ClientSecretNewParamsSessionUnion) GetTruncation() *RealtimeTruncationUnionParam
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) GetType ¶
func (u ClientSecretNewParamsSessionUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ClientSecretNewParamsSessionUnion) MarshalJSON ¶
func (u ClientSecretNewParamsSessionUnion) MarshalJSON() ([]byte, error)
func (*ClientSecretNewParamsSessionUnion) UnmarshalJSON ¶
func (u *ClientSecretNewParamsSessionUnion) UnmarshalJSON(data []byte) error
type ClientSecretNewResponse ¶
type ClientSecretNewResponse struct {
// Expiration timestamp for the client secret, in seconds since epoch.
ExpiresAt int64 `json:"expires_at,required"`
// The session configuration for either a realtime or transcription session.
Session ClientSecretNewResponseSessionUnion `json:"session,required"`
// The generated client secret value.
Value string `json:"value,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ExpiresAt respjson.Field
Session respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Response from creating a session and client secret for the Realtime API.
func (ClientSecretNewResponse) RawJSON ¶
func (r ClientSecretNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ClientSecretNewResponse) UnmarshalJSON ¶
func (r *ClientSecretNewResponse) UnmarshalJSON(data []byte) error
type ClientSecretNewResponseSessionUnion ¶
type ClientSecretNewResponseSessionUnion struct {
// This field is from variant [RealtimeSessionCreateResponse].
ClientSecret RealtimeSessionClientSecret `json:"client_secret"`
// Any of "realtime", "transcription".
Type string `json:"type"`
// This field is a union of [RealtimeSessionCreateResponseAudio],
// [RealtimeTranscriptionSessionCreateResponseAudio]
Audio ClientSecretNewResponseSessionUnionAudio `json:"audio"`
Include []string `json:"include"`
// This field is from variant [RealtimeSessionCreateResponse].
Instructions string `json:"instructions"`
// This field is from variant [RealtimeSessionCreateResponse].
MaxOutputTokens RealtimeSessionCreateResponseMaxOutputTokensUnion `json:"max_output_tokens"`
// This field is from variant [RealtimeSessionCreateResponse].
Model RealtimeSessionCreateResponseModel `json:"model"`
// This field is from variant [RealtimeSessionCreateResponse].
OutputModalities []string `json:"output_modalities"`
// This field is from variant [RealtimeSessionCreateResponse].
Prompt responses.ResponsePrompt `json:"prompt"`
// This field is from variant [RealtimeSessionCreateResponse].
ToolChoice RealtimeSessionCreateResponseToolChoiceUnion `json:"tool_choice"`
// This field is from variant [RealtimeSessionCreateResponse].
Tools []RealtimeSessionCreateResponseToolUnion `json:"tools"`
// This field is from variant [RealtimeSessionCreateResponse].
Tracing RealtimeSessionCreateResponseTracingUnion `json:"tracing"`
// This field is from variant [RealtimeSessionCreateResponse].
Truncation RealtimeTruncationUnion `json:"truncation"`
// This field is from variant [RealtimeTranscriptionSessionCreateResponse].
ID string `json:"id"`
// This field is from variant [RealtimeTranscriptionSessionCreateResponse].
Object string `json:"object"`
// This field is from variant [RealtimeTranscriptionSessionCreateResponse].
ExpiresAt int64 `json:"expires_at"`
JSON struct {
ClientSecret respjson.Field
Type respjson.Field
Audio respjson.Field
Include respjson.Field
Instructions respjson.Field
MaxOutputTokens respjson.Field
Model respjson.Field
OutputModalities respjson.Field
Prompt respjson.Field
ToolChoice respjson.Field
Tools respjson.Field
Tracing respjson.Field
Truncation respjson.Field
ID respjson.Field
Object respjson.Field
ExpiresAt respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ClientSecretNewResponseSessionUnion contains all possible properties and values from RealtimeSessionCreateResponse, RealtimeTranscriptionSessionCreateResponse.
Use the ClientSecretNewResponseSessionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ClientSecretNewResponseSessionUnion) AsAny ¶
func (u ClientSecretNewResponseSessionUnion) AsAny() anyClientSecretNewResponseSession
Use the following switch statement to find the correct variant
switch variant := ClientSecretNewResponseSessionUnion.AsAny().(type) {
case realtime.RealtimeSessionCreateResponse:
case realtime.RealtimeTranscriptionSessionCreateResponse:
default:
fmt.Errorf("no variant present")
}
func (ClientSecretNewResponseSessionUnion) AsRealtime ¶
func (u ClientSecretNewResponseSessionUnion) AsRealtime() (v RealtimeSessionCreateResponse)
func (ClientSecretNewResponseSessionUnion) AsTranscription ¶
func (u ClientSecretNewResponseSessionUnion) AsTranscription() (v RealtimeTranscriptionSessionCreateResponse)
func (ClientSecretNewResponseSessionUnion) RawJSON ¶
func (u ClientSecretNewResponseSessionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ClientSecretNewResponseSessionUnion) UnmarshalJSON ¶
func (r *ClientSecretNewResponseSessionUnion) UnmarshalJSON(data []byte) error
type ClientSecretNewResponseSessionUnionAudio ¶
type ClientSecretNewResponseSessionUnionAudio struct {
// This field is a union of [RealtimeSessionCreateResponseAudioInput],
// [RealtimeTranscriptionSessionCreateResponseAudioInput]
Input ClientSecretNewResponseSessionUnionAudioInput `json:"input"`
// This field is from variant [RealtimeSessionCreateResponseAudio].
Output RealtimeSessionCreateResponseAudioOutput `json:"output"`
JSON struct {
Input respjson.Field
Output respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ClientSecretNewResponseSessionUnionAudio is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudio provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.
func (*ClientSecretNewResponseSessionUnionAudio) UnmarshalJSON ¶
func (r *ClientSecretNewResponseSessionUnionAudio) UnmarshalJSON(data []byte) error
type ClientSecretNewResponseSessionUnionAudioInput ¶
type ClientSecretNewResponseSessionUnionAudioInput struct {
// This field is from variant [RealtimeSessionCreateResponseAudioInput].
Format RealtimeAudioFormatsUnion `json:"format"`
// This field is a union of
// [RealtimeSessionCreateResponseAudioInputNoiseReduction],
// [RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction]
NoiseReduction ClientSecretNewResponseSessionUnionAudioInputNoiseReduction `json:"noise_reduction"`
// This field is from variant [RealtimeSessionCreateResponseAudioInput].
Transcription AudioTranscription `json:"transcription"`
// This field is a union of
// [RealtimeSessionCreateResponseAudioInputTurnDetectionUnion],
// [RealtimeTranscriptionSessionTurnDetection]
TurnDetection ClientSecretNewResponseSessionUnionAudioInputTurnDetection `json:"turn_detection"`
JSON struct {
Format respjson.Field
NoiseReduction respjson.Field
Transcription respjson.Field
TurnDetection respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ClientSecretNewResponseSessionUnionAudioInput is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudioInput provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.
func (*ClientSecretNewResponseSessionUnionAudioInput) UnmarshalJSON ¶
func (r *ClientSecretNewResponseSessionUnionAudioInput) UnmarshalJSON(data []byte) error
type ClientSecretNewResponseSessionUnionAudioInputNoiseReduction ¶
type ClientSecretNewResponseSessionUnionAudioInputNoiseReduction struct {
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputNoiseReduction].
Type NoiseReductionType `json:"type"`
JSON struct {
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ClientSecretNewResponseSessionUnionAudioInputNoiseReduction is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudioInputNoiseReduction provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.
func (*ClientSecretNewResponseSessionUnionAudioInputNoiseReduction) UnmarshalJSON ¶
func (r *ClientSecretNewResponseSessionUnionAudioInputNoiseReduction) UnmarshalJSON(data []byte) error
type ClientSecretNewResponseSessionUnionAudioInputTurnDetection ¶
type ClientSecretNewResponseSessionUnionAudioInputTurnDetection struct {
Type string `json:"type"`
CreateResponse bool `json:"create_response"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionUnion].
IdleTimeoutMs int64 `json:"idle_timeout_ms"`
InterruptResponse bool `json:"interrupt_response"`
PrefixPaddingMs int64 `json:"prefix_padding_ms"`
SilenceDurationMs int64 `json:"silence_duration_ms"`
Threshold float64 `json:"threshold"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionUnion].
Eagerness string `json:"eagerness"`
JSON struct {
Type respjson.Field
CreateResponse respjson.Field
IdleTimeoutMs respjson.Field
InterruptResponse respjson.Field
PrefixPaddingMs respjson.Field
SilenceDurationMs respjson.Field
Threshold respjson.Field
Eagerness respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ClientSecretNewResponseSessionUnionAudioInputTurnDetection is an implicit subunion of ClientSecretNewResponseSessionUnion. ClientSecretNewResponseSessionUnionAudioInputTurnDetection provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ClientSecretNewResponseSessionUnion.
func (*ClientSecretNewResponseSessionUnionAudioInputTurnDetection) UnmarshalJSON ¶
func (r *ClientSecretNewResponseSessionUnionAudioInputTurnDetection) UnmarshalJSON(data []byte) error
type ClientSecretService ¶
type ClientSecretService struct {
Options []option.RequestOption
}
ClientSecretService 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 NewClientSecretService method instead.
func NewClientSecretService ¶
func NewClientSecretService(opts ...option.RequestOption) (r ClientSecretService)
NewClientSecretService 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 (*ClientSecretService) New ¶
func (r *ClientSecretService) New(ctx context.Context, body ClientSecretNewParams, opts ...option.RequestOption) (res *ClientSecretNewResponse, err error)
Create a Realtime client secret with an associated session configuration.
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`, `in`, `nin`.
- `eq`: equals - `ne`: not equal - `gt`: greater than - `gte`: greater than or equal - `lt`: less than - `lte`: less than or equal - `in`: in - `nin`: not in
This is an alias to an internal type.
type ComparisonFilterValueArrayItemUnion ¶ added in v3.3.0
type ComparisonFilterValueArrayItemUnion = shared.ComparisonFilterValueArrayItemUnion
This is an alias to an internal type.
type ComparisonFilterValueArrayItemUnionParam ¶ added in v3.3.0
type ComparisonFilterValueArrayItemUnionParam = shared.ComparisonFilterValueArrayItemUnionParam
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 CustomToolInputFormatGrammar ¶
type CustomToolInputFormatGrammar = shared.CustomToolInputFormatGrammar
A grammar defined by the user.
This is an alias to an internal type.
type CustomToolInputFormatGrammarParam ¶
type CustomToolInputFormatGrammarParam = shared.CustomToolInputFormatGrammarParam
A grammar defined by the user.
This is an alias to an internal type.
type CustomToolInputFormatText ¶
type CustomToolInputFormatText = shared.CustomToolInputFormatText
Unconstrained free-form text.
This is an alias to an internal type.
type CustomToolInputFormatTextParam ¶
type CustomToolInputFormatTextParam = shared.CustomToolInputFormatTextParam
Unconstrained free-form text.
This is an alias to an internal type.
type CustomToolInputFormatUnion ¶
type CustomToolInputFormatUnion = shared.CustomToolInputFormatUnion
The input format for the custom tool. Default is unconstrained text.
This is an alias to an internal type.
type CustomToolInputFormatUnionParam ¶
type CustomToolInputFormatUnionParam = shared.CustomToolInputFormatUnionParam
The input format for the custom tool. Default is unconstrained text.
This is an alias to an internal type.
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 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 NoiseReductionType ¶
type NoiseReductionType string
Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.
const ( NoiseReductionTypeNearField NoiseReductionType = "near_field" NoiseReductionTypeFarField NoiseReductionType = "far_field" )
type RealtimeAudioConfigInputNoiseReductionParam ¶
type RealtimeAudioConfigInputNoiseReductionParam struct {
// Type of noise reduction. `near_field` is for close-talking microphones such as
// headphones, `far_field` is for far-field microphones such as laptop or
// conference room microphones.
//
// Any of "near_field", "far_field".
Type NoiseReductionType `json:"type,omitzero"`
// contains filtered or unexported fields
}
Configuration for input audio noise reduction. This can be set to `null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
func (RealtimeAudioConfigInputNoiseReductionParam) MarshalJSON ¶
func (r RealtimeAudioConfigInputNoiseReductionParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioConfigInputNoiseReductionParam) UnmarshalJSON ¶
func (r *RealtimeAudioConfigInputNoiseReductionParam) UnmarshalJSON(data []byte) error
type RealtimeAudioConfigInputParam ¶
type RealtimeAudioConfigInputParam struct {
// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
// set to `null` to turn off, in which case the client must manually trigger model
// response.
//
// Server VAD means that the model will detect the start and end of speech based on
// audio volume and respond at the end of user speech.
//
// Semantic VAD is more advanced and uses a turn detection model (in conjunction
// with VAD) to semantically estimate whether the user has finished speaking, then
// dynamically sets a timeout based on this probability. For example, if user audio
// trails off with "uhhm", the model will score a low probability of turn end and
// wait longer for the user to continue speaking. This can be useful for more
// natural conversations, but may have a higher latency.
TurnDetection RealtimeAudioInputTurnDetectionUnionParam `json:"turn_detection,omitzero"`
// The format of the input audio.
Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
// Configuration for input audio noise reduction. This can be set to `null` to turn
// off. Noise reduction filters audio added to the input audio buffer before it is
// sent to VAD and the model. Filtering the audio can improve VAD and turn
// detection accuracy (reducing false positives) and model performance by improving
// perception of the input audio.
NoiseReduction RealtimeAudioConfigInputNoiseReductionParam `json:"noise_reduction,omitzero"`
// Configuration for input audio transcription, defaults to off and can be set to
// `null` to turn off once on. Input audio transcription is not native to the
// model, since the model consumes audio directly. Transcription runs
// asynchronously through
// [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
// and should be treated as guidance of input audio content rather than precisely
// what the model heard. The client can optionally set the language and prompt for
// transcription, these offer additional guidance to the transcription service.
Transcription AudioTranscriptionParam `json:"transcription,omitzero"`
// contains filtered or unexported fields
}
func (RealtimeAudioConfigInputParam) MarshalJSON ¶
func (r RealtimeAudioConfigInputParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioConfigInputParam) UnmarshalJSON ¶
func (r *RealtimeAudioConfigInputParam) UnmarshalJSON(data []byte) error
type RealtimeAudioConfigOutputParam ¶
type RealtimeAudioConfigOutputParam struct {
// The speed of the model's spoken response as a multiple of the original speed.
// 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed.
// This value can only be changed in between model turns, not while a response is
// in progress.
//
// This parameter is a post-processing adjustment to the audio after it is
// generated, it's also possible to prompt the model to speak faster or slower.
Speed param.Opt[float64] `json:"speed,omitzero"`
// The format of the output audio.
Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
// The voice the model uses to respond. Voice cannot be changed during the session
// once the model has responded with audio at least once. Current voice options are
// `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`,
// and `cedar`. We recommend `marin` and `cedar` for best quality.
Voice RealtimeAudioConfigOutputVoice `json:"voice,omitzero"`
// contains filtered or unexported fields
}
func (RealtimeAudioConfigOutputParam) MarshalJSON ¶
func (r RealtimeAudioConfigOutputParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioConfigOutputParam) UnmarshalJSON ¶
func (r *RealtimeAudioConfigOutputParam) UnmarshalJSON(data []byte) error
type RealtimeAudioConfigOutputVoice ¶
type RealtimeAudioConfigOutputVoice string
The voice the model uses to respond. Voice cannot be changed during the session once the model has responded with audio at least once. Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for best quality.
const ( RealtimeAudioConfigOutputVoiceAlloy RealtimeAudioConfigOutputVoice = "alloy" RealtimeAudioConfigOutputVoiceAsh RealtimeAudioConfigOutputVoice = "ash" RealtimeAudioConfigOutputVoiceBallad RealtimeAudioConfigOutputVoice = "ballad" RealtimeAudioConfigOutputVoiceCoral RealtimeAudioConfigOutputVoice = "coral" RealtimeAudioConfigOutputVoiceEcho RealtimeAudioConfigOutputVoice = "echo" RealtimeAudioConfigOutputVoiceSage RealtimeAudioConfigOutputVoice = "sage" RealtimeAudioConfigOutputVoiceShimmer RealtimeAudioConfigOutputVoice = "shimmer" RealtimeAudioConfigOutputVoiceVerse RealtimeAudioConfigOutputVoice = "verse" RealtimeAudioConfigOutputVoiceMarin RealtimeAudioConfigOutputVoice = "marin" RealtimeAudioConfigOutputVoiceCedar RealtimeAudioConfigOutputVoice = "cedar" )
type RealtimeAudioConfigParam ¶
type RealtimeAudioConfigParam struct {
Input RealtimeAudioConfigInputParam `json:"input,omitzero"`
Output RealtimeAudioConfigOutputParam `json:"output,omitzero"`
// contains filtered or unexported fields
}
Configuration for input and output audio.
func (RealtimeAudioConfigParam) MarshalJSON ¶
func (r RealtimeAudioConfigParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioConfigParam) UnmarshalJSON ¶
func (r *RealtimeAudioConfigParam) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsAudioPCM ¶
type RealtimeAudioFormatsAudioPCM struct {
// The sample rate of the audio. Always `24000`.
//
// Any of 24000.
Rate int64 `json:"rate"`
// The audio format. Always `audio/pcm`.
//
// Any of "audio/pcm".
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Rate respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The PCM audio format. Only a 24kHz sample rate is supported.
func (RealtimeAudioFormatsAudioPCM) RawJSON ¶
func (r RealtimeAudioFormatsAudioPCM) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeAudioFormatsAudioPCM) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsAudioPCM) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsAudioPCMA ¶
type RealtimeAudioFormatsAudioPCMA struct {
// The audio format. Always `audio/pcma`.
//
// Any of "audio/pcma".
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The G.711 A-law format.
func (RealtimeAudioFormatsAudioPCMA) RawJSON ¶
func (r RealtimeAudioFormatsAudioPCMA) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeAudioFormatsAudioPCMA) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsAudioPCMA) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsAudioPCMAParam ¶
type RealtimeAudioFormatsAudioPCMAParam struct {
// The audio format. Always `audio/pcma`.
//
// Any of "audio/pcma".
Type string `json:"type,omitzero"`
// contains filtered or unexported fields
}
The G.711 A-law format.
func (RealtimeAudioFormatsAudioPCMAParam) MarshalJSON ¶
func (r RealtimeAudioFormatsAudioPCMAParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioFormatsAudioPCMAParam) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsAudioPCMAParam) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsAudioPCMParam ¶
type RealtimeAudioFormatsAudioPCMParam struct {
// The sample rate of the audio. Always `24000`.
//
// Any of 24000.
Rate int64 `json:"rate,omitzero"`
// The audio format. Always `audio/pcm`.
//
// Any of "audio/pcm".
Type string `json:"type,omitzero"`
// contains filtered or unexported fields
}
The PCM audio format. Only a 24kHz sample rate is supported.
func (RealtimeAudioFormatsAudioPCMParam) MarshalJSON ¶
func (r RealtimeAudioFormatsAudioPCMParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioFormatsAudioPCMParam) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsAudioPCMParam) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsAudioPCMU ¶
type RealtimeAudioFormatsAudioPCMU struct {
// The audio format. Always `audio/pcmu`.
//
// Any of "audio/pcmu".
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The G.711 μ-law format.
func (RealtimeAudioFormatsAudioPCMU) RawJSON ¶
func (r RealtimeAudioFormatsAudioPCMU) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeAudioFormatsAudioPCMU) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsAudioPCMU) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsAudioPCMUParam ¶
type RealtimeAudioFormatsAudioPCMUParam struct {
// The audio format. Always `audio/pcmu`.
//
// Any of "audio/pcmu".
Type string `json:"type,omitzero"`
// contains filtered or unexported fields
}
The G.711 μ-law format.
func (RealtimeAudioFormatsAudioPCMUParam) MarshalJSON ¶
func (r RealtimeAudioFormatsAudioPCMUParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioFormatsAudioPCMUParam) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsAudioPCMUParam) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsUnion ¶
type RealtimeAudioFormatsUnion struct {
// This field is from variant [RealtimeAudioFormatsAudioPCM].
Rate int64 `json:"rate"`
// Any of "audio/pcm", "audio/pcmu", "audio/pcma".
Type string `json:"type"`
JSON struct {
Rate respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeAudioFormatsUnion contains all possible properties and values from RealtimeAudioFormatsAudioPCM, RealtimeAudioFormatsAudioPCMU, RealtimeAudioFormatsAudioPCMA.
Use the RealtimeAudioFormatsUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (RealtimeAudioFormatsUnion) AsAny ¶
func (u RealtimeAudioFormatsUnion) AsAny() anyRealtimeAudioFormats
Use the following switch statement to find the correct variant
switch variant := RealtimeAudioFormatsUnion.AsAny().(type) {
case realtime.RealtimeAudioFormatsAudioPCM:
case realtime.RealtimeAudioFormatsAudioPCMU:
case realtime.RealtimeAudioFormatsAudioPCMA:
default:
fmt.Errorf("no variant present")
}
func (RealtimeAudioFormatsUnion) AsAudioPCM ¶
func (u RealtimeAudioFormatsUnion) AsAudioPCM() (v RealtimeAudioFormatsAudioPCM)
func (RealtimeAudioFormatsUnion) AsAudioPCMA ¶
func (u RealtimeAudioFormatsUnion) AsAudioPCMA() (v RealtimeAudioFormatsAudioPCMA)
func (RealtimeAudioFormatsUnion) AsAudioPCMU ¶
func (u RealtimeAudioFormatsUnion) AsAudioPCMU() (v RealtimeAudioFormatsAudioPCMU)
func (RealtimeAudioFormatsUnion) RawJSON ¶
func (u RealtimeAudioFormatsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (RealtimeAudioFormatsUnion) ToParam ¶
func (r RealtimeAudioFormatsUnion) ToParam() RealtimeAudioFormatsUnionParam
ToParam converts this RealtimeAudioFormatsUnion to a RealtimeAudioFormatsUnionParam.
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 RealtimeAudioFormatsUnionParam.Overrides()
func (*RealtimeAudioFormatsUnion) UnmarshalJSON ¶
func (r *RealtimeAudioFormatsUnion) UnmarshalJSON(data []byte) error
type RealtimeAudioFormatsUnionParam ¶
type RealtimeAudioFormatsUnionParam struct {
OfAudioPCM *RealtimeAudioFormatsAudioPCMParam `json:",omitzero,inline"`
OfAudioPCMU *RealtimeAudioFormatsAudioPCMUParam `json:",omitzero,inline"`
OfAudioPCMA *RealtimeAudioFormatsAudioPCMAParam `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 (RealtimeAudioFormatsUnionParam) GetRate ¶
func (u RealtimeAudioFormatsUnionParam) GetRate() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioFormatsUnionParam) GetType ¶
func (u RealtimeAudioFormatsUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioFormatsUnionParam) MarshalJSON ¶
func (u RealtimeAudioFormatsUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeAudioFormatsUnionParam) UnmarshalJSON ¶
func (u *RealtimeAudioFormatsUnionParam) UnmarshalJSON(data []byte) error
type RealtimeAudioInputTurnDetectionSemanticVadParam ¶
type RealtimeAudioInputTurnDetectionSemanticVadParam struct {
// Whether or not to automatically generate a response when a VAD stop event
// occurs.
CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
// Whether or not to automatically interrupt any ongoing response with output to
// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
// occurs.
InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
// will wait longer for the user to continue speaking, `high` will respond more
// quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`,
// and `high` have max timeouts of 8s, 4s, and 2s respectively.
//
// Any of "low", "medium", "high", "auto".
Eagerness string `json:"eagerness,omitzero"`
// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
//
// This field can be elided, and will marshal its zero value as "semantic_vad".
Type constant.SemanticVad `json:"type,required"`
// contains filtered or unexported fields
}
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
The property Type is required.
func (RealtimeAudioInputTurnDetectionSemanticVadParam) MarshalJSON ¶
func (r RealtimeAudioInputTurnDetectionSemanticVadParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioInputTurnDetectionSemanticVadParam) UnmarshalJSON ¶
func (r *RealtimeAudioInputTurnDetectionSemanticVadParam) UnmarshalJSON(data []byte) error
type RealtimeAudioInputTurnDetectionServerVadParam ¶
type RealtimeAudioInputTurnDetectionServerVadParam struct {
// Optional timeout after which a model response will be triggered automatically.
// This is useful for situations in which a long pause from the user is unexpected,
// such as a phone call. The model will effectively prompt the user to continue the
// conversation based on the current context.
//
// The timeout value will be applied after the last model response's audio has
// finished playing, i.e. it's set to the `response.done` time plus audio playback
// duration.
//
// An `input_audio_buffer.timeout_triggered` event (plus events associated with the
// Response) will be emitted when the timeout is reached. Idle timeout is currently
// only supported for `server_vad` mode.
IdleTimeoutMs param.Opt[int64] `json:"idle_timeout_ms,omitzero"`
// Whether or not to automatically generate a response when a VAD stop event
// occurs.
CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
// Whether or not to automatically interrupt any ongoing response with output to
// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
// occurs.
InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
// Used only for `server_vad` mode. Amount of audio to include before the VAD
// detected speech (in milliseconds). Defaults to 300ms.
PrefixPaddingMs param.Opt[int64] `json:"prefix_padding_ms,omitzero"`
// Used only for `server_vad` mode. Duration of silence to detect speech stop (in
// milliseconds). Defaults to 500ms. With shorter values the model will respond
// more quickly, but may jump in on short pauses from the user.
SilenceDurationMs param.Opt[int64] `json:"silence_duration_ms,omitzero"`
// Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
// defaults to 0.5. A higher threshold will require louder audio to activate the
// model, and thus might perform better in noisy environments.
Threshold param.Opt[float64] `json:"threshold,omitzero"`
// Type of turn detection, `server_vad` to turn on simple Server VAD.
//
// This field can be elided, and will marshal its zero value as "server_vad".
Type constant.ServerVad `json:"type,required"`
// contains filtered or unexported fields
}
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
The property Type is required.
func (RealtimeAudioInputTurnDetectionServerVadParam) MarshalJSON ¶
func (r RealtimeAudioInputTurnDetectionServerVadParam) MarshalJSON() (data []byte, err error)
func (*RealtimeAudioInputTurnDetectionServerVadParam) UnmarshalJSON ¶
func (r *RealtimeAudioInputTurnDetectionServerVadParam) UnmarshalJSON(data []byte) error
type RealtimeAudioInputTurnDetectionUnionParam ¶
type RealtimeAudioInputTurnDetectionUnionParam struct {
OfServerVad *RealtimeAudioInputTurnDetectionServerVadParam `json:",omitzero,inline"`
OfSemanticVad *RealtimeAudioInputTurnDetectionSemanticVadParam `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 (RealtimeAudioInputTurnDetectionUnionParam) GetCreateResponse ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetCreateResponse() *bool
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetEagerness ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetEagerness() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetInterruptResponse ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetInterruptResponse() *bool
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetSilenceDurationMs ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetSilenceDurationMs() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetThreshold ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetThreshold() *float64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) GetType ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeAudioInputTurnDetectionUnionParam) MarshalJSON ¶
func (u RealtimeAudioInputTurnDetectionUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeAudioInputTurnDetectionUnionParam) UnmarshalJSON ¶
func (u *RealtimeAudioInputTurnDetectionUnionParam) UnmarshalJSON(data []byte) error
type RealtimeFunctionTool ¶
type RealtimeFunctionTool struct {
// The description of the function, including guidance on when and how to call it,
// and guidance about what to tell the user when calling (if anything).
Description string `json:"description"`
// The name of the function.
Name string `json:"name"`
// Parameters of the function in JSON Schema.
Parameters any `json:"parameters"`
// The type of the tool, i.e. `function`.
//
// Any of "function".
Type RealtimeFunctionToolType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
Name respjson.Field
Parameters respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (RealtimeFunctionTool) RawJSON ¶
func (r RealtimeFunctionTool) RawJSON() string
Returns the unmodified JSON received from the API
func (RealtimeFunctionTool) ToParam ¶
func (r RealtimeFunctionTool) ToParam() RealtimeFunctionToolParam
ToParam converts this RealtimeFunctionTool to a RealtimeFunctionToolParam.
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 RealtimeFunctionToolParam.Overrides()
func (*RealtimeFunctionTool) UnmarshalJSON ¶
func (r *RealtimeFunctionTool) UnmarshalJSON(data []byte) error
type RealtimeFunctionToolParam ¶
type RealtimeFunctionToolParam struct {
// The description of the function, including guidance on when and how to call it,
// and guidance about what to tell the user when calling (if anything).
Description param.Opt[string] `json:"description,omitzero"`
// The name of the function.
Name param.Opt[string] `json:"name,omitzero"`
// Parameters of the function in JSON Schema.
Parameters any `json:"parameters,omitzero"`
// The type of the tool, i.e. `function`.
//
// Any of "function".
Type RealtimeFunctionToolType `json:"type,omitzero"`
// contains filtered or unexported fields
}
func (RealtimeFunctionToolParam) MarshalJSON ¶
func (r RealtimeFunctionToolParam) MarshalJSON() (data []byte, err error)
func (*RealtimeFunctionToolParam) UnmarshalJSON ¶
func (r *RealtimeFunctionToolParam) UnmarshalJSON(data []byte) error
type RealtimeFunctionToolType ¶
type RealtimeFunctionToolType string
The type of the tool, i.e. `function`.
const (
RealtimeFunctionToolTypeFunction RealtimeFunctionToolType = "function"
)
type RealtimeService ¶
type RealtimeService struct {
Options []option.RequestOption
ClientSecrets ClientSecretService
Calls CallService
}
RealtimeService 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 NewRealtimeService method instead.
func NewRealtimeService ¶
func NewRealtimeService(opts ...option.RequestOption) (r RealtimeService)
NewRealtimeService 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.
type RealtimeSessionClientSecret ¶
type RealtimeSessionClientSecret struct {
// Timestamp for when the token expires. Currently, all tokens expire after one
// minute.
ExpiresAt int64 `json:"expires_at,required"`
// Ephemeral key usable in client environments to authenticate connections to the
// Realtime API. Use this in client-side environments rather than a standard API
// token, which should only be used server-side.
Value string `json:"value,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ExpiresAt respjson.Field
Value respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Ephemeral key returned by the API.
func (RealtimeSessionClientSecret) RawJSON ¶
func (r RealtimeSessionClientSecret) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionClientSecret) UnmarshalJSON ¶
func (r *RealtimeSessionClientSecret) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateRequestMaxOutputTokensUnionParam ¶
type RealtimeSessionCreateRequestMaxOutputTokensUnionParam struct {
OfInt param.Opt[int64] `json:",omitzero,inline"`
// Construct this variant with constant.ValueOf[constant.Inf]()
OfInf constant.Inf `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 (RealtimeSessionCreateRequestMaxOutputTokensUnionParam) MarshalJSON ¶
func (u RealtimeSessionCreateRequestMaxOutputTokensUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeSessionCreateRequestMaxOutputTokensUnionParam) UnmarshalJSON ¶
func (u *RealtimeSessionCreateRequestMaxOutputTokensUnionParam) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateRequestModel ¶
type RealtimeSessionCreateRequestModel = string
The Realtime model used for this session.
const ( RealtimeSessionCreateRequestModelGPTRealtime RealtimeSessionCreateRequestModel = "gpt-realtime" RealtimeSessionCreateRequestModelGPTRealtime2025_08_28 RealtimeSessionCreateRequestModel = "gpt-realtime-2025-08-28" RealtimeSessionCreateRequestModelGPT4oRealtimePreview RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview" RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-10-01" RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_12_17 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-12-17" RealtimeSessionCreateRequestModelGPT4oRealtimePreview2025_06_03 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2025-06-03" RealtimeSessionCreateRequestModelGPT4oMiniRealtimePreview RealtimeSessionCreateRequestModel = "gpt-4o-mini-realtime-preview" RealtimeSessionCreateRequestModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateRequestModel = "gpt-4o-mini-realtime-preview-2024-12-17" RealtimeSessionCreateRequestModelGPTRealtimeMini RealtimeSessionCreateRequestModel = "gpt-realtime-mini" RealtimeSessionCreateRequestModelGPTRealtimeMini2025_10_06 RealtimeSessionCreateRequestModel = "gpt-realtime-mini-2025-10-06" RealtimeSessionCreateRequestModelGPTAudioMini RealtimeSessionCreateRequestModel = "gpt-audio-mini" RealtimeSessionCreateRequestModelGPTAudioMini2025_10_06 RealtimeSessionCreateRequestModel = "gpt-audio-mini-2025-10-06" )
type RealtimeSessionCreateRequestParam ¶
type RealtimeSessionCreateRequestParam struct {
// The default system instructions (i.e. system message) prepended to model calls.
// This field allows the client to guide the model on desired responses. The model
// can be instructed on response content and format, (e.g. "be extremely succinct",
// "act friendly", "here are examples of good responses") and on audio behavior
// (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
// instructions are not guaranteed to be followed by the model, but they provide
// guidance to the model on the desired behavior.
//
// Note that the server sets default instructions which will be used if this field
// is not set and are visible in the `session.created` event at the start of the
// session.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
Prompt responses.ResponsePromptParam `json:"prompt,omitzero"`
// Realtime API can write session traces to the
// [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
// tracing is enabled for a session, the configuration cannot be modified.
//
// `auto` will create a trace for the session with default values for the workflow
// name, group id, and metadata.
Tracing RealtimeTracingConfigUnionParam `json:"tracing,omitzero"`
// Configuration for input and output audio.
Audio RealtimeAudioConfigParam `json:"audio,omitzero"`
// Additional fields to include in server outputs.
//
// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
// transcription.
//
// Any of "item.input_audio_transcription.logprobs".
Include []string `json:"include,omitzero"`
// Maximum number of output tokens for a single assistant response, inclusive of
// tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
// `inf` for the maximum available tokens for a given model. Defaults to `inf`.
MaxOutputTokens RealtimeSessionCreateRequestMaxOutputTokensUnionParam `json:"max_output_tokens,omitzero"`
// The Realtime model used for this session.
Model RealtimeSessionCreateRequestModel `json:"model,omitzero"`
// The set of modalities the model can respond with. It defaults to `["audio"]`,
// indicating that the model will respond with audio plus a transcript. `["text"]`
// can be used to make the model respond with text only. It is not possible to
// request both `text` and `audio` at the same time.
//
// Any of "text", "audio".
OutputModalities []string `json:"output_modalities,omitzero"`
// How the model chooses tools. Provide one of the string modes or force a specific
// function/MCP tool.
ToolChoice RealtimeToolChoiceConfigUnionParam `json:"tool_choice,omitzero"`
// Tools available to the model.
Tools RealtimeToolsConfigParam `json:"tools,omitzero"`
// Controls how the realtime conversation is truncated prior to model inference.
// The default is `auto`.
Truncation RealtimeTruncationUnionParam `json:"truncation,omitzero"`
// The type of session to create. Always `realtime` for the Realtime API.
//
// This field can be elided, and will marshal its zero value as "realtime".
Type constant.Realtime `json:"type,required"`
// contains filtered or unexported fields
}
Realtime session object configuration.
The property Type is required.
func (RealtimeSessionCreateRequestParam) MarshalJSON ¶
func (r RealtimeSessionCreateRequestParam) MarshalJSON() (data []byte, err error)
func (*RealtimeSessionCreateRequestParam) UnmarshalJSON ¶
func (r *RealtimeSessionCreateRequestParam) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponse ¶
type RealtimeSessionCreateResponse struct {
// Ephemeral key returned by the API.
ClientSecret RealtimeSessionClientSecret `json:"client_secret,required"`
// The type of session to create. Always `realtime` for the Realtime API.
Type constant.Realtime `json:"type,required"`
// Configuration for input and output audio.
Audio RealtimeSessionCreateResponseAudio `json:"audio"`
// Additional fields to include in server outputs.
//
// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
// transcription.
//
// Any of "item.input_audio_transcription.logprobs".
Include []string `json:"include"`
// The default system instructions (i.e. system message) prepended to model calls.
// This field allows the client to guide the model on desired responses. The model
// can be instructed on response content and format, (e.g. "be extremely succinct",
// "act friendly", "here are examples of good responses") and on audio behavior
// (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
// instructions are not guaranteed to be followed by the model, but they provide
// guidance to the model on the desired behavior.
//
// Note that the server sets default instructions which will be used if this field
// is not set and are visible in the `session.created` event at the start of the
// session.
Instructions string `json:"instructions"`
// Maximum number of output tokens for a single assistant response, inclusive of
// tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
// `inf` for the maximum available tokens for a given model. Defaults to `inf`.
MaxOutputTokens RealtimeSessionCreateResponseMaxOutputTokensUnion `json:"max_output_tokens"`
// The Realtime model used for this session.
Model RealtimeSessionCreateResponseModel `json:"model"`
// The set of modalities the model can respond with. It defaults to `["audio"]`,
// indicating that the model will respond with audio plus a transcript. `["text"]`
// can be used to make the model respond with text only. It is not possible to
// request both `text` and `audio` at the same time.
//
// Any of "text", "audio".
OutputModalities []string `json:"output_modalities"`
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
Prompt responses.ResponsePrompt `json:"prompt,nullable"`
// How the model chooses tools. Provide one of the string modes or force a specific
// function/MCP tool.
ToolChoice RealtimeSessionCreateResponseToolChoiceUnion `json:"tool_choice"`
// Tools available to the model.
Tools []RealtimeSessionCreateResponseToolUnion `json:"tools"`
// Realtime API can write session traces to the
// [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
// tracing is enabled for a session, the configuration cannot be modified.
//
// `auto` will create a trace for the session with default values for the workflow
// name, group id, and metadata.
Tracing RealtimeSessionCreateResponseTracingUnion `json:"tracing,nullable"`
// Controls how the realtime conversation is truncated prior to model inference.
// The default is `auto`.
Truncation RealtimeTruncationUnion `json:"truncation"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClientSecret respjson.Field
Type respjson.Field
Audio respjson.Field
Include respjson.Field
Instructions respjson.Field
MaxOutputTokens respjson.Field
Model respjson.Field
OutputModalities respjson.Field
Prompt respjson.Field
ToolChoice respjson.Field
Tools respjson.Field
Tracing respjson.Field
Truncation respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A new Realtime session configuration, with an ephemeral key. Default TTL for keys is one minute.
func (RealtimeSessionCreateResponse) RawJSON ¶
func (r RealtimeSessionCreateResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponse) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponse) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudio ¶
type RealtimeSessionCreateResponseAudio struct {
Input RealtimeSessionCreateResponseAudioInput `json:"input"`
Output RealtimeSessionCreateResponseAudioOutput `json:"output"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Input respjson.Field
Output respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Configuration for input and output audio.
func (RealtimeSessionCreateResponseAudio) RawJSON ¶
func (r RealtimeSessionCreateResponseAudio) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudio) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudio) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudioInput ¶
type RealtimeSessionCreateResponseAudioInput struct {
// The format of the input audio.
Format RealtimeAudioFormatsUnion `json:"format"`
// Configuration for input audio noise reduction. This can be set to `null` to turn
// off. Noise reduction filters audio added to the input audio buffer before it is
// sent to VAD and the model. Filtering the audio can improve VAD and turn
// detection accuracy (reducing false positives) and model performance by improving
// perception of the input audio.
NoiseReduction RealtimeSessionCreateResponseAudioInputNoiseReduction `json:"noise_reduction"`
// Configuration for input audio transcription, defaults to off and can be set to
// `null` to turn off once on. Input audio transcription is not native to the
// model, since the model consumes audio directly. Transcription runs
// asynchronously through
// [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
// and should be treated as guidance of input audio content rather than precisely
// what the model heard. The client can optionally set the language and prompt for
// transcription, these offer additional guidance to the transcription service.
Transcription AudioTranscription `json:"transcription"`
// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
// set to `null` to turn off, in which case the client must manually trigger model
// response.
//
// Server VAD means that the model will detect the start and end of speech based on
// audio volume and respond at the end of user speech.
//
// Semantic VAD is more advanced and uses a turn detection model (in conjunction
// with VAD) to semantically estimate whether the user has finished speaking, then
// dynamically sets a timeout based on this probability. For example, if user audio
// trails off with "uhhm", the model will score a low probability of turn end and
// wait longer for the user to continue speaking. This can be useful for more
// natural conversations, but may have a higher latency.
TurnDetection RealtimeSessionCreateResponseAudioInputTurnDetectionUnion `json:"turn_detection,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Format respjson.Field
NoiseReduction respjson.Field
Transcription respjson.Field
TurnDetection respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (RealtimeSessionCreateResponseAudioInput) RawJSON ¶
func (r RealtimeSessionCreateResponseAudioInput) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudioInput) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudioInput) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudioInputNoiseReduction ¶
type RealtimeSessionCreateResponseAudioInputNoiseReduction struct {
// Type of noise reduction. `near_field` is for close-talking microphones such as
// headphones, `far_field` is for far-field microphones such as laptop or
// conference room microphones.
//
// Any of "near_field", "far_field".
Type NoiseReductionType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Configuration for input audio noise reduction. This can be set to `null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
func (RealtimeSessionCreateResponseAudioInputNoiseReduction) RawJSON ¶
func (r RealtimeSessionCreateResponseAudioInputNoiseReduction) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudioInputNoiseReduction) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudioInputNoiseReduction) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad ¶
type RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad struct {
// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
Type constant.SemanticVad `json:"type,required"`
// Whether or not to automatically generate a response when a VAD stop event
// occurs.
CreateResponse bool `json:"create_response"`
// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
// will wait longer for the user to continue speaking, `high` will respond more
// quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`,
// and `high` have max timeouts of 8s, 4s, and 2s respectively.
//
// Any of "low", "medium", "high", "auto".
Eagerness string `json:"eagerness"`
// Whether or not to automatically interrupt any ongoing response with output to
// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
// occurs.
InterruptResponse bool `json:"interrupt_response"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
CreateResponse respjson.Field
Eagerness respjson.Field
InterruptResponse respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
func (RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad) RawJSON ¶
func (r RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad ¶
type RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad struct {
// Type of turn detection, `server_vad` to turn on simple Server VAD.
Type constant.ServerVad `json:"type,required"`
// Whether or not to automatically generate a response when a VAD stop event
// occurs.
CreateResponse bool `json:"create_response"`
// Optional timeout after which a model response will be triggered automatically.
// This is useful for situations in which a long pause from the user is unexpected,
// such as a phone call. The model will effectively prompt the user to continue the
// conversation based on the current context.
//
// The timeout value will be applied after the last model response's audio has
// finished playing, i.e. it's set to the `response.done` time plus audio playback
// duration.
//
// An `input_audio_buffer.timeout_triggered` event (plus events associated with the
// Response) will be emitted when the timeout is reached. Idle timeout is currently
// only supported for `server_vad` mode.
IdleTimeoutMs int64 `json:"idle_timeout_ms,nullable"`
// Whether or not to automatically interrupt any ongoing response with output to
// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
// occurs.
InterruptResponse bool `json:"interrupt_response"`
// Used only for `server_vad` mode. Amount of audio to include before the VAD
// detected speech (in milliseconds). Defaults to 300ms.
PrefixPaddingMs int64 `json:"prefix_padding_ms"`
// Used only for `server_vad` mode. Duration of silence to detect speech stop (in
// milliseconds). Defaults to 500ms. With shorter values the model will respond
// more quickly, but may jump in on short pauses from the user.
SilenceDurationMs int64 `json:"silence_duration_ms"`
// Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
// defaults to 0.5. A higher threshold will require louder audio to activate the
// model, and thus might perform better in noisy environments.
Threshold float64 `json:"threshold"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
CreateResponse respjson.Field
IdleTimeoutMs respjson.Field
InterruptResponse respjson.Field
PrefixPaddingMs respjson.Field
SilenceDurationMs respjson.Field
Threshold respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
func (RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad) RawJSON ¶
func (r RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudioInputTurnDetectionUnion ¶
type RealtimeSessionCreateResponseAudioInputTurnDetectionUnion struct {
// Any of "server_vad", "semantic_vad".
Type string `json:"type"`
CreateResponse bool `json:"create_response"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
IdleTimeoutMs int64 `json:"idle_timeout_ms"`
InterruptResponse bool `json:"interrupt_response"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
PrefixPaddingMs int64 `json:"prefix_padding_ms"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
SilenceDurationMs int64 `json:"silence_duration_ms"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad].
Threshold float64 `json:"threshold"`
// This field is from variant
// [RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad].
Eagerness string `json:"eagerness"`
JSON struct {
Type respjson.Field
CreateResponse respjson.Field
IdleTimeoutMs respjson.Field
InterruptResponse respjson.Field
PrefixPaddingMs respjson.Field
SilenceDurationMs respjson.Field
Threshold respjson.Field
Eagerness respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseAudioInputTurnDetectionUnion contains all possible properties and values from RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad, RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad.
Use the RealtimeSessionCreateResponseAudioInputTurnDetectionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsAny ¶
func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsAny() anyRealtimeSessionCreateResponseAudioInputTurnDetection
Use the following switch statement to find the correct variant
switch variant := RealtimeSessionCreateResponseAudioInputTurnDetectionUnion.AsAny().(type) {
case realtime.RealtimeSessionCreateResponseAudioInputTurnDetectionServerVad:
case realtime.RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad:
default:
fmt.Errorf("no variant present")
}
func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsSemanticVad ¶
func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsSemanticVad() (v RealtimeSessionCreateResponseAudioInputTurnDetectionSemanticVad)
func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) AsServerVad ¶
func (RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudioInputTurnDetectionUnion) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseAudioOutput ¶
type RealtimeSessionCreateResponseAudioOutput struct {
// The format of the output audio.
Format RealtimeAudioFormatsUnion `json:"format"`
// The speed of the model's spoken response as a multiple of the original speed.
// 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed.
// This value can only be changed in between model turns, not while a response is
// in progress.
//
// This parameter is a post-processing adjustment to the audio after it is
// generated, it's also possible to prompt the model to speak faster or slower.
Speed float64 `json:"speed"`
// The voice the model uses to respond. Voice cannot be changed during the session
// once the model has responded with audio at least once. Current voice options are
// `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`,
// and `cedar`. We recommend `marin` and `cedar` for best quality.
Voice string `json:"voice"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Format respjson.Field
Speed respjson.Field
Voice respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (RealtimeSessionCreateResponseAudioOutput) RawJSON ¶
func (r RealtimeSessionCreateResponseAudioOutput) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseAudioOutput) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseAudioOutput) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseMaxOutputTokensUnion ¶
type RealtimeSessionCreateResponseMaxOutputTokensUnion struct {
// This field will be present if the value is a [int64] instead of an object.
OfInt int64 `json:",inline"`
// This field will be present if the value is a [constant.Inf] instead of an
// object.
OfInf constant.Inf `json:",inline"`
JSON struct {
OfInt respjson.Field
OfInf respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseMaxOutputTokensUnion contains all possible properties and values from [int64], constant.Inf.
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: OfInt OfInf]
func (RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInf ¶
func (u RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInf() (v constant.Inf)
func (RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInt ¶
func (u RealtimeSessionCreateResponseMaxOutputTokensUnion) AsInt() (v int64)
func (RealtimeSessionCreateResponseMaxOutputTokensUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseMaxOutputTokensUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseMaxOutputTokensUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseMaxOutputTokensUnion) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseModel ¶
type RealtimeSessionCreateResponseModel string
The Realtime model used for this session.
const ( RealtimeSessionCreateResponseModelGPTRealtime RealtimeSessionCreateResponseModel = "gpt-realtime" RealtimeSessionCreateResponseModelGPTRealtime2025_08_28 RealtimeSessionCreateResponseModel = "gpt-realtime-2025-08-28" RealtimeSessionCreateResponseModelGPT4oRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview" RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-10-01" RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-12-17" RealtimeSessionCreateResponseModelGPT4oRealtimePreview2025_06_03 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2025-06-03" RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview" RealtimeSessionCreateResponseModelGPT4oMiniRealtimePreview2024_12_17 RealtimeSessionCreateResponseModel = "gpt-4o-mini-realtime-preview-2024-12-17" RealtimeSessionCreateResponseModelGPTRealtimeMini RealtimeSessionCreateResponseModel = "gpt-realtime-mini" RealtimeSessionCreateResponseModelGPTRealtimeMini2025_10_06 RealtimeSessionCreateResponseModel = "gpt-realtime-mini-2025-10-06" RealtimeSessionCreateResponseModelGPTAudioMini RealtimeSessionCreateResponseModel = "gpt-audio-mini" RealtimeSessionCreateResponseModelGPTAudioMini2025_10_06 RealtimeSessionCreateResponseModel = "gpt-audio-mini-2025-10-06" )
type RealtimeSessionCreateResponseToolChoiceUnion ¶
type RealtimeSessionCreateResponseToolChoiceUnion struct {
// This field will be present if the value is a [responses.ToolChoiceOptions]
// instead of an object.
OfToolChoiceMode responses.ToolChoiceOptions `json:",inline"`
Name string `json:"name"`
Type string `json:"type"`
// This field is from variant [responses.ToolChoiceMcp].
ServerLabel string `json:"server_label"`
JSON struct {
OfToolChoiceMode respjson.Field
Name respjson.Field
Type respjson.Field
ServerLabel respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseToolChoiceUnion contains all possible properties and values from responses.ToolChoiceOptions, responses.ToolChoiceFunction, responses.ToolChoiceMcp.
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 (RealtimeSessionCreateResponseToolChoiceUnion) AsFunctionTool ¶
func (u RealtimeSessionCreateResponseToolChoiceUnion) AsFunctionTool() (v responses.ToolChoiceFunction)
func (RealtimeSessionCreateResponseToolChoiceUnion) AsMcpTool ¶
func (u RealtimeSessionCreateResponseToolChoiceUnion) AsMcpTool() (v responses.ToolChoiceMcp)
func (RealtimeSessionCreateResponseToolChoiceUnion) AsToolChoiceMode ¶
func (u RealtimeSessionCreateResponseToolChoiceUnion) AsToolChoiceMode() (v responses.ToolChoiceOptions)
func (RealtimeSessionCreateResponseToolChoiceUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseToolChoiceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolChoiceUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolChoiceUnion) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpTool ¶
type RealtimeSessionCreateResponseToolMcpTool struct {
// A label for this MCP server, used to identify it in tool calls.
ServerLabel string `json:"server_label,required"`
// The type of the MCP tool. Always `mcp`.
Type constant.Mcp `json:"type,required"`
// List of allowed tool names or a filter object.
AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion `json:"allowed_tools,nullable"`
// An OAuth access token that can be used with a remote MCP server, either with a
// custom MCP server URL or a service connector. Your application must handle the
// OAuth authorization flow and provide the token here.
Authorization string `json:"authorization"`
// Identifier for service connectors, like those available in ChatGPT. One of
// `server_url` or `connector_id` must be provided. Learn more about service
// connectors
// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
//
// Currently supported `connector_id` values are:
//
// - Dropbox: `connector_dropbox`
// - Gmail: `connector_gmail`
// - Google Calendar: `connector_googlecalendar`
// - Google Drive: `connector_googledrive`
// - Microsoft Teams: `connector_microsoftteams`
// - Outlook Calendar: `connector_outlookcalendar`
// - Outlook Email: `connector_outlookemail`
// - SharePoint: `connector_sharepoint`
//
// Any of "connector_dropbox", "connector_gmail", "connector_googlecalendar",
// "connector_googledrive", "connector_microsoftteams",
// "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint".
ConnectorID string `json:"connector_id"`
// Optional HTTP headers to send to the MCP server. Use for authentication or other
// purposes.
Headers map[string]string `json:"headers,nullable"`
// Specify which of the MCP server's tools require approval.
RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion `json:"require_approval,nullable"`
// Optional description of the MCP server, used to provide more context.
ServerDescription string `json:"server_description"`
// The URL for the MCP server. One of `server_url` or `connector_id` must be
// provided.
ServerURL string `json:"server_url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ServerLabel respjson.Field
Type respjson.Field
AllowedTools respjson.Field
Authorization respjson.Field
ConnectorID respjson.Field
Headers respjson.Field
RequireApproval respjson.Field
ServerDescription respjson.Field
ServerURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
func (RealtimeSessionCreateResponseToolMcpTool) RawJSON ¶
func (r RealtimeSessionCreateResponseToolMcpTool) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpTool) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpTool) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter ¶
type RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter struct {
// Indicates whether or not a tool modifies data or is read-only. If an MCP server
// is
// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
// it will match this filter.
ReadOnly bool `json:"read_only"`
// List of allowed tool names.
ToolNames []string `json:"tool_names"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ReadOnly respjson.Field
ToolNames respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A filter object to specify which tools are allowed.
func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter) RawJSON ¶
func (r RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion ¶
type RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion struct {
// This field will be present if the value is a [[]string] instead of an object.
OfMcpAllowedTools []string `json:",inline"`
// This field is from variant
// [RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter].
ReadOnly bool `json:"read_only"`
// This field is from variant
// [RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter].
ToolNames []string `json:"tool_names"`
JSON struct {
OfMcpAllowedTools respjson.Field
ReadOnly respjson.Field
ToolNames respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion contains all possible properties and values from [[]string], RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter.
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: OfMcpAllowedTools]
func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpAllowedTools ¶
func (u RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpAllowedTools() (v []string)
func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpToolFilter ¶
func (u RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) AsMcpToolFilter() (v RealtimeSessionCreateResponseToolMcpToolAllowedToolsMcpToolFilter)
func (RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter ¶
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter struct {
// A filter object to specify which tools are allowed.
Always RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
// A filter object to specify which tools are allowed.
Never RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever `json:"never"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Always respjson.Field
Never respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Specify which of the MCP server's tools require approval. Can be `always`, `never`, or a filter object associated with tools that require approval.
func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter) RawJSON ¶
func (r RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways ¶
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways struct {
// Indicates whether or not a tool modifies data or is read-only. If an MCP server
// is
// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
// it will match this filter.
ReadOnly bool `json:"read_only"`
// List of allowed tool names.
ToolNames []string `json:"tool_names"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ReadOnly respjson.Field
ToolNames respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A filter object to specify which tools are allowed.
func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways) RawJSON ¶
func (r RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever ¶
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever struct {
// Indicates whether or not a tool modifies data or is read-only. If an MCP server
// is
// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
// it will match this filter.
ReadOnly bool `json:"read_only"`
// List of allowed tool names.
ToolNames []string `json:"tool_names"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ReadOnly respjson.Field
ToolNames respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A filter object to specify which tools are allowed.
func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever) RawJSON ¶
func (r RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting ¶
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting string
Specify a single approval policy for all tools. One of `always` or `never`. When set to `always`, all tools will require approval. When set to `never`, all tools will not require approval.
const ( RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingAlways RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "always" RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSettingNever RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalSetting = "never" )
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion ¶
type RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfMcpToolApprovalSetting string `json:",inline"`
// This field is from variant
// [RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter].
Always RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
// This field is from variant
// [RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter].
Never RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilterNever `json:"never"`
JSON struct {
OfMcpToolApprovalSetting respjson.Field
Always respjson.Field
Never respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion contains all possible properties and values from RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter, [string].
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: OfMcpToolApprovalSetting]
func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalFilter ¶
func (u RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalFilter() (v RealtimeSessionCreateResponseToolMcpToolRequireApprovalMcpToolApprovalFilter)
func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalSetting ¶
func (u RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) AsMcpToolApprovalSetting() (v string)
func (RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseToolUnion ¶
type RealtimeSessionCreateResponseToolUnion struct {
// This field is from variant [RealtimeFunctionTool].
Description string `json:"description"`
// This field is from variant [RealtimeFunctionTool].
Name string `json:"name"`
// This field is from variant [RealtimeFunctionTool].
Parameters any `json:"parameters"`
Type string `json:"type"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
ServerLabel string `json:"server_label"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion `json:"allowed_tools"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
Authorization string `json:"authorization"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
ConnectorID string `json:"connector_id"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
Headers map[string]string `json:"headers"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion `json:"require_approval"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
ServerDescription string `json:"server_description"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
ServerURL string `json:"server_url"`
JSON struct {
Description respjson.Field
Name respjson.Field
Parameters respjson.Field
Type respjson.Field
ServerLabel respjson.Field
AllowedTools respjson.Field
Authorization respjson.Field
ConnectorID respjson.Field
Headers respjson.Field
RequireApproval respjson.Field
ServerDescription respjson.Field
ServerURL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseToolUnion contains all possible properties and values from RealtimeFunctionTool, RealtimeSessionCreateResponseToolMcpTool.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (RealtimeSessionCreateResponseToolUnion) AsFunctionTool ¶
func (u RealtimeSessionCreateResponseToolUnion) AsFunctionTool() (v RealtimeFunctionTool)
func (RealtimeSessionCreateResponseToolUnion) AsMcpTool ¶
func (u RealtimeSessionCreateResponseToolUnion) AsMcpTool() (v RealtimeSessionCreateResponseToolMcpTool)
func (RealtimeSessionCreateResponseToolUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseToolUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseToolUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseToolUnion) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseTracingTracingConfiguration ¶
type RealtimeSessionCreateResponseTracingTracingConfiguration struct {
// The group id to attach to this trace to enable filtering and grouping in the
// Traces Dashboard.
GroupID string `json:"group_id"`
// The arbitrary metadata to attach to this trace to enable filtering in the Traces
// Dashboard.
Metadata any `json:"metadata"`
// The name of the workflow to attach to this trace. This is used to name the trace
// in the Traces Dashboard.
WorkflowName string `json:"workflow_name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
GroupID respjson.Field
Metadata respjson.Field
WorkflowName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Granular configuration for tracing.
func (RealtimeSessionCreateResponseTracingTracingConfiguration) RawJSON ¶
func (r RealtimeSessionCreateResponseTracingTracingConfiguration) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseTracingTracingConfiguration) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseTracingTracingConfiguration) UnmarshalJSON(data []byte) error
type RealtimeSessionCreateResponseTracingUnion ¶
type RealtimeSessionCreateResponseTracingUnion struct {
// This field will be present if the value is a [constant.Auto] instead of an
// object.
OfAuto constant.Auto `json:",inline"`
// This field is from variant
// [RealtimeSessionCreateResponseTracingTracingConfiguration].
GroupID string `json:"group_id"`
// This field is from variant
// [RealtimeSessionCreateResponseTracingTracingConfiguration].
Metadata any `json:"metadata"`
// This field is from variant
// [RealtimeSessionCreateResponseTracingTracingConfiguration].
WorkflowName string `json:"workflow_name"`
JSON struct {
OfAuto respjson.Field
GroupID respjson.Field
Metadata respjson.Field
WorkflowName respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeSessionCreateResponseTracingUnion contains all possible properties and values from constant.Auto, RealtimeSessionCreateResponseTracingTracingConfiguration.
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: OfAuto]
func (RealtimeSessionCreateResponseTracingUnion) AsAuto ¶
func (u RealtimeSessionCreateResponseTracingUnion) AsAuto() (v constant.Auto)
func (RealtimeSessionCreateResponseTracingUnion) AsTracingConfiguration ¶
func (u RealtimeSessionCreateResponseTracingUnion) AsTracingConfiguration() (v RealtimeSessionCreateResponseTracingTracingConfiguration)
func (RealtimeSessionCreateResponseTracingUnion) RawJSON ¶
func (u RealtimeSessionCreateResponseTracingUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeSessionCreateResponseTracingUnion) UnmarshalJSON ¶
func (r *RealtimeSessionCreateResponseTracingUnion) UnmarshalJSON(data []byte) error
type RealtimeToolChoiceConfigUnionParam ¶
type RealtimeToolChoiceConfigUnionParam struct {
// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
OfToolChoiceMode param.Opt[responses.ToolChoiceOptions] `json:",omitzero,inline"`
OfFunctionTool *responses.ToolChoiceFunctionParam `json:",omitzero,inline"`
OfMcpTool *responses.ToolChoiceMcpParam `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 RealtimeToolChoiceConfigParamOfFunctionTool ¶
func RealtimeToolChoiceConfigParamOfFunctionTool(name string) RealtimeToolChoiceConfigUnionParam
func RealtimeToolChoiceConfigParamOfMcpTool ¶
func RealtimeToolChoiceConfigParamOfMcpTool(serverLabel string) RealtimeToolChoiceConfigUnionParam
func (RealtimeToolChoiceConfigUnionParam) GetName ¶
func (u RealtimeToolChoiceConfigUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolChoiceConfigUnionParam) GetServerLabel ¶
func (u RealtimeToolChoiceConfigUnionParam) GetServerLabel() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolChoiceConfigUnionParam) GetType ¶
func (u RealtimeToolChoiceConfigUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolChoiceConfigUnionParam) MarshalJSON ¶
func (u RealtimeToolChoiceConfigUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeToolChoiceConfigUnionParam) UnmarshalJSON ¶
func (u *RealtimeToolChoiceConfigUnionParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigParam ¶
type RealtimeToolsConfigParam []RealtimeToolsConfigUnionParam
type RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam ¶
type RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam struct {
// Indicates whether or not a tool modifies data or is read-only. If an MCP server
// is
// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
// it will match this filter.
ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
// List of allowed tool names.
ToolNames []string `json:"tool_names,omitzero"`
// contains filtered or unexported fields
}
A filter object to specify which tools are allowed.
func (RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam) MarshalJSON ¶
func (r RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam) MarshalJSON() (data []byte, err error)
func (*RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam) UnmarshalJSON ¶
func (r *RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionMcpAllowedToolsParam ¶
type RealtimeToolsConfigUnionMcpAllowedToolsParam struct {
OfMcpAllowedTools []string `json:",omitzero,inline"`
OfMcpToolFilter *RealtimeToolsConfigUnionMcpAllowedToolsMcpToolFilterParam `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 (RealtimeToolsConfigUnionMcpAllowedToolsParam) MarshalJSON ¶
func (u RealtimeToolsConfigUnionMcpAllowedToolsParam) MarshalJSON() ([]byte, error)
func (*RealtimeToolsConfigUnionMcpAllowedToolsParam) UnmarshalJSON ¶
func (u *RealtimeToolsConfigUnionMcpAllowedToolsParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionMcpParam ¶
type RealtimeToolsConfigUnionMcpParam struct {
// A label for this MCP server, used to identify it in tool calls.
ServerLabel string `json:"server_label,required"`
// An OAuth access token that can be used with a remote MCP server, either with a
// custom MCP server URL or a service connector. Your application must handle the
// OAuth authorization flow and provide the token here.
Authorization param.Opt[string] `json:"authorization,omitzero"`
// Optional description of the MCP server, used to provide more context.
ServerDescription param.Opt[string] `json:"server_description,omitzero"`
// The URL for the MCP server. One of `server_url` or `connector_id` must be
// provided.
ServerURL param.Opt[string] `json:"server_url,omitzero"`
// List of allowed tool names or a filter object.
AllowedTools RealtimeToolsConfigUnionMcpAllowedToolsParam `json:"allowed_tools,omitzero"`
// Optional HTTP headers to send to the MCP server. Use for authentication or other
// purposes.
Headers map[string]string `json:"headers,omitzero"`
// Specify which of the MCP server's tools require approval.
RequireApproval RealtimeToolsConfigUnionMcpRequireApprovalParam `json:"require_approval,omitzero"`
// Identifier for service connectors, like those available in ChatGPT. One of
// `server_url` or `connector_id` must be provided. Learn more about service
// connectors
// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
//
// Currently supported `connector_id` values are:
//
// - Dropbox: `connector_dropbox`
// - Gmail: `connector_gmail`
// - Google Calendar: `connector_googlecalendar`
// - Google Drive: `connector_googledrive`
// - Microsoft Teams: `connector_microsoftteams`
// - Outlook Calendar: `connector_outlookcalendar`
// - Outlook Email: `connector_outlookemail`
// - SharePoint: `connector_sharepoint`
//
// Any of "connector_dropbox", "connector_gmail", "connector_googlecalendar",
// "connector_googledrive", "connector_microsoftteams",
// "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint".
ConnectorID string `json:"connector_id,omitzero"`
// The type of the MCP tool. Always `mcp`.
//
// This field can be elided, and will marshal its zero value as "mcp".
Type constant.Mcp `json:"type,required"`
// contains filtered or unexported fields
}
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
The properties ServerLabel, Type are required.
func (RealtimeToolsConfigUnionMcpParam) MarshalJSON ¶
func (r RealtimeToolsConfigUnionMcpParam) MarshalJSON() (data []byte, err error)
func (*RealtimeToolsConfigUnionMcpParam) UnmarshalJSON ¶
func (r *RealtimeToolsConfigUnionMcpParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam ¶
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam struct {
// Indicates whether or not a tool modifies data or is read-only. If an MCP server
// is
// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
// it will match this filter.
ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
// List of allowed tool names.
ToolNames []string `json:"tool_names,omitzero"`
// contains filtered or unexported fields
}
A filter object to specify which tools are allowed.
func (RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) MarshalJSON ¶
func (r RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) MarshalJSON() (data []byte, err error)
func (*RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) UnmarshalJSON ¶
func (r *RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam ¶
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam struct {
// Indicates whether or not a tool modifies data or is read-only. If an MCP server
// is
// [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
// it will match this filter.
ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
// List of allowed tool names.
ToolNames []string `json:"tool_names,omitzero"`
// contains filtered or unexported fields
}
A filter object to specify which tools are allowed.
func (RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam) MarshalJSON ¶
func (r RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam) MarshalJSON() (data []byte, err error)
func (*RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam) UnmarshalJSON ¶
func (r *RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam ¶
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam struct {
// A filter object to specify which tools are allowed.
Always RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterAlwaysParam `json:"always,omitzero"`
// A filter object to specify which tools are allowed.
Never RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterNeverParam `json:"never,omitzero"`
// contains filtered or unexported fields
}
Specify which of the MCP server's tools require approval. Can be `always`, `never`, or a filter object associated with tools that require approval.
func (RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON ¶
func (r RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON() (data []byte, err error)
func (*RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam) UnmarshalJSON ¶
func (r *RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting ¶
type RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting string
Specify a single approval policy for all tools. One of `always` or `never`. When set to `always`, all tools will require approval. When set to `never`, all tools will not require approval.
const ( RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSettingAlways RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting = "always" RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSettingNever RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalSetting = "never" )
type RealtimeToolsConfigUnionMcpRequireApprovalParam ¶
type RealtimeToolsConfigUnionMcpRequireApprovalParam struct {
OfMcpToolApprovalFilter *RealtimeToolsConfigUnionMcpRequireApprovalMcpToolApprovalFilterParam `json:",omitzero,inline"`
// Check if union is this variant with
// !param.IsOmitted(union.OfMcpToolApprovalSetting)
OfMcpToolApprovalSetting param.Opt[string] `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 (RealtimeToolsConfigUnionMcpRequireApprovalParam) MarshalJSON ¶
func (u RealtimeToolsConfigUnionMcpRequireApprovalParam) MarshalJSON() ([]byte, error)
func (*RealtimeToolsConfigUnionMcpRequireApprovalParam) UnmarshalJSON ¶
func (u *RealtimeToolsConfigUnionMcpRequireApprovalParam) UnmarshalJSON(data []byte) error
type RealtimeToolsConfigUnionParam ¶
type RealtimeToolsConfigUnionParam struct {
OfFunction *RealtimeFunctionToolParam `json:",omitzero,inline"`
OfMcp *RealtimeToolsConfigUnionMcpParam `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 RealtimeToolsConfigUnionParamOfMcp ¶
func RealtimeToolsConfigUnionParamOfMcp(serverLabel string) RealtimeToolsConfigUnionParam
func (RealtimeToolsConfigUnionParam) GetAllowedTools ¶
func (u RealtimeToolsConfigUnionParam) GetAllowedTools() *RealtimeToolsConfigUnionMcpAllowedToolsParam
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetAuthorization ¶
func (u RealtimeToolsConfigUnionParam) GetAuthorization() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetConnectorID ¶
func (u RealtimeToolsConfigUnionParam) GetConnectorID() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetDescription ¶
func (u RealtimeToolsConfigUnionParam) GetDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetHeaders ¶
func (u RealtimeToolsConfigUnionParam) GetHeaders() map[string]string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetName ¶
func (u RealtimeToolsConfigUnionParam) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetParameters ¶
func (u RealtimeToolsConfigUnionParam) GetParameters() *any
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetRequireApproval ¶
func (u RealtimeToolsConfigUnionParam) GetRequireApproval() *RealtimeToolsConfigUnionMcpRequireApprovalParam
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetServerDescription ¶
func (u RealtimeToolsConfigUnionParam) GetServerDescription() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetServerLabel ¶
func (u RealtimeToolsConfigUnionParam) GetServerLabel() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetServerURL ¶
func (u RealtimeToolsConfigUnionParam) GetServerURL() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) GetType ¶
func (u RealtimeToolsConfigUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeToolsConfigUnionParam) MarshalJSON ¶
func (u RealtimeToolsConfigUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeToolsConfigUnionParam) UnmarshalJSON ¶
func (u *RealtimeToolsConfigUnionParam) UnmarshalJSON(data []byte) error
type RealtimeTracingConfigTracingConfigurationParam ¶
type RealtimeTracingConfigTracingConfigurationParam struct {
// The group id to attach to this trace to enable filtering and grouping in the
// Traces Dashboard.
GroupID param.Opt[string] `json:"group_id,omitzero"`
// The name of the workflow to attach to this trace. This is used to name the trace
// in the Traces Dashboard.
WorkflowName param.Opt[string] `json:"workflow_name,omitzero"`
// The arbitrary metadata to attach to this trace to enable filtering in the Traces
// Dashboard.
Metadata any `json:"metadata,omitzero"`
// contains filtered or unexported fields
}
Granular configuration for tracing.
func (RealtimeTracingConfigTracingConfigurationParam) MarshalJSON ¶
func (r RealtimeTracingConfigTracingConfigurationParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTracingConfigTracingConfigurationParam) UnmarshalJSON ¶
func (r *RealtimeTracingConfigTracingConfigurationParam) UnmarshalJSON(data []byte) error
type RealtimeTracingConfigUnionParam ¶
type RealtimeTracingConfigUnionParam struct {
// Construct this variant with constant.ValueOf[constant.Auto]()
OfAuto constant.Auto `json:",omitzero,inline"`
OfTracingConfiguration *RealtimeTracingConfigTracingConfigurationParam `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 RealtimeTracingConfigParamOfAuto ¶
func RealtimeTracingConfigParamOfAuto() RealtimeTracingConfigUnionParam
func (RealtimeTracingConfigUnionParam) MarshalJSON ¶
func (u RealtimeTracingConfigUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeTracingConfigUnionParam) UnmarshalJSON ¶
func (u *RealtimeTracingConfigUnionParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionAudioInputNoiseReductionParam ¶
type RealtimeTranscriptionSessionAudioInputNoiseReductionParam struct {
// Type of noise reduction. `near_field` is for close-talking microphones such as
// headphones, `far_field` is for far-field microphones such as laptop or
// conference room microphones.
//
// Any of "near_field", "far_field".
Type NoiseReductionType `json:"type,omitzero"`
// contains filtered or unexported fields
}
Configuration for input audio noise reduction. This can be set to `null` to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.
func (RealtimeTranscriptionSessionAudioInputNoiseReductionParam) MarshalJSON ¶
func (r RealtimeTranscriptionSessionAudioInputNoiseReductionParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTranscriptionSessionAudioInputNoiseReductionParam) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionAudioInputNoiseReductionParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionAudioInputParam ¶
type RealtimeTranscriptionSessionAudioInputParam struct {
// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
// set to `null` to turn off, in which case the client must manually trigger model
// response.
//
// Server VAD means that the model will detect the start and end of speech based on
// audio volume and respond at the end of user speech.
//
// Semantic VAD is more advanced and uses a turn detection model (in conjunction
// with VAD) to semantically estimate whether the user has finished speaking, then
// dynamically sets a timeout based on this probability. For example, if user audio
// trails off with "uhhm", the model will score a low probability of turn end and
// wait longer for the user to continue speaking. This can be useful for more
// natural conversations, but may have a higher latency.
TurnDetection RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam `json:"turn_detection,omitzero"`
// The PCM audio format. Only a 24kHz sample rate is supported.
Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
// Configuration for input audio noise reduction. This can be set to `null` to turn
// off. Noise reduction filters audio added to the input audio buffer before it is
// sent to VAD and the model. Filtering the audio can improve VAD and turn
// detection accuracy (reducing false positives) and model performance by improving
// perception of the input audio.
NoiseReduction RealtimeTranscriptionSessionAudioInputNoiseReductionParam `json:"noise_reduction,omitzero"`
// Configuration for input audio transcription, defaults to off and can be set to
// `null` to turn off once on. Input audio transcription is not native to the
// model, since the model consumes audio directly. Transcription runs
// asynchronously through
// [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
// and should be treated as guidance of input audio content rather than precisely
// what the model heard. The client can optionally set the language and prompt for
// transcription, these offer additional guidance to the transcription service.
Transcription AudioTranscriptionParam `json:"transcription,omitzero"`
// contains filtered or unexported fields
}
func (RealtimeTranscriptionSessionAudioInputParam) MarshalJSON ¶
func (r RealtimeTranscriptionSessionAudioInputParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTranscriptionSessionAudioInputParam) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionAudioInputParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam ¶
type RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam struct {
// Whether or not to automatically generate a response when a VAD stop event
// occurs.
CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
// Whether or not to automatically interrupt any ongoing response with output to
// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
// occurs.
InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
// Used only for `semantic_vad` mode. The eagerness of the model to respond. `low`
// will wait longer for the user to continue speaking, `high` will respond more
// quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`,
// and `high` have max timeouts of 8s, 4s, and 2s respectively.
//
// Any of "low", "medium", "high", "auto".
Eagerness string `json:"eagerness,omitzero"`
// Type of turn detection, `semantic_vad` to turn on Semantic VAD.
//
// This field can be elided, and will marshal its zero value as "semantic_vad".
Type constant.SemanticVad `json:"type,required"`
// contains filtered or unexported fields
}
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
The property Type is required.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam) MarshalJSON ¶
func (r RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam ¶
type RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam struct {
// Optional timeout after which a model response will be triggered automatically.
// This is useful for situations in which a long pause from the user is unexpected,
// such as a phone call. The model will effectively prompt the user to continue the
// conversation based on the current context.
//
// The timeout value will be applied after the last model response's audio has
// finished playing, i.e. it's set to the `response.done` time plus audio playback
// duration.
//
// An `input_audio_buffer.timeout_triggered` event (plus events associated with the
// Response) will be emitted when the timeout is reached. Idle timeout is currently
// only supported for `server_vad` mode.
IdleTimeoutMs param.Opt[int64] `json:"idle_timeout_ms,omitzero"`
// Whether or not to automatically generate a response when a VAD stop event
// occurs.
CreateResponse param.Opt[bool] `json:"create_response,omitzero"`
// Whether or not to automatically interrupt any ongoing response with output to
// the default conversation (i.e. `conversation` of `auto`) when a VAD start event
// occurs.
InterruptResponse param.Opt[bool] `json:"interrupt_response,omitzero"`
// Used only for `server_vad` mode. Amount of audio to include before the VAD
// detected speech (in milliseconds). Defaults to 300ms.
PrefixPaddingMs param.Opt[int64] `json:"prefix_padding_ms,omitzero"`
// Used only for `server_vad` mode. Duration of silence to detect speech stop (in
// milliseconds). Defaults to 500ms. With shorter values the model will respond
// more quickly, but may jump in on short pauses from the user.
SilenceDurationMs param.Opt[int64] `json:"silence_duration_ms,omitzero"`
// Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this
// defaults to 0.5. A higher threshold will require louder audio to activate the
// model, and thus might perform better in noisy environments.
Threshold param.Opt[float64] `json:"threshold,omitzero"`
// Type of turn detection, `server_vad` to turn on simple Server VAD.
//
// This field can be elided, and will marshal its zero value as "server_vad".
Type constant.ServerVad `json:"type,required"`
// contains filtered or unexported fields
}
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
The property Type is required.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam) MarshalJSON ¶
func (r RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam ¶
type RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam struct {
OfServerVad *RealtimeTranscriptionSessionAudioInputTurnDetectionServerVadParam `json:",omitzero,inline"`
OfSemanticVad *RealtimeTranscriptionSessionAudioInputTurnDetectionSemanticVadParam `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 (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetCreateResponse ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetCreateResponse() *bool
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetEagerness ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetEagerness() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetIdleTimeoutMs() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetInterruptResponse ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetInterruptResponse() *bool
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetPrefixPaddingMs() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetSilenceDurationMs ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetSilenceDurationMs() *int64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetThreshold ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetThreshold() *float64
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetType ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) MarshalJSON ¶
func (u RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) UnmarshalJSON ¶
func (u *RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionAudioParam ¶
type RealtimeTranscriptionSessionAudioParam struct {
Input RealtimeTranscriptionSessionAudioInputParam `json:"input,omitzero"`
// contains filtered or unexported fields
}
Configuration for input and output audio.
func (RealtimeTranscriptionSessionAudioParam) MarshalJSON ¶
func (r RealtimeTranscriptionSessionAudioParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTranscriptionSessionAudioParam) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionAudioParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionCreateRequestParam ¶
type RealtimeTranscriptionSessionCreateRequestParam struct {
// Configuration for input and output audio.
Audio RealtimeTranscriptionSessionAudioParam `json:"audio,omitzero"`
// Additional fields to include in server outputs.
//
// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
// transcription.
//
// Any of "item.input_audio_transcription.logprobs".
Include []string `json:"include,omitzero"`
// The type of session to create. Always `transcription` for transcription
// sessions.
//
// This field can be elided, and will marshal its zero value as "transcription".
Type constant.Transcription `json:"type,required"`
// contains filtered or unexported fields
}
Realtime transcription session object configuration.
The property Type is required.
func (RealtimeTranscriptionSessionCreateRequestParam) MarshalJSON ¶
func (r RealtimeTranscriptionSessionCreateRequestParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTranscriptionSessionCreateRequestParam) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionCreateRequestParam) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionCreateResponse ¶
type RealtimeTranscriptionSessionCreateResponse struct {
// Unique identifier for the session that looks like `sess_1234567890abcdef`.
ID string `json:"id,required"`
// The object type. Always `realtime.transcription_session`.
Object string `json:"object,required"`
// The type of session. Always `transcription` for transcription sessions.
Type constant.Transcription `json:"type,required"`
// Configuration for input audio for the session.
Audio RealtimeTranscriptionSessionCreateResponseAudio `json:"audio"`
// Expiration timestamp for the session, in seconds since epoch.
ExpiresAt int64 `json:"expires_at"`
// Additional fields to include in server outputs.
//
// - `item.input_audio_transcription.logprobs`: Include logprobs for input audio
// transcription.
//
// Any of "item.input_audio_transcription.logprobs".
Include []string `json:"include"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Object respjson.Field
Type respjson.Field
Audio respjson.Field
ExpiresAt respjson.Field
Include respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A Realtime transcription session configuration object.
func (RealtimeTranscriptionSessionCreateResponse) RawJSON ¶
func (r RealtimeTranscriptionSessionCreateResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeTranscriptionSessionCreateResponse) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionCreateResponse) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionCreateResponseAudio ¶
type RealtimeTranscriptionSessionCreateResponseAudio struct {
Input RealtimeTranscriptionSessionCreateResponseAudioInput `json:"input"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Input respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Configuration for input audio for the session.
func (RealtimeTranscriptionSessionCreateResponseAudio) RawJSON ¶
func (r RealtimeTranscriptionSessionCreateResponseAudio) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeTranscriptionSessionCreateResponseAudio) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionCreateResponseAudio) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionCreateResponseAudioInput ¶
type RealtimeTranscriptionSessionCreateResponseAudioInput struct {
// The PCM audio format. Only a 24kHz sample rate is supported.
Format RealtimeAudioFormatsUnion `json:"format"`
// Configuration for input audio noise reduction.
NoiseReduction RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction `json:"noise_reduction"`
// Configuration of the transcription model.
Transcription AudioTranscription `json:"transcription"`
// Configuration for turn detection. Can be set to `null` to turn off. Server VAD
// means that the model will detect the start and end of speech based on audio
// volume and respond at the end of user speech.
TurnDetection RealtimeTranscriptionSessionTurnDetection `json:"turn_detection"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Format respjson.Field
NoiseReduction respjson.Field
Transcription respjson.Field
TurnDetection respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (RealtimeTranscriptionSessionCreateResponseAudioInput) RawJSON ¶
func (r RealtimeTranscriptionSessionCreateResponseAudioInput) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeTranscriptionSessionCreateResponseAudioInput) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionCreateResponseAudioInput) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction ¶
type RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction struct {
// Type of noise reduction. `near_field` is for close-talking microphones such as
// headphones, `far_field` is for far-field microphones such as laptop or
// conference room microphones.
//
// Any of "near_field", "far_field".
Type NoiseReductionType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Configuration for input audio noise reduction.
func (RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) RawJSON ¶
func (r RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) UnmarshalJSON(data []byte) error
type RealtimeTranscriptionSessionTurnDetection ¶
type RealtimeTranscriptionSessionTurnDetection struct {
// Amount of audio to include before the VAD detected speech (in milliseconds).
// Defaults to 300ms.
PrefixPaddingMs int64 `json:"prefix_padding_ms"`
// Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms.
// With shorter values the model will respond more quickly, but may jump in on
// short pauses from the user.
SilenceDurationMs int64 `json:"silence_duration_ms"`
// Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher
// threshold will require louder audio to activate the model, and thus might
// perform better in noisy environments.
Threshold float64 `json:"threshold"`
// Type of turn detection, only `server_vad` is currently supported.
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
PrefixPaddingMs respjson.Field
SilenceDurationMs respjson.Field
Threshold respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.
func (RealtimeTranscriptionSessionTurnDetection) RawJSON ¶
func (r RealtimeTranscriptionSessionTurnDetection) RawJSON() string
Returns the unmodified JSON received from the API
func (*RealtimeTranscriptionSessionTurnDetection) UnmarshalJSON ¶
func (r *RealtimeTranscriptionSessionTurnDetection) UnmarshalJSON(data []byte) error
type RealtimeTruncationRealtimeTruncationStrategy ¶
type RealtimeTruncationRealtimeTruncationStrategy string
The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.
const ( RealtimeTruncationRealtimeTruncationStrategyAuto RealtimeTruncationRealtimeTruncationStrategy = "auto" RealtimeTruncationRealtimeTruncationStrategyDisabled RealtimeTruncationRealtimeTruncationStrategy = "disabled" )
type RealtimeTruncationRetentionRatio ¶
type RealtimeTruncationRetentionRatio struct {
// Fraction of post-instruction conversation tokens to retain (0.0 - 1.0) when the
// conversation exceeds the input token limit.
RetentionRatio float64 `json:"retention_ratio,required"`
// Use retention ratio truncation.
Type constant.RetentionRatio `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RetentionRatio respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.
func (RealtimeTruncationRetentionRatio) RawJSON ¶
func (r RealtimeTruncationRetentionRatio) RawJSON() string
Returns the unmodified JSON received from the API
func (RealtimeTruncationRetentionRatio) ToParam ¶
func (r RealtimeTruncationRetentionRatio) ToParam() RealtimeTruncationRetentionRatioParam
ToParam converts this RealtimeTruncationRetentionRatio to a RealtimeTruncationRetentionRatioParam.
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 RealtimeTruncationRetentionRatioParam.Overrides()
func (*RealtimeTruncationRetentionRatio) UnmarshalJSON ¶
func (r *RealtimeTruncationRetentionRatio) UnmarshalJSON(data []byte) error
type RealtimeTruncationRetentionRatioParam ¶
type RealtimeTruncationRetentionRatioParam struct {
// Fraction of post-instruction conversation tokens to retain (0.0 - 1.0) when the
// conversation exceeds the input token limit.
RetentionRatio float64 `json:"retention_ratio,required"`
// Use retention ratio truncation.
//
// This field can be elided, and will marshal its zero value as "retention_ratio".
Type constant.RetentionRatio `json:"type,required"`
// contains filtered or unexported fields
}
Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.
The properties RetentionRatio, Type are required.
func (RealtimeTruncationRetentionRatioParam) MarshalJSON ¶
func (r RealtimeTruncationRetentionRatioParam) MarshalJSON() (data []byte, err error)
func (*RealtimeTruncationRetentionRatioParam) UnmarshalJSON ¶
func (r *RealtimeTruncationRetentionRatioParam) UnmarshalJSON(data []byte) error
type RealtimeTruncationUnion ¶
type RealtimeTruncationUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfRealtimeTruncationStrategy string `json:",inline"`
// This field is from variant [RealtimeTruncationRetentionRatio].
RetentionRatio float64 `json:"retention_ratio"`
// This field is from variant [RealtimeTruncationRetentionRatio].
Type constant.RetentionRatio `json:"type"`
JSON struct {
OfRealtimeTruncationStrategy respjson.Field
RetentionRatio respjson.Field
Type respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
RealtimeTruncationUnion contains all possible properties and values from [string], RealtimeTruncationRetentionRatio.
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: OfRealtimeTruncationStrategy]
func (RealtimeTruncationUnion) AsRealtimeTruncationStrategy ¶
func (u RealtimeTruncationUnion) AsRealtimeTruncationStrategy() (v string)
func (RealtimeTruncationUnion) AsRetentionRatioTruncation ¶
func (u RealtimeTruncationUnion) AsRetentionRatioTruncation() (v RealtimeTruncationRetentionRatio)
func (RealtimeTruncationUnion) RawJSON ¶
func (u RealtimeTruncationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (RealtimeTruncationUnion) ToParam ¶
func (r RealtimeTruncationUnion) ToParam() RealtimeTruncationUnionParam
ToParam converts this RealtimeTruncationUnion to a RealtimeTruncationUnionParam.
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 RealtimeTruncationUnionParam.Overrides()
func (*RealtimeTruncationUnion) UnmarshalJSON ¶
func (r *RealtimeTruncationUnion) UnmarshalJSON(data []byte) error
type RealtimeTruncationUnionParam ¶
type RealtimeTruncationUnionParam struct {
// Check if union is this variant with
// !param.IsOmitted(union.OfRealtimeTruncationStrategy)
OfRealtimeTruncationStrategy param.Opt[string] `json:",omitzero,inline"`
OfRetentionRatioTruncation *RealtimeTruncationRetentionRatioParam `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 RealtimeTruncationParamOfRetentionRatioTruncation ¶
func RealtimeTruncationParamOfRetentionRatioTruncation(retentionRatio float64) RealtimeTruncationUnionParam
func (RealtimeTruncationUnionParam) MarshalJSON ¶
func (u RealtimeTruncationUnionParam) MarshalJSON() ([]byte, error)
func (*RealtimeTruncationUnionParam) UnmarshalJSON ¶
func (u *RealtimeTruncationUnionParam) UnmarshalJSON(data []byte) error
type Reasoning ¶
**gpt-5 and 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
Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
Note: The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
This is an alias to an internal type.
type ReasoningGenerateSummary ¶
type ReasoningGenerateSummary = shared.ReasoningGenerateSummary
**Deprecated:** use `summary` instead.
A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.
This is an alias to an internal type.
type ReasoningParam ¶
type ReasoningParam = shared.ReasoningParam
**gpt-5 and 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 ReasoningSummary ¶
type ReasoningSummary = shared.ReasoningSummary
A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.
This is an alias to an internal type.
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 ResponseFormatTextParam ¶
type ResponseFormatTextParam = shared.ResponseFormatTextParam
Default response format. Used to generate text responses.
This is an alias to an internal type.
type ResponsesModel ¶
type ResponsesModel = shared.ResponsesModel
This is an alias to an internal type.