Documentation
¶
Index ¶
- Constants
- type ChatModel
- type ComparisonFilter
- type ComparisonFilterParam
- type ComparisonFilterType
- type ComparisonFilterValueUnion
- type ComparisonFilterValueUnionParam
- type CompoundFilter
- type CompoundFilterParam
- type CompoundFilterType
- type ComputerScreenshotContent
- type Conversation
- type ConversationDeletedResource
- type ConversationItemImageGenerationCall
- type ConversationItemList
- type ConversationItemLocalShellCall
- type ConversationItemLocalShellCallAction
- type ConversationItemLocalShellCallOutput
- type ConversationItemMcpApprovalRequest
- type ConversationItemMcpApprovalResponse
- type ConversationItemMcpCall
- type ConversationItemMcpListTools
- type ConversationItemMcpListToolsTool
- type ConversationItemUnion
- func (u ConversationItemUnion) AsAny() anyConversationItem
- func (u ConversationItemUnion) AsCodeInterpreterCall() (v responses.ResponseCodeInterpreterToolCall)
- func (u ConversationItemUnion) AsComputerCall() (v responses.ResponseComputerToolCall)
- func (u ConversationItemUnion) AsComputerCallOutput() (v responses.ResponseComputerToolCallOutputItem)
- func (u ConversationItemUnion) AsCustomToolCall() (v responses.ResponseCustomToolCall)
- func (u ConversationItemUnion) AsCustomToolCallOutput() (v responses.ResponseCustomToolCallOutput)
- func (u ConversationItemUnion) AsFileSearchCall() (v responses.ResponseFileSearchToolCall)
- func (u ConversationItemUnion) AsFunctionCall() (v responses.ResponseFunctionToolCallItem)
- func (u ConversationItemUnion) AsFunctionCallOutput() (v responses.ResponseFunctionToolCallOutputItem)
- func (u ConversationItemUnion) AsImageGenerationCall() (v ConversationItemImageGenerationCall)
- func (u ConversationItemUnion) AsLocalShellCall() (v ConversationItemLocalShellCall)
- func (u ConversationItemUnion) AsLocalShellCallOutput() (v ConversationItemLocalShellCallOutput)
- func (u ConversationItemUnion) AsMcpApprovalRequest() (v ConversationItemMcpApprovalRequest)
- func (u ConversationItemUnion) AsMcpApprovalResponse() (v ConversationItemMcpApprovalResponse)
- func (u ConversationItemUnion) AsMcpCall() (v ConversationItemMcpCall)
- func (u ConversationItemUnion) AsMcpListTools() (v ConversationItemMcpListTools)
- func (u ConversationItemUnion) AsMessage() (v Message)
- func (u ConversationItemUnion) AsReasoning() (v responses.ResponseReasoningItem)
- func (u ConversationItemUnion) AsWebSearchCall() (v responses.ResponseFunctionWebSearch)
- func (u ConversationItemUnion) RawJSON() string
- func (r *ConversationItemUnion) UnmarshalJSON(data []byte) error
- type ConversationItemUnionAction
- type ConversationItemUnionContent
- type ConversationItemUnionOutput
- type ConversationNewParams
- type ConversationService
- func (r *ConversationService) Delete(ctx context.Context, conversationID string, opts ...option.RequestOption) (res *ConversationDeletedResource, err error)
- func (r *ConversationService) Get(ctx context.Context, conversationID string, opts ...option.RequestOption) (res *Conversation, err error)
- func (r *ConversationService) New(ctx context.Context, body ConversationNewParams, opts ...option.RequestOption) (res *Conversation, err error)
- func (r *ConversationService) Update(ctx context.Context, conversationID string, body ConversationUpdateParams, ...) (res *Conversation, err error)
- type ConversationUpdateParams
- type CustomToolInputFormatGrammar
- type CustomToolInputFormatGrammarParam
- type CustomToolInputFormatText
- type CustomToolInputFormatTextParam
- type CustomToolInputFormatUnion
- type CustomToolInputFormatUnionParam
- type Error
- type ErrorObject
- type FunctionDefinition
- type FunctionDefinitionParam
- type FunctionParameters
- type ItemGetParams
- type ItemListParams
- type ItemListParamsOrder
- type ItemNewParams
- type ItemService
- func (r *ItemService) Delete(ctx context.Context, conversationID string, itemID string, ...) (res *Conversation, err error)
- func (r *ItemService) Get(ctx context.Context, conversationID string, itemID string, query ItemGetParams, ...) (res *ConversationItemUnion, err error)
- func (r *ItemService) List(ctx context.Context, conversationID string, query ItemListParams, ...) (res *pagination.ConversationCursorPage[ConversationItemUnion], err error)
- func (r *ItemService) ListAutoPaging(ctx context.Context, conversationID string, query ItemListParams, ...) *pagination.ConversationCursorPageAutoPager[ConversationItemUnion]
- func (r *ItemService) New(ctx context.Context, conversationID string, params ItemNewParams, ...) (res *ConversationItemList, err error)
- type Message
- type MessageContentReasoningText
- type MessageContentUnion
- func (u MessageContentUnion) AsAny() anyMessageContent
- func (u MessageContentUnion) AsComputerScreenshot() (v ComputerScreenshotContent)
- func (u MessageContentUnion) AsInputFile() (v responses.ResponseInputFile)
- func (u MessageContentUnion) AsInputImage() (v responses.ResponseInputImage)
- func (u MessageContentUnion) AsInputText() (v responses.ResponseInputText)
- func (u MessageContentUnion) AsOutputText() (v responses.ResponseOutputText)
- func (u MessageContentUnion) AsReasoningText() (v MessageContentReasoningText)
- func (u MessageContentUnion) AsRefusal() (v responses.ResponseOutputRefusal)
- func (u MessageContentUnion) AsSummaryText() (v SummaryTextContent)
- func (u MessageContentUnion) AsText() (v TextContent)
- func (u MessageContentUnion) RawJSON() string
- func (r *MessageContentUnion) UnmarshalJSON(data []byte) error
- type MessageRole
- type MessageStatus
- type Metadata
- 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
- type SummaryTextContent
- type TextContent
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 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 ComparisonFilter ¶
type ComparisonFilter = shared.ComparisonFilter
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
This is an alias to an internal type.
type ComparisonFilterParam ¶
type ComparisonFilterParam = shared.ComparisonFilterParam
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
This is an alias to an internal type.
type ComparisonFilterType ¶
type ComparisonFilterType = shared.ComparisonFilterType
Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.
- `eq`: equals - `ne`: not equal - `gt`: greater than - `gte`: greater than or equal - `lt`: less than - `lte`: less than or equal
This is an alias to an internal type.
type ComparisonFilterValueUnion ¶
type ComparisonFilterValueUnion = shared.ComparisonFilterValueUnion
The value to compare against the attribute key; supports string, number, or boolean types.
This is an alias to an internal type.
type ComparisonFilterValueUnionParam ¶
type ComparisonFilterValueUnionParam = shared.ComparisonFilterValueUnionParam
The value to compare against the attribute key; supports string, number, or boolean types.
This is an alias to an internal type.
type CompoundFilter ¶
type CompoundFilter = shared.CompoundFilter
Combine multiple filters using `and` or `or`.
This is an alias to an internal type.
type CompoundFilterParam ¶
type CompoundFilterParam = shared.CompoundFilterParam
Combine multiple filters using `and` or `or`.
This is an alias to an internal type.
type CompoundFilterType ¶
type CompoundFilterType = shared.CompoundFilterType
Type of operation: `and` or `or`.
This is an alias to an internal type.
type ComputerScreenshotContent ¶
type ComputerScreenshotContent struct {
// The identifier of an uploaded file that contains the screenshot.
FileID string `json:"file_id,required"`
// The URL of the screenshot image.
ImageURL string `json:"image_url,required"`
// Specifies the event type. For a computer screenshot, this property is always set
// to `computer_screenshot`.
Type constant.ComputerScreenshot `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FileID respjson.Field
ImageURL respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A screenshot of a computer.
func (ComputerScreenshotContent) ImplMessageContentUnion ¶ added in v2.5.0
func (ComputerScreenshotContent) ImplMessageContentUnion()
func (ComputerScreenshotContent) RawJSON ¶
func (r ComputerScreenshotContent) RawJSON() string
Returns the unmodified JSON received from the API
func (*ComputerScreenshotContent) UnmarshalJSON ¶
func (r *ComputerScreenshotContent) UnmarshalJSON(data []byte) error
type Conversation ¶
type Conversation struct {
// The unique ID of the conversation.
ID string `json:"id,required"`
// The time at which the conversation was created, measured in seconds since the
// Unix epoch.
CreatedAt int64 `json:"created_at,required"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard. Keys are strings with a maximum
// length of 64 characters. Values are strings with a maximum length of 512
// characters.
Metadata any `json:"metadata,required"`
// The object type, which is always `conversation`.
Object constant.Conversation `json:"object,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Metadata respjson.Field
Object respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (Conversation) RawJSON ¶
func (r Conversation) RawJSON() string
Returns the unmodified JSON received from the API
func (*Conversation) UnmarshalJSON ¶
func (r *Conversation) UnmarshalJSON(data []byte) error
type ConversationDeletedResource ¶
type ConversationDeletedResource struct {
ID string `json:"id,required"`
Deleted bool `json:"deleted,required"`
Object constant.ConversationDeleted `json:"object,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Deleted respjson.Field
Object respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ConversationDeletedResource) RawJSON ¶
func (r ConversationDeletedResource) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationDeletedResource) UnmarshalJSON ¶
func (r *ConversationDeletedResource) UnmarshalJSON(data []byte) error
type ConversationItemImageGenerationCall ¶
type ConversationItemImageGenerationCall struct {
// The unique ID of the image generation call.
ID string `json:"id,required"`
// The generated image encoded in base64.
Result string `json:"result,required"`
// The status of the image generation call.
//
// Any of "in_progress", "completed", "generating", "failed".
Status string `json:"status,required"`
// The type of the image generation call. Always `image_generation_call`.
Type constant.ImageGenerationCall `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Result respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An image generation request made by the model.
func (ConversationItemImageGenerationCall) ImplConversationItemUnion ¶
func (ConversationItemImageGenerationCall) ImplConversationItemUnion()
func (ConversationItemImageGenerationCall) RawJSON ¶
func (r ConversationItemImageGenerationCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemImageGenerationCall) UnmarshalJSON ¶
func (r *ConversationItemImageGenerationCall) UnmarshalJSON(data []byte) error
type ConversationItemList ¶
type ConversationItemList struct {
// A list of conversation items.
Data []ConversationItemUnion `json:"data,required"`
// The ID of the first item in the list.
FirstID string `json:"first_id,required"`
// Whether there are more items available.
HasMore bool `json:"has_more,required"`
// The ID of the last item in the list.
LastID string `json:"last_id,required"`
// The type of object returned, must be `list`.
Object constant.List `json:"object,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
FirstID respjson.Field
HasMore respjson.Field
LastID respjson.Field
Object respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A list of Conversation items.
func (ConversationItemList) RawJSON ¶
func (r ConversationItemList) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemList) UnmarshalJSON ¶
func (r *ConversationItemList) UnmarshalJSON(data []byte) error
type ConversationItemLocalShellCall ¶
type ConversationItemLocalShellCall struct {
// The unique ID of the local shell call.
ID string `json:"id,required"`
// Execute a shell command on the server.
Action ConversationItemLocalShellCallAction `json:"action,required"`
// The unique ID of the local shell tool call generated by the model.
CallID string `json:"call_id,required"`
// The status of the local shell call.
//
// Any of "in_progress", "completed", "incomplete".
Status string `json:"status,required"`
// The type of the local shell call. Always `local_shell_call`.
Type constant.LocalShellCall `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Action respjson.Field
CallID respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A tool call to run a command on the local shell.
func (ConversationItemLocalShellCall) ImplConversationItemUnion ¶
func (ConversationItemLocalShellCall) ImplConversationItemUnion()
func (ConversationItemLocalShellCall) RawJSON ¶
func (r ConversationItemLocalShellCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemLocalShellCall) UnmarshalJSON ¶
func (r *ConversationItemLocalShellCall) UnmarshalJSON(data []byte) error
type ConversationItemLocalShellCallAction ¶
type ConversationItemLocalShellCallAction struct {
// The command to run.
Command []string `json:"command,required"`
// Environment variables to set for the command.
Env map[string]string `json:"env,required"`
// The type of the local shell action. Always `exec`.
Type constant.Exec `json:"type,required"`
// Optional timeout in milliseconds for the command.
TimeoutMs int64 `json:"timeout_ms,nullable"`
// Optional user to run the command as.
User string `json:"user,nullable"`
// Optional working directory to run the command in.
WorkingDirectory string `json:"working_directory,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Command respjson.Field
Env respjson.Field
Type respjson.Field
TimeoutMs respjson.Field
User respjson.Field
WorkingDirectory respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Execute a shell command on the server.
func (ConversationItemLocalShellCallAction) RawJSON ¶
func (r ConversationItemLocalShellCallAction) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemLocalShellCallAction) UnmarshalJSON ¶
func (r *ConversationItemLocalShellCallAction) UnmarshalJSON(data []byte) error
type ConversationItemLocalShellCallOutput ¶
type ConversationItemLocalShellCallOutput struct {
// The unique ID of the local shell tool call generated by the model.
ID string `json:"id,required"`
// A JSON string of the output of the local shell tool call.
Output string `json:"output,required"`
// The type of the local shell tool call output. Always `local_shell_call_output`.
Type constant.LocalShellCallOutput `json:"type,required"`
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
//
// Any of "in_progress", "completed", "incomplete".
Status string `json:"status,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Output respjson.Field
Type respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The output of a local shell tool call.
func (ConversationItemLocalShellCallOutput) ImplConversationItemUnion ¶
func (ConversationItemLocalShellCallOutput) ImplConversationItemUnion()
func (ConversationItemLocalShellCallOutput) RawJSON ¶
func (r ConversationItemLocalShellCallOutput) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemLocalShellCallOutput) UnmarshalJSON ¶
func (r *ConversationItemLocalShellCallOutput) UnmarshalJSON(data []byte) error
type ConversationItemMcpApprovalRequest ¶
type ConversationItemMcpApprovalRequest struct {
// The unique ID of the approval request.
ID string `json:"id,required"`
// A JSON string of arguments for the tool.
Arguments string `json:"arguments,required"`
// The name of the tool to run.
Name string `json:"name,required"`
// The label of the MCP server making the request.
ServerLabel string `json:"server_label,required"`
// The type of the item. Always `mcp_approval_request`.
Type constant.McpApprovalRequest `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Arguments respjson.Field
Name respjson.Field
ServerLabel respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A request for human approval of a tool invocation.
func (ConversationItemMcpApprovalRequest) ImplConversationItemUnion ¶
func (ConversationItemMcpApprovalRequest) ImplConversationItemUnion()
func (ConversationItemMcpApprovalRequest) RawJSON ¶
func (r ConversationItemMcpApprovalRequest) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemMcpApprovalRequest) UnmarshalJSON ¶
func (r *ConversationItemMcpApprovalRequest) UnmarshalJSON(data []byte) error
type ConversationItemMcpApprovalResponse ¶
type ConversationItemMcpApprovalResponse struct {
// The unique ID of the approval response
ID string `json:"id,required"`
// The ID of the approval request being answered.
ApprovalRequestID string `json:"approval_request_id,required"`
// Whether the request was approved.
Approve bool `json:"approve,required"`
// The type of the item. Always `mcp_approval_response`.
Type constant.McpApprovalResponse `json:"type,required"`
// Optional reason for the decision.
Reason string `json:"reason,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ApprovalRequestID respjson.Field
Approve respjson.Field
Type respjson.Field
Reason respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A response to an MCP approval request.
func (ConversationItemMcpApprovalResponse) ImplConversationItemUnion ¶
func (ConversationItemMcpApprovalResponse) ImplConversationItemUnion()
func (ConversationItemMcpApprovalResponse) RawJSON ¶
func (r ConversationItemMcpApprovalResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemMcpApprovalResponse) UnmarshalJSON ¶
func (r *ConversationItemMcpApprovalResponse) UnmarshalJSON(data []byte) error
type ConversationItemMcpCall ¶
type ConversationItemMcpCall struct {
// The unique ID of the tool call.
ID string `json:"id,required"`
// A JSON string of the arguments passed to the tool.
Arguments string `json:"arguments,required"`
// The name of the tool that was run.
Name string `json:"name,required"`
// The label of the MCP server running the tool.
ServerLabel string `json:"server_label,required"`
// The type of the item. Always `mcp_call`.
Type constant.McpCall `json:"type,required"`
// The error from the tool call, if any.
Error string `json:"error,nullable"`
// The output from the tool call.
Output string `json:"output,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Arguments respjson.Field
Name respjson.Field
ServerLabel respjson.Field
Type respjson.Field
Error respjson.Field
Output respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An invocation of a tool on an MCP server.
func (ConversationItemMcpCall) ImplConversationItemUnion ¶
func (ConversationItemMcpCall) ImplConversationItemUnion()
func (ConversationItemMcpCall) RawJSON ¶
func (r ConversationItemMcpCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemMcpCall) UnmarshalJSON ¶
func (r *ConversationItemMcpCall) UnmarshalJSON(data []byte) error
type ConversationItemMcpListTools ¶
type ConversationItemMcpListTools struct {
// The unique ID of the list.
ID string `json:"id,required"`
// The label of the MCP server.
ServerLabel string `json:"server_label,required"`
// The tools available on the server.
Tools []ConversationItemMcpListToolsTool `json:"tools,required"`
// The type of the item. Always `mcp_list_tools`.
Type constant.McpListTools `json:"type,required"`
// Error message if the server could not list tools.
Error string `json:"error,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ServerLabel respjson.Field
Tools respjson.Field
Type respjson.Field
Error respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A list of tools available on an MCP server.
func (ConversationItemMcpListTools) ImplConversationItemUnion ¶
func (ConversationItemMcpListTools) ImplConversationItemUnion()
func (ConversationItemMcpListTools) RawJSON ¶
func (r ConversationItemMcpListTools) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemMcpListTools) UnmarshalJSON ¶
func (r *ConversationItemMcpListTools) UnmarshalJSON(data []byte) error
type ConversationItemMcpListToolsTool ¶
type ConversationItemMcpListToolsTool struct {
// The JSON schema describing the tool's input.
InputSchema any `json:"input_schema,required"`
// The name of the tool.
Name string `json:"name,required"`
// Additional annotations about the tool.
Annotations any `json:"annotations,nullable"`
// The description of the tool.
Description string `json:"description,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
InputSchema respjson.Field
Name respjson.Field
Annotations respjson.Field
Description respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A tool available on an MCP server.
func (ConversationItemMcpListToolsTool) RawJSON ¶
func (r ConversationItemMcpListToolsTool) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemMcpListToolsTool) UnmarshalJSON ¶
func (r *ConversationItemMcpListToolsTool) UnmarshalJSON(data []byte) error
type ConversationItemUnion ¶
type ConversationItemUnion struct {
ID string `json:"id"`
// This field is a union of [[]MessageContentUnion],
// [[]responses.ResponseReasoningItemContent]
Content ConversationItemUnionContent `json:"content"`
// This field is from variant [Message].
Role MessageRole `json:"role"`
Status string `json:"status"`
// Any of "message", "function_call", "function_call_output", "file_search_call",
// "web_search_call", "image_generation_call", "computer_call",
// "computer_call_output", "reasoning", "code_interpreter_call",
// "local_shell_call", "local_shell_call_output", "mcp_list_tools",
// "mcp_approval_request", "mcp_approval_response", "mcp_call", "custom_tool_call",
// "custom_tool_call_output".
Type string `json:"type"`
Arguments string `json:"arguments"`
CallID string `json:"call_id"`
Name string `json:"name"`
// This field is a union of [string],
// [responses.ResponseComputerToolCallOutputScreenshot], [string], [string],
// [string]
Output ConversationItemUnionOutput `json:"output"`
// This field is from variant [responses.ResponseFileSearchToolCall].
Queries []string `json:"queries"`
// This field is from variant [responses.ResponseFileSearchToolCall].
Results []responses.ResponseFileSearchToolCallResult `json:"results"`
// This field is a union of [responses.ResponseFunctionWebSearchActionUnion],
// [responses.ResponseComputerToolCallActionUnion],
// [ConversationItemLocalShellCallAction]
Action ConversationItemUnionAction `json:"action"`
// This field is from variant [ConversationItemImageGenerationCall].
Result string `json:"result"`
// This field is from variant [responses.ResponseComputerToolCall].
PendingSafetyChecks []responses.ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
// This field is from variant [responses.ResponseComputerToolCallOutputItem].
AcknowledgedSafetyChecks []responses.ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
// This field is from variant [responses.ResponseReasoningItem].
Summary []responses.ResponseReasoningItemSummary `json:"summary"`
// This field is from variant [responses.ResponseReasoningItem].
EncryptedContent string `json:"encrypted_content"`
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
Code string `json:"code"`
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
Outputs []responses.ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
ServerLabel string `json:"server_label"`
// This field is from variant [ConversationItemMcpListTools].
Tools []ConversationItemMcpListToolsTool `json:"tools"`
Error string `json:"error"`
// This field is from variant [ConversationItemMcpApprovalResponse].
ApprovalRequestID string `json:"approval_request_id"`
// This field is from variant [ConversationItemMcpApprovalResponse].
Approve bool `json:"approve"`
// This field is from variant [ConversationItemMcpApprovalResponse].
Reason string `json:"reason"`
// This field is from variant [responses.ResponseCustomToolCall].
Input string `json:"input"`
JSON struct {
ID respjson.Field
Content respjson.Field
Role respjson.Field
Status respjson.Field
Type respjson.Field
Arguments respjson.Field
CallID respjson.Field
Name respjson.Field
Output respjson.Field
Queries respjson.Field
Results respjson.Field
Action respjson.Field
Result respjson.Field
PendingSafetyChecks respjson.Field
AcknowledgedSafetyChecks respjson.Field
Summary respjson.Field
EncryptedContent respjson.Field
Code respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
ServerLabel respjson.Field
Tools respjson.Field
Error respjson.Field
ApprovalRequestID respjson.Field
Approve respjson.Field
Reason respjson.Field
Input respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ConversationItemUnion contains all possible properties and values from Message, responses.ResponseFunctionToolCallItem, responses.ResponseFunctionToolCallOutputItem, responses.ResponseFileSearchToolCall, responses.ResponseFunctionWebSearch, ConversationItemImageGenerationCall, responses.ResponseComputerToolCall, responses.ResponseComputerToolCallOutputItem, responses.ResponseReasoningItem, responses.ResponseCodeInterpreterToolCall, ConversationItemLocalShellCall, ConversationItemLocalShellCallOutput, ConversationItemMcpListTools, ConversationItemMcpApprovalRequest, ConversationItemMcpApprovalResponse, ConversationItemMcpCall, responses.ResponseCustomToolCall, responses.ResponseCustomToolCallOutput.
Use the ConversationItemUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ConversationItemUnion) AsAny ¶
func (u ConversationItemUnion) AsAny() anyConversationItem
Use the following switch statement to find the correct variant
switch variant := ConversationItemUnion.AsAny().(type) {
case conversations.Message:
case responses.ResponseFunctionToolCallItem:
case responses.ResponseFunctionToolCallOutputItem:
case responses.ResponseFileSearchToolCall:
case responses.ResponseFunctionWebSearch:
case conversations.ConversationItemImageGenerationCall:
case responses.ResponseComputerToolCall:
case responses.ResponseComputerToolCallOutputItem:
case responses.ResponseReasoningItem:
case responses.ResponseCodeInterpreterToolCall:
case conversations.ConversationItemLocalShellCall:
case conversations.ConversationItemLocalShellCallOutput:
case conversations.ConversationItemMcpListTools:
case conversations.ConversationItemMcpApprovalRequest:
case conversations.ConversationItemMcpApprovalResponse:
case conversations.ConversationItemMcpCall:
case responses.ResponseCustomToolCall:
case responses.ResponseCustomToolCallOutput:
default:
fmt.Errorf("no variant present")
}
func (ConversationItemUnion) AsCodeInterpreterCall ¶
func (u ConversationItemUnion) AsCodeInterpreterCall() (v responses.ResponseCodeInterpreterToolCall)
func (ConversationItemUnion) AsComputerCall ¶
func (u ConversationItemUnion) AsComputerCall() (v responses.ResponseComputerToolCall)
func (ConversationItemUnion) AsComputerCallOutput ¶
func (u ConversationItemUnion) AsComputerCallOutput() (v responses.ResponseComputerToolCallOutputItem)
func (ConversationItemUnion) AsCustomToolCall ¶
func (u ConversationItemUnion) AsCustomToolCall() (v responses.ResponseCustomToolCall)
func (ConversationItemUnion) AsCustomToolCallOutput ¶
func (u ConversationItemUnion) AsCustomToolCallOutput() (v responses.ResponseCustomToolCallOutput)
func (ConversationItemUnion) AsFileSearchCall ¶
func (u ConversationItemUnion) AsFileSearchCall() (v responses.ResponseFileSearchToolCall)
func (ConversationItemUnion) AsFunctionCall ¶
func (u ConversationItemUnion) AsFunctionCall() (v responses.ResponseFunctionToolCallItem)
func (ConversationItemUnion) AsFunctionCallOutput ¶
func (u ConversationItemUnion) AsFunctionCallOutput() (v responses.ResponseFunctionToolCallOutputItem)
func (ConversationItemUnion) AsImageGenerationCall ¶
func (u ConversationItemUnion) AsImageGenerationCall() (v ConversationItemImageGenerationCall)
func (ConversationItemUnion) AsLocalShellCall ¶
func (u ConversationItemUnion) AsLocalShellCall() (v ConversationItemLocalShellCall)
func (ConversationItemUnion) AsLocalShellCallOutput ¶
func (u ConversationItemUnion) AsLocalShellCallOutput() (v ConversationItemLocalShellCallOutput)
func (ConversationItemUnion) AsMcpApprovalRequest ¶
func (u ConversationItemUnion) AsMcpApprovalRequest() (v ConversationItemMcpApprovalRequest)
func (ConversationItemUnion) AsMcpApprovalResponse ¶
func (u ConversationItemUnion) AsMcpApprovalResponse() (v ConversationItemMcpApprovalResponse)
func (ConversationItemUnion) AsMcpCall ¶
func (u ConversationItemUnion) AsMcpCall() (v ConversationItemMcpCall)
func (ConversationItemUnion) AsMcpListTools ¶
func (u ConversationItemUnion) AsMcpListTools() (v ConversationItemMcpListTools)
func (ConversationItemUnion) AsMessage ¶
func (u ConversationItemUnion) AsMessage() (v Message)
func (ConversationItemUnion) AsReasoning ¶
func (u ConversationItemUnion) AsReasoning() (v responses.ResponseReasoningItem)
func (ConversationItemUnion) AsWebSearchCall ¶
func (u ConversationItemUnion) AsWebSearchCall() (v responses.ResponseFunctionWebSearch)
func (ConversationItemUnion) RawJSON ¶
func (u ConversationItemUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConversationItemUnion) UnmarshalJSON ¶
func (r *ConversationItemUnion) UnmarshalJSON(data []byte) error
type ConversationItemUnionAction ¶
type ConversationItemUnionAction struct {
// This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
Query string `json:"query"`
Type string `json:"type"`
// This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
Sources []responses.ResponseFunctionWebSearchActionSearchSource `json:"sources"`
URL string `json:"url"`
// This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
Pattern string `json:"pattern"`
// This field is from variant [responses.ResponseComputerToolCallActionUnion].
Button string `json:"button"`
X int64 `json:"x"`
Y int64 `json:"y"`
// This field is from variant [responses.ResponseComputerToolCallActionUnion].
Path []responses.ResponseComputerToolCallActionDragPath `json:"path"`
// This field is from variant [responses.ResponseComputerToolCallActionUnion].
Keys []string `json:"keys"`
// This field is from variant [responses.ResponseComputerToolCallActionUnion].
ScrollX int64 `json:"scroll_x"`
// This field is from variant [responses.ResponseComputerToolCallActionUnion].
ScrollY int64 `json:"scroll_y"`
// This field is from variant [responses.ResponseComputerToolCallActionUnion].
Text string `json:"text"`
// This field is from variant [ConversationItemLocalShellCallAction].
Command []string `json:"command"`
// This field is from variant [ConversationItemLocalShellCallAction].
Env map[string]string `json:"env"`
// This field is from variant [ConversationItemLocalShellCallAction].
TimeoutMs int64 `json:"timeout_ms"`
// This field is from variant [ConversationItemLocalShellCallAction].
User string `json:"user"`
// This field is from variant [ConversationItemLocalShellCallAction].
WorkingDirectory string `json:"working_directory"`
JSON struct {
Query respjson.Field
Type respjson.Field
Sources respjson.Field
URL respjson.Field
Pattern respjson.Field
Button respjson.Field
X respjson.Field
Y respjson.Field
Path respjson.Field
Keys respjson.Field
ScrollX respjson.Field
ScrollY respjson.Field
Text respjson.Field
Command respjson.Field
Env respjson.Field
TimeoutMs respjson.Field
User respjson.Field
WorkingDirectory respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ConversationItemUnionAction is an implicit subunion of ConversationItemUnion. ConversationItemUnionAction provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ConversationItemUnion.
func (*ConversationItemUnionAction) UnmarshalJSON ¶
func (r *ConversationItemUnionAction) UnmarshalJSON(data []byte) error
type ConversationItemUnionContent ¶
type ConversationItemUnionContent struct {
// This field will be present if the value is a [[]MessageContentUnion] instead of
// an object.
OfMessageContentArray []MessageContentUnion `json:",inline"`
// This field will be present if the value is a
// [[]responses.ResponseReasoningItemContent] instead of an object.
OfResponseReasoningItemContentArray []responses.ResponseReasoningItemContent `json:",inline"`
JSON struct {
OfMessageContentArray respjson.Field
OfResponseReasoningItemContentArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ConversationItemUnionContent is an implicit subunion of ConversationItemUnion. ConversationItemUnionContent provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ConversationItemUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfMessageContentArray OfResponseReasoningItemContentArray]
func (*ConversationItemUnionContent) UnmarshalJSON ¶
func (r *ConversationItemUnionContent) UnmarshalJSON(data []byte) error
type ConversationItemUnionOutput ¶
type ConversationItemUnionOutput struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [responses.ResponseComputerToolCallOutputScreenshot].
Type constant.ComputerScreenshot `json:"type"`
// This field is from variant [responses.ResponseComputerToolCallOutputScreenshot].
FileID string `json:"file_id"`
// This field is from variant [responses.ResponseComputerToolCallOutputScreenshot].
ImageURL string `json:"image_url"`
JSON struct {
OfString respjson.Field
Type respjson.Field
FileID respjson.Field
ImageURL respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
ConversationItemUnionOutput is an implicit subunion of ConversationItemUnion. ConversationItemUnionOutput provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the ConversationItemUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfString]
func (*ConversationItemUnionOutput) UnmarshalJSON ¶
func (r *ConversationItemUnionOutput) UnmarshalJSON(data []byte) error
type ConversationNewParams ¶
type ConversationNewParams struct {
// Initial items to include in the conversation context. You may add up to 20 items
// at a time.
Items []responses.ResponseInputItemUnionParam `json:"items,omitzero"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard.
//
// Keys are strings with a maximum length of 64 characters. Values are strings with
// a maximum length of 512 characters.
Metadata shared.Metadata `json:"metadata,omitzero"`
// contains filtered or unexported fields
}
func (ConversationNewParams) MarshalJSON ¶
func (r ConversationNewParams) MarshalJSON() (data []byte, err error)
func (*ConversationNewParams) UnmarshalJSON ¶
func (r *ConversationNewParams) UnmarshalJSON(data []byte) error
type ConversationService ¶
type ConversationService struct {
Options []option.RequestOption
Items ItemService
}
ConversationService 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 NewConversationService method instead.
func NewConversationService ¶
func NewConversationService(opts ...option.RequestOption) (r ConversationService)
NewConversationService 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 (*ConversationService) Delete ¶
func (r *ConversationService) Delete(ctx context.Context, conversationID string, opts ...option.RequestOption) (res *ConversationDeletedResource, err error)
Delete a conversation. Items in the conversation will not be deleted.
func (*ConversationService) Get ¶
func (r *ConversationService) Get(ctx context.Context, conversationID string, opts ...option.RequestOption) (res *Conversation, err error)
Get a conversation
func (*ConversationService) New ¶
func (r *ConversationService) New(ctx context.Context, body ConversationNewParams, opts ...option.RequestOption) (res *Conversation, err error)
Create a conversation.
func (*ConversationService) Update ¶
func (r *ConversationService) Update(ctx context.Context, conversationID string, body ConversationUpdateParams, opts ...option.RequestOption) (res *Conversation, err error)
Update a conversation
type ConversationUpdateParams ¶
type ConversationUpdateParams struct {
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard.
//
// Keys are strings with a maximum length of 64 characters. Values are strings with
// a maximum length of 512 characters.
Metadata shared.Metadata `json:"metadata,omitzero,required"`
// contains filtered or unexported fields
}
func (ConversationUpdateParams) MarshalJSON ¶
func (r ConversationUpdateParams) MarshalJSON() (data []byte, err error)
func (*ConversationUpdateParams) UnmarshalJSON ¶
func (r *ConversationUpdateParams) UnmarshalJSON(data []byte) error
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 ItemGetParams ¶
type ItemGetParams struct {
// Additional fields to include in the response. See the `include` parameter for
// [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
// for more information.
Include []responses.ResponseIncludable `query:"include,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ItemGetParams) URLQuery ¶
func (r ItemGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes ItemGetParams's query parameters as `url.Values`.
type ItemListParams ¶
type ItemListParams struct {
// An item ID to list items after, used in pagination.
After param.Opt[string] `query:"after,omitzero" json:"-"`
// A limit on the number of objects to be returned. Limit can range between 1 and
// 100, and the default is 20.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Specify additional output data to include in the model response. Currently
// supported values are:
//
// - `web_search_call.action.sources`: Include the sources of the web search tool
// call.
// - `code_interpreter_call.outputs`: Includes the outputs of python code execution
// in code interpreter tool call items.
// - `computer_call_output.output.image_url`: Include image urls from the computer
// call output.
// - `file_search_call.results`: Include the search results of the file search tool
// call.
// - `message.input_image.image_url`: Include image urls from the input message.
// - `message.output_text.logprobs`: Include logprobs with assistant messages.
// - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
// tokens in reasoning item outputs. This enables reasoning items to be used in
// multi-turn conversations when using the Responses API statelessly (like when
// the `store` parameter is set to `false`, or when an organization is enrolled
// in the zero data retention program).
Include []responses.ResponseIncludable `query:"include,omitzero" json:"-"`
// The order to return the input items in. Default is `desc`.
//
// - `asc`: Return the input items in ascending order.
// - `desc`: Return the input items in descending order.
//
// Any of "asc", "desc".
Order ItemListParamsOrder `query:"order,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ItemListParams) URLQuery ¶
func (r ItemListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ItemListParams's query parameters as `url.Values`.
type ItemListParamsOrder ¶
type ItemListParamsOrder string
The order to return the input items in. Default is `desc`.
- `asc`: Return the input items in ascending order. - `desc`: Return the input items in descending order.
const ( ItemListParamsOrderAsc ItemListParamsOrder = "asc" ItemListParamsOrderDesc ItemListParamsOrder = "desc" )
type ItemNewParams ¶
type ItemNewParams struct {
// The items to add to the conversation. You may add up to 20 items at a time.
Items []responses.ResponseInputItemUnionParam `json:"items,omitzero,required"`
// Additional fields to include in the response. See the `include` parameter for
// [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
// for more information.
Include []responses.ResponseIncludable `query:"include,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ItemNewParams) MarshalJSON ¶
func (r ItemNewParams) MarshalJSON() (data []byte, err error)
func (ItemNewParams) URLQuery ¶
func (r ItemNewParams) URLQuery() (v url.Values, err error)
URLQuery serializes ItemNewParams's query parameters as `url.Values`.
func (*ItemNewParams) UnmarshalJSON ¶
func (r *ItemNewParams) UnmarshalJSON(data []byte) error
type ItemService ¶
type ItemService struct {
Options []option.RequestOption
}
ItemService 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 NewItemService method instead.
func NewItemService ¶
func NewItemService(opts ...option.RequestOption) (r ItemService)
NewItemService 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 (*ItemService) Delete ¶
func (r *ItemService) Delete(ctx context.Context, conversationID string, itemID string, opts ...option.RequestOption) (res *Conversation, err error)
Delete an item from a conversation with the given IDs.
func (*ItemService) Get ¶
func (r *ItemService) Get(ctx context.Context, conversationID string, itemID string, query ItemGetParams, opts ...option.RequestOption) (res *ConversationItemUnion, err error)
Get a single item from a conversation with the given IDs.
func (*ItemService) List ¶
func (r *ItemService) List(ctx context.Context, conversationID string, query ItemListParams, opts ...option.RequestOption) (res *pagination.ConversationCursorPage[ConversationItemUnion], err error)
List all items for a conversation with the given ID.
func (*ItemService) ListAutoPaging ¶
func (r *ItemService) ListAutoPaging(ctx context.Context, conversationID string, query ItemListParams, opts ...option.RequestOption) *pagination.ConversationCursorPageAutoPager[ConversationItemUnion]
List all items for a conversation with the given ID.
func (*ItemService) New ¶
func (r *ItemService) New(ctx context.Context, conversationID string, params ItemNewParams, opts ...option.RequestOption) (res *ConversationItemList, err error)
Create items in a conversation with the given ID.
type Message ¶
type Message struct {
// The unique ID of the message.
ID string `json:"id,required"`
// The content of the message
Content []MessageContentUnion `json:"content,required"`
// The role of the message. One of `unknown`, `user`, `assistant`, `system`,
// `critic`, `discriminator`, `developer`, or `tool`.
//
// Any of "unknown", "user", "assistant", "system", "critic", "discriminator",
// "developer", "tool".
Role MessageRole `json:"role,required"`
// The status of item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
//
// Any of "in_progress", "completed", "incomplete".
Status MessageStatus `json:"status,required"`
// The type of the message. Always set to `message`.
Type constant.Message `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Content respjson.Field
Role respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A message to or from the model.
func (Message) ImplConversationItemUnion ¶
func (Message) ImplConversationItemUnion()
func (*Message) UnmarshalJSON ¶
type MessageContentReasoningText ¶ added in v2.6.0
type MessageContentReasoningText struct {
// The reasoning text from the model.
Text string `json:"text,required"`
// The type of the reasoning text. Always `reasoning_text`.
Type constant.ReasoningText `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Reasoning text from the model.
func (MessageContentReasoningText) ImplMessageContentUnion ¶ added in v2.6.0
func (MessageContentReasoningText) ImplMessageContentUnion()
func (MessageContentReasoningText) RawJSON ¶ added in v2.6.0
func (r MessageContentReasoningText) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageContentReasoningText) UnmarshalJSON ¶ added in v2.6.0
func (r *MessageContentReasoningText) UnmarshalJSON(data []byte) error
type MessageContentUnion ¶
type MessageContentUnion struct {
Text string `json:"text"`
// Any of "input_text", "output_text", "text", "summary_text", "reasoning_text",
// "refusal", "input_image", "computer_screenshot", "input_file".
Type string `json:"type"`
// This field is from variant [responses.ResponseOutputText].
Annotations []responses.ResponseOutputTextAnnotationUnion `json:"annotations"`
// This field is from variant [responses.ResponseOutputText].
Logprobs []responses.ResponseOutputTextLogprob `json:"logprobs"`
// This field is from variant [responses.ResponseOutputRefusal].
Refusal string `json:"refusal"`
// This field is from variant [responses.ResponseInputImage].
Detail responses.ResponseInputImageDetail `json:"detail"`
FileID string `json:"file_id"`
ImageURL string `json:"image_url"`
// This field is from variant [responses.ResponseInputFile].
FileData string `json:"file_data"`
// This field is from variant [responses.ResponseInputFile].
FileURL string `json:"file_url"`
// This field is from variant [responses.ResponseInputFile].
Filename string `json:"filename"`
JSON struct {
Text respjson.Field
Type respjson.Field
Annotations respjson.Field
Logprobs respjson.Field
Refusal respjson.Field
Detail respjson.Field
FileID respjson.Field
ImageURL respjson.Field
FileData respjson.Field
FileURL respjson.Field
Filename respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MessageContentUnion contains all possible properties and values from responses.ResponseInputText, responses.ResponseOutputText, TextContent, SummaryTextContent, MessageContentReasoningText, responses.ResponseOutputRefusal, responses.ResponseInputImage, ComputerScreenshotContent, responses.ResponseInputFile.
Use the MessageContentUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessageContentUnion) AsAny ¶
func (u MessageContentUnion) AsAny() anyMessageContent
Use the following switch statement to find the correct variant
switch variant := MessageContentUnion.AsAny().(type) {
case responses.ResponseInputText:
case responses.ResponseOutputText:
case conversations.TextContent:
case conversations.SummaryTextContent:
case conversations.MessageContentReasoningText:
case responses.ResponseOutputRefusal:
case responses.ResponseInputImage:
case conversations.ComputerScreenshotContent:
case responses.ResponseInputFile:
default:
fmt.Errorf("no variant present")
}
func (MessageContentUnion) AsComputerScreenshot ¶
func (u MessageContentUnion) AsComputerScreenshot() (v ComputerScreenshotContent)
func (MessageContentUnion) AsInputFile ¶
func (u MessageContentUnion) AsInputFile() (v responses.ResponseInputFile)
func (MessageContentUnion) AsInputImage ¶
func (u MessageContentUnion) AsInputImage() (v responses.ResponseInputImage)
func (MessageContentUnion) AsInputText ¶
func (u MessageContentUnion) AsInputText() (v responses.ResponseInputText)
func (MessageContentUnion) AsOutputText ¶
func (u MessageContentUnion) AsOutputText() (v responses.ResponseOutputText)
func (MessageContentUnion) AsReasoningText ¶ added in v2.6.0
func (u MessageContentUnion) AsReasoningText() (v MessageContentReasoningText)
func (MessageContentUnion) AsRefusal ¶
func (u MessageContentUnion) AsRefusal() (v responses.ResponseOutputRefusal)
func (MessageContentUnion) AsSummaryText ¶
func (u MessageContentUnion) AsSummaryText() (v SummaryTextContent)
func (MessageContentUnion) AsText ¶
func (u MessageContentUnion) AsText() (v TextContent)
func (MessageContentUnion) RawJSON ¶
func (u MessageContentUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageContentUnion) UnmarshalJSON ¶
func (r *MessageContentUnion) UnmarshalJSON(data []byte) error
type MessageRole ¶
type MessageRole string
The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`.
const ( MessageRoleUnknown MessageRole = "unknown" MessageRoleUser MessageRole = "user" MessageRoleAssistant MessageRole = "assistant" MessageRoleSystem MessageRole = "system" MessageRoleCritic MessageRole = "critic" MessageRoleDiscriminator MessageRole = "discriminator" MessageRoleDeveloper MessageRole = "developer" MessageRoleTool MessageRole = "tool" )
type MessageStatus ¶
type MessageStatus string
The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.
const ( MessageStatusInProgress MessageStatus = "in_progress" MessageStatusCompleted MessageStatus = "completed" MessageStatusIncomplete MessageStatus = "incomplete" )
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 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.
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.
type SummaryTextContent ¶
type SummaryTextContent struct {
// A summary of the reasoning output from the model so far.
Text string `json:"text,required"`
// The type of the object. Always `summary_text`.
Type constant.SummaryText `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A summary text from the model.
func (SummaryTextContent) ImplMessageContentUnion ¶ added in v2.5.0
func (SummaryTextContent) ImplMessageContentUnion()
func (SummaryTextContent) RawJSON ¶
func (r SummaryTextContent) RawJSON() string
Returns the unmodified JSON received from the API
func (*SummaryTextContent) UnmarshalJSON ¶
func (r *SummaryTextContent) UnmarshalJSON(data []byte) error
type TextContent ¶
type TextContent struct {
Text string `json:"text,required"`
Type constant.Text `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Text respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A text content.
func (TextContent) ImplMessageContentUnion ¶ added in v2.5.0
func (TextContent) ImplMessageContentUnion()
func (TextContent) RawJSON ¶
func (r TextContent) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextContent) UnmarshalJSON ¶
func (r *TextContent) UnmarshalJSON(data []byte) error