Documentation
¶
Index ¶
- Constants
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AnnotationDeltaUnion
- func (u AnnotationDeltaUnion) AsAny() anyAnnotationDelta
- func (u AnnotationDeltaUnion) AsFileCitation() (v FileCitationDeltaAnnotation)
- func (u AnnotationDeltaUnion) AsFilePath() (v FilePathDeltaAnnotation)
- func (u AnnotationDeltaUnion) RawJSON() string
- func (r *AnnotationDeltaUnion) UnmarshalJSON(data []byte) error
- type AnnotationUnion
- type Assistant
- type AssistantDeleted
- type AssistantResponseFormatOptionUnion
- func (u AssistantResponseFormatOptionUnion) AsAuto() (v constant.Auto)
- func (u AssistantResponseFormatOptionUnion) AsJSONObject() (v shared.ResponseFormatJSONObject)
- func (u AssistantResponseFormatOptionUnion) AsJSONSchema() (v shared.ResponseFormatJSONSchema)
- func (u AssistantResponseFormatOptionUnion) AsText() (v shared.ResponseFormatText)
- func (u AssistantResponseFormatOptionUnion) RawJSON() string
- func (r AssistantResponseFormatOptionUnion) ToParam() AssistantResponseFormatOptionUnionParam
- func (r *AssistantResponseFormatOptionUnion) UnmarshalJSON(data []byte) error
- type AssistantResponseFormatOptionUnionParam
- func (u AssistantResponseFormatOptionUnionParam) GetJSONSchema() *shared.ResponseFormatJSONSchemaJSONSchemaParam
- func (u AssistantResponseFormatOptionUnionParam) GetType() *string
- func (u AssistantResponseFormatOptionUnionParam) IsPresent() bool
- func (u AssistantResponseFormatOptionUnionParam) MarshalJSON() ([]byte, error)
- type AssistantStreamEventErrorEvent
- type AssistantStreamEventThreadCreated
- type AssistantStreamEventThreadMessageCompleted
- type AssistantStreamEventThreadMessageCreated
- type AssistantStreamEventThreadMessageDelta
- type AssistantStreamEventThreadMessageInProgress
- type AssistantStreamEventThreadMessageIncomplete
- type AssistantStreamEventThreadRunCancelled
- type AssistantStreamEventThreadRunCancelling
- type AssistantStreamEventThreadRunCompleted
- type AssistantStreamEventThreadRunCreated
- type AssistantStreamEventThreadRunExpired
- type AssistantStreamEventThreadRunFailed
- type AssistantStreamEventThreadRunInProgress
- type AssistantStreamEventThreadRunIncomplete
- type AssistantStreamEventThreadRunQueued
- type AssistantStreamEventThreadRunRequiresAction
- type AssistantStreamEventThreadRunStepCancelled
- type AssistantStreamEventThreadRunStepCompleted
- type AssistantStreamEventThreadRunStepCreated
- type AssistantStreamEventThreadRunStepDelta
- type AssistantStreamEventThreadRunStepExpired
- type AssistantStreamEventThreadRunStepFailed
- type AssistantStreamEventThreadRunStepInProgress
- type AssistantStreamEventUnion
- func (u AssistantStreamEventUnion) AsAny() anyAssistantStreamEvent
- func (u AssistantStreamEventUnion) AsErrorEvent() (v AssistantStreamEventErrorEvent)
- func (u AssistantStreamEventUnion) AsThreadCreated() (v AssistantStreamEventThreadCreated)
- func (u AssistantStreamEventUnion) AsThreadMessageCompleted() (v AssistantStreamEventThreadMessageCompleted)
- func (u AssistantStreamEventUnion) AsThreadMessageCreated() (v AssistantStreamEventThreadMessageCreated)
- func (u AssistantStreamEventUnion) AsThreadMessageDelta() (v AssistantStreamEventThreadMessageDelta)
- func (u AssistantStreamEventUnion) AsThreadMessageInProgress() (v AssistantStreamEventThreadMessageInProgress)
- func (u AssistantStreamEventUnion) AsThreadMessageIncomplete() (v AssistantStreamEventThreadMessageIncomplete)
- func (u AssistantStreamEventUnion) AsThreadRunCancelled() (v AssistantStreamEventThreadRunCancelled)
- func (u AssistantStreamEventUnion) AsThreadRunCancelling() (v AssistantStreamEventThreadRunCancelling)
- func (u AssistantStreamEventUnion) AsThreadRunCompleted() (v AssistantStreamEventThreadRunCompleted)
- func (u AssistantStreamEventUnion) AsThreadRunCreated() (v AssistantStreamEventThreadRunCreated)
- func (u AssistantStreamEventUnion) AsThreadRunExpired() (v AssistantStreamEventThreadRunExpired)
- func (u AssistantStreamEventUnion) AsThreadRunFailed() (v AssistantStreamEventThreadRunFailed)
- func (u AssistantStreamEventUnion) AsThreadRunInProgress() (v AssistantStreamEventThreadRunInProgress)
- func (u AssistantStreamEventUnion) AsThreadRunIncomplete() (v AssistantStreamEventThreadRunIncomplete)
- func (u AssistantStreamEventUnion) AsThreadRunQueued() (v AssistantStreamEventThreadRunQueued)
- func (u AssistantStreamEventUnion) AsThreadRunRequiresAction() (v AssistantStreamEventThreadRunRequiresAction)
- func (u AssistantStreamEventUnion) AsThreadRunStepCancelled() (v AssistantStreamEventThreadRunStepCancelled)
- func (u AssistantStreamEventUnion) AsThreadRunStepCompleted() (v AssistantStreamEventThreadRunStepCompleted)
- func (u AssistantStreamEventUnion) AsThreadRunStepCreated() (v AssistantStreamEventThreadRunStepCreated)
- func (u AssistantStreamEventUnion) AsThreadRunStepDelta() (v AssistantStreamEventThreadRunStepDelta)
- func (u AssistantStreamEventUnion) AsThreadRunStepExpired() (v AssistantStreamEventThreadRunStepExpired)
- func (u AssistantStreamEventUnion) AsThreadRunStepFailed() (v AssistantStreamEventThreadRunStepFailed)
- func (u AssistantStreamEventUnion) AsThreadRunStepInProgress() (v AssistantStreamEventThreadRunStepInProgress)
- func (u AssistantStreamEventUnion) RawJSON() string
- func (r *AssistantStreamEventUnion) UnmarshalJSON(data []byte) error
- type AssistantStreamEventUnionData
- type AssistantStreamEventUnionDataDelta
- type AssistantStreamEventUnionDataIncompleteDetails
- type AssistantStreamEventUnionDataLastError
- type AssistantStreamEventUnionDataUsage
- type AssistantToolChoice
- type AssistantToolChoiceFunction
- type AssistantToolChoiceFunctionParam
- type AssistantToolChoiceOptionAuto
- type AssistantToolChoiceOptionUnion
- func (u AssistantToolChoiceOptionUnion) AsAssistantToolChoice() (v AssistantToolChoice)
- func (u AssistantToolChoiceOptionUnion) AsAuto() (v string)
- func (u AssistantToolChoiceOptionUnion) RawJSON() string
- func (r AssistantToolChoiceOptionUnion) ToParam() AssistantToolChoiceOptionUnionParam
- func (r *AssistantToolChoiceOptionUnion) UnmarshalJSON(data []byte) error
- type AssistantToolChoiceOptionUnionParam
- type AssistantToolChoiceParam
- type AssistantToolChoiceType
- type AssistantToolResources
- type AssistantToolResourcesCodeInterpreter
- type AssistantToolResourcesFileSearch
- type AssistantToolUnion
- func (u AssistantToolUnion) AsAny() anyAssistantTool
- func (u AssistantToolUnion) AsCodeInterpreter() (v CodeInterpreterTool)
- func (u AssistantToolUnion) AsFileSearch() (v FileSearchTool)
- func (u AssistantToolUnion) AsFunction() (v FunctionTool)
- func (u AssistantToolUnion) RawJSON() string
- func (r AssistantToolUnion) ToParam() AssistantToolUnionParam
- func (r *AssistantToolUnion) UnmarshalJSON(data []byte) error
- type AssistantToolUnionParam
- func (u AssistantToolUnionParam) GetFileSearch() *FileSearchToolFileSearchParam
- func (u AssistantToolUnionParam) GetFunction() *shared.FunctionDefinitionParam
- func (u AssistantToolUnionParam) GetType() *string
- func (u AssistantToolUnionParam) IsPresent() bool
- func (u AssistantToolUnionParam) MarshalJSON() ([]byte, error)
- type AudioModel
- type AudioResponseFormat
- type AudioService
- type AudioSpeechNewParams
- type AudioSpeechNewParamsResponseFormat
- type AudioSpeechNewParamsVoice
- type AudioSpeechService
- type AudioTranscriptionNewParams
- type AudioTranscriptionService
- type AudioTranslationNewParams
- type AudioTranslationNewParamsResponseFormat
- type AudioTranslationService
- type AutoFileChunkingStrategyParam
- type Batch
- type BatchError
- type BatchErrors
- type BatchListParams
- type BatchNewParams
- type BatchNewParamsCompletionWindow
- type BatchNewParamsEndpoint
- type BatchRequestCounts
- type BatchService
- func (r *BatchService) Cancel(ctx context.Context, batchID string, opts ...option.RequestOption) (res *Batch, err error)
- func (r *BatchService) Get(ctx context.Context, batchID string, opts ...option.RequestOption) (res *Batch, err error)
- func (r *BatchService) List(ctx context.Context, query BatchListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Batch], err error)
- func (r *BatchService) ListAutoPaging(ctx context.Context, query BatchListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Batch]
- func (r *BatchService) New(ctx context.Context, body BatchNewParams, opts ...option.RequestOption) (res *Batch, err error)
- type BatchStatus
- type BetaAssistantListParams
- type BetaAssistantListParamsOrder
- type BetaAssistantNewParams
- type BetaAssistantNewParamsToolResources
- type BetaAssistantNewParamsToolResourcesCodeInterpreter
- type BetaAssistantNewParamsToolResourcesFileSearch
- type BetaAssistantNewParamsToolResourcesFileSearchVectorStore
- type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto
- type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic
- type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
- type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion
- func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() ...
- func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string
- func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool
- func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error)
- type BetaAssistantService
- func (r *BetaAssistantService) Delete(ctx context.Context, assistantID string, opts ...option.RequestOption) (res *AssistantDeleted, err error)
- func (r *BetaAssistantService) Get(ctx context.Context, assistantID string, opts ...option.RequestOption) (res *Assistant, err error)
- func (r *BetaAssistantService) List(ctx context.Context, query BetaAssistantListParams, ...) (res *pagination.CursorPage[Assistant], err error)
- func (r *BetaAssistantService) ListAutoPaging(ctx context.Context, query BetaAssistantListParams, ...) *pagination.CursorPageAutoPager[Assistant]
- func (r *BetaAssistantService) New(ctx context.Context, body BetaAssistantNewParams, opts ...option.RequestOption) (res *Assistant, err error)
- func (r *BetaAssistantService) Update(ctx context.Context, assistantID string, body BetaAssistantUpdateParams, ...) (res *Assistant, err error)
- type BetaAssistantUpdateParams
- type BetaAssistantUpdateParamsModel
- type BetaAssistantUpdateParamsToolResources
- type BetaAssistantUpdateParamsToolResourcesCodeInterpreter
- type BetaAssistantUpdateParamsToolResourcesFileSearch
- type BetaService
- type BetaThreadMessageListParams
- type BetaThreadMessageListParamsOrder
- type BetaThreadMessageNewParams
- type BetaThreadMessageNewParamsAttachment
- type BetaThreadMessageNewParamsAttachmentToolFileSearch
- type BetaThreadMessageNewParamsAttachmentToolUnion
- type BetaThreadMessageNewParamsContentUnion
- type BetaThreadMessageNewParamsRole
- type BetaThreadMessageService
- func (r *BetaThreadMessageService) Delete(ctx context.Context, threadID string, messageID string, ...) (res *MessageDeleted, err error)
- func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, messageID string, ...) (res *Message, err error)
- func (r *BetaThreadMessageService) List(ctx context.Context, threadID string, query BetaThreadMessageListParams, ...) (res *pagination.CursorPage[Message], err error)
- func (r *BetaThreadMessageService) ListAutoPaging(ctx context.Context, threadID string, query BetaThreadMessageListParams, ...) *pagination.CursorPageAutoPager[Message]
- func (r *BetaThreadMessageService) New(ctx context.Context, threadID string, body BetaThreadMessageNewParams, ...) (res *Message, err error)
- func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string, messageID string, ...) (res *Message, err error)
- type BetaThreadMessageUpdateParams
- type BetaThreadNewAndRunParams
- type BetaThreadNewAndRunParamsThread
- type BetaThreadNewAndRunParamsThreadMessage
- type BetaThreadNewAndRunParamsThreadMessageAttachment
- type BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch
- type BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion
- type BetaThreadNewAndRunParamsThreadMessageContentUnion
- type BetaThreadNewAndRunParamsThreadToolResources
- type BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter
- type BetaThreadNewAndRunParamsThreadToolResourcesFileSearch
- type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore
- type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto
- type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic
- type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
- type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion
- func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() ...
- func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string
- func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool
- func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error)
- type BetaThreadNewAndRunParamsToolResources
- type BetaThreadNewAndRunParamsToolResourcesCodeInterpreter
- type BetaThreadNewAndRunParamsToolResourcesFileSearch
- type BetaThreadNewAndRunParamsToolUnion
- func (u BetaThreadNewAndRunParamsToolUnion) GetFileSearch() *FileSearchToolFileSearchParam
- func (u BetaThreadNewAndRunParamsToolUnion) GetFunction() *shared.FunctionDefinitionParam
- func (u BetaThreadNewAndRunParamsToolUnion) GetType() *string
- func (u BetaThreadNewAndRunParamsToolUnion) IsPresent() bool
- func (u BetaThreadNewAndRunParamsToolUnion) MarshalJSON() ([]byte, error)
- type BetaThreadNewAndRunParamsTruncationStrategy
- type BetaThreadNewParams
- type BetaThreadNewParamsMessage
- type BetaThreadNewParamsMessageAttachment
- type BetaThreadNewParamsMessageAttachmentToolFileSearch
- type BetaThreadNewParamsMessageAttachmentToolUnion
- type BetaThreadNewParamsMessageContentUnion
- type BetaThreadNewParamsToolResources
- type BetaThreadNewParamsToolResourcesCodeInterpreter
- type BetaThreadNewParamsToolResourcesFileSearch
- type BetaThreadNewParamsToolResourcesFileSearchVectorStore
- type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto
- type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic
- type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
- type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion
- func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() ...
- func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string
- func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool
- func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error)
- type BetaThreadRunListParams
- type BetaThreadRunListParamsOrder
- type BetaThreadRunNewParams
- type BetaThreadRunNewParamsAdditionalMessage
- type BetaThreadRunNewParamsAdditionalMessageAttachment
- type BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch
- type BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion
- type BetaThreadRunNewParamsAdditionalMessageContentUnion
- type BetaThreadRunNewParamsTruncationStrategy
- type BetaThreadRunService
- func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runID string, ...) (res *Run, err error)
- func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID string, ...) (res *Run, err error)
- func (r *BetaThreadRunService) List(ctx context.Context, threadID string, query BetaThreadRunListParams, ...) (res *pagination.CursorPage[Run], err error)
- func (r *BetaThreadRunService) ListAutoPaging(ctx context.Context, threadID string, query BetaThreadRunListParams, ...) *pagination.CursorPageAutoPager[Run]
- func (r *BetaThreadRunService) New(ctx context.Context, threadID string, params BetaThreadRunNewParams, ...) (res *Run, err error)
- func (r *BetaThreadRunService) NewAndPoll(ctx context.Context, threadID string, params BetaThreadRunNewParams, ...) (res *Run, err error)
- func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string, params BetaThreadRunNewParams, ...) (stream *ssestream.Stream[AssistantStreamEventUnion])
- func (r *BetaThreadRunService) PollStatus(ctx context.Context, threadID string, runID string, pollIntervalMs int, ...) (res *Run, err error)
- func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID string, runID string, ...) (res *Run, err error)
- func (r *BetaThreadRunService) SubmitToolOutputsAndPoll(ctx context.Context, threadID string, runID string, ...) (*Run, error)
- func (r *BetaThreadRunService) SubmitToolOutputsStreaming(ctx context.Context, threadID string, runID string, ...) (stream *ssestream.Stream[AssistantStreamEventUnion])
- func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runID string, ...) (res *Run, err error)
- type BetaThreadRunStepGetParams
- type BetaThreadRunStepListParams
- type BetaThreadRunStepListParamsOrder
- type BetaThreadRunStepService
- func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, runID string, stepID string, ...) (res *RunStep, err error)
- func (r *BetaThreadRunStepService) List(ctx context.Context, threadID string, runID string, ...) (res *pagination.CursorPage[RunStep], err error)
- func (r *BetaThreadRunStepService) ListAutoPaging(ctx context.Context, threadID string, runID string, ...) *pagination.CursorPageAutoPager[RunStep]
- type BetaThreadRunSubmitToolOutputsParams
- type BetaThreadRunSubmitToolOutputsParamsToolOutput
- type BetaThreadRunUpdateParams
- type BetaThreadService
- func (r *BetaThreadService) Delete(ctx context.Context, threadID string, opts ...option.RequestOption) (res *ThreadDeleted, err error)
- func (r *BetaThreadService) Get(ctx context.Context, threadID string, opts ...option.RequestOption) (res *Thread, err error)
- func (r *BetaThreadService) New(ctx context.Context, body BetaThreadNewParams, opts ...option.RequestOption) (res *Thread, err error)
- func (r *BetaThreadService) NewAndRun(ctx context.Context, body BetaThreadNewAndRunParams, ...) (res *Run, err error)
- func (r *BetaThreadService) NewAndRunPoll(ctx context.Context, body BetaThreadNewAndRunParams, pollIntervalMs int, ...) (res *Run, err error)
- func (r *BetaThreadService) NewAndRunStreaming(ctx context.Context, body BetaThreadNewAndRunParams, ...) (stream *ssestream.Stream[AssistantStreamEventUnion])
- func (r *BetaThreadService) Update(ctx context.Context, threadID string, body BetaThreadUpdateParams, ...) (res *Thread, err error)
- type BetaThreadUpdateParams
- type BetaThreadUpdateParamsToolResources
- type BetaThreadUpdateParamsToolResourcesCodeInterpreter
- type BetaThreadUpdateParamsToolResourcesFileSearch
- type ChatCompletion
- type ChatCompletionAccumulator
- func (acc *ChatCompletionAccumulator) AddChunk(chunk ChatCompletionChunk) bool
- func (acc *ChatCompletionAccumulator) JustFinishedContent() (content string, ok bool)
- func (acc *ChatCompletionAccumulator) JustFinishedRefusal() (refusal string, ok bool)
- func (acc *ChatCompletionAccumulator) JustFinishedToolCall() (toolcall FinishedChatCompletionToolCall, ok bool)
- type ChatCompletionAssistantMessageParam
- type ChatCompletionAssistantMessageParamAudio
- type ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion
- func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetRefusal() *string
- func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetText() *string
- func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetType() *string
- func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) IsPresent() bool
- func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) MarshalJSON() ([]byte, error)
- type ChatCompletionAssistantMessageParamContentUnion
- type ChatCompletionAssistantMessageParamFunctionCalldeprecated
- type ChatCompletionAudio
- type ChatCompletionAudioParam
- type ChatCompletionAudioParamFormat
- type ChatCompletionAudioParamVoice
- type ChatCompletionChoice
- type ChatCompletionChoiceLogprobs
- type ChatCompletionChunk
- type ChatCompletionChunkChoice
- type ChatCompletionChunkChoiceDelta
- type ChatCompletionChunkChoiceDeltaFunctionCalldeprecated
- type ChatCompletionChunkChoiceDeltaToolCall
- type ChatCompletionChunkChoiceDeltaToolCallFunction
- type ChatCompletionChunkChoiceLogprobs
- type ChatCompletionChunkServiceTier
- type ChatCompletionContentPartFileFileParam
- type ChatCompletionContentPartFileParam
- type ChatCompletionContentPartImageImageURLParam
- type ChatCompletionContentPartImageParam
- type ChatCompletionContentPartInputAudioInputAudioParam
- type ChatCompletionContentPartInputAudioParam
- type ChatCompletionContentPartRefusalParam
- type ChatCompletionContentPartTextParam
- type ChatCompletionContentPartUnionParam
- func FileContentPart(file ChatCompletionContentPartFileFileParam) ChatCompletionContentPartUnionParam
- func ImageContentPart(imageURL ChatCompletionContentPartImageImageURLParam) ChatCompletionContentPartUnionParam
- func InputAudioContentPart(inputAudio ChatCompletionContentPartInputAudioInputAudioParam) ChatCompletionContentPartUnionParam
- func TextContentPart(text string) ChatCompletionContentPartUnionParam
- func (u ChatCompletionContentPartUnionParam) GetFile() *ChatCompletionContentPartFileFileParam
- func (u ChatCompletionContentPartUnionParam) GetImageURL() *ChatCompletionContentPartImageImageURLParam
- func (u ChatCompletionContentPartUnionParam) GetInputAudio() *ChatCompletionContentPartInputAudioInputAudioParam
- func (u ChatCompletionContentPartUnionParam) GetText() *string
- func (u ChatCompletionContentPartUnionParam) GetType() *string
- func (u ChatCompletionContentPartUnionParam) IsPresent() bool
- func (u ChatCompletionContentPartUnionParam) MarshalJSON() ([]byte, error)
- type ChatCompletionDeleted
- type ChatCompletionDeveloperMessageParam
- type ChatCompletionDeveloperMessageParamContentUnion
- type ChatCompletionFunctionCallOptionParam
- type ChatCompletionFunctionMessageParamdeprecated
- type ChatCompletionListParams
- type ChatCompletionListParamsOrder
- type ChatCompletionMessage
- type ChatCompletionMessageAnnotation
- type ChatCompletionMessageAnnotationURLCitation
- type ChatCompletionMessageFunctionCalldeprecated
- type ChatCompletionMessageListParams
- type ChatCompletionMessageListParamsOrder
- type ChatCompletionMessageParamUnion
- func AssistantMessage[T string | []ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion](content T) ChatCompletionMessageParamUnion
- func ChatCompletionMessageParamOfFunction(content string, name string) ChatCompletionMessageParamUnion
- func DeveloperMessage[T string | []ChatCompletionContentPartTextParam](content T) ChatCompletionMessageParamUnion
- func SystemMessage[T string | []ChatCompletionContentPartTextParam](content T) ChatCompletionMessageParamUnion
- func ToolMessage[T string | []ChatCompletionContentPartTextParam](content T, toolCallID string) ChatCompletionMessageParamUnion
- func UserMessage[T string | []ChatCompletionContentPartUnionParam](content T) ChatCompletionMessageParamUnion
- func (u ChatCompletionMessageParamUnion) GetAudio() *ChatCompletionAssistantMessageParamAudio
- func (u ChatCompletionMessageParamUnion) GetContent() (res chatCompletionMessageParamUnionContent)
- func (u ChatCompletionMessageParamUnion) GetFunctionCall() *ChatCompletionAssistantMessageParamFunctionCall
- func (u ChatCompletionMessageParamUnion) GetName() *string
- func (u ChatCompletionMessageParamUnion) GetRefusal() *string
- func (u ChatCompletionMessageParamUnion) GetRole() *string
- func (u ChatCompletionMessageParamUnion) GetToolCallID() *string
- func (u ChatCompletionMessageParamUnion) GetToolCalls() []ChatCompletionMessageToolCallParam
- func (u ChatCompletionMessageParamUnion) IsPresent() bool
- func (u ChatCompletionMessageParamUnion) MarshalJSON() ([]byte, error)
- type ChatCompletionMessageService
- func (r *ChatCompletionMessageService) List(ctx context.Context, completionID string, ...) (res *pagination.CursorPage[ChatCompletionStoreMessage], err error)
- func (r *ChatCompletionMessageService) ListAutoPaging(ctx context.Context, completionID string, ...) *pagination.CursorPageAutoPager[ChatCompletionStoreMessage]
- type ChatCompletionMessageToolCall
- type ChatCompletionMessageToolCallFunction
- type ChatCompletionMessageToolCallFunctionParam
- type ChatCompletionMessageToolCallParam
- type ChatCompletionNamedToolChoiceFunctionParam
- type ChatCompletionNamedToolChoiceParam
- type ChatCompletionNewParams
- type ChatCompletionNewParamsFunctiondeprecated
- type ChatCompletionNewParamsFunctionCallFunctionCallMode
- type ChatCompletionNewParamsFunctionCallUnion
- type ChatCompletionNewParamsResponseFormatUnion
- func (u ChatCompletionNewParamsResponseFormatUnion) GetJSONSchema() *shared.ResponseFormatJSONSchemaJSONSchemaParam
- func (u ChatCompletionNewParamsResponseFormatUnion) GetType() *string
- func (u ChatCompletionNewParamsResponseFormatUnion) IsPresent() bool
- func (u ChatCompletionNewParamsResponseFormatUnion) MarshalJSON() ([]byte, error)
- type ChatCompletionNewParamsServiceTier
- type ChatCompletionNewParamsStopUnion
- type ChatCompletionNewParamsWebSearchOptions
- type ChatCompletionNewParamsWebSearchOptionsUserLocation
- type ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate
- type ChatCompletionPredictionContentContentUnionParam
- type ChatCompletionPredictionContentParam
- type ChatCompletionService
- func (r *ChatCompletionService) Delete(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletionDeleted, err error)
- func (r *ChatCompletionService) Get(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletion, err error)
- func (r *ChatCompletionService) List(ctx context.Context, query ChatCompletionListParams, ...) (res *pagination.CursorPage[ChatCompletion], err error)
- func (r *ChatCompletionService) ListAutoPaging(ctx context.Context, query ChatCompletionListParams, ...) *pagination.CursorPageAutoPager[ChatCompletion]
- func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewParams, ...) (res *ChatCompletion, err error)
- func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompletionNewParams, ...) (stream *ssestream.Stream[ChatCompletionChunk])
- func (r *ChatCompletionService) Update(ctx context.Context, completionID string, body ChatCompletionUpdateParams, ...) (res *ChatCompletion, err error)
- type ChatCompletionServiceTier
- type ChatCompletionStoreMessage
- type ChatCompletionStreamOptionsParam
- type ChatCompletionSystemMessageParam
- type ChatCompletionSystemMessageParamContentUnion
- type ChatCompletionTokenLogprob
- type ChatCompletionTokenLogprobTopLogprob
- type ChatCompletionToolChoiceOptionAuto
- type ChatCompletionToolChoiceOptionUnionParam
- func (u ChatCompletionToolChoiceOptionUnionParam) GetFunction() *ChatCompletionNamedToolChoiceFunctionParam
- func (u ChatCompletionToolChoiceOptionUnionParam) GetType() *string
- func (u ChatCompletionToolChoiceOptionUnionParam) IsPresent() bool
- func (u ChatCompletionToolChoiceOptionUnionParam) MarshalJSON() ([]byte, error)
- type ChatCompletionToolMessageParam
- type ChatCompletionToolMessageParamContentUnion
- type ChatCompletionToolParam
- type ChatCompletionUpdateParams
- type ChatCompletionUserMessageParam
- type ChatCompletionUserMessageParamContentUnion
- type ChatModel
- type ChatService
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, ...) error
- func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, ...) error
- func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, ...) error
- func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, ...) error
- type CodeInterpreterLogs
- type CodeInterpreterOutputImage
- type CodeInterpreterOutputImageImage
- type CodeInterpreterTool
- type CodeInterpreterToolCall
- type CodeInterpreterToolCallCodeInterpreter
- type CodeInterpreterToolCallCodeInterpreterOutputImage
- type CodeInterpreterToolCallCodeInterpreterOutputImageImage
- type CodeInterpreterToolCallCodeInterpreterOutputLogs
- type CodeInterpreterToolCallCodeInterpreterOutputUnion
- func (u CodeInterpreterToolCallCodeInterpreterOutputUnion) AsAny() anyCodeInterpreterToolCallCodeInterpreterOutput
- func (u CodeInterpreterToolCallCodeInterpreterOutputUnion) AsImage() (v CodeInterpreterToolCallCodeInterpreterOutputImage)
- func (u CodeInterpreterToolCallCodeInterpreterOutputUnion) AsLogs() (v CodeInterpreterToolCallCodeInterpreterOutputLogs)
- func (u CodeInterpreterToolCallCodeInterpreterOutputUnion) RawJSON() string
- func (r *CodeInterpreterToolCallCodeInterpreterOutputUnion) UnmarshalJSON(data []byte) error
- type CodeInterpreterToolCallDelta
- type CodeInterpreterToolCallDeltaCodeInterpreter
- type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion
- func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsAny() anyCodeInterpreterToolCallDeltaCodeInterpreterOutput
- func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsImage() (v CodeInterpreterOutputImage)
- func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsLogs() (v CodeInterpreterLogs)
- func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) RawJSON() string
- func (r *CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) UnmarshalJSON(data []byte) error
- type CodeInterpreterToolParam
- type ComparisonFilter
- type ComparisonFilterParam
- type ComparisonFilterType
- type ComparisonFilterValueUnion
- type ComparisonFilterValueUnionParam
- type Completion
- type CompletionChoice
- type CompletionChoiceFinishReason
- type CompletionChoiceLogprobs
- type CompletionNewParams
- type CompletionNewParamsModel
- type CompletionNewParamsPromptUnion
- type CompletionNewParamsStopUnion
- type CompletionService
- type CompletionUsage
- type CompletionUsageCompletionTokensDetails
- type CompletionUsagePromptTokensDetails
- type CompoundFilter
- type CompoundFilterParam
- type CompoundFilterType
- type CreateEmbeddingResponse
- type CreateEmbeddingResponseUsage
- type Embedding
- type EmbeddingModel
- type EmbeddingNewParams
- type EmbeddingNewParamsEncodingFormat
- type EmbeddingNewParamsInputUnion
- type EmbeddingService
- type Error
- type ErrorObject
- type FileChunkingStrategyParamUnion
- type FileChunkingStrategyUnion
- func (u FileChunkingStrategyUnion) AsAny() anyFileChunkingStrategy
- func (u FileChunkingStrategyUnion) AsOther() (v OtherFileChunkingStrategyObject)
- func (u FileChunkingStrategyUnion) AsStatic() (v StaticFileChunkingStrategyObject)
- func (u FileChunkingStrategyUnion) RawJSON() string
- func (r *FileChunkingStrategyUnion) UnmarshalJSON(data []byte) error
- type FileCitationAnnotation
- type FileCitationAnnotationFileCitation
- type FileCitationDeltaAnnotation
- type FileCitationDeltaAnnotationFileCitation
- type FileDeleted
- type FileListParams
- type FileListParamsOrder
- type FileNewParams
- type FileObject
- type FileObjectPurpose
- type FileObjectStatus
- type FilePathAnnotation
- type FilePathAnnotationFilePath
- type FilePathDeltaAnnotation
- type FilePathDeltaAnnotationFilePath
- type FilePurpose
- type FileSearchTool
- type FileSearchToolCall
- type FileSearchToolCallDelta
- type FileSearchToolCallFileSearch
- type FileSearchToolCallFileSearchRankingOptions
- type FileSearchToolCallFileSearchResult
- type FileSearchToolCallFileSearchResultContent
- type FileSearchToolFileSearch
- type FileSearchToolFileSearchParam
- type FileSearchToolFileSearchRankingOptions
- type FileSearchToolFileSearchRankingOptionsParam
- type FileSearchToolParam
- type FileService
- func (r *FileService) Content(ctx context.Context, fileID string, opts ...option.RequestOption) (res *http.Response, err error)
- func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileDeleted, err error)
- func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileObject, err error)
- func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FileObject], err error)
- func (r *FileService) ListAutoPaging(ctx context.Context, query FileListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[FileObject]
- func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...option.RequestOption) (res *FileObject, err error)
- type FineTuningCheckpointPermissionDeleteResponse
- type FineTuningCheckpointPermissionGetParams
- type FineTuningCheckpointPermissionGetParamsOrder
- type FineTuningCheckpointPermissionGetResponse
- type FineTuningCheckpointPermissionGetResponseData
- type FineTuningCheckpointPermissionNewParams
- type FineTuningCheckpointPermissionNewResponse
- type FineTuningCheckpointPermissionService
- func (r *FineTuningCheckpointPermissionService) Delete(ctx context.Context, fineTunedModelCheckpoint string, ...) (res *FineTuningCheckpointPermissionDeleteResponse, err error)
- func (r *FineTuningCheckpointPermissionService) Get(ctx context.Context, fineTunedModelCheckpoint string, ...) (res *FineTuningCheckpointPermissionGetResponse, err error)
- func (r *FineTuningCheckpointPermissionService) New(ctx context.Context, fineTunedModelCheckpoint string, ...) (res *pagination.Page[FineTuningCheckpointPermissionNewResponse], err error)
- func (r *FineTuningCheckpointPermissionService) NewAutoPaging(ctx context.Context, fineTunedModelCheckpoint string, ...) *pagination.PageAutoPager[FineTuningCheckpointPermissionNewResponse]
- type FineTuningCheckpointService
- type FineTuningJob
- type FineTuningJobCheckpoint
- type FineTuningJobCheckpointListParams
- type FineTuningJobCheckpointMetrics
- type FineTuningJobCheckpointService
- func (r *FineTuningJobCheckpointService) List(ctx context.Context, fineTuningJobID string, ...) (res *pagination.CursorPage[FineTuningJobCheckpoint], err error)
- func (r *FineTuningJobCheckpointService) ListAutoPaging(ctx context.Context, fineTuningJobID string, ...) *pagination.CursorPageAutoPager[FineTuningJobCheckpoint]
- type FineTuningJobError
- type FineTuningJobEvent
- type FineTuningJobEventLevel
- type FineTuningJobEventType
- type FineTuningJobHyperparameters
- type FineTuningJobHyperparametersBatchSizeUnion
- func (u FineTuningJobHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobHyperparametersBatchSizeUnion) AsInt() (v int64)
- func (u FineTuningJobHyperparametersBatchSizeUnion) RawJSON() string
- func (r *FineTuningJobHyperparametersBatchSizeUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobHyperparametersLearningRateMultiplierUnion
- func (u FineTuningJobHyperparametersLearningRateMultiplierUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobHyperparametersLearningRateMultiplierUnion) AsFloat() (v float64)
- func (u FineTuningJobHyperparametersLearningRateMultiplierUnion) RawJSON() string
- func (r *FineTuningJobHyperparametersLearningRateMultiplierUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobHyperparametersNEpochsUnion
- type FineTuningJobListEventsParams
- type FineTuningJobListParams
- type FineTuningJobMethod
- type FineTuningJobMethodDpo
- type FineTuningJobMethodDpoHyperparameters
- type FineTuningJobMethodDpoHyperparametersBatchSizeUnion
- func (u FineTuningJobMethodDpoHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodDpoHyperparametersBatchSizeUnion) AsInt() (v int64)
- func (u FineTuningJobMethodDpoHyperparametersBatchSizeUnion) RawJSON() string
- func (r *FineTuningJobMethodDpoHyperparametersBatchSizeUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobMethodDpoHyperparametersBetaUnion
- func (u FineTuningJobMethodDpoHyperparametersBetaUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodDpoHyperparametersBetaUnion) AsFloat() (v float64)
- func (u FineTuningJobMethodDpoHyperparametersBetaUnion) RawJSON() string
- func (r *FineTuningJobMethodDpoHyperparametersBetaUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion
- func (u FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) AsFloat() (v float64)
- func (u FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) RawJSON() string
- func (r *FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobMethodDpoHyperparametersNEpochsUnion
- func (u FineTuningJobMethodDpoHyperparametersNEpochsUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodDpoHyperparametersNEpochsUnion) AsInt() (v int64)
- func (u FineTuningJobMethodDpoHyperparametersNEpochsUnion) RawJSON() string
- func (r *FineTuningJobMethodDpoHyperparametersNEpochsUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobMethodSupervised
- type FineTuningJobMethodSupervisedHyperparameters
- type FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion
- func (u FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) AsInt() (v int64)
- func (u FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) RawJSON() string
- func (r *FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion
- func (u FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) AsFloat() (v float64)
- func (u FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) RawJSON() string
- func (r *FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobMethodSupervisedHyperparametersNEpochsUnion
- func (u FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) AsAuto() (v constant.Auto)
- func (u FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) AsInt() (v int64)
- func (u FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) RawJSON() string
- func (r *FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) UnmarshalJSON(data []byte) error
- type FineTuningJobNewParams
- type FineTuningJobNewParamsHyperparametersdeprecated
- type FineTuningJobNewParamsHyperparametersBatchSizeUnion
- type FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion
- type FineTuningJobNewParamsHyperparametersNEpochsUnion
- type FineTuningJobNewParamsIntegration
- type FineTuningJobNewParamsIntegrationWandb
- type FineTuningJobNewParamsMethod
- type FineTuningJobNewParamsMethodDpo
- type FineTuningJobNewParamsMethodDpoHyperparameters
- type FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion
- type FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion
- type FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion
- type FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion
- type FineTuningJobNewParamsMethodSupervised
- type FineTuningJobNewParamsMethodSupervisedHyperparameters
- type FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion
- type FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion
- type FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion
- type FineTuningJobNewParamsModel
- type FineTuningJobService
- func (r *FineTuningJobService) Cancel(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error)
- func (r *FineTuningJobService) Get(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error)
- func (r *FineTuningJobService) List(ctx context.Context, query FineTuningJobListParams, ...) (res *pagination.CursorPage[FineTuningJob], err error)
- func (r *FineTuningJobService) ListAutoPaging(ctx context.Context, query FineTuningJobListParams, ...) *pagination.CursorPageAutoPager[FineTuningJob]
- func (r *FineTuningJobService) ListEvents(ctx context.Context, fineTuningJobID string, ...) (res *pagination.CursorPage[FineTuningJobEvent], err error)
- func (r *FineTuningJobService) ListEventsAutoPaging(ctx context.Context, fineTuningJobID string, ...) *pagination.CursorPageAutoPager[FineTuningJobEvent]
- func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewParams, opts ...option.RequestOption) (res *FineTuningJob, err error)
- type FineTuningJobStatus
- type FineTuningJobWandbIntegration
- type FineTuningJobWandbIntegrationObject
- type FineTuningService
- type FinishedChatCompletionToolCall
- type FunctionDefinition
- type FunctionDefinitionParam
- type FunctionParameters
- type FunctionTool
- type FunctionToolCall
- type FunctionToolCallDelta
- type FunctionToolCallDeltaFunction
- type FunctionToolCallFunction
- type FunctionToolParam
- type Image
- type ImageEditParams
- type ImageEditParamsResponseFormat
- type ImageEditParamsSize
- type ImageFile
- type ImageFileContentBlock
- type ImageFileContentBlockParam
- type ImageFileDelta
- type ImageFileDeltaBlock
- type ImageFileDeltaDetail
- type ImageFileDetail
- type ImageFileParam
- type ImageGenerateParams
- type ImageGenerateParamsQuality
- type ImageGenerateParamsResponseFormat
- type ImageGenerateParamsSize
- type ImageGenerateParamsStyle
- type ImageModel
- type ImageNewVariationParams
- type ImageNewVariationParamsResponseFormat
- type ImageNewVariationParamsSize
- type ImageService
- func (r *ImageService) Edit(ctx context.Context, body ImageEditParams, opts ...option.RequestOption) (res *ImagesResponse, err error)
- func (r *ImageService) Generate(ctx context.Context, body ImageGenerateParams, opts ...option.RequestOption) (res *ImagesResponse, err error)
- func (r *ImageService) NewVariation(ctx context.Context, body ImageNewVariationParams, ...) (res *ImagesResponse, err error)
- type ImageURL
- type ImageURLContentBlock
- type ImageURLContentBlockParam
- type ImageURLDelta
- type ImageURLDeltaBlock
- type ImageURLDeltaDetail
- type ImageURLDetail
- type ImageURLParam
- type ImagesResponse
- type Message
- type MessageAttachment
- type MessageAttachmentToolAssistantToolsFileSearchTypeOnly
- type MessageAttachmentToolUnion
- func (u MessageAttachmentToolUnion) AsCodeInterpreterTool() (v CodeInterpreterTool)
- func (u MessageAttachmentToolUnion) AsFileSearchTool() (v MessageAttachmentToolAssistantToolsFileSearchTypeOnly)
- func (u MessageAttachmentToolUnion) RawJSON() string
- func (r *MessageAttachmentToolUnion) UnmarshalJSON(data []byte) error
- type MessageContentDeltaUnion
- func (u MessageContentDeltaUnion) AsAny() anyMessageContentDelta
- func (u MessageContentDeltaUnion) AsImageFile() (v ImageFileDeltaBlock)
- func (u MessageContentDeltaUnion) AsImageURL() (v ImageURLDeltaBlock)
- func (u MessageContentDeltaUnion) AsRefusal() (v RefusalDeltaBlock)
- func (u MessageContentDeltaUnion) AsText() (v TextDeltaBlock)
- func (u MessageContentDeltaUnion) RawJSON() string
- func (r *MessageContentDeltaUnion) UnmarshalJSON(data []byte) error
- type MessageContentPartParamUnion
- func (u MessageContentPartParamUnion) GetImageFile() *ImageFileParam
- func (u MessageContentPartParamUnion) GetImageURL() *ImageURLParam
- func (u MessageContentPartParamUnion) GetText() *string
- func (u MessageContentPartParamUnion) GetType() *string
- func (u MessageContentPartParamUnion) IsPresent() bool
- func (u MessageContentPartParamUnion) MarshalJSON() ([]byte, error)
- type MessageContentUnion
- func (u MessageContentUnion) AsAny() anyMessageContent
- func (u MessageContentUnion) AsImageFile() (v ImageFileContentBlock)
- func (u MessageContentUnion) AsImageURL() (v ImageURLContentBlock)
- func (u MessageContentUnion) AsRefusal() (v RefusalContentBlock)
- func (u MessageContentUnion) AsText() (v TextContentBlock)
- func (u MessageContentUnion) RawJSON() string
- func (r *MessageContentUnion) UnmarshalJSON(data []byte) error
- type MessageCreationStepDetails
- type MessageCreationStepDetailsMessageCreation
- type MessageDeleted
- type MessageDelta
- type MessageDeltaEvent
- type MessageDeltaRole
- type MessageIncompleteDetails
- type MessageRole
- type MessageStatus
- type Metadata
- type MetadataParam
- type Model
- type ModelDeleted
- type ModelService
- func (r *ModelService) Delete(ctx context.Context, model string, opts ...option.RequestOption) (res *ModelDeleted, err error)
- func (r *ModelService) Get(ctx context.Context, model string, opts ...option.RequestOption) (res *Model, err error)
- func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *pagination.Page[Model], err error)
- func (r *ModelService) ListAutoPaging(ctx context.Context, opts ...option.RequestOption) *pagination.PageAutoPager[Model]
- type Moderation
- type ModerationCategories
- type ModerationCategoryAppliedInputTypes
- type ModerationCategoryScores
- type ModerationImageURLInputImageURLParam
- type ModerationImageURLInputParam
- type ModerationModel
- type ModerationMultiModalInputUnionParam
- func (u ModerationMultiModalInputUnionParam) GetImageURL() *ModerationImageURLInputImageURLParam
- func (u ModerationMultiModalInputUnionParam) GetText() *string
- func (u ModerationMultiModalInputUnionParam) GetType() *string
- func (u ModerationMultiModalInputUnionParam) IsPresent() bool
- func (u ModerationMultiModalInputUnionParam) MarshalJSON() ([]byte, error)
- type ModerationNewParams
- type ModerationNewParamsInputUnion
- type ModerationNewResponse
- type ModerationService
- type ModerationTextInputParam
- type OtherFileChunkingStrategyObject
- type Reasoning
- type ReasoningEffort
- type ReasoningGenerateSummary
- type ReasoningParam
- type RefusalContentBlock
- type RefusalDeltaBlock
- type RequiredActionFunctionToolCall
- type RequiredActionFunctionToolCallFunction
- type ResponseFormatJSONObject
- type ResponseFormatJSONObjectParam
- type ResponseFormatJSONSchema
- type ResponseFormatJSONSchemaJSONSchema
- type ResponseFormatJSONSchemaJSONSchemaParam
- type ResponseFormatJSONSchemaParam
- type ResponseFormatText
- type ResponseFormatTextParam
- type ResponsesModel
- type Run
- type RunIncompleteDetails
- type RunLastError
- type RunRequiredAction
- type RunRequiredActionSubmitToolOutputs
- type RunStatus
- type RunStep
- type RunStepDelta
- type RunStepDeltaEvent
- type RunStepDeltaMessageDelta
- type RunStepDeltaMessageDeltaMessageCreation
- type RunStepDeltaStepDetailsUnion
- func (u RunStepDeltaStepDetailsUnion) AsAny() anyRunStepDeltaStepDetails
- func (u RunStepDeltaStepDetailsUnion) AsMessageCreation() (v RunStepDeltaMessageDelta)
- func (u RunStepDeltaStepDetailsUnion) AsToolCalls() (v ToolCallDeltaObject)
- func (u RunStepDeltaStepDetailsUnion) RawJSON() string
- func (r *RunStepDeltaStepDetailsUnion) UnmarshalJSON(data []byte) error
- type RunStepInclude
- type RunStepLastError
- type RunStepStatus
- type RunStepStepDetailsUnion
- func (u RunStepStepDetailsUnion) AsAny() anyRunStepStepDetails
- func (u RunStepStepDetailsUnion) AsMessageCreation() (v MessageCreationStepDetails)
- func (u RunStepStepDetailsUnion) AsToolCalls() (v ToolCallsStepDetails)
- func (u RunStepStepDetailsUnion) RawJSON() string
- func (r *RunStepStepDetailsUnion) UnmarshalJSON(data []byte) error
- type RunStepType
- type RunStepUsage
- type RunTruncationStrategy
- type RunUsage
- type SpeechModel
- type StaticFileChunkingStrategy
- type StaticFileChunkingStrategyObject
- type StaticFileChunkingStrategyObjectParam
- type StaticFileChunkingStrategyParam
- type Text
- type TextContentBlock
- type TextContentBlockParam
- type TextDelta
- type TextDeltaBlock
- type Thread
- type ThreadDeleted
- type ThreadToolResources
- type ThreadToolResourcesCodeInterpreter
- type ThreadToolResourcesFileSearch
- type ToolCallDeltaObject
- type ToolCallDeltaUnion
- func (u ToolCallDeltaUnion) AsAny() anyToolCallDelta
- func (u ToolCallDeltaUnion) AsCodeInterpreter() (v CodeInterpreterToolCallDelta)
- func (u ToolCallDeltaUnion) AsFileSearch() (v FileSearchToolCallDelta)
- func (u ToolCallDeltaUnion) AsFunction() (v FunctionToolCallDelta)
- func (u ToolCallDeltaUnion) RawJSON() string
- func (r *ToolCallDeltaUnion) UnmarshalJSON(data []byte) error
- type ToolCallUnion
- func (u ToolCallUnion) AsAny() anyToolCall
- func (u ToolCallUnion) AsCodeInterpreter() (v CodeInterpreterToolCall)
- func (u ToolCallUnion) AsFileSearch() (v FileSearchToolCall)
- func (u ToolCallUnion) AsFunction() (v FunctionToolCall)
- func (u ToolCallUnion) RawJSON() string
- func (r *ToolCallUnion) UnmarshalJSON(data []byte) error
- type ToolCallsStepDetails
- type Transcription
- type TranscriptionInclude
- type TranscriptionLogprob
- type TranscriptionStreamEventUnion
- func (u TranscriptionStreamEventUnion) AsAny() anyTranscriptionStreamEvent
- func (u TranscriptionStreamEventUnion) AsTranscriptTextDelta() (v TranscriptionTextDeltaEvent)
- func (u TranscriptionStreamEventUnion) AsTranscriptTextDone() (v TranscriptionTextDoneEvent)
- func (u TranscriptionStreamEventUnion) RawJSON() string
- func (r *TranscriptionStreamEventUnion) UnmarshalJSON(data []byte) error
- type TranscriptionStreamEventUnionLogprobs
- type TranscriptionTextDeltaEvent
- type TranscriptionTextDeltaEventLogprob
- type TranscriptionTextDoneEvent
- type TranscriptionTextDoneEventLogprob
- type Translation
- type Upload
- type UploadCompleteParams
- type UploadNewParams
- type UploadPart
- type UploadPartNewParams
- type UploadPartService
- type UploadService
- func (r *UploadService) Cancel(ctx context.Context, uploadID string, opts ...option.RequestOption) (res *Upload, err error)
- func (r *UploadService) Complete(ctx context.Context, uploadID string, body UploadCompleteParams, ...) (res *Upload, err error)
- func (r *UploadService) New(ctx context.Context, body UploadNewParams, opts ...option.RequestOption) (res *Upload, err error)
- type UploadStatus
- type VectorStore
- type VectorStoreDeleted
- type VectorStoreExpiresAfter
- type VectorStoreFile
- type VectorStoreFileAttributeUnion
- func (u VectorStoreFileAttributeUnion) AsBool() (v bool)
- func (u VectorStoreFileAttributeUnion) AsFloat() (v float64)
- func (u VectorStoreFileAttributeUnion) AsString() (v string)
- func (u VectorStoreFileAttributeUnion) RawJSON() string
- func (r *VectorStoreFileAttributeUnion) UnmarshalJSON(data []byte) error
- type VectorStoreFileBatch
- type VectorStoreFileBatchFileCounts
- type VectorStoreFileBatchListFilesParams
- type VectorStoreFileBatchListFilesParamsFilter
- type VectorStoreFileBatchListFilesParamsOrder
- type VectorStoreFileBatchNewParams
- type VectorStoreFileBatchNewParamsAttributeUnion
- type VectorStoreFileBatchService
- func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, vectorStoreID string, batchID string, ...) (res *VectorStoreFileBatch, err error)
- func (r *VectorStoreFileBatchService) Get(ctx context.Context, vectorStoreID string, batchID string, ...) (res *VectorStoreFileBatch, err error)
- func (r *VectorStoreFileBatchService) ListFiles(ctx context.Context, vectorStoreID string, batchID string, ...) (res *pagination.CursorPage[VectorStoreFile], err error)
- func (r *VectorStoreFileBatchService) ListFilesAutoPaging(ctx context.Context, vectorStoreID string, batchID string, ...) *pagination.CursorPageAutoPager[VectorStoreFile]
- func (r *VectorStoreFileBatchService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileBatchNewParams, ...) (res *VectorStoreFileBatch, err error)
- func (r *VectorStoreFileBatchService) NewAndPoll(ctx context.Context, vectorStoreId string, body VectorStoreFileBatchNewParams, ...) (res *VectorStoreFileBatch, err error)
- func (r *VectorStoreFileBatchService) PollStatus(ctx context.Context, vectorStoreID string, batchID string, pollIntervalMs int, ...) (*VectorStoreFileBatch, error)
- func (r *VectorStoreFileBatchService) UploadAndPoll(ctx context.Context, vectorStoreID string, files []FileNewParams, ...) (*VectorStoreFileBatch, error)
- type VectorStoreFileBatchStatus
- type VectorStoreFileContentResponse
- type VectorStoreFileCounts
- type VectorStoreFileDeleted
- type VectorStoreFileLastError
- type VectorStoreFileListParams
- type VectorStoreFileListParamsFilter
- type VectorStoreFileListParamsOrder
- type VectorStoreFileNewParams
- type VectorStoreFileNewParamsAttributeUnion
- type VectorStoreFileService
- func (r *VectorStoreFileService) Content(ctx context.Context, vectorStoreID string, fileID string, ...) (res *pagination.Page[VectorStoreFileContentResponse], err error)
- func (r *VectorStoreFileService) ContentAutoPaging(ctx context.Context, vectorStoreID string, fileID string, ...) *pagination.PageAutoPager[VectorStoreFileContentResponse]
- func (r *VectorStoreFileService) Delete(ctx context.Context, vectorStoreID string, fileID string, ...) (res *VectorStoreFileDeleted, err error)
- func (r *VectorStoreFileService) Get(ctx context.Context, vectorStoreID string, fileID string, ...) (res *VectorStoreFile, err error)
- func (r *VectorStoreFileService) List(ctx context.Context, vectorStoreID string, query VectorStoreFileListParams, ...) (res *pagination.CursorPage[VectorStoreFile], err error)
- func (r *VectorStoreFileService) ListAutoPaging(ctx context.Context, vectorStoreID string, query VectorStoreFileListParams, ...) *pagination.CursorPageAutoPager[VectorStoreFile]
- func (r *VectorStoreFileService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileNewParams, ...) (res *VectorStoreFile, err error)
- func (r *VectorStoreFileService) NewAndPoll(ctx context.Context, vectorStoreId string, body VectorStoreFileNewParams, ...) (res *VectorStoreFile, err error)
- func (r *VectorStoreFileService) PollStatus(ctx context.Context, vectorStoreID string, fileID string, pollIntervalMs int, ...) (*VectorStoreFile, error)
- func (r *VectorStoreFileService) Update(ctx context.Context, vectorStoreID string, fileID string, ...) (res *VectorStoreFile, err error)
- func (r *VectorStoreFileService) Upload(ctx context.Context, vectorStoreID string, body FileNewParams, ...) (*VectorStoreFile, error)
- func (r *VectorStoreFileService) UploadAndPoll(ctx context.Context, vectorStoreID string, body FileNewParams, ...) (*VectorStoreFile, error)
- type VectorStoreFileStatus
- type VectorStoreFileUpdateParams
- type VectorStoreFileUpdateParamsAttributeUnion
- type VectorStoreListParams
- type VectorStoreListParamsOrder
- type VectorStoreNewParams
- type VectorStoreNewParamsExpiresAfter
- type VectorStoreSearchParams
- type VectorStoreSearchParamsFiltersUnion
- func (u VectorStoreSearchParamsFiltersUnion) GetFilters() []shared.ComparisonFilterParam
- func (u VectorStoreSearchParamsFiltersUnion) GetKey() *string
- func (u VectorStoreSearchParamsFiltersUnion) GetType() *string
- func (u VectorStoreSearchParamsFiltersUnion) GetValue() *shared.ComparisonFilterValueUnionParam
- func (u VectorStoreSearchParamsFiltersUnion) IsPresent() bool
- func (u VectorStoreSearchParamsFiltersUnion) MarshalJSON() ([]byte, error)
- type VectorStoreSearchParamsQueryUnion
- type VectorStoreSearchParamsRankingOptions
- type VectorStoreSearchResponse
- type VectorStoreSearchResponseAttributeUnion
- func (u VectorStoreSearchResponseAttributeUnion) AsBool() (v bool)
- func (u VectorStoreSearchResponseAttributeUnion) AsFloat() (v float64)
- func (u VectorStoreSearchResponseAttributeUnion) AsString() (v string)
- func (u VectorStoreSearchResponseAttributeUnion) RawJSON() string
- func (r *VectorStoreSearchResponseAttributeUnion) UnmarshalJSON(data []byte) error
- type VectorStoreSearchResponseContent
- type VectorStoreService
- func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStoreDeleted, err error)
- func (r *VectorStoreService) Get(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStore, err error)
- func (r *VectorStoreService) List(ctx context.Context, query VectorStoreListParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStore], err error)
- func (r *VectorStoreService) ListAutoPaging(ctx context.Context, query VectorStoreListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[VectorStore]
- func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams, opts ...option.RequestOption) (res *VectorStore, err error)
- func (r *VectorStoreService) Search(ctx context.Context, vectorStoreID string, body VectorStoreSearchParams, ...) (res *pagination.Page[VectorStoreSearchResponse], err error)
- func (r *VectorStoreService) SearchAutoPaging(ctx context.Context, vectorStoreID string, body VectorStoreSearchParams, ...) *pagination.PageAutoPager[VectorStoreSearchResponse]
- func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, body VectorStoreUpdateParams, ...) (res *VectorStore, err error)
- type VectorStoreStatus
- type VectorStoreUpdateParams
- type VectorStoreUpdateParamsExpiresAfter
Constants ¶
const ChatModelChatgpt4oLatest = shared.ChatModelChatgpt4oLatest
Equals "chatgpt-4o-latest"
const ChatModelGPT3_5Turbo = shared.ChatModelGPT3_5Turbo
Equals "gpt-3.5-turbo"
const ChatModelGPT3_5Turbo0125 = shared.ChatModelGPT3_5Turbo0125
Equals "gpt-3.5-turbo-0125"
const ChatModelGPT3_5Turbo0301 = shared.ChatModelGPT3_5Turbo0301
Equals "gpt-3.5-turbo-0301"
const ChatModelGPT3_5Turbo0613 = shared.ChatModelGPT3_5Turbo0613
Equals "gpt-3.5-turbo-0613"
const ChatModelGPT3_5Turbo1106 = shared.ChatModelGPT3_5Turbo1106
Equals "gpt-3.5-turbo-1106"
const ChatModelGPT3_5Turbo16k = shared.ChatModelGPT3_5Turbo16k
Equals "gpt-3.5-turbo-16k"
const ChatModelGPT3_5Turbo16k0613 = shared.ChatModelGPT3_5Turbo16k0613
Equals "gpt-3.5-turbo-16k-0613"
const ChatModelGPT4 = shared.ChatModelGPT4
Equals "gpt-4"
const ChatModelGPT4Turbo = shared.ChatModelGPT4Turbo
Equals "gpt-4-turbo"
const ChatModelGPT4Turbo2024_04_09 = shared.ChatModelGPT4Turbo2024_04_09
Equals "gpt-4-turbo-2024-04-09"
const ChatModelGPT4TurboPreview = shared.ChatModelGPT4TurboPreview
Equals "gpt-4-turbo-preview"
const ChatModelGPT4VisionPreview = shared.ChatModelGPT4VisionPreview
Equals "gpt-4-vision-preview"
const ChatModelGPT4_0125Preview = shared.ChatModelGPT4_0125Preview
Equals "gpt-4-0125-preview"
const ChatModelGPT4_0314 = shared.ChatModelGPT4_0314
Equals "gpt-4-0314"
const ChatModelGPT4_0613 = shared.ChatModelGPT4_0613
Equals "gpt-4-0613"
const ChatModelGPT4_1106Preview = shared.ChatModelGPT4_1106Preview
Equals "gpt-4-1106-preview"
const ChatModelGPT4_32k = shared.ChatModelGPT4_32k
Equals "gpt-4-32k"
const ChatModelGPT4_32k0314 = shared.ChatModelGPT4_32k0314
Equals "gpt-4-32k-0314"
const ChatModelGPT4_32k0613 = shared.ChatModelGPT4_32k0613
Equals "gpt-4-32k-0613"
const ChatModelGPT4o = shared.ChatModelGPT4o
Equals "gpt-4o"
const ChatModelGPT4o2024_05_13 = shared.ChatModelGPT4o2024_05_13
Equals "gpt-4o-2024-05-13"
const ChatModelGPT4o2024_08_06 = shared.ChatModelGPT4o2024_08_06
Equals "gpt-4o-2024-08-06"
const ChatModelGPT4o2024_11_20 = shared.ChatModelGPT4o2024_11_20
Equals "gpt-4o-2024-11-20"
const ChatModelGPT4oAudioPreview = shared.ChatModelGPT4oAudioPreview
Equals "gpt-4o-audio-preview"
const ChatModelGPT4oAudioPreview2024_10_01 = shared.ChatModelGPT4oAudioPreview2024_10_01
Equals "gpt-4o-audio-preview-2024-10-01"
const ChatModelGPT4oAudioPreview2024_12_17 = shared.ChatModelGPT4oAudioPreview2024_12_17
Equals "gpt-4o-audio-preview-2024-12-17"
const ChatModelGPT4oMini = shared.ChatModelGPT4oMini
Equals "gpt-4o-mini"
const ChatModelGPT4oMini2024_07_18 = shared.ChatModelGPT4oMini2024_07_18
Equals "gpt-4o-mini-2024-07-18"
const ChatModelGPT4oMiniAudioPreview = shared.ChatModelGPT4oMiniAudioPreview
Equals "gpt-4o-mini-audio-preview"
const ChatModelGPT4oMiniAudioPreview2024_12_17 = shared.ChatModelGPT4oMiniAudioPreview2024_12_17
Equals "gpt-4o-mini-audio-preview-2024-12-17"
const ChatModelGPT4oMiniSearchPreview = shared.ChatModelGPT4oMiniSearchPreview
Equals "gpt-4o-mini-search-preview"
const ChatModelGPT4oMiniSearchPreview2025_03_11 = shared.ChatModelGPT4oMiniSearchPreview2025_03_11
Equals "gpt-4o-mini-search-preview-2025-03-11"
const ChatModelGPT4oSearchPreview = shared.ChatModelGPT4oSearchPreview
Equals "gpt-4o-search-preview"
const ChatModelGPT4oSearchPreview2025_03_11 = shared.ChatModelGPT4oSearchPreview2025_03_11
Equals "gpt-4o-search-preview-2025-03-11"
const ChatModelO1 = shared.ChatModelO1
Equals "o1"
const ChatModelO1Mini = shared.ChatModelO1Mini
Equals "o1-mini"
const ChatModelO1Mini2024_09_12 = shared.ChatModelO1Mini2024_09_12
Equals "o1-mini-2024-09-12"
const ChatModelO1Preview = shared.ChatModelO1Preview
Equals "o1-preview"
const ChatModelO1Preview2024_09_12 = shared.ChatModelO1Preview2024_09_12
Equals "o1-preview-2024-09-12"
const ChatModelO1_2024_12_17 = shared.ChatModelO1_2024_12_17
Equals "o1-2024-12-17"
const ChatModelO3Mini = shared.ChatModelO3Mini
Equals "o3-mini"
const ChatModelO3Mini2025_01_31 = shared.ChatModelO3Mini2025_01_31
Equals "o3-mini-2025-01-31"
const ComparisonFilterTypeEq = shared.ComparisonFilterTypeEq
Equals "eq"
const ComparisonFilterTypeGt = shared.ComparisonFilterTypeGt
Equals "gt"
const ComparisonFilterTypeGte = shared.ComparisonFilterTypeGte
Equals "gte"
const ComparisonFilterTypeLt = shared.ComparisonFilterTypeLt
Equals "lt"
const ComparisonFilterTypeLte = shared.ComparisonFilterTypeLte
Equals "lte"
const ComparisonFilterTypeNe = shared.ComparisonFilterTypeNe
Equals "ne"
const CompoundFilterTypeAnd = shared.CompoundFilterTypeAnd
Equals "and"
const CompoundFilterTypeOr = shared.CompoundFilterTypeOr
Equals "or"
const ReasoningEffortHigh = shared.ReasoningEffortHigh
Equals "high"
const ReasoningEffortLow = shared.ReasoningEffortLow
Equals "low"
const ReasoningEffortMedium = shared.ReasoningEffortMedium
Equals "medium"
const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
Equals "concise"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
Equals "detailed"
const ResponsesModelComputerUsePreview = shared.ResponsesModelComputerUsePreview
Equals "computer-use-preview"
const ResponsesModelComputerUsePreview2025_03_11 = shared.ResponsesModelComputerUsePreview2025_03_11
Equals "computer-use-preview-2025-03-11"
const ResponsesModelO1Pro = shared.ResponsesModelO1Pro
Equals "o1-pro"
const ResponsesModelO1Pro2025_03_19 = shared.ResponsesModelO1Pro2025_03_19
Equals "o1-pro-2025-03-19"
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AnnotationDeltaUnion ¶
type AnnotationDeltaUnion struct { Index int64 `json:"index"` // Any of "file_citation", "file_path". Type string `json:"type"` EndIndex int64 `json:"end_index"` // This field is from variant [FileCitationDeltaAnnotation]. FileCitation FileCitationDeltaAnnotationFileCitation `json:"file_citation"` StartIndex int64 `json:"start_index"` Text string `json:"text"` // This field is from variant [FilePathDeltaAnnotation]. FilePath FilePathDeltaAnnotationFilePath `json:"file_path"` JSON struct { Index resp.Field Type resp.Field EndIndex resp.Field FileCitation resp.Field StartIndex resp.Field Text resp.Field FilePath resp.Field // contains filtered or unexported fields } `json:"-"` }
AnnotationDeltaUnion contains all possible properties and values from FileCitationDeltaAnnotation, FilePathDeltaAnnotation.
Use the AnnotationDeltaUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (AnnotationDeltaUnion) AsAny ¶
func (u AnnotationDeltaUnion) AsAny() anyAnnotationDelta
Use the following switch statement to find the correct variant
switch variant := AnnotationDeltaUnion.AsAny().(type) { case FileCitationDeltaAnnotation: case FilePathDeltaAnnotation: default: fmt.Errorf("no variant present") }
func (AnnotationDeltaUnion) AsFileCitation ¶
func (u AnnotationDeltaUnion) AsFileCitation() (v FileCitationDeltaAnnotation)
func (AnnotationDeltaUnion) AsFilePath ¶
func (u AnnotationDeltaUnion) AsFilePath() (v FilePathDeltaAnnotation)
func (AnnotationDeltaUnion) RawJSON ¶
func (u AnnotationDeltaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*AnnotationDeltaUnion) UnmarshalJSON ¶
func (r *AnnotationDeltaUnion) UnmarshalJSON(data []byte) error
type AnnotationUnion ¶
type AnnotationUnion struct { EndIndex int64 `json:"end_index"` // This field is from variant [FileCitationAnnotation]. FileCitation FileCitationAnnotationFileCitation `json:"file_citation"` StartIndex int64 `json:"start_index"` Text string `json:"text"` // Any of "file_citation", "file_path". Type string `json:"type"` // This field is from variant [FilePathAnnotation]. FilePath FilePathAnnotationFilePath `json:"file_path"` JSON struct { EndIndex resp.Field FileCitation resp.Field StartIndex resp.Field Text resp.Field Type resp.Field FilePath resp.Field // contains filtered or unexported fields } `json:"-"` }
AnnotationUnion contains all possible properties and values from FileCitationAnnotation, FilePathAnnotation.
Use the AnnotationUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (AnnotationUnion) AsAny ¶
func (u AnnotationUnion) AsAny() anyAnnotation
Use the following switch statement to find the correct variant
switch variant := AnnotationUnion.AsAny().(type) { case FileCitationAnnotation: case FilePathAnnotation: default: fmt.Errorf("no variant present") }
func (AnnotationUnion) AsFileCitation ¶
func (u AnnotationUnion) AsFileCitation() (v FileCitationAnnotation)
func (AnnotationUnion) AsFilePath ¶
func (u AnnotationUnion) AsFilePath() (v FilePathAnnotation)
func (AnnotationUnion) RawJSON ¶
func (u AnnotationUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*AnnotationUnion) UnmarshalJSON ¶
func (r *AnnotationUnion) UnmarshalJSON(data []byte) error
type Assistant ¶
type Assistant struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the assistant was created. CreatedAt int64 `json:"created_at,required"` // The description of the assistant. The maximum length is 512 characters. Description string `json:"description,required"` // The system instructions that the assistant uses. The maximum length is 256,000 // characters. Instructions string `json:"instructions,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.Metadata `json:"metadata,required"` // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our // [Model overview](https://platform.openai.com/docs/models) for descriptions of // them. Model string `json:"model,required"` // The name of the assistant. The maximum length is 256 characters. Name string `json:"name,required"` // The object type, which is always `assistant`. Object constant.Assistant `json:"object,required"` // A list of tool enabled on the assistant. There can be a maximum of 128 tools per // assistant. Tools can be of types `code_interpreter`, `file_search`, or // `function`. Tools []AssistantToolUnion `json:"tools,required"` // Specifies the format that the model must output. Compatible with // [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), // [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), // and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the // message the model generates is valid JSON. // // **Important:** when using JSON mode, you **must** also instruct the model to // produce JSON yourself via a system or user message. Without this, the model may // generate an unending stream of whitespace until the generation reaches the token // limit, resulting in a long-running and seemingly "stuck" request. Also note that // the message content may be partially cut off if `finish_reason="length"`, which // indicates the generation exceeded `max_tokens` or the conversation exceeded the // max context length. ResponseFormat AssistantResponseFormatOptionUnion `json:"response_format,nullable"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. Temperature float64 `json:"temperature,nullable"` // A set of resources that are used by the assistant's tools. The resources are // specific to the type of tool. For example, the `code_interpreter` tool requires // a list of file IDs, while the `file_search` tool requires a list of vector store // IDs. ToolResources AssistantToolResources `json:"tool_resources,nullable"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or temperature but not both. TopP float64 `json:"top_p,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Description resp.Field Instructions resp.Field Metadata resp.Field Model resp.Field Name resp.Field Object resp.Field Tools resp.Field ResponseFormat resp.Field Temperature resp.Field ToolResources resp.Field TopP resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents an `assistant` that can call the model and use tools.
func (*Assistant) UnmarshalJSON ¶
type AssistantDeleted ¶
type AssistantDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object constant.AssistantDeleted `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (AssistantDeleted) RawJSON ¶
func (r AssistantDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantDeleted) UnmarshalJSON ¶
func (r *AssistantDeleted) UnmarshalJSON(data []byte) error
type AssistantResponseFormatOptionUnion ¶
type AssistantResponseFormatOptionUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` Type string `json:"type"` // This field is from variant [shared.ResponseFormatJSONSchema]. JSONSchema shared.ResponseFormatJSONSchemaJSONSchema `json:"json_schema"` JSON struct { OfAuto resp.Field Type resp.Field JSONSchema resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantResponseFormatOptionUnion contains all possible properties and values from constant.Auto, shared.ResponseFormatText, shared.ResponseFormatJSONObject, shared.ResponseFormatJSONSchema.
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 (AssistantResponseFormatOptionUnion) AsAuto ¶
func (u AssistantResponseFormatOptionUnion) AsAuto() (v constant.Auto)
func (AssistantResponseFormatOptionUnion) AsJSONObject ¶
func (u AssistantResponseFormatOptionUnion) AsJSONObject() (v shared.ResponseFormatJSONObject)
func (AssistantResponseFormatOptionUnion) AsJSONSchema ¶
func (u AssistantResponseFormatOptionUnion) AsJSONSchema() (v shared.ResponseFormatJSONSchema)
func (AssistantResponseFormatOptionUnion) AsText ¶
func (u AssistantResponseFormatOptionUnion) AsText() (v shared.ResponseFormatText)
func (AssistantResponseFormatOptionUnion) RawJSON ¶
func (u AssistantResponseFormatOptionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (AssistantResponseFormatOptionUnion) ToParam ¶
func (r AssistantResponseFormatOptionUnion) ToParam() AssistantResponseFormatOptionUnionParam
ToParam converts this AssistantResponseFormatOptionUnion to a AssistantResponseFormatOptionUnionParam.
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 AssistantResponseFormatOptionUnionParam.IsOverridden()
func (*AssistantResponseFormatOptionUnion) UnmarshalJSON ¶
func (r *AssistantResponseFormatOptionUnion) UnmarshalJSON(data []byte) error
type AssistantResponseFormatOptionUnionParam ¶
type AssistantResponseFormatOptionUnionParam struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfText *shared.ResponseFormatTextParam `json:",omitzero,inline"` OfJSONObject *shared.ResponseFormatJSONObjectParam `json:",omitzero,inline"` OfJSONSchema *shared.ResponseFormatJSONSchemaParam `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 AssistantResponseFormatOptionParamOfAuto ¶
func AssistantResponseFormatOptionParamOfAuto() AssistantResponseFormatOptionUnionParam
func AssistantResponseFormatOptionParamOfJSONSchema ¶
func AssistantResponseFormatOptionParamOfJSONSchema(jsonSchema shared.ResponseFormatJSONSchemaJSONSchemaParam) AssistantResponseFormatOptionUnionParam
func (AssistantResponseFormatOptionUnionParam) GetJSONSchema ¶
func (u AssistantResponseFormatOptionUnionParam) GetJSONSchema() *shared.ResponseFormatJSONSchemaJSONSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (AssistantResponseFormatOptionUnionParam) GetType ¶
func (u AssistantResponseFormatOptionUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (AssistantResponseFormatOptionUnionParam) IsPresent ¶
func (u AssistantResponseFormatOptionUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AssistantResponseFormatOptionUnionParam) MarshalJSON ¶
func (u AssistantResponseFormatOptionUnionParam) MarshalJSON() ([]byte, error)
type AssistantStreamEventErrorEvent ¶
type AssistantStreamEventErrorEvent struct { Data shared.ErrorObject `json:"data,required"` Event constant.Error `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when an [error](https://platform.openai.com/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout.
func (AssistantStreamEventErrorEvent) RawJSON ¶
func (r AssistantStreamEventErrorEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventErrorEvent) UnmarshalJSON ¶
func (r *AssistantStreamEventErrorEvent) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadCreated ¶
type AssistantStreamEventThreadCreated struct { // Represents a thread that contains // [messages](https://platform.openai.com/docs/api-reference/messages). Data Thread `json:"data,required"` Event constant.ThreadCreated `json:"event,required"` // Whether to enable input audio transcription. Enabled bool `json:"enabled"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field Enabled resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a new [thread](https://platform.openai.com/docs/api-reference/threads/object) is created.
func (AssistantStreamEventThreadCreated) RawJSON ¶
func (r AssistantStreamEventThreadCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadCreated) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadCreated) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadMessageCompleted ¶
type AssistantStreamEventThreadMessageCompleted struct { // Represents a message within a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Message `json:"data,required"` Event constant.ThreadMessageCompleted `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is completed.
func (AssistantStreamEventThreadMessageCompleted) RawJSON ¶
func (r AssistantStreamEventThreadMessageCompleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadMessageCompleted) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadMessageCompleted) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadMessageCreated ¶
type AssistantStreamEventThreadMessageCreated struct { // Represents a message within a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Message `json:"data,required"` Event constant.ThreadMessageCreated `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) is created.
func (AssistantStreamEventThreadMessageCreated) RawJSON ¶
func (r AssistantStreamEventThreadMessageCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadMessageCreated) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadMessageCreated) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadMessageDelta ¶
type AssistantStreamEventThreadMessageDelta struct { // Represents a message delta i.e. any changed fields on a message during // streaming. Data MessageDeltaEvent `json:"data,required"` Event constant.ThreadMessageDelta `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when parts of a Message(https://platform.openai.com/docs/api-reference/messages/object) are being streamed.
func (AssistantStreamEventThreadMessageDelta) RawJSON ¶
func (r AssistantStreamEventThreadMessageDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadMessageDelta) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadMessageDelta) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadMessageInProgress ¶
type AssistantStreamEventThreadMessageInProgress struct { // Represents a message within a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Message `json:"data,required"` Event constant.ThreadMessageInProgress `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) moves to an `in_progress` state.
func (AssistantStreamEventThreadMessageInProgress) RawJSON ¶
func (r AssistantStreamEventThreadMessageInProgress) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadMessageInProgress) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadMessageInProgress) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadMessageIncomplete ¶
type AssistantStreamEventThreadMessageIncomplete struct { // Represents a message within a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Message `json:"data,required"` Event constant.ThreadMessageIncomplete `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [message](https://platform.openai.com/docs/api-reference/messages/object) ends before it is completed.
func (AssistantStreamEventThreadMessageIncomplete) RawJSON ¶
func (r AssistantStreamEventThreadMessageIncomplete) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadMessageIncomplete) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadMessageIncomplete) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunCancelled ¶
type AssistantStreamEventThreadRunCancelled struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunCancelled `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) is cancelled.
func (AssistantStreamEventThreadRunCancelled) RawJSON ¶
func (r AssistantStreamEventThreadRunCancelled) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunCancelled) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunCancelled) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunCancelling ¶
type AssistantStreamEventThreadRunCancelling struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunCancelling `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `cancelling` status.
func (AssistantStreamEventThreadRunCancelling) RawJSON ¶
func (r AssistantStreamEventThreadRunCancelling) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunCancelling) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunCancelling) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunCompleted ¶
type AssistantStreamEventThreadRunCompleted struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunCompleted `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) is completed.
func (AssistantStreamEventThreadRunCompleted) RawJSON ¶
func (r AssistantStreamEventThreadRunCompleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunCompleted) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunCompleted) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunCreated ¶
type AssistantStreamEventThreadRunCreated struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunCreated `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a new [run](https://platform.openai.com/docs/api-reference/runs/object) is created.
func (AssistantStreamEventThreadRunCreated) RawJSON ¶
func (r AssistantStreamEventThreadRunCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunCreated) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunCreated) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunExpired ¶
type AssistantStreamEventThreadRunExpired struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunExpired `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) expires.
func (AssistantStreamEventThreadRunExpired) RawJSON ¶
func (r AssistantStreamEventThreadRunExpired) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunExpired) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunExpired) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunFailed ¶
type AssistantStreamEventThreadRunFailed struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunFailed `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) fails.
func (AssistantStreamEventThreadRunFailed) RawJSON ¶
func (r AssistantStreamEventThreadRunFailed) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunFailed) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunFailed) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunInProgress ¶
type AssistantStreamEventThreadRunInProgress struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunInProgress `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to an `in_progress` status.
func (AssistantStreamEventThreadRunInProgress) RawJSON ¶
func (r AssistantStreamEventThreadRunInProgress) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunInProgress) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunInProgress) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunIncomplete ¶
type AssistantStreamEventThreadRunIncomplete struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunIncomplete `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) ends with status `incomplete`.
func (AssistantStreamEventThreadRunIncomplete) RawJSON ¶
func (r AssistantStreamEventThreadRunIncomplete) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunIncomplete) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunIncomplete) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunQueued ¶
type AssistantStreamEventThreadRunQueued struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunQueued `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `queued` status.
func (AssistantStreamEventThreadRunQueued) RawJSON ¶
func (r AssistantStreamEventThreadRunQueued) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunQueued) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunQueued) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunRequiresAction ¶
type AssistantStreamEventThreadRunRequiresAction struct { // Represents an execution run on a // [thread](https://platform.openai.com/docs/api-reference/threads). Data Run `json:"data,required"` Event constant.ThreadRunRequiresAction `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run](https://platform.openai.com/docs/api-reference/runs/object) moves to a `requires_action` status.
func (AssistantStreamEventThreadRunRequiresAction) RawJSON ¶
func (r AssistantStreamEventThreadRunRequiresAction) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunRequiresAction) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunRequiresAction) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepCancelled ¶
type AssistantStreamEventThreadRunStepCancelled struct { // Represents a step in execution of a run. Data RunStep `json:"data,required"` Event constant.ThreadRunStepCancelled `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is cancelled.
func (AssistantStreamEventThreadRunStepCancelled) RawJSON ¶
func (r AssistantStreamEventThreadRunStepCancelled) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepCancelled) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepCancelled) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepCompleted ¶
type AssistantStreamEventThreadRunStepCompleted struct { // Represents a step in execution of a run. Data RunStep `json:"data,required"` Event constant.ThreadRunStepCompleted `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is completed.
func (AssistantStreamEventThreadRunStepCompleted) RawJSON ¶
func (r AssistantStreamEventThreadRunStepCompleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepCompleted) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepCompleted) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepCreated ¶
type AssistantStreamEventThreadRunStepCreated struct { // Represents a step in execution of a run. Data RunStep `json:"data,required"` Event constant.ThreadRunStepCreated `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) is created.
func (AssistantStreamEventThreadRunStepCreated) RawJSON ¶
func (r AssistantStreamEventThreadRunStepCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepCreated) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepCreated) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepDelta ¶
type AssistantStreamEventThreadRunStepDelta struct { // Represents a run step delta i.e. any changed fields on a run step during // streaming. Data RunStepDeltaEvent `json:"data,required"` Event constant.ThreadRunStepDelta `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when parts of a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) are being streamed.
func (AssistantStreamEventThreadRunStepDelta) RawJSON ¶
func (r AssistantStreamEventThreadRunStepDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepDelta) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepDelta) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepExpired ¶
type AssistantStreamEventThreadRunStepExpired struct { // Represents a step in execution of a run. Data RunStep `json:"data,required"` Event constant.ThreadRunStepExpired `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) expires.
func (AssistantStreamEventThreadRunStepExpired) RawJSON ¶
func (r AssistantStreamEventThreadRunStepExpired) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepExpired) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepExpired) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepFailed ¶
type AssistantStreamEventThreadRunStepFailed struct { // Represents a step in execution of a run. Data RunStep `json:"data,required"` Event constant.ThreadRunStepFailed `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) fails.
func (AssistantStreamEventThreadRunStepFailed) RawJSON ¶
func (r AssistantStreamEventThreadRunStepFailed) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepFailed) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepFailed) UnmarshalJSON(data []byte) error
type AssistantStreamEventThreadRunStepInProgress ¶
type AssistantStreamEventThreadRunStepInProgress struct { // Represents a step in execution of a run. Data RunStep `json:"data,required"` Event constant.ThreadRunStepInProgress `json:"event,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Event resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Occurs when a [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) moves to an `in_progress` state.
func (AssistantStreamEventThreadRunStepInProgress) RawJSON ¶
func (r AssistantStreamEventThreadRunStepInProgress) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventThreadRunStepInProgress) UnmarshalJSON ¶
func (r *AssistantStreamEventThreadRunStepInProgress) UnmarshalJSON(data []byte) error
type AssistantStreamEventUnion ¶
type AssistantStreamEventUnion struct { // This field is a union of [Thread], [Run], [RunStep], [RunStepDeltaEvent], // [Message], [MessageDeltaEvent], [shared.ErrorObject] Data AssistantStreamEventUnionData `json:"data"` // Any of "thread.created", "thread.run.created", "thread.run.queued", // "thread.run.in_progress", "thread.run.requires_action", "thread.run.completed", // "thread.run.incomplete", "thread.run.failed", "thread.run.cancelling", // "thread.run.cancelled", "thread.run.expired", "thread.run.step.created", // "thread.run.step.in_progress", "thread.run.step.delta", // "thread.run.step.completed", "thread.run.step.failed", // "thread.run.step.cancelled", "thread.run.step.expired", // "thread.message.created", "thread.message.in_progress", "thread.message.delta", // "thread.message.completed", "thread.message.incomplete", "error". Event string `json:"event"` // This field is from variant [AssistantStreamEventThreadCreated]. Enabled bool `json:"enabled"` JSON struct { Data resp.Field Event resp.Field Enabled resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantStreamEventUnion contains all possible properties and values from AssistantStreamEventThreadCreated, AssistantStreamEventThreadRunCreated, AssistantStreamEventThreadRunQueued, AssistantStreamEventThreadRunInProgress, AssistantStreamEventThreadRunRequiresAction, AssistantStreamEventThreadRunCompleted, AssistantStreamEventThreadRunIncomplete, AssistantStreamEventThreadRunFailed, AssistantStreamEventThreadRunCancelling, AssistantStreamEventThreadRunCancelled, AssistantStreamEventThreadRunExpired, AssistantStreamEventThreadRunStepCreated, AssistantStreamEventThreadRunStepInProgress, AssistantStreamEventThreadRunStepDelta, AssistantStreamEventThreadRunStepCompleted, AssistantStreamEventThreadRunStepFailed, AssistantStreamEventThreadRunStepCancelled, AssistantStreamEventThreadRunStepExpired, AssistantStreamEventThreadMessageCreated, AssistantStreamEventThreadMessageInProgress, AssistantStreamEventThreadMessageDelta, AssistantStreamEventThreadMessageCompleted, AssistantStreamEventThreadMessageIncomplete, AssistantStreamEventErrorEvent.
Use the AssistantStreamEventUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (AssistantStreamEventUnion) AsAny ¶
func (u AssistantStreamEventUnion) AsAny() anyAssistantStreamEvent
Use the following switch statement to find the correct variant
switch variant := AssistantStreamEventUnion.AsAny().(type) { case AssistantStreamEventThreadCreated: case AssistantStreamEventThreadRunCreated: case AssistantStreamEventThreadRunQueued: case AssistantStreamEventThreadRunInProgress: case AssistantStreamEventThreadRunRequiresAction: case AssistantStreamEventThreadRunCompleted: case AssistantStreamEventThreadRunIncomplete: case AssistantStreamEventThreadRunFailed: case AssistantStreamEventThreadRunCancelling: case AssistantStreamEventThreadRunCancelled: case AssistantStreamEventThreadRunExpired: case AssistantStreamEventThreadRunStepCreated: case AssistantStreamEventThreadRunStepInProgress: case AssistantStreamEventThreadRunStepDelta: case AssistantStreamEventThreadRunStepCompleted: case AssistantStreamEventThreadRunStepFailed: case AssistantStreamEventThreadRunStepCancelled: case AssistantStreamEventThreadRunStepExpired: case AssistantStreamEventThreadMessageCreated: case AssistantStreamEventThreadMessageInProgress: case AssistantStreamEventThreadMessageDelta: case AssistantStreamEventThreadMessageCompleted: case AssistantStreamEventThreadMessageIncomplete: case AssistantStreamEventErrorEvent: default: fmt.Errorf("no variant present") }
func (AssistantStreamEventUnion) AsErrorEvent ¶
func (u AssistantStreamEventUnion) AsErrorEvent() (v AssistantStreamEventErrorEvent)
func (AssistantStreamEventUnion) AsThreadCreated ¶
func (u AssistantStreamEventUnion) AsThreadCreated() (v AssistantStreamEventThreadCreated)
func (AssistantStreamEventUnion) AsThreadMessageCompleted ¶
func (u AssistantStreamEventUnion) AsThreadMessageCompleted() (v AssistantStreamEventThreadMessageCompleted)
func (AssistantStreamEventUnion) AsThreadMessageCreated ¶
func (u AssistantStreamEventUnion) AsThreadMessageCreated() (v AssistantStreamEventThreadMessageCreated)
func (AssistantStreamEventUnion) AsThreadMessageDelta ¶
func (u AssistantStreamEventUnion) AsThreadMessageDelta() (v AssistantStreamEventThreadMessageDelta)
func (AssistantStreamEventUnion) AsThreadMessageInProgress ¶
func (u AssistantStreamEventUnion) AsThreadMessageInProgress() (v AssistantStreamEventThreadMessageInProgress)
func (AssistantStreamEventUnion) AsThreadMessageIncomplete ¶
func (u AssistantStreamEventUnion) AsThreadMessageIncomplete() (v AssistantStreamEventThreadMessageIncomplete)
func (AssistantStreamEventUnion) AsThreadRunCancelled ¶
func (u AssistantStreamEventUnion) AsThreadRunCancelled() (v AssistantStreamEventThreadRunCancelled)
func (AssistantStreamEventUnion) AsThreadRunCancelling ¶
func (u AssistantStreamEventUnion) AsThreadRunCancelling() (v AssistantStreamEventThreadRunCancelling)
func (AssistantStreamEventUnion) AsThreadRunCompleted ¶
func (u AssistantStreamEventUnion) AsThreadRunCompleted() (v AssistantStreamEventThreadRunCompleted)
func (AssistantStreamEventUnion) AsThreadRunCreated ¶
func (u AssistantStreamEventUnion) AsThreadRunCreated() (v AssistantStreamEventThreadRunCreated)
func (AssistantStreamEventUnion) AsThreadRunExpired ¶
func (u AssistantStreamEventUnion) AsThreadRunExpired() (v AssistantStreamEventThreadRunExpired)
func (AssistantStreamEventUnion) AsThreadRunFailed ¶
func (u AssistantStreamEventUnion) AsThreadRunFailed() (v AssistantStreamEventThreadRunFailed)
func (AssistantStreamEventUnion) AsThreadRunInProgress ¶
func (u AssistantStreamEventUnion) AsThreadRunInProgress() (v AssistantStreamEventThreadRunInProgress)
func (AssistantStreamEventUnion) AsThreadRunIncomplete ¶
func (u AssistantStreamEventUnion) AsThreadRunIncomplete() (v AssistantStreamEventThreadRunIncomplete)
func (AssistantStreamEventUnion) AsThreadRunQueued ¶
func (u AssistantStreamEventUnion) AsThreadRunQueued() (v AssistantStreamEventThreadRunQueued)
func (AssistantStreamEventUnion) AsThreadRunRequiresAction ¶
func (u AssistantStreamEventUnion) AsThreadRunRequiresAction() (v AssistantStreamEventThreadRunRequiresAction)
func (AssistantStreamEventUnion) AsThreadRunStepCancelled ¶
func (u AssistantStreamEventUnion) AsThreadRunStepCancelled() (v AssistantStreamEventThreadRunStepCancelled)
func (AssistantStreamEventUnion) AsThreadRunStepCompleted ¶
func (u AssistantStreamEventUnion) AsThreadRunStepCompleted() (v AssistantStreamEventThreadRunStepCompleted)
func (AssistantStreamEventUnion) AsThreadRunStepCreated ¶
func (u AssistantStreamEventUnion) AsThreadRunStepCreated() (v AssistantStreamEventThreadRunStepCreated)
func (AssistantStreamEventUnion) AsThreadRunStepDelta ¶
func (u AssistantStreamEventUnion) AsThreadRunStepDelta() (v AssistantStreamEventThreadRunStepDelta)
func (AssistantStreamEventUnion) AsThreadRunStepExpired ¶
func (u AssistantStreamEventUnion) AsThreadRunStepExpired() (v AssistantStreamEventThreadRunStepExpired)
func (AssistantStreamEventUnion) AsThreadRunStepFailed ¶
func (u AssistantStreamEventUnion) AsThreadRunStepFailed() (v AssistantStreamEventThreadRunStepFailed)
func (AssistantStreamEventUnion) AsThreadRunStepInProgress ¶
func (u AssistantStreamEventUnion) AsThreadRunStepInProgress() (v AssistantStreamEventThreadRunStepInProgress)
func (AssistantStreamEventUnion) RawJSON ¶
func (u AssistantStreamEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantStreamEventUnion) UnmarshalJSON ¶
func (r *AssistantStreamEventUnion) UnmarshalJSON(data []byte) error
type AssistantStreamEventUnionData ¶
type AssistantStreamEventUnionData struct { ID string `json:"id"` CreatedAt int64 `json:"created_at"` // This field is from variant [Thread]. Metadata shared.Metadata `json:"metadata"` Object string `json:"object"` // This field is from variant [Thread]. ToolResources ThreadToolResources `json:"tool_resources"` AssistantID string `json:"assistant_id"` CancelledAt int64 `json:"cancelled_at"` CompletedAt int64 `json:"completed_at"` // This field is from variant [Run]. ExpiresAt int64 `json:"expires_at"` FailedAt int64 `json:"failed_at"` // This field is a union of [RunIncompleteDetails], [MessageIncompleteDetails] IncompleteDetails AssistantStreamEventUnionDataIncompleteDetails `json:"incomplete_details"` // This field is from variant [Run]. Instructions string `json:"instructions"` // This field is a union of [RunLastError], [RunStepLastError] LastError AssistantStreamEventUnionDataLastError `json:"last_error"` // This field is from variant [Run]. MaxCompletionTokens int64 `json:"max_completion_tokens"` // This field is from variant [Run]. MaxPromptTokens int64 `json:"max_prompt_tokens"` // This field is from variant [Run]. Model string `json:"model"` // This field is from variant [Run]. ParallelToolCalls bool `json:"parallel_tool_calls"` // This field is from variant [Run]. RequiredAction RunRequiredAction `json:"required_action"` // This field is from variant [Run]. ResponseFormat AssistantResponseFormatOptionUnion `json:"response_format"` // This field is from variant [Run]. StartedAt int64 `json:"started_at"` Status string `json:"status"` ThreadID string `json:"thread_id"` // This field is from variant [Run]. ToolChoice AssistantToolChoiceOptionUnion `json:"tool_choice"` // This field is from variant [Run]. Tools []AssistantToolUnion `json:"tools"` // This field is from variant [Run]. TruncationStrategy RunTruncationStrategy `json:"truncation_strategy"` // This field is a union of [RunUsage], [RunStepUsage] Usage AssistantStreamEventUnionDataUsage `json:"usage"` // This field is from variant [Run]. Temperature float64 `json:"temperature"` // This field is from variant [Run]. TopP float64 `json:"top_p"` // This field is from variant [RunStep]. ExpiredAt int64 `json:"expired_at"` RunID string `json:"run_id"` // This field is from variant [RunStep]. StepDetails RunStepStepDetailsUnion `json:"step_details"` Type string `json:"type"` // This field is a union of [RunStepDelta], [MessageDelta] Delta AssistantStreamEventUnionDataDelta `json:"delta"` // This field is from variant [Message]. Attachments []MessageAttachment `json:"attachments"` // This field is from variant [Message]. Content []MessageContentUnion `json:"content"` // This field is from variant [Message]. IncompleteAt int64 `json:"incomplete_at"` // This field is from variant [Message]. Role MessageRole `json:"role"` // This field is from variant [shared.ErrorObject]. Code string `json:"code"` // This field is from variant [shared.ErrorObject]. Message string `json:"message"` // This field is from variant [shared.ErrorObject]. Param string `json:"param"` JSON struct { ID resp.Field CreatedAt resp.Field Metadata resp.Field Object resp.Field ToolResources resp.Field AssistantID resp.Field CancelledAt resp.Field CompletedAt resp.Field ExpiresAt resp.Field FailedAt resp.Field IncompleteDetails resp.Field Instructions resp.Field LastError resp.Field MaxCompletionTokens resp.Field MaxPromptTokens resp.Field Model resp.Field ParallelToolCalls resp.Field RequiredAction resp.Field ResponseFormat resp.Field StartedAt resp.Field Status resp.Field ThreadID resp.Field ToolChoice resp.Field Tools resp.Field TruncationStrategy resp.Field Usage resp.Field Temperature resp.Field TopP resp.Field ExpiredAt resp.Field RunID resp.Field StepDetails resp.Field Type resp.Field Delta resp.Field Attachments resp.Field Content resp.Field IncompleteAt resp.Field Role resp.Field Code resp.Field Message resp.Field Param resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantStreamEventUnionData is an implicit subunion of AssistantStreamEventUnion. AssistantStreamEventUnionData provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the AssistantStreamEventUnion.
func (*AssistantStreamEventUnionData) UnmarshalJSON ¶
func (r *AssistantStreamEventUnionData) UnmarshalJSON(data []byte) error
type AssistantStreamEventUnionDataDelta ¶
type AssistantStreamEventUnionDataDelta struct { // This field is from variant [RunStepDelta]. StepDetails RunStepDeltaStepDetailsUnion `json:"step_details"` // This field is from variant [MessageDelta]. Content []MessageContentDeltaUnion `json:"content"` // This field is from variant [MessageDelta]. Role MessageDeltaRole `json:"role"` JSON struct { StepDetails resp.Field Content resp.Field Role resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantStreamEventUnionDataDelta is an implicit subunion of AssistantStreamEventUnion. AssistantStreamEventUnionDataDelta provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the AssistantStreamEventUnion.
func (*AssistantStreamEventUnionDataDelta) UnmarshalJSON ¶
func (r *AssistantStreamEventUnionDataDelta) UnmarshalJSON(data []byte) error
type AssistantStreamEventUnionDataIncompleteDetails ¶
type AssistantStreamEventUnionDataIncompleteDetails struct { Reason string `json:"reason"` JSON struct { Reason resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantStreamEventUnionDataIncompleteDetails is an implicit subunion of AssistantStreamEventUnion. AssistantStreamEventUnionDataIncompleteDetails provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the AssistantStreamEventUnion.
func (*AssistantStreamEventUnionDataIncompleteDetails) UnmarshalJSON ¶
func (r *AssistantStreamEventUnionDataIncompleteDetails) UnmarshalJSON(data []byte) error
type AssistantStreamEventUnionDataLastError ¶
type AssistantStreamEventUnionDataLastError struct { Code string `json:"code"` Message string `json:"message"` JSON struct { Code resp.Field Message resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantStreamEventUnionDataLastError is an implicit subunion of AssistantStreamEventUnion. AssistantStreamEventUnionDataLastError provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the AssistantStreamEventUnion.
func (*AssistantStreamEventUnionDataLastError) UnmarshalJSON ¶
func (r *AssistantStreamEventUnionDataLastError) UnmarshalJSON(data []byte) error
type AssistantStreamEventUnionDataUsage ¶
type AssistantStreamEventUnionDataUsage struct { CompletionTokens int64 `json:"completion_tokens"` PromptTokens int64 `json:"prompt_tokens"` TotalTokens int64 `json:"total_tokens"` JSON struct { CompletionTokens resp.Field PromptTokens resp.Field TotalTokens resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantStreamEventUnionDataUsage is an implicit subunion of AssistantStreamEventUnion. AssistantStreamEventUnionDataUsage provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the AssistantStreamEventUnion.
func (*AssistantStreamEventUnionDataUsage) UnmarshalJSON ¶
func (r *AssistantStreamEventUnionDataUsage) UnmarshalJSON(data []byte) error
type AssistantToolChoice ¶
type AssistantToolChoice struct { // The type of the tool. If type is `function`, the function name must be set // // Any of "function", "code_interpreter", "file_search". Type AssistantToolChoiceType `json:"type,required"` Function AssistantToolChoiceFunction `json:"function"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field Function resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Specifies a tool the model should use. Use to force the model to call a specific tool.
func (AssistantToolChoice) RawJSON ¶
func (r AssistantToolChoice) RawJSON() string
Returns the unmodified JSON received from the API
func (AssistantToolChoice) ToParam ¶
func (r AssistantToolChoice) ToParam() AssistantToolChoiceParam
ToParam converts this AssistantToolChoice to a AssistantToolChoiceParam.
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 AssistantToolChoiceParam.IsOverridden()
func (*AssistantToolChoice) UnmarshalJSON ¶
func (r *AssistantToolChoice) UnmarshalJSON(data []byte) error
type AssistantToolChoiceFunction ¶
type AssistantToolChoiceFunction struct { // The name of the function to call. Name string `json:"name,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Name resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (AssistantToolChoiceFunction) RawJSON ¶
func (r AssistantToolChoiceFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (AssistantToolChoiceFunction) ToParam ¶
func (r AssistantToolChoiceFunction) ToParam() AssistantToolChoiceFunctionParam
ToParam converts this AssistantToolChoiceFunction to a AssistantToolChoiceFunctionParam.
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 AssistantToolChoiceFunctionParam.IsOverridden()
func (*AssistantToolChoiceFunction) UnmarshalJSON ¶
func (r *AssistantToolChoiceFunction) UnmarshalJSON(data []byte) error
type AssistantToolChoiceFunctionParam ¶
type AssistantToolChoiceFunctionParam struct { // The name of the function to call. Name string `json:"name,required"` // contains filtered or unexported fields }
The property Name is required.
func (AssistantToolChoiceFunctionParam) IsPresent ¶
func (f AssistantToolChoiceFunctionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AssistantToolChoiceFunctionParam) MarshalJSON ¶
func (r AssistantToolChoiceFunctionParam) MarshalJSON() (data []byte, err error)
type AssistantToolChoiceOptionAuto ¶
type AssistantToolChoiceOptionAuto string
`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.
const ( AssistantToolChoiceOptionAutoNone AssistantToolChoiceOptionAuto = "none" AssistantToolChoiceOptionAutoAuto AssistantToolChoiceOptionAuto = "auto" AssistantToolChoiceOptionAutoRequired AssistantToolChoiceOptionAuto = "required" )
type AssistantToolChoiceOptionUnion ¶
type AssistantToolChoiceOptionUnion struct { // This field will be present if the value is a [string] instead of an object. OfAuto string `json:",inline"` // This field is from variant [AssistantToolChoice]. Type AssistantToolChoiceType `json:"type"` // This field is from variant [AssistantToolChoice]. Function AssistantToolChoiceFunction `json:"function"` JSON struct { OfAuto resp.Field Type resp.Field Function resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantToolChoiceOptionUnion contains all possible properties and values from [string], AssistantToolChoice.
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 (AssistantToolChoiceOptionUnion) AsAssistantToolChoice ¶
func (u AssistantToolChoiceOptionUnion) AsAssistantToolChoice() (v AssistantToolChoice)
func (AssistantToolChoiceOptionUnion) AsAuto ¶
func (u AssistantToolChoiceOptionUnion) AsAuto() (v string)
func (AssistantToolChoiceOptionUnion) RawJSON ¶
func (u AssistantToolChoiceOptionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (AssistantToolChoiceOptionUnion) ToParam ¶
func (r AssistantToolChoiceOptionUnion) ToParam() AssistantToolChoiceOptionUnionParam
ToParam converts this AssistantToolChoiceOptionUnion to a AssistantToolChoiceOptionUnionParam.
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 AssistantToolChoiceOptionUnionParam.IsOverridden()
func (*AssistantToolChoiceOptionUnion) UnmarshalJSON ¶
func (r *AssistantToolChoiceOptionUnion) UnmarshalJSON(data []byte) error
type AssistantToolChoiceOptionUnionParam ¶
type AssistantToolChoiceOptionUnionParam struct { // Check if union is this variant with !param.IsOmitted(union.OfAuto) OfAuto param.Opt[string] `json:",omitzero,inline"` OfAssistantToolChoice *AssistantToolChoiceParam `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 AssistantToolChoiceOptionParamOfAssistantToolChoice ¶
func AssistantToolChoiceOptionParamOfAssistantToolChoice(type_ AssistantToolChoiceType) AssistantToolChoiceOptionUnionParam
func (AssistantToolChoiceOptionUnionParam) GetFunction ¶
func (u AssistantToolChoiceOptionUnionParam) GetFunction() *AssistantToolChoiceFunctionParam
Returns a pointer to the underlying variant's property, if present.
func (AssistantToolChoiceOptionUnionParam) GetType ¶
func (u AssistantToolChoiceOptionUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (AssistantToolChoiceOptionUnionParam) IsPresent ¶
func (u AssistantToolChoiceOptionUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AssistantToolChoiceOptionUnionParam) MarshalJSON ¶
func (u AssistantToolChoiceOptionUnionParam) MarshalJSON() ([]byte, error)
type AssistantToolChoiceParam ¶
type AssistantToolChoiceParam struct { // The type of the tool. If type is `function`, the function name must be set // // Any of "function", "code_interpreter", "file_search". Type AssistantToolChoiceType `json:"type,omitzero,required"` Function AssistantToolChoiceFunctionParam `json:"function,omitzero"` // contains filtered or unexported fields }
Specifies a tool the model should use. Use to force the model to call a specific tool.
The property Type is required.
func (AssistantToolChoiceParam) IsPresent ¶
func (f AssistantToolChoiceParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AssistantToolChoiceParam) MarshalJSON ¶
func (r AssistantToolChoiceParam) MarshalJSON() (data []byte, err error)
type AssistantToolChoiceType ¶
type AssistantToolChoiceType string
The type of the tool. If type is `function`, the function name must be set
const ( AssistantToolChoiceTypeFunction AssistantToolChoiceType = "function" AssistantToolChoiceTypeCodeInterpreter AssistantToolChoiceType = "code_interpreter" AssistantToolChoiceTypeFileSearch AssistantToolChoiceType = "file_search" )
type AssistantToolResources ¶
type AssistantToolResources struct { CodeInterpreter AssistantToolResourcesCodeInterpreter `json:"code_interpreter"` FileSearch AssistantToolResourcesFileSearch `json:"file_search"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CodeInterpreter resp.Field FileSearch resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (AssistantToolResources) RawJSON ¶
func (r AssistantToolResources) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantToolResources) UnmarshalJSON ¶
func (r *AssistantToolResources) UnmarshalJSON(data []byte) error
type AssistantToolResourcesCodeInterpreter ¶
type AssistantToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter“ tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileIDs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (AssistantToolResourcesCodeInterpreter) RawJSON ¶
func (r AssistantToolResourcesCodeInterpreter) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantToolResourcesCodeInterpreter) UnmarshalJSON ¶
func (r *AssistantToolResourcesCodeInterpreter) UnmarshalJSON(data []byte) error
type AssistantToolResourcesFileSearch ¶
type AssistantToolResourcesFileSearch struct { // The ID of the // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this assistant. There can be a maximum of 1 vector store attached to // the assistant. VectorStoreIDs []string `json:"vector_store_ids"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { VectorStoreIDs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (AssistantToolResourcesFileSearch) RawJSON ¶
func (r AssistantToolResourcesFileSearch) RawJSON() string
Returns the unmodified JSON received from the API
func (*AssistantToolResourcesFileSearch) UnmarshalJSON ¶
func (r *AssistantToolResourcesFileSearch) UnmarshalJSON(data []byte) error
type AssistantToolUnion ¶
type AssistantToolUnion struct { // Any of "code_interpreter", "file_search", "function". Type string `json:"type"` // This field is from variant [FileSearchTool]. FileSearch FileSearchToolFileSearch `json:"file_search"` // This field is from variant [FunctionTool]. Function shared.FunctionDefinition `json:"function"` JSON struct { Type resp.Field FileSearch resp.Field Function resp.Field // contains filtered or unexported fields } `json:"-"` }
AssistantToolUnion contains all possible properties and values from CodeInterpreterTool, FileSearchTool, FunctionTool.
Use the AssistantToolUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (AssistantToolUnion) AsAny ¶
func (u AssistantToolUnion) AsAny() anyAssistantTool
Use the following switch statement to find the correct variant
switch variant := AssistantToolUnion.AsAny().(type) { case CodeInterpreterTool: case FileSearchTool: case FunctionTool: default: fmt.Errorf("no variant present") }
func (AssistantToolUnion) AsCodeInterpreter ¶
func (u AssistantToolUnion) AsCodeInterpreter() (v CodeInterpreterTool)
func (AssistantToolUnion) AsFileSearch ¶
func (u AssistantToolUnion) AsFileSearch() (v FileSearchTool)
func (AssistantToolUnion) AsFunction ¶
func (u AssistantToolUnion) AsFunction() (v FunctionTool)
func (AssistantToolUnion) RawJSON ¶
func (u AssistantToolUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (AssistantToolUnion) ToParam ¶
func (r AssistantToolUnion) ToParam() AssistantToolUnionParam
ToParam converts this AssistantToolUnion to a AssistantToolUnionParam.
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 AssistantToolUnionParam.IsOverridden()
func (*AssistantToolUnion) UnmarshalJSON ¶
func (r *AssistantToolUnion) UnmarshalJSON(data []byte) error
type AssistantToolUnionParam ¶
type AssistantToolUnionParam struct { OfCodeInterpreter *CodeInterpreterToolParam `json:",omitzero,inline"` OfFileSearch *FileSearchToolParam `json:",omitzero,inline"` OfFunction *FunctionToolParam `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 AssistantToolParamOfFunction ¶
func AssistantToolParamOfFunction(function shared.FunctionDefinitionParam) AssistantToolUnionParam
func (AssistantToolUnionParam) GetFileSearch ¶
func (u AssistantToolUnionParam) GetFileSearch() *FileSearchToolFileSearchParam
Returns a pointer to the underlying variant's property, if present.
func (AssistantToolUnionParam) GetFunction ¶
func (u AssistantToolUnionParam) GetFunction() *shared.FunctionDefinitionParam
Returns a pointer to the underlying variant's property, if present.
func (AssistantToolUnionParam) GetType ¶
func (u AssistantToolUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (AssistantToolUnionParam) IsPresent ¶
func (u AssistantToolUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AssistantToolUnionParam) MarshalJSON ¶
func (u AssistantToolUnionParam) MarshalJSON() ([]byte, error)
type AudioModel ¶
type AudioModel = string
const ( AudioModelWhisper1 AudioModel = "whisper-1" AudioModelGPT4oTranscribe AudioModel = "gpt-4o-transcribe" AudioModelGPT4oMiniTranscribe AudioModel = "gpt-4o-mini-transcribe" )
type AudioResponseFormat ¶
type AudioResponseFormat string
The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`.
const ( AudioResponseFormatJSON AudioResponseFormat = "json" AudioResponseFormatText AudioResponseFormat = "text" AudioResponseFormatSRT AudioResponseFormat = "srt" AudioResponseFormatVerboseJSON AudioResponseFormat = "verbose_json" AudioResponseFormatVTT AudioResponseFormat = "vtt" )
type AudioService ¶
type AudioService struct { Options []option.RequestOption Transcriptions AudioTranscriptionService Translations AudioTranslationService Speech AudioSpeechService }
AudioService 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 NewAudioService method instead.
func NewAudioService ¶
func NewAudioService(opts ...option.RequestOption) (r AudioService)
NewAudioService 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 AudioSpeechNewParams ¶
type AudioSpeechNewParams struct { // The text to generate audio for. The maximum length is 4096 characters. Input string `json:"input,required"` // One of the available [TTS models](https://platform.openai.com/docs/models#tts): // `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`. Model SpeechModel `json:"model,omitzero,required"` // The voice to use when generating the audio. Supported voices are `alloy`, `ash`, // `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and // `verse`. Previews of the voices are available in the // [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options). Voice AudioSpeechNewParamsVoice `json:"voice,omitzero,required"` // Control the voice of your generated audio with additional instructions. Does not // work with `tts-1` or `tts-1-hd`. Instructions param.Opt[string] `json:"instructions,omitzero"` // The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is // the default. Speed param.Opt[float64] `json:"speed,omitzero"` // The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, // `wav`, and `pcm`. // // Any of "mp3", "opus", "aac", "flac", "wav", "pcm". ResponseFormat AudioSpeechNewParamsResponseFormat `json:"response_format,omitzero"` // contains filtered or unexported fields }
func (AudioSpeechNewParams) IsPresent ¶
func (f AudioSpeechNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AudioSpeechNewParams) MarshalJSON ¶
func (r AudioSpeechNewParams) MarshalJSON() (data []byte, err error)
type AudioSpeechNewParamsResponseFormat ¶
type AudioSpeechNewParamsResponseFormat string
The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
const ( AudioSpeechNewParamsResponseFormatMP3 AudioSpeechNewParamsResponseFormat = "mp3" AudioSpeechNewParamsResponseFormatOpus AudioSpeechNewParamsResponseFormat = "opus" AudioSpeechNewParamsResponseFormatAAC AudioSpeechNewParamsResponseFormat = "aac" AudioSpeechNewParamsResponseFormatFLAC AudioSpeechNewParamsResponseFormat = "flac" AudioSpeechNewParamsResponseFormatWAV AudioSpeechNewParamsResponseFormat = "wav" AudioSpeechNewParamsResponseFormatPCM AudioSpeechNewParamsResponseFormat = "pcm" )
type AudioSpeechNewParamsVoice ¶
type AudioSpeechNewParamsVoice string
The voice to use when generating the audio. Supported voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and `verse`. Previews of the voices are available in the [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
const ( AudioSpeechNewParamsVoiceAlloy AudioSpeechNewParamsVoice = "alloy" AudioSpeechNewParamsVoiceAsh AudioSpeechNewParamsVoice = "ash" AudioSpeechNewParamsVoiceBallad AudioSpeechNewParamsVoice = "ballad" AudioSpeechNewParamsVoiceCoral AudioSpeechNewParamsVoice = "coral" AudioSpeechNewParamsVoiceEcho AudioSpeechNewParamsVoice = "echo" AudioSpeechNewParamsVoiceFable AudioSpeechNewParamsVoice = "fable" AudioSpeechNewParamsVoiceOnyx AudioSpeechNewParamsVoice = "onyx" AudioSpeechNewParamsVoiceNova AudioSpeechNewParamsVoice = "nova" AudioSpeechNewParamsVoiceSage AudioSpeechNewParamsVoice = "sage" AudioSpeechNewParamsVoiceShimmer AudioSpeechNewParamsVoice = "shimmer" AudioSpeechNewParamsVoiceVerse AudioSpeechNewParamsVoice = "verse" )
type AudioSpeechService ¶
type AudioSpeechService struct {
Options []option.RequestOption
}
AudioSpeechService 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 NewAudioSpeechService method instead.
func NewAudioSpeechService ¶
func NewAudioSpeechService(opts ...option.RequestOption) (r AudioSpeechService)
NewAudioSpeechService 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 (*AudioSpeechService) New ¶
func (r *AudioSpeechService) New(ctx context.Context, body AudioSpeechNewParams, opts ...option.RequestOption) (res *http.Response, err error)
Generates audio from the input text.
type AudioTranscriptionNewParams ¶
type AudioTranscriptionNewParams struct { // The audio file object (not file name) to transcribe, in one of these formats: // flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. File io.Reader `json:"file,required" format:"binary"` // ID of the model to use. The options are `gpt-4o-transcribe`, // `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source // Whisper V2 model). Model AudioModel `json:"model,omitzero,required"` // 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. The // [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) // should match the audio language. Prompt param.Opt[string] `json:"prompt,omitzero"` // The sampling temperature, between 0 and 1. Higher values like 0.8 will make the // output more random, while lower values like 0.2 will make it more focused and // deterministic. If set to 0, the model will use // [log probability](https://en.wikipedia.org/wiki/Log_probability) to // automatically increase the temperature until certain thresholds are hit. Temperature param.Opt[float64] `json:"temperature,omitzero"` // Additional information to include in the transcription response. `logprobs` will // return the log probabilities of the tokens in the response to understand the // model's confidence in the transcription. `logprobs` only works with // response_format set to `json` and only with the models `gpt-4o-transcribe` and // `gpt-4o-mini-transcribe`. Include []TranscriptionInclude `json:"include,omitzero"` // The format of the output, in one of these options: `json`, `text`, `srt`, // `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, // the only supported format is `json`. // // Any of "json", "text", "srt", "verbose_json", "vtt". ResponseFormat AudioResponseFormat `json:"response_format,omitzero"` // The timestamp granularities to populate for this transcription. // `response_format` must be set `verbose_json` to use timestamp granularities. // Either or both of these options are supported: `word`, or `segment`. Note: There // is no additional latency for segment timestamps, but generating word timestamps // incurs additional latency. // // Any of "word", "segment". TimestampGranularities []string `json:"timestamp_granularities,omitzero"` // contains filtered or unexported fields }
func (AudioTranscriptionNewParams) IsPresent ¶
func (f AudioTranscriptionNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AudioTranscriptionNewParams) MarshalMultipart ¶
func (r AudioTranscriptionNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type AudioTranscriptionService ¶
type AudioTranscriptionService struct {
Options []option.RequestOption
}
AudioTranscriptionService 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 NewAudioTranscriptionService method instead.
func NewAudioTranscriptionService ¶
func NewAudioTranscriptionService(opts ...option.RequestOption) (r AudioTranscriptionService)
NewAudioTranscriptionService 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 (*AudioTranscriptionService) New ¶
func (r *AudioTranscriptionService) New(ctx context.Context, body AudioTranscriptionNewParams, opts ...option.RequestOption) (res *Transcription, err error)
Transcribes audio into the input language.
func (*AudioTranscriptionService) NewStreaming ¶
func (r *AudioTranscriptionService) NewStreaming(ctx context.Context, body AudioTranscriptionNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[TranscriptionStreamEventUnion])
Transcribes audio into the input language.
type AudioTranslationNewParams ¶
type AudioTranslationNewParams struct { // The audio file object (not file name) translate, in one of these formats: flac, // mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. File io.Reader `json:"file,required" format:"binary"` // ID of the model to use. Only `whisper-1` (which is powered by our open source // Whisper V2 model) is currently available. Model AudioModel `json:"model,omitzero,required"` // An optional text to guide the model's style or continue a previous audio // segment. The // [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) // should be in English. Prompt param.Opt[string] `json:"prompt,omitzero"` // The sampling temperature, between 0 and 1. Higher values like 0.8 will make the // output more random, while lower values like 0.2 will make it more focused and // deterministic. If set to 0, the model will use // [log probability](https://en.wikipedia.org/wiki/Log_probability) to // automatically increase the temperature until certain thresholds are hit. Temperature param.Opt[float64] `json:"temperature,omitzero"` // The format of the output, in one of these options: `json`, `text`, `srt`, // `verbose_json`, or `vtt`. // // Any of "json", "text", "srt", "verbose_json", "vtt". ResponseFormat AudioTranslationNewParamsResponseFormat `json:"response_format,omitzero"` // contains filtered or unexported fields }
func (AudioTranslationNewParams) IsPresent ¶
func (f AudioTranslationNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AudioTranslationNewParams) MarshalMultipart ¶
func (r AudioTranslationNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type AudioTranslationNewParamsResponseFormat ¶
type AudioTranslationNewParamsResponseFormat string
The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.
const ( AudioTranslationNewParamsResponseFormatJSON AudioTranslationNewParamsResponseFormat = "json" AudioTranslationNewParamsResponseFormatText AudioTranslationNewParamsResponseFormat = "text" AudioTranslationNewParamsResponseFormatSRT AudioTranslationNewParamsResponseFormat = "srt" AudioTranslationNewParamsResponseFormatVerboseJSON AudioTranslationNewParamsResponseFormat = "verbose_json" AudioTranslationNewParamsResponseFormatVTT AudioTranslationNewParamsResponseFormat = "vtt" )
type AudioTranslationService ¶
type AudioTranslationService struct {
Options []option.RequestOption
}
AudioTranslationService 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 NewAudioTranslationService method instead.
func NewAudioTranslationService ¶
func NewAudioTranslationService(opts ...option.RequestOption) (r AudioTranslationService)
NewAudioTranslationService 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 (*AudioTranslationService) New ¶
func (r *AudioTranslationService) New(ctx context.Context, body AudioTranslationNewParams, opts ...option.RequestOption) (res *Translation, err error)
Translates audio into English.
type AutoFileChunkingStrategyParam ¶
type AutoFileChunkingStrategyParam struct { // Always `auto`. // // This field can be elided, and will marshal its zero value as "auto". Type constant.Auto `json:"type,required"` // contains filtered or unexported fields }
The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
The property Type is required.
func (AutoFileChunkingStrategyParam) IsPresent ¶
func (f AutoFileChunkingStrategyParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (AutoFileChunkingStrategyParam) MarshalJSON ¶
func (r AutoFileChunkingStrategyParam) MarshalJSON() (data []byte, err error)
type Batch ¶
type Batch struct { ID string `json:"id,required"` // The time frame within which the batch should be processed. CompletionWindow string `json:"completion_window,required"` // The Unix timestamp (in seconds) for when the batch was created. CreatedAt int64 `json:"created_at,required"` // The OpenAI API endpoint used by the batch. Endpoint string `json:"endpoint,required"` // The ID of the input file for the batch. InputFileID string `json:"input_file_id,required"` // The object type, which is always `batch`. Object constant.Batch `json:"object,required"` // The current status of the batch. // // Any of "validating", "failed", "in_progress", "finalizing", "completed", // "expired", "cancelling", "cancelled". Status BatchStatus `json:"status,required"` // The Unix timestamp (in seconds) for when the batch was cancelled. CancelledAt int64 `json:"cancelled_at"` // The Unix timestamp (in seconds) for when the batch started cancelling. CancellingAt int64 `json:"cancelling_at"` // The Unix timestamp (in seconds) for when the batch was completed. CompletedAt int64 `json:"completed_at"` // The ID of the file containing the outputs of requests with errors. ErrorFileID string `json:"error_file_id"` Errors BatchErrors `json:"errors"` // The Unix timestamp (in seconds) for when the batch expired. ExpiredAt int64 `json:"expired_at"` // The Unix timestamp (in seconds) for when the batch will expire. ExpiresAt int64 `json:"expires_at"` // The Unix timestamp (in seconds) for when the batch failed. FailedAt int64 `json:"failed_at"` // The Unix timestamp (in seconds) for when the batch started finalizing. FinalizingAt int64 `json:"finalizing_at"` // The Unix timestamp (in seconds) for when the batch started processing. InProgressAt int64 `json:"in_progress_at"` // 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,nullable"` // The ID of the file containing the outputs of successfully executed requests. OutputFileID string `json:"output_file_id"` // The request counts for different statuses within the batch. RequestCounts BatchRequestCounts `json:"request_counts"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CompletionWindow resp.Field CreatedAt resp.Field Endpoint resp.Field InputFileID resp.Field Object resp.Field Status resp.Field CancelledAt resp.Field CancellingAt resp.Field CompletedAt resp.Field ErrorFileID resp.Field Errors resp.Field ExpiredAt resp.Field ExpiresAt resp.Field FailedAt resp.Field FinalizingAt resp.Field InProgressAt resp.Field Metadata resp.Field OutputFileID resp.Field RequestCounts resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (*Batch) UnmarshalJSON ¶
type BatchError ¶
type BatchError struct { // An error code identifying the error type. Code string `json:"code"` // The line number of the input file where the error occurred, if applicable. Line int64 `json:"line,nullable"` // A human-readable message providing more details about the error. Message string `json:"message"` // The name of the parameter that caused the error, if applicable. Param string `json:"param,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Line resp.Field Message resp.Field Param resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (BatchError) RawJSON ¶
func (r BatchError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchError) UnmarshalJSON ¶
func (r *BatchError) UnmarshalJSON(data []byte) error
type BatchErrors ¶
type BatchErrors struct { Data []BatchError `json:"data"` // The object type, which is always `list`. Object string `json:"object"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (BatchErrors) RawJSON ¶
func (r BatchErrors) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchErrors) UnmarshalJSON ¶
func (r *BatchErrors) UnmarshalJSON(data []byte) error
type BatchListParams ¶
type BatchListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. 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:"-"` // contains filtered or unexported fields }
func (BatchListParams) IsPresent ¶
func (f BatchListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BatchListParams) URLQuery ¶
func (r BatchListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BatchListParams's query parameters as `url.Values`.
type BatchNewParams ¶
type BatchNewParams struct { // The time frame within which the batch should be processed. Currently only `24h` // is supported. // // Any of "24h". CompletionWindow BatchNewParamsCompletionWindow `json:"completion_window,omitzero,required"` // The endpoint to be used for all requests in the batch. Currently // `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` // are supported. Note that `/v1/embeddings` batches are also restricted to a // maximum of 50,000 embedding inputs across all requests in the batch. // // Any of "/v1/responses", "/v1/chat/completions", "/v1/embeddings", // "/v1/completions". Endpoint BatchNewParamsEndpoint `json:"endpoint,omitzero,required"` // The ID of an uploaded file that contains requests for the new batch. // // See [upload file](https://platform.openai.com/docs/api-reference/files/create) // for how to upload a file. // // Your input file must be formatted as a // [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), // and must be uploaded with the purpose `batch`. The file can contain up to 50,000 // requests, and can be up to 200 MB in size. InputFileID string `json:"input_file_id,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
func (BatchNewParams) IsPresent ¶
func (f BatchNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BatchNewParams) MarshalJSON ¶
func (r BatchNewParams) MarshalJSON() (data []byte, err error)
type BatchNewParamsCompletionWindow ¶
type BatchNewParamsCompletionWindow string
The time frame within which the batch should be processed. Currently only `24h` is supported.
const (
BatchNewParamsCompletionWindow24h BatchNewParamsCompletionWindow = "24h"
)
type BatchNewParamsEndpoint ¶
type BatchNewParamsEndpoint string
The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch.
const ( BatchNewParamsEndpointV1Responses BatchNewParamsEndpoint = "/v1/responses" BatchNewParamsEndpointV1ChatCompletions BatchNewParamsEndpoint = "/v1/chat/completions" BatchNewParamsEndpointV1Embeddings BatchNewParamsEndpoint = "/v1/embeddings" BatchNewParamsEndpointV1Completions BatchNewParamsEndpoint = "/v1/completions" )
type BatchRequestCounts ¶
type BatchRequestCounts struct { // Number of requests that have been completed successfully. Completed int64 `json:"completed,required"` // Number of requests that have failed. Failed int64 `json:"failed,required"` // Total number of requests in the batch. Total int64 `json:"total,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Completed resp.Field Failed resp.Field Total resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The request counts for different statuses within the batch.
func (BatchRequestCounts) RawJSON ¶
func (r BatchRequestCounts) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchRequestCounts) UnmarshalJSON ¶
func (r *BatchRequestCounts) UnmarshalJSON(data []byte) error
type BatchService ¶
type BatchService struct {
Options []option.RequestOption
}
BatchService 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 NewBatchService method instead.
func NewBatchService ¶
func NewBatchService(opts ...option.RequestOption) (r BatchService)
NewBatchService 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 (*BatchService) Cancel ¶
func (r *BatchService) Cancel(ctx context.Context, batchID string, opts ...option.RequestOption) (res *Batch, err error)
Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.
func (*BatchService) Get ¶
func (r *BatchService) Get(ctx context.Context, batchID string, opts ...option.RequestOption) (res *Batch, err error)
Retrieves a batch.
func (*BatchService) List ¶
func (r *BatchService) List(ctx context.Context, query BatchListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Batch], err error)
List your organization's batches.
func (*BatchService) ListAutoPaging ¶
func (r *BatchService) ListAutoPaging(ctx context.Context, query BatchListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Batch]
List your organization's batches.
func (*BatchService) New ¶
func (r *BatchService) New(ctx context.Context, body BatchNewParams, opts ...option.RequestOption) (res *Batch, err error)
Creates and executes a batch from an uploaded file of requests
type BatchStatus ¶
type BatchStatus string
The current status of the batch.
const ( BatchStatusValidating BatchStatus = "validating" BatchStatusFailed BatchStatus = "failed" BatchStatusInProgress BatchStatus = "in_progress" BatchStatusFinalizing BatchStatus = "finalizing" BatchStatusCompleted BatchStatus = "completed" BatchStatusExpired BatchStatus = "expired" BatchStatusCancelling BatchStatus = "cancelling" BatchStatusCancelled BatchStatus = "cancelled" )
type BetaAssistantListParams ¶
type BetaAssistantListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order BetaAssistantListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (BetaAssistantListParams) IsPresent ¶
func (f BetaAssistantListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantListParams) URLQuery ¶
func (r BetaAssistantListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaAssistantListParams's query parameters as `url.Values`.
type BetaAssistantListParamsOrder ¶
type BetaAssistantListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( BetaAssistantListParamsOrderAsc BetaAssistantListParamsOrder = "asc" BetaAssistantListParamsOrderDesc BetaAssistantListParamsOrder = "desc" )
type BetaAssistantNewParams ¶
type BetaAssistantNewParams struct { // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our // [Model overview](https://platform.openai.com/docs/models) for descriptions of // them. Model shared.ChatModel `json:"model,omitzero,required"` // The description of the assistant. The maximum length is 512 characters. Description param.Opt[string] `json:"description,omitzero"` // The system instructions that the assistant uses. The maximum length is 256,000 // characters. Instructions param.Opt[string] `json:"instructions,omitzero"` // The name of the assistant. The maximum length is 256 characters. Name param.Opt[string] `json:"name,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or temperature but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // **o-series models only** // // Constrains effort on reasoning for // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently // supported values are `low`, `medium`, and `high`. Reducing reasoning effort can // result in faster responses and fewer tokens used on reasoning in a response. // // Any of "low", "medium", "high". ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"` // A set of resources that are used by the assistant's tools. The resources are // specific to the type of tool. For example, the `code_interpreter` tool requires // a list of file IDs, while the `file_search` tool requires a list of vector store // IDs. ToolResources BetaAssistantNewParamsToolResources `json:"tool_resources,omitzero"` // Specifies the format that the model must output. Compatible with // [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), // [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), // and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the // message the model generates is valid JSON. // // **Important:** when using JSON mode, you **must** also instruct the model to // produce JSON yourself via a system or user message. Without this, the model may // generate an unending stream of whitespace until the generation reaches the token // limit, resulting in a long-running and seemingly "stuck" request. Also note that // the message content may be partially cut off if `finish_reason="length"`, which // indicates the generation exceeded `max_tokens` or the conversation exceeded the // max context length. ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"` // A list of tool enabled on the assistant. There can be a maximum of 128 tools per // assistant. Tools can be of types `code_interpreter`, `file_search`, or // `function`. Tools []AssistantToolUnionParam `json:"tools,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantNewParams) IsPresent ¶
func (f BetaAssistantNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParams) MarshalJSON ¶
func (r BetaAssistantNewParams) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResources ¶
type BetaAssistantNewParamsToolResources struct { CodeInterpreter BetaAssistantNewParamsToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"` FileSearch BetaAssistantNewParamsToolResourcesFileSearch `json:"file_search,omitzero"` // contains filtered or unexported fields }
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (BetaAssistantNewParamsToolResources) IsPresent ¶
func (f BetaAssistantNewParamsToolResources) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResources) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResources) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesCodeInterpreter ¶
type BetaAssistantNewParamsToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter` tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantNewParamsToolResourcesCodeInterpreter) IsPresent ¶
func (f BetaAssistantNewParamsToolResourcesCodeInterpreter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesCodeInterpreter) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesFileSearch ¶
type BetaAssistantNewParamsToolResourcesFileSearch struct { // The // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this assistant. There can be a maximum of 1 vector store attached to // the assistant. VectorStoreIDs []string `json:"vector_store_ids,omitzero"` // A helper to create a // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // with file_ids and attach it to this assistant. There can be a maximum of 1 // vector store attached to the assistant. VectorStores []BetaAssistantNewParamsToolResourcesFileSearchVectorStore `json:"vector_stores,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantNewParamsToolResourcesFileSearch) IsPresent ¶
func (f BetaAssistantNewParamsToolResourcesFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesFileSearch) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResourcesFileSearch) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesFileSearchVectorStore ¶
type BetaAssistantNewParamsToolResourcesFileSearchVectorStore 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.MetadataParam `json:"metadata,omitzero"` // The chunking strategy used to chunk the file(s). If not set, will use the `auto` // strategy. ChunkingStrategy BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion `json:"chunking_strategy,omitzero"` // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to // add to the vector store. There can be a maximum of 10000 files in a vector // store. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStore) IsPresent ¶
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStore) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStore) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto ¶
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct { // Always `auto`. // // This field can be elided, and will marshal its zero value as "auto". Type constant.Auto `json:"type,required"` // contains filtered or unexported fields }
The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
The property Type is required.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent ¶
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic ¶
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic struct { Static BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic `json:"static,omitzero,required"` // Always `static`. // // This field can be elided, and will marshal its zero value as "static". Type constant.Static `json:"type,required"` // contains filtered or unexported fields }
The properties Static, Type are required.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent ¶
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic ¶
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct { // The number of tokens that overlap between chunks. The default value is `400`. // // Note that the overlap must not exceed half of `max_chunk_size_tokens`. ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"` // The maximum number of tokens in each chunk. The default value is `800`. The // minimum value is `100` and the maximum value is `4096`. MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"` // contains filtered or unexported fields }
The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent ¶
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON ¶
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON() (data []byte, err error)
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion ¶
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion struct { OfAuto *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto `json:",omitzero,inline"` OfStatic *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic `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 (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic ¶
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
Returns a pointer to the underlying variant's property, if present.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType ¶
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent ¶
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON ¶
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error)
type BetaAssistantService ¶
type BetaAssistantService struct {
Options []option.RequestOption
}
BetaAssistantService 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 NewBetaAssistantService method instead.
func NewBetaAssistantService ¶
func NewBetaAssistantService(opts ...option.RequestOption) (r BetaAssistantService)
NewBetaAssistantService 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 (*BetaAssistantService) Delete ¶
func (r *BetaAssistantService) Delete(ctx context.Context, assistantID string, opts ...option.RequestOption) (res *AssistantDeleted, err error)
Delete an assistant.
func (*BetaAssistantService) Get ¶
func (r *BetaAssistantService) Get(ctx context.Context, assistantID string, opts ...option.RequestOption) (res *Assistant, err error)
Retrieves an assistant.
func (*BetaAssistantService) List ¶
func (r *BetaAssistantService) List(ctx context.Context, query BetaAssistantListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Assistant], err error)
Returns a list of assistants.
func (*BetaAssistantService) ListAutoPaging ¶
func (r *BetaAssistantService) ListAutoPaging(ctx context.Context, query BetaAssistantListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Assistant]
Returns a list of assistants.
func (*BetaAssistantService) New ¶
func (r *BetaAssistantService) New(ctx context.Context, body BetaAssistantNewParams, opts ...option.RequestOption) (res *Assistant, err error)
Create an assistant with a model and instructions.
func (*BetaAssistantService) Update ¶
func (r *BetaAssistantService) Update(ctx context.Context, assistantID string, body BetaAssistantUpdateParams, opts ...option.RequestOption) (res *Assistant, err error)
Modifies an assistant.
type BetaAssistantUpdateParams ¶
type BetaAssistantUpdateParams struct { // The description of the assistant. The maximum length is 512 characters. Description param.Opt[string] `json:"description,omitzero"` // The system instructions that the assistant uses. The maximum length is 256,000 // characters. Instructions param.Opt[string] `json:"instructions,omitzero"` // The name of the assistant. The maximum length is 256 characters. Name param.Opt[string] `json:"name,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or temperature but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // **o-series models only** // // Constrains effort on reasoning for // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently // supported values are `low`, `medium`, and `high`. Reducing reasoning effort can // result in faster responses and fewer tokens used on reasoning in a response. // // Any of "low", "medium", "high". ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"` // A set of resources that are used by the assistant's tools. The resources are // specific to the type of tool. For example, the `code_interpreter` tool requires // a list of file IDs, while the `file_search` tool requires a list of vector store // IDs. ToolResources BetaAssistantUpdateParamsToolResources `json:"tool_resources,omitzero"` // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our // [Model overview](https://platform.openai.com/docs/models) for descriptions of // them. Model BetaAssistantUpdateParamsModel `json:"model,omitzero"` // Specifies the format that the model must output. Compatible with // [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), // [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), // and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the // message the model generates is valid JSON. // // **Important:** when using JSON mode, you **must** also instruct the model to // produce JSON yourself via a system or user message. Without this, the model may // generate an unending stream of whitespace until the generation reaches the token // limit, resulting in a long-running and seemingly "stuck" request. Also note that // the message content may be partially cut off if `finish_reason="length"`, which // indicates the generation exceeded `max_tokens` or the conversation exceeded the // max context length. ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"` // A list of tool enabled on the assistant. There can be a maximum of 128 tools per // assistant. Tools can be of types `code_interpreter`, `file_search`, or // `function`. Tools []AssistantToolUnionParam `json:"tools,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantUpdateParams) IsPresent ¶
func (f BetaAssistantUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantUpdateParams) MarshalJSON ¶
func (r BetaAssistantUpdateParams) MarshalJSON() (data []byte, err error)
type BetaAssistantUpdateParamsModel ¶
type BetaAssistantUpdateParamsModel string
ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.
const ( BetaAssistantUpdateParamsModelO3Mini BetaAssistantUpdateParamsModel = "o3-mini" BetaAssistantUpdateParamsModelO3Mini2025_01_31 BetaAssistantUpdateParamsModel = "o3-mini-2025-01-31" BetaAssistantUpdateParamsModelO1 BetaAssistantUpdateParamsModel = "o1" BetaAssistantUpdateParamsModelO1_2024_12_17 BetaAssistantUpdateParamsModel = "o1-2024-12-17" BetaAssistantUpdateParamsModelGPT4o BetaAssistantUpdateParamsModel = "gpt-4o" BetaAssistantUpdateParamsModelGPT4o2024_11_20 BetaAssistantUpdateParamsModel = "gpt-4o-2024-11-20" BetaAssistantUpdateParamsModelGPT4o2024_08_06 BetaAssistantUpdateParamsModel = "gpt-4o-2024-08-06" BetaAssistantUpdateParamsModelGPT4o2024_05_13 BetaAssistantUpdateParamsModel = "gpt-4o-2024-05-13" BetaAssistantUpdateParamsModelGPT4oMini BetaAssistantUpdateParamsModel = "gpt-4o-mini" BetaAssistantUpdateParamsModelGPT4oMini2024_07_18 BetaAssistantUpdateParamsModel = "gpt-4o-mini-2024-07-18" BetaAssistantUpdateParamsModelGPT4_5Preview BetaAssistantUpdateParamsModel = "gpt-4.5-preview" BetaAssistantUpdateParamsModelGPT4_5Preview2025_02_27 BetaAssistantUpdateParamsModel = "gpt-4.5-preview-2025-02-27" BetaAssistantUpdateParamsModelGPT4Turbo BetaAssistantUpdateParamsModel = "gpt-4-turbo" BetaAssistantUpdateParamsModelGPT4Turbo2024_04_09 BetaAssistantUpdateParamsModel = "gpt-4-turbo-2024-04-09" BetaAssistantUpdateParamsModelGPT4_0125Preview BetaAssistantUpdateParamsModel = "gpt-4-0125-preview" BetaAssistantUpdateParamsModelGPT4TurboPreview BetaAssistantUpdateParamsModel = "gpt-4-turbo-preview" BetaAssistantUpdateParamsModelGPT4_1106Preview BetaAssistantUpdateParamsModel = "gpt-4-1106-preview" BetaAssistantUpdateParamsModelGPT4VisionPreview BetaAssistantUpdateParamsModel = "gpt-4-vision-preview" BetaAssistantUpdateParamsModelGPT4 BetaAssistantUpdateParamsModel = "gpt-4" BetaAssistantUpdateParamsModelGPT4_0314 BetaAssistantUpdateParamsModel = "gpt-4-0314" BetaAssistantUpdateParamsModelGPT4_0613 BetaAssistantUpdateParamsModel = "gpt-4-0613" BetaAssistantUpdateParamsModelGPT4_32k BetaAssistantUpdateParamsModel = "gpt-4-32k" BetaAssistantUpdateParamsModelGPT4_32k0314 BetaAssistantUpdateParamsModel = "gpt-4-32k-0314" BetaAssistantUpdateParamsModelGPT4_32k0613 BetaAssistantUpdateParamsModel = "gpt-4-32k-0613" BetaAssistantUpdateParamsModelGPT3_5Turbo BetaAssistantUpdateParamsModel = "gpt-3.5-turbo" BetaAssistantUpdateParamsModelGPT3_5Turbo16k BetaAssistantUpdateParamsModel = "gpt-3.5-turbo-16k" BetaAssistantUpdateParamsModelGPT3_5Turbo0613 BetaAssistantUpdateParamsModel = "gpt-3.5-turbo-0613" BetaAssistantUpdateParamsModelGPT3_5Turbo1106 BetaAssistantUpdateParamsModel = "gpt-3.5-turbo-1106" BetaAssistantUpdateParamsModelGPT3_5Turbo0125 BetaAssistantUpdateParamsModel = "gpt-3.5-turbo-0125" BetaAssistantUpdateParamsModelGPT3_5Turbo16k0613 BetaAssistantUpdateParamsModel = "gpt-3.5-turbo-16k-0613" )
type BetaAssistantUpdateParamsToolResources ¶
type BetaAssistantUpdateParamsToolResources struct { CodeInterpreter BetaAssistantUpdateParamsToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"` FileSearch BetaAssistantUpdateParamsToolResourcesFileSearch `json:"file_search,omitzero"` // contains filtered or unexported fields }
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (BetaAssistantUpdateParamsToolResources) IsPresent ¶
func (f BetaAssistantUpdateParamsToolResources) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantUpdateParamsToolResources) MarshalJSON ¶
func (r BetaAssistantUpdateParamsToolResources) MarshalJSON() (data []byte, err error)
type BetaAssistantUpdateParamsToolResourcesCodeInterpreter ¶
type BetaAssistantUpdateParamsToolResourcesCodeInterpreter struct { // Overrides the list of // [file](https://platform.openai.com/docs/api-reference/files) IDs made available // to the `code_interpreter` tool. There can be a maximum of 20 files associated // with the tool. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantUpdateParamsToolResourcesCodeInterpreter) IsPresent ¶
func (f BetaAssistantUpdateParamsToolResourcesCodeInterpreter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantUpdateParamsToolResourcesCodeInterpreter) MarshalJSON ¶
func (r BetaAssistantUpdateParamsToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error)
type BetaAssistantUpdateParamsToolResourcesFileSearch ¶
type BetaAssistantUpdateParamsToolResourcesFileSearch struct { // Overrides the // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this assistant. There can be a maximum of 1 vector store attached to // the assistant. VectorStoreIDs []string `json:"vector_store_ids,omitzero"` // contains filtered or unexported fields }
func (BetaAssistantUpdateParamsToolResourcesFileSearch) IsPresent ¶
func (f BetaAssistantUpdateParamsToolResourcesFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaAssistantUpdateParamsToolResourcesFileSearch) MarshalJSON ¶
func (r BetaAssistantUpdateParamsToolResourcesFileSearch) MarshalJSON() (data []byte, err error)
type BetaService ¶
type BetaService struct { Options []option.RequestOption Assistants BetaAssistantService Threads BetaThreadService }
BetaService 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 NewBetaService method instead.
func NewBetaService ¶
func NewBetaService(opts ...option.RequestOption) (r BetaService)
NewBetaService 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 BetaThreadMessageListParams ¶
type BetaThreadMessageListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Filter messages by the run ID that generated them. RunID param.Opt[string] `query:"run_id,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order BetaThreadMessageListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (BetaThreadMessageListParams) IsPresent ¶
func (f BetaThreadMessageListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageListParams) URLQuery ¶
func (r BetaThreadMessageListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaThreadMessageListParams's query parameters as `url.Values`.
type BetaThreadMessageListParamsOrder ¶
type BetaThreadMessageListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( BetaThreadMessageListParamsOrderAsc BetaThreadMessageListParamsOrder = "asc" BetaThreadMessageListParamsOrderDesc BetaThreadMessageListParamsOrder = "desc" )
type BetaThreadMessageNewParams ¶
type BetaThreadMessageNewParams struct { // The text contents of the message. Content BetaThreadMessageNewParamsContentUnion `json:"content,omitzero,required"` // The role of the entity that is creating the message. Allowed values include: // // - `user`: Indicates the message is sent by an actual user and should be used in // most cases to represent user-generated messages. // - `assistant`: Indicates the message is generated by the assistant. Use this // value to insert messages from the assistant into the conversation. // // Any of "user", "assistant". Role BetaThreadMessageNewParamsRole `json:"role,omitzero,required"` // A list of files attached to the message, and the tools they should be added to. Attachments []BetaThreadMessageNewParamsAttachment `json:"attachments,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
func (BetaThreadMessageNewParams) IsPresent ¶
func (f BetaThreadMessageNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageNewParams) MarshalJSON ¶
func (r BetaThreadMessageNewParams) MarshalJSON() (data []byte, err error)
type BetaThreadMessageNewParamsAttachment ¶
type BetaThreadMessageNewParamsAttachment struct { // The ID of the file to attach to the message. FileID param.Opt[string] `json:"file_id,omitzero"` // The tools to add this file to. Tools []BetaThreadMessageNewParamsAttachmentToolUnion `json:"tools,omitzero"` // contains filtered or unexported fields }
func (BetaThreadMessageNewParamsAttachment) IsPresent ¶
func (f BetaThreadMessageNewParamsAttachment) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageNewParamsAttachment) MarshalJSON ¶
func (r BetaThreadMessageNewParamsAttachment) MarshalJSON() (data []byte, err error)
type BetaThreadMessageNewParamsAttachmentToolFileSearch ¶
type BetaThreadMessageNewParamsAttachmentToolFileSearch struct { // The type of tool being defined: `file_search` // // This field can be elided, and will marshal its zero value as "file_search". Type constant.FileSearch `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (BetaThreadMessageNewParamsAttachmentToolFileSearch) IsPresent ¶
func (f BetaThreadMessageNewParamsAttachmentToolFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageNewParamsAttachmentToolFileSearch) MarshalJSON ¶
func (r BetaThreadMessageNewParamsAttachmentToolFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadMessageNewParamsAttachmentToolUnion ¶
type BetaThreadMessageNewParamsAttachmentToolUnion struct { OfCodeInterpreter *CodeInterpreterToolParam `json:",omitzero,inline"` OfFileSearch *BetaThreadMessageNewParamsAttachmentToolFileSearch `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 (BetaThreadMessageNewParamsAttachmentToolUnion) GetType ¶
func (u BetaThreadMessageNewParamsAttachmentToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadMessageNewParamsAttachmentToolUnion) IsPresent ¶
func (u BetaThreadMessageNewParamsAttachmentToolUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageNewParamsAttachmentToolUnion) MarshalJSON ¶
func (u BetaThreadMessageNewParamsAttachmentToolUnion) MarshalJSON() ([]byte, error)
type BetaThreadMessageNewParamsContentUnion ¶
type BetaThreadMessageNewParamsContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []MessageContentPartParamUnion `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 (BetaThreadMessageNewParamsContentUnion) IsPresent ¶
func (u BetaThreadMessageNewParamsContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageNewParamsContentUnion) MarshalJSON ¶
func (u BetaThreadMessageNewParamsContentUnion) MarshalJSON() ([]byte, error)
type BetaThreadMessageNewParamsRole ¶
type BetaThreadMessageNewParamsRole string
The role of the entity that is creating the message. Allowed values include:
- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.
const ( BetaThreadMessageNewParamsRoleUser BetaThreadMessageNewParamsRole = "user" BetaThreadMessageNewParamsRoleAssistant BetaThreadMessageNewParamsRole = "assistant" )
type BetaThreadMessageService ¶
type BetaThreadMessageService struct {
Options []option.RequestOption
}
BetaThreadMessageService 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 NewBetaThreadMessageService method instead.
func NewBetaThreadMessageService ¶
func NewBetaThreadMessageService(opts ...option.RequestOption) (r BetaThreadMessageService)
NewBetaThreadMessageService 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 (*BetaThreadMessageService) Delete ¶
func (r *BetaThreadMessageService) Delete(ctx context.Context, threadID string, messageID string, opts ...option.RequestOption) (res *MessageDeleted, err error)
Deletes a message.
func (*BetaThreadMessageService) Get ¶
func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, messageID string, opts ...option.RequestOption) (res *Message, err error)
Retrieve a message.
func (*BetaThreadMessageService) List ¶
func (r *BetaThreadMessageService) List(ctx context.Context, threadID string, query BetaThreadMessageListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Message], err error)
Returns a list of messages for a given thread.
func (*BetaThreadMessageService) ListAutoPaging ¶
func (r *BetaThreadMessageService) ListAutoPaging(ctx context.Context, threadID string, query BetaThreadMessageListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Message]
Returns a list of messages for a given thread.
func (*BetaThreadMessageService) New ¶
func (r *BetaThreadMessageService) New(ctx context.Context, threadID string, body BetaThreadMessageNewParams, opts ...option.RequestOption) (res *Message, err error)
Create a message.
func (*BetaThreadMessageService) Update ¶
func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string, messageID string, body BetaThreadMessageUpdateParams, opts ...option.RequestOption) (res *Message, err error)
Modifies a message.
type BetaThreadMessageUpdateParams ¶
type BetaThreadMessageUpdateParams 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.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
func (BetaThreadMessageUpdateParams) IsPresent ¶
func (f BetaThreadMessageUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadMessageUpdateParams) MarshalJSON ¶
func (r BetaThreadMessageUpdateParams) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParams ¶
type BetaThreadNewAndRunParams struct { // The ID of the // [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to // execute this run. AssistantID string `json:"assistant_id,required"` // Override the default system message of the assistant. This is useful for // modifying the behavior on a per-run basis. Instructions param.Opt[string] `json:"instructions,omitzero"` // The maximum number of completion tokens that may be used over the course of the // run. The run will make a best effort to use only the number of completion tokens // specified, across multiple turns of the run. If the run exceeds the number of // completion tokens specified, the run will end with status `incomplete`. See // `incomplete_details` for more info. MaxCompletionTokens param.Opt[int64] `json:"max_completion_tokens,omitzero"` // The maximum number of prompt tokens that may be used over the course of the run. // The run will make a best effort to use only the number of prompt tokens // specified, across multiple turns of the run. If the run exceeds the number of // prompt tokens specified, the run will end with status `incomplete`. See // `incomplete_details` for more info. MaxPromptTokens param.Opt[int64] `json:"max_prompt_tokens,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or temperature but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // Whether to enable // [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) // during tool use. ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to // be used to execute this run. If a value is provided here, it will override the // model associated with the assistant. If not, the model associated with the // assistant will be used. Model shared.ChatModel `json:"model,omitzero"` // A set of resources that are used by the assistant's tools. The resources are // specific to the type of tool. For example, the `code_interpreter` tool requires // a list of file IDs, while the `file_search` tool requires a list of vector store // IDs. ToolResources BetaThreadNewAndRunParamsToolResources `json:"tool_resources,omitzero"` // Override the tools the assistant can use for this run. This is useful for // modifying the behavior on a per-run basis. Tools []BetaThreadNewAndRunParamsToolUnion `json:"tools,omitzero"` // Controls for how a thread will be truncated prior to the run. Use this to // control the intial context window of the run. TruncationStrategy BetaThreadNewAndRunParamsTruncationStrategy `json:"truncation_strategy,omitzero"` // Specifies the format that the model must output. Compatible with // [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), // [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), // and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the // message the model generates is valid JSON. // // **Important:** when using JSON mode, you **must** also instruct the model to // produce JSON yourself via a system or user message. Without this, the model may // generate an unending stream of whitespace until the generation reaches the token // limit, resulting in a long-running and seemingly "stuck" request. Also note that // the message content may be partially cut off if `finish_reason="length"`, which // indicates the generation exceeded `max_tokens` or the conversation exceeded the // max context length. ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"` // Options to create a new thread. If no thread is provided when running a request, // an empty thread will be created. Thread BetaThreadNewAndRunParamsThread `json:"thread,omitzero"` // Controls which (if any) tool is called by the model. `none` means the model will // not call any tools and instead generates a message. `auto` is the default value // and means the model can pick between generating a message or calling one or more // tools. `required` means the model must call one or more tools before responding // to the user. Specifying a particular tool like `{"type": "file_search"}` or // `{"type": "function", "function": {"name": "my_function"}}` forces the model to // call that tool. ToolChoice AssistantToolChoiceOptionUnionParam `json:"tool_choice,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParams) IsPresent ¶
func (f BetaThreadNewAndRunParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParams) MarshalJSON ¶
func (r BetaThreadNewAndRunParams) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThread ¶
type BetaThreadNewAndRunParamsThread 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.MetadataParam `json:"metadata,omitzero"` // A set of resources that are made available to the assistant's tools in this // thread. The resources are specific to the type of tool. For example, the // `code_interpreter` tool requires a list of file IDs, while the `file_search` // tool requires a list of vector store IDs. ToolResources BetaThreadNewAndRunParamsThreadToolResources `json:"tool_resources,omitzero"` // A list of [messages](https://platform.openai.com/docs/api-reference/messages) to // start the thread with. Messages []BetaThreadNewAndRunParamsThreadMessage `json:"messages,omitzero"` // contains filtered or unexported fields }
Options to create a new thread. If no thread is provided when running a request, an empty thread will be created.
func (BetaThreadNewAndRunParamsThread) IsPresent ¶
func (f BetaThreadNewAndRunParamsThread) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThread) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThread) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadMessage ¶
type BetaThreadNewAndRunParamsThreadMessage struct { // The text contents of the message. Content BetaThreadNewAndRunParamsThreadMessageContentUnion `json:"content,omitzero,required"` // The role of the entity that is creating the message. Allowed values include: // // - `user`: Indicates the message is sent by an actual user and should be used in // most cases to represent user-generated messages. // - `assistant`: Indicates the message is generated by the assistant. Use this // value to insert messages from the assistant into the conversation. // // Any of "user", "assistant". Role string `json:"role,omitzero,required"` // A list of files attached to the message, and the tools they should be added to. Attachments []BetaThreadNewAndRunParamsThreadMessageAttachment `json:"attachments,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
The properties Content, Role are required.
func (BetaThreadNewAndRunParamsThreadMessage) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadMessage) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadMessage) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadMessage) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadMessageAttachment ¶
type BetaThreadNewAndRunParamsThreadMessageAttachment struct { // The ID of the file to attach to the message. FileID param.Opt[string] `json:"file_id,omitzero"` // The tools to add this file to. Tools []BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion `json:"tools,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParamsThreadMessageAttachment) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadMessageAttachment) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadMessageAttachment) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadMessageAttachment) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch ¶
type BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch struct { // The type of tool being defined: `file_search` // // This field can be elided, and will marshal its zero value as "file_search". Type constant.FileSearch `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion ¶
type BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion struct { OfCodeInterpreter *CodeInterpreterToolParam `json:",omitzero,inline"` OfFileSearch *BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch `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 (BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) GetType ¶
func (u BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) IsPresent ¶
func (u BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) MarshalJSON ¶
func (u BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) MarshalJSON() ([]byte, error)
type BetaThreadNewAndRunParamsThreadMessageContentUnion ¶
type BetaThreadNewAndRunParamsThreadMessageContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []MessageContentPartParamUnion `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 (BetaThreadNewAndRunParamsThreadMessageContentUnion) IsPresent ¶
func (u BetaThreadNewAndRunParamsThreadMessageContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadMessageContentUnion) MarshalJSON ¶
func (u BetaThreadNewAndRunParamsThreadMessageContentUnion) MarshalJSON() ([]byte, error)
type BetaThreadNewAndRunParamsThreadToolResources ¶
type BetaThreadNewAndRunParamsThreadToolResources struct { CodeInterpreter BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"` FileSearch BetaThreadNewAndRunParamsThreadToolResourcesFileSearch `json:"file_search,omitzero"` // contains filtered or unexported fields }
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (BetaThreadNewAndRunParamsThreadToolResources) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResources) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResources) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResources) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter ¶
type BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter` tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearch ¶
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearch struct { // The // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this thread. There can be a maximum of 1 vector store attached to // the thread. VectorStoreIDs []string `json:"vector_store_ids,omitzero"` // A helper to create a // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // with file_ids and attach it to this thread. There can be a maximum of 1 vector // store attached to the thread. VectorStores []BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore `json:"vector_stores,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearch) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResourcesFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearch) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResourcesFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore ¶
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore 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.MetadataParam `json:"metadata,omitzero"` // The chunking strategy used to chunk the file(s). If not set, will use the `auto` // strategy. ChunkingStrategy BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion `json:"chunking_strategy,omitzero"` // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to // add to the vector store. There can be a maximum of 10000 files in a vector // store. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto ¶
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct { // Always `auto`. // // This field can be elided, and will marshal its zero value as "auto". Type constant.Auto `json:"type,required"` // contains filtered or unexported fields }
The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
The property Type is required.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic ¶
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic struct { Static BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic `json:"static,omitzero,required"` // Always `static`. // // This field can be elided, and will marshal its zero value as "static". Type constant.Static `json:"type,required"` // contains filtered or unexported fields }
The properties Static, Type are required.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic ¶
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct { // The number of tokens that overlap between chunks. The default value is `400`. // // Note that the overlap must not exceed half of `max_chunk_size_tokens`. ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"` // The maximum number of tokens in each chunk. The default value is `800`. The // minimum value is `100` and the maximum value is `4096`. MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"` // contains filtered or unexported fields }
The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent ¶
func (f BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion ¶
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion struct { OfAuto *BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto `json:",omitzero,inline"` OfStatic *BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStatic `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 (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic ¶
func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() *BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType ¶
func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent ¶
func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON ¶
func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error)
type BetaThreadNewAndRunParamsToolResources ¶
type BetaThreadNewAndRunParamsToolResources struct { CodeInterpreter BetaThreadNewAndRunParamsToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"` FileSearch BetaThreadNewAndRunParamsToolResourcesFileSearch `json:"file_search,omitzero"` // contains filtered or unexported fields }
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (BetaThreadNewAndRunParamsToolResources) IsPresent ¶
func (f BetaThreadNewAndRunParamsToolResources) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsToolResources) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsToolResources) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsToolResourcesCodeInterpreter ¶
type BetaThreadNewAndRunParamsToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter` tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParamsToolResourcesCodeInterpreter) IsPresent ¶
func (f BetaThreadNewAndRunParamsToolResourcesCodeInterpreter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsToolResourcesCodeInterpreter) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsToolResourcesFileSearch ¶
type BetaThreadNewAndRunParamsToolResourcesFileSearch struct { // The ID of the // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this assistant. There can be a maximum of 1 vector store attached to // the assistant. VectorStoreIDs []string `json:"vector_store_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewAndRunParamsToolResourcesFileSearch) IsPresent ¶
func (f BetaThreadNewAndRunParamsToolResourcesFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsToolResourcesFileSearch) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsToolResourcesFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadNewAndRunParamsToolUnion ¶
type BetaThreadNewAndRunParamsToolUnion struct { OfCodeInterpreterTool *CodeInterpreterToolParam `json:",omitzero,inline"` OfFileSearchTool *FileSearchToolParam `json:",omitzero,inline"` OfFunctionTool *FunctionToolParam `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 (BetaThreadNewAndRunParamsToolUnion) GetFileSearch ¶
func (u BetaThreadNewAndRunParamsToolUnion) GetFileSearch() *FileSearchToolFileSearchParam
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewAndRunParamsToolUnion) GetFunction ¶
func (u BetaThreadNewAndRunParamsToolUnion) GetFunction() *shared.FunctionDefinitionParam
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewAndRunParamsToolUnion) GetType ¶
func (u BetaThreadNewAndRunParamsToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewAndRunParamsToolUnion) IsPresent ¶
func (u BetaThreadNewAndRunParamsToolUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsToolUnion) MarshalJSON ¶
func (u BetaThreadNewAndRunParamsToolUnion) MarshalJSON() ([]byte, error)
type BetaThreadNewAndRunParamsTruncationStrategy ¶
type BetaThreadNewAndRunParamsTruncationStrategy struct { // The truncation strategy to use for the thread. The default is `auto`. If set to // `last_messages`, the thread will be truncated to the n most recent messages in // the thread. When set to `auto`, messages in the middle of the thread will be // dropped to fit the context length of the model, `max_prompt_tokens`. // // Any of "auto", "last_messages". Type string `json:"type,omitzero,required"` // The number of most recent messages from the thread when constructing the context // for the run. LastMessages param.Opt[int64] `json:"last_messages,omitzero"` // contains filtered or unexported fields }
Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
The property Type is required.
func (BetaThreadNewAndRunParamsTruncationStrategy) IsPresent ¶
func (f BetaThreadNewAndRunParamsTruncationStrategy) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewAndRunParamsTruncationStrategy) MarshalJSON ¶
func (r BetaThreadNewAndRunParamsTruncationStrategy) MarshalJSON() (data []byte, err error)
type BetaThreadNewParams ¶
type BetaThreadNewParams 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.MetadataParam `json:"metadata,omitzero"` // A set of resources that are made available to the assistant's tools in this // thread. The resources are specific to the type of tool. For example, the // `code_interpreter` tool requires a list of file IDs, while the `file_search` // tool requires a list of vector store IDs. ToolResources BetaThreadNewParamsToolResources `json:"tool_resources,omitzero"` // A list of [messages](https://platform.openai.com/docs/api-reference/messages) to // start the thread with. Messages []BetaThreadNewParamsMessage `json:"messages,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewParams) IsPresent ¶
func (f BetaThreadNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParams) MarshalJSON ¶
func (r BetaThreadNewParams) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsMessage ¶
type BetaThreadNewParamsMessage struct { // The text contents of the message. Content BetaThreadNewParamsMessageContentUnion `json:"content,omitzero,required"` // The role of the entity that is creating the message. Allowed values include: // // - `user`: Indicates the message is sent by an actual user and should be used in // most cases to represent user-generated messages. // - `assistant`: Indicates the message is generated by the assistant. Use this // value to insert messages from the assistant into the conversation. // // Any of "user", "assistant". Role string `json:"role,omitzero,required"` // A list of files attached to the message, and the tools they should be added to. Attachments []BetaThreadNewParamsMessageAttachment `json:"attachments,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
The properties Content, Role are required.
func (BetaThreadNewParamsMessage) IsPresent ¶
func (f BetaThreadNewParamsMessage) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsMessage) MarshalJSON ¶
func (r BetaThreadNewParamsMessage) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsMessageAttachment ¶
type BetaThreadNewParamsMessageAttachment struct { // The ID of the file to attach to the message. FileID param.Opt[string] `json:"file_id,omitzero"` // The tools to add this file to. Tools []BetaThreadNewParamsMessageAttachmentToolUnion `json:"tools,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewParamsMessageAttachment) IsPresent ¶
func (f BetaThreadNewParamsMessageAttachment) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsMessageAttachment) MarshalJSON ¶
func (r BetaThreadNewParamsMessageAttachment) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsMessageAttachmentToolFileSearch ¶
type BetaThreadNewParamsMessageAttachmentToolFileSearch struct { // The type of tool being defined: `file_search` // // This field can be elided, and will marshal its zero value as "file_search". Type constant.FileSearch `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (BetaThreadNewParamsMessageAttachmentToolFileSearch) IsPresent ¶
func (f BetaThreadNewParamsMessageAttachmentToolFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsMessageAttachmentToolFileSearch) MarshalJSON ¶
func (r BetaThreadNewParamsMessageAttachmentToolFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsMessageAttachmentToolUnion ¶
type BetaThreadNewParamsMessageAttachmentToolUnion struct { OfCodeInterpreter *CodeInterpreterToolParam `json:",omitzero,inline"` OfFileSearch *BetaThreadNewParamsMessageAttachmentToolFileSearch `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 (BetaThreadNewParamsMessageAttachmentToolUnion) GetType ¶
func (u BetaThreadNewParamsMessageAttachmentToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewParamsMessageAttachmentToolUnion) IsPresent ¶
func (u BetaThreadNewParamsMessageAttachmentToolUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsMessageAttachmentToolUnion) MarshalJSON ¶
func (u BetaThreadNewParamsMessageAttachmentToolUnion) MarshalJSON() ([]byte, error)
type BetaThreadNewParamsMessageContentUnion ¶
type BetaThreadNewParamsMessageContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []MessageContentPartParamUnion `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 (BetaThreadNewParamsMessageContentUnion) IsPresent ¶
func (u BetaThreadNewParamsMessageContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsMessageContentUnion) MarshalJSON ¶
func (u BetaThreadNewParamsMessageContentUnion) MarshalJSON() ([]byte, error)
type BetaThreadNewParamsToolResources ¶
type BetaThreadNewParamsToolResources struct { CodeInterpreter BetaThreadNewParamsToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"` FileSearch BetaThreadNewParamsToolResourcesFileSearch `json:"file_search,omitzero"` // contains filtered or unexported fields }
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (BetaThreadNewParamsToolResources) IsPresent ¶
func (f BetaThreadNewParamsToolResources) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResources) MarshalJSON ¶
func (r BetaThreadNewParamsToolResources) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesCodeInterpreter ¶
type BetaThreadNewParamsToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter` tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewParamsToolResourcesCodeInterpreter) IsPresent ¶
func (f BetaThreadNewParamsToolResourcesCodeInterpreter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesCodeInterpreter) MarshalJSON ¶
func (r BetaThreadNewParamsToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesFileSearch ¶
type BetaThreadNewParamsToolResourcesFileSearch struct { // The // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this thread. There can be a maximum of 1 vector store attached to // the thread. VectorStoreIDs []string `json:"vector_store_ids,omitzero"` // A helper to create a // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // with file_ids and attach it to this thread. There can be a maximum of 1 vector // store attached to the thread. VectorStores []BetaThreadNewParamsToolResourcesFileSearchVectorStore `json:"vector_stores,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewParamsToolResourcesFileSearch) IsPresent ¶
func (f BetaThreadNewParamsToolResourcesFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesFileSearch) MarshalJSON ¶
func (r BetaThreadNewParamsToolResourcesFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesFileSearchVectorStore ¶
type BetaThreadNewParamsToolResourcesFileSearchVectorStore 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.MetadataParam `json:"metadata,omitzero"` // The chunking strategy used to chunk the file(s). If not set, will use the `auto` // strategy. ChunkingStrategy BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion `json:"chunking_strategy,omitzero"` // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to // add to the vector store. There can be a maximum of 10000 files in a vector // store. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadNewParamsToolResourcesFileSearchVectorStore) IsPresent ¶
func (f BetaThreadNewParamsToolResourcesFileSearchVectorStore) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStore) MarshalJSON ¶
func (r BetaThreadNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto ¶
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct { // Always `auto`. // // This field can be elided, and will marshal its zero value as "auto". Type constant.Auto `json:"type,required"` // contains filtered or unexported fields }
The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
The property Type is required.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent ¶
func (f BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON ¶
func (r BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic ¶
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic struct { Static BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic `json:"static,omitzero,required"` // Always `static`. // // This field can be elided, and will marshal its zero value as "static". Type constant.Static `json:"type,required"` // contains filtered or unexported fields }
The properties Static, Type are required.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent ¶
func (f BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON ¶
func (r BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic ¶
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct { // The number of tokens that overlap between chunks. The default value is `400`. // // Note that the overlap must not exceed half of `max_chunk_size_tokens`. ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"` // The maximum number of tokens in each chunk. The default value is `800`. The // minimum value is `100` and the maximum value is `4096`. MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"` // contains filtered or unexported fields }
The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent ¶
func (f BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON ¶
func (r BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON() (data []byte, err error)
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion ¶
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion struct { OfAuto *BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto `json:",omitzero,inline"` OfStatic *BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic `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 (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic ¶
func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() *BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType ¶
func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent ¶
func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON ¶
func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error)
type BetaThreadRunListParams ¶
type BetaThreadRunListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order BetaThreadRunListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (BetaThreadRunListParams) IsPresent ¶
func (f BetaThreadRunListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunListParams) URLQuery ¶
func (r BetaThreadRunListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaThreadRunListParams's query parameters as `url.Values`.
type BetaThreadRunListParamsOrder ¶
type BetaThreadRunListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( BetaThreadRunListParamsOrderAsc BetaThreadRunListParamsOrder = "asc" BetaThreadRunListParamsOrderDesc BetaThreadRunListParamsOrder = "desc" )
type BetaThreadRunNewParams ¶
type BetaThreadRunNewParams struct { // The ID of the // [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to // execute this run. AssistantID string `json:"assistant_id,required"` // Appends additional instructions at the end of the instructions for the run. This // is useful for modifying the behavior on a per-run basis without overriding other // instructions. AdditionalInstructions param.Opt[string] `json:"additional_instructions,omitzero"` // Overrides the // [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) // of the assistant. This is useful for modifying the behavior on a per-run basis. Instructions param.Opt[string] `json:"instructions,omitzero"` // The maximum number of completion tokens that may be used over the course of the // run. The run will make a best effort to use only the number of completion tokens // specified, across multiple turns of the run. If the run exceeds the number of // completion tokens specified, the run will end with status `incomplete`. See // `incomplete_details` for more info. MaxCompletionTokens param.Opt[int64] `json:"max_completion_tokens,omitzero"` // The maximum number of prompt tokens that may be used over the course of the run. // The run will make a best effort to use only the number of prompt tokens // specified, across multiple turns of the run. If the run exceeds the number of // prompt tokens specified, the run will end with status `incomplete`. See // `incomplete_details` for more info. MaxPromptTokens param.Opt[int64] `json:"max_prompt_tokens,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or temperature but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // Whether to enable // [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) // during tool use. ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"` // Adds additional messages to the thread before creating the run. AdditionalMessages []BetaThreadRunNewParamsAdditionalMessage `json:"additional_messages,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to // be used to execute this run. If a value is provided here, it will override the // model associated with the assistant. If not, the model associated with the // assistant will be used. Model shared.ChatModel `json:"model,omitzero"` // **o-series models only** // // Constrains effort on reasoning for // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently // supported values are `low`, `medium`, and `high`. Reducing reasoning effort can // result in faster responses and fewer tokens used on reasoning in a response. // // Any of "low", "medium", "high". ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"` // Override the tools the assistant can use for this run. This is useful for // modifying the behavior on a per-run basis. Tools []AssistantToolUnionParam `json:"tools,omitzero"` // Controls for how a thread will be truncated prior to the run. Use this to // control the intial context window of the run. TruncationStrategy BetaThreadRunNewParamsTruncationStrategy `json:"truncation_strategy,omitzero"` // A list of additional fields to include in the response. Currently the only // supported value is `step_details.tool_calls[*].file_search.results[*].content` // to fetch the file search result content. // // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. Include []RunStepInclude `query:"include,omitzero" json:"-"` // Specifies the format that the model must output. Compatible with // [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), // [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), // and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the // message the model generates is valid JSON. // // **Important:** when using JSON mode, you **must** also instruct the model to // produce JSON yourself via a system or user message. Without this, the model may // generate an unending stream of whitespace until the generation reaches the token // limit, resulting in a long-running and seemingly "stuck" request. Also note that // the message content may be partially cut off if `finish_reason="length"`, which // indicates the generation exceeded `max_tokens` or the conversation exceeded the // max context length. ResponseFormat AssistantResponseFormatOptionUnionParam `json:"response_format,omitzero"` // Controls which (if any) tool is called by the model. `none` means the model will // not call any tools and instead generates a message. `auto` is the default value // and means the model can pick between generating a message or calling one or more // tools. `required` means the model must call one or more tools before responding // to the user. Specifying a particular tool like `{"type": "file_search"}` or // `{"type": "function", "function": {"name": "my_function"}}` forces the model to // call that tool. ToolChoice AssistantToolChoiceOptionUnionParam `json:"tool_choice,omitzero"` // contains filtered or unexported fields }
func (BetaThreadRunNewParams) IsPresent ¶
func (f BetaThreadRunNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParams) MarshalJSON ¶
func (r BetaThreadRunNewParams) MarshalJSON() (data []byte, err error)
func (BetaThreadRunNewParams) URLQuery ¶
func (r BetaThreadRunNewParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaThreadRunNewParams's query parameters as `url.Values`.
type BetaThreadRunNewParamsAdditionalMessage ¶
type BetaThreadRunNewParamsAdditionalMessage struct { // The text contents of the message. Content BetaThreadRunNewParamsAdditionalMessageContentUnion `json:"content,omitzero,required"` // The role of the entity that is creating the message. Allowed values include: // // - `user`: Indicates the message is sent by an actual user and should be used in // most cases to represent user-generated messages. // - `assistant`: Indicates the message is generated by the assistant. Use this // value to insert messages from the assistant into the conversation. // // Any of "user", "assistant". Role string `json:"role,omitzero,required"` // A list of files attached to the message, and the tools they should be added to. Attachments []BetaThreadRunNewParamsAdditionalMessageAttachment `json:"attachments,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
The properties Content, Role are required.
func (BetaThreadRunNewParamsAdditionalMessage) IsPresent ¶
func (f BetaThreadRunNewParamsAdditionalMessage) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParamsAdditionalMessage) MarshalJSON ¶
func (r BetaThreadRunNewParamsAdditionalMessage) MarshalJSON() (data []byte, err error)
type BetaThreadRunNewParamsAdditionalMessageAttachment ¶
type BetaThreadRunNewParamsAdditionalMessageAttachment struct { // The ID of the file to attach to the message. FileID param.Opt[string] `json:"file_id,omitzero"` // The tools to add this file to. Tools []BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion `json:"tools,omitzero"` // contains filtered or unexported fields }
func (BetaThreadRunNewParamsAdditionalMessageAttachment) IsPresent ¶
func (f BetaThreadRunNewParamsAdditionalMessageAttachment) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParamsAdditionalMessageAttachment) MarshalJSON ¶
func (r BetaThreadRunNewParamsAdditionalMessageAttachment) MarshalJSON() (data []byte, err error)
type BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch ¶
type BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch struct { // The type of tool being defined: `file_search` // // This field can be elided, and will marshal its zero value as "file_search". Type constant.FileSearch `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch) IsPresent ¶
func (f BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch) MarshalJSON ¶
func (r BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch) MarshalJSON() (data []byte, err error)
type BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion ¶
type BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion struct { OfCodeInterpreter *CodeInterpreterToolParam `json:",omitzero,inline"` OfFileSearch *BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch `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 (BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) GetType ¶
func (u BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) IsPresent ¶
func (u BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) MarshalJSON ¶
func (u BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) MarshalJSON() ([]byte, error)
type BetaThreadRunNewParamsAdditionalMessageContentUnion ¶
type BetaThreadRunNewParamsAdditionalMessageContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []MessageContentPartParamUnion `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 (BetaThreadRunNewParamsAdditionalMessageContentUnion) IsPresent ¶
func (u BetaThreadRunNewParamsAdditionalMessageContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParamsAdditionalMessageContentUnion) MarshalJSON ¶
func (u BetaThreadRunNewParamsAdditionalMessageContentUnion) MarshalJSON() ([]byte, error)
type BetaThreadRunNewParamsTruncationStrategy ¶
type BetaThreadRunNewParamsTruncationStrategy struct { // The truncation strategy to use for the thread. The default is `auto`. If set to // `last_messages`, the thread will be truncated to the n most recent messages in // the thread. When set to `auto`, messages in the middle of the thread will be // dropped to fit the context length of the model, `max_prompt_tokens`. // // Any of "auto", "last_messages". Type string `json:"type,omitzero,required"` // The number of most recent messages from the thread when constructing the context // for the run. LastMessages param.Opt[int64] `json:"last_messages,omitzero"` // contains filtered or unexported fields }
Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
The property Type is required.
func (BetaThreadRunNewParamsTruncationStrategy) IsPresent ¶
func (f BetaThreadRunNewParamsTruncationStrategy) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunNewParamsTruncationStrategy) MarshalJSON ¶
func (r BetaThreadRunNewParamsTruncationStrategy) MarshalJSON() (data []byte, err error)
type BetaThreadRunService ¶
type BetaThreadRunService struct { Options []option.RequestOption Steps BetaThreadRunStepService }
BetaThreadRunService 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 NewBetaThreadRunService method instead.
func NewBetaThreadRunService ¶
func NewBetaThreadRunService(opts ...option.RequestOption) (r BetaThreadRunService)
NewBetaThreadRunService 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 (*BetaThreadRunService) Cancel ¶
func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runID string, opts ...option.RequestOption) (res *Run, err error)
Cancels a run that is `in_progress`.
func (*BetaThreadRunService) Get ¶
func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID string, opts ...option.RequestOption) (res *Run, err error)
Retrieves a run.
func (*BetaThreadRunService) List ¶
func (r *BetaThreadRunService) List(ctx context.Context, threadID string, query BetaThreadRunListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Run], err error)
Returns a list of runs belonging to a thread.
func (*BetaThreadRunService) ListAutoPaging ¶
func (r *BetaThreadRunService) ListAutoPaging(ctx context.Context, threadID string, query BetaThreadRunListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Run]
Returns a list of runs belonging to a thread.
func (*BetaThreadRunService) New ¶
func (r *BetaThreadRunService) New(ctx context.Context, threadID string, params BetaThreadRunNewParams, opts ...option.RequestOption) (res *Run, err error)
Create a run.
func (*BetaThreadRunService) NewAndPoll ¶
func (r *BetaThreadRunService) NewAndPoll(ctx context.Context, threadID string, params BetaThreadRunNewParams, pollIntervalMs int, opts ...option.RequestOption) (res *Run, err error)
Create a run and poll until task is completed. Pass 0 to pollIntervalMs to use the default polling interval.
func (*BetaThreadRunService) NewStreaming ¶
func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string, params BetaThreadRunNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[AssistantStreamEventUnion])
Create a run.
func (*BetaThreadRunService) PollStatus ¶
func (r *BetaThreadRunService) PollStatus(ctx context.Context, threadID string, runID string, pollIntervalMs int, opts ...option.RequestOption) (res *Run, err error)
PollStatus waits until a Run is no longer in an incomplete state and returns it. Pass 0 as pollIntervalMs to use the default polling interval of 1 second.
func (*BetaThreadRunService) SubmitToolOutputs ¶
func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID string, runID string, body BetaThreadRunSubmitToolOutputsParams, opts ...option.RequestOption) (res *Run, err error)
When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
func (*BetaThreadRunService) SubmitToolOutputsAndPoll ¶
func (r *BetaThreadRunService) SubmitToolOutputsAndPoll(ctx context.Context, threadID string, runID string, body BetaThreadRunSubmitToolOutputsParams, pollIntervalMs int, opts ...option.RequestOption) (*Run, error)
A helper to submit a tool output to a run and poll for a terminal run state. Pass 0 to pollIntervalMs to use the default polling interval. More information on Run lifecycles can be found here: https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
func (*BetaThreadRunService) SubmitToolOutputsStreaming ¶
func (r *BetaThreadRunService) SubmitToolOutputsStreaming(ctx context.Context, threadID string, runID string, body BetaThreadRunSubmitToolOutputsParams, opts ...option.RequestOption) (stream *ssestream.Stream[AssistantStreamEventUnion])
When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
func (*BetaThreadRunService) Update ¶
func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runID string, body BetaThreadRunUpdateParams, opts ...option.RequestOption) (res *Run, err error)
Modifies a run.
type BetaThreadRunStepGetParams ¶
type BetaThreadRunStepGetParams struct { // A list of additional fields to include in the response. Currently the only // supported value is `step_details.tool_calls[*].file_search.results[*].content` // to fetch the file search result content. // // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. Include []RunStepInclude `query:"include,omitzero" json:"-"` // contains filtered or unexported fields }
func (BetaThreadRunStepGetParams) IsPresent ¶
func (f BetaThreadRunStepGetParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunStepGetParams) URLQuery ¶
func (r BetaThreadRunStepGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaThreadRunStepGetParams's query parameters as `url.Values`.
type BetaThreadRunStepListParams ¶
type BetaThreadRunStepListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // A list of additional fields to include in the response. Currently the only // supported value is `step_details.tool_calls[*].file_search.results[*].content` // to fetch the file search result content. // // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. Include []RunStepInclude `query:"include,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order BetaThreadRunStepListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (BetaThreadRunStepListParams) IsPresent ¶
func (f BetaThreadRunStepListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunStepListParams) URLQuery ¶
func (r BetaThreadRunStepListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BetaThreadRunStepListParams's query parameters as `url.Values`.
type BetaThreadRunStepListParamsOrder ¶
type BetaThreadRunStepListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( BetaThreadRunStepListParamsOrderAsc BetaThreadRunStepListParamsOrder = "asc" BetaThreadRunStepListParamsOrderDesc BetaThreadRunStepListParamsOrder = "desc" )
type BetaThreadRunStepService ¶
type BetaThreadRunStepService struct {
Options []option.RequestOption
}
BetaThreadRunStepService 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 NewBetaThreadRunStepService method instead.
func NewBetaThreadRunStepService ¶
func NewBetaThreadRunStepService(opts ...option.RequestOption) (r BetaThreadRunStepService)
NewBetaThreadRunStepService 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 (*BetaThreadRunStepService) Get ¶
func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, runID string, stepID string, query BetaThreadRunStepGetParams, opts ...option.RequestOption) (res *RunStep, err error)
Retrieves a run step.
func (*BetaThreadRunStepService) List ¶
func (r *BetaThreadRunStepService) List(ctx context.Context, threadID string, runID string, query BetaThreadRunStepListParams, opts ...option.RequestOption) (res *pagination.CursorPage[RunStep], err error)
Returns a list of run steps belonging to a run.
func (*BetaThreadRunStepService) ListAutoPaging ¶
func (r *BetaThreadRunStepService) ListAutoPaging(ctx context.Context, threadID string, runID string, query BetaThreadRunStepListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[RunStep]
Returns a list of run steps belonging to a run.
type BetaThreadRunSubmitToolOutputsParams ¶
type BetaThreadRunSubmitToolOutputsParams struct { // A list of tools for which the outputs are being submitted. ToolOutputs []BetaThreadRunSubmitToolOutputsParamsToolOutput `json:"tool_outputs,omitzero,required"` // contains filtered or unexported fields }
func (BetaThreadRunSubmitToolOutputsParams) IsPresent ¶
func (f BetaThreadRunSubmitToolOutputsParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunSubmitToolOutputsParams) MarshalJSON ¶
func (r BetaThreadRunSubmitToolOutputsParams) MarshalJSON() (data []byte, err error)
type BetaThreadRunSubmitToolOutputsParamsToolOutput ¶
type BetaThreadRunSubmitToolOutputsParamsToolOutput struct { // The output of the tool call to be submitted to continue the run. Output param.Opt[string] `json:"output,omitzero"` // The ID of the tool call in the `required_action` object within the run object // the output is being submitted for. ToolCallID param.Opt[string] `json:"tool_call_id,omitzero"` // contains filtered or unexported fields }
func (BetaThreadRunSubmitToolOutputsParamsToolOutput) IsPresent ¶
func (f BetaThreadRunSubmitToolOutputsParamsToolOutput) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunSubmitToolOutputsParamsToolOutput) MarshalJSON ¶
func (r BetaThreadRunSubmitToolOutputsParamsToolOutput) MarshalJSON() (data []byte, err error)
type BetaThreadRunUpdateParams ¶
type BetaThreadRunUpdateParams 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.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
func (BetaThreadRunUpdateParams) IsPresent ¶
func (f BetaThreadRunUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadRunUpdateParams) MarshalJSON ¶
func (r BetaThreadRunUpdateParams) MarshalJSON() (data []byte, err error)
type BetaThreadService ¶
type BetaThreadService struct { Options []option.RequestOption Runs BetaThreadRunService Messages BetaThreadMessageService }
BetaThreadService 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 NewBetaThreadService method instead.
func NewBetaThreadService ¶
func NewBetaThreadService(opts ...option.RequestOption) (r BetaThreadService)
NewBetaThreadService 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 (*BetaThreadService) Delete ¶
func (r *BetaThreadService) Delete(ctx context.Context, threadID string, opts ...option.RequestOption) (res *ThreadDeleted, err error)
Delete a thread.
func (*BetaThreadService) Get ¶
func (r *BetaThreadService) Get(ctx context.Context, threadID string, opts ...option.RequestOption) (res *Thread, err error)
Retrieves a thread.
func (*BetaThreadService) New ¶
func (r *BetaThreadService) New(ctx context.Context, body BetaThreadNewParams, opts ...option.RequestOption) (res *Thread, err error)
Create a thread.
func (*BetaThreadService) NewAndRun ¶
func (r *BetaThreadService) NewAndRun(ctx context.Context, body BetaThreadNewAndRunParams, opts ...option.RequestOption) (res *Run, err error)
Create a thread and run it in one request.
func (*BetaThreadService) NewAndRunPoll ¶
func (r *BetaThreadService) NewAndRunPoll(ctx context.Context, body BetaThreadNewAndRunParams, pollIntervalMs int, opts ...option.RequestOption) (res *Run, err error)
Create a thread and run it in one request. Poll the API until the run is complete.
func (*BetaThreadService) NewAndRunStreaming ¶
func (r *BetaThreadService) NewAndRunStreaming(ctx context.Context, body BetaThreadNewAndRunParams, opts ...option.RequestOption) (stream *ssestream.Stream[AssistantStreamEventUnion])
Create a thread and run it in one request.
func (*BetaThreadService) Update ¶
func (r *BetaThreadService) Update(ctx context.Context, threadID string, body BetaThreadUpdateParams, opts ...option.RequestOption) (res *Thread, err error)
Modifies a thread.
type BetaThreadUpdateParams ¶
type BetaThreadUpdateParams 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.MetadataParam `json:"metadata,omitzero"` // A set of resources that are made available to the assistant's tools in this // thread. The resources are specific to the type of tool. For example, the // `code_interpreter` tool requires a list of file IDs, while the `file_search` // tool requires a list of vector store IDs. ToolResources BetaThreadUpdateParamsToolResources `json:"tool_resources,omitzero"` // contains filtered or unexported fields }
func (BetaThreadUpdateParams) IsPresent ¶
func (f BetaThreadUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadUpdateParams) MarshalJSON ¶
func (r BetaThreadUpdateParams) MarshalJSON() (data []byte, err error)
type BetaThreadUpdateParamsToolResources ¶
type BetaThreadUpdateParamsToolResources struct { CodeInterpreter BetaThreadUpdateParamsToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"` FileSearch BetaThreadUpdateParamsToolResourcesFileSearch `json:"file_search,omitzero"` // contains filtered or unexported fields }
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (BetaThreadUpdateParamsToolResources) IsPresent ¶
func (f BetaThreadUpdateParamsToolResources) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadUpdateParamsToolResources) MarshalJSON ¶
func (r BetaThreadUpdateParamsToolResources) MarshalJSON() (data []byte, err error)
type BetaThreadUpdateParamsToolResourcesCodeInterpreter ¶
type BetaThreadUpdateParamsToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter` tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadUpdateParamsToolResourcesCodeInterpreter) IsPresent ¶
func (f BetaThreadUpdateParamsToolResourcesCodeInterpreter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadUpdateParamsToolResourcesCodeInterpreter) MarshalJSON ¶
func (r BetaThreadUpdateParamsToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error)
type BetaThreadUpdateParamsToolResourcesFileSearch ¶
type BetaThreadUpdateParamsToolResourcesFileSearch struct { // The // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this thread. There can be a maximum of 1 vector store attached to // the thread. VectorStoreIDs []string `json:"vector_store_ids,omitzero"` // contains filtered or unexported fields }
func (BetaThreadUpdateParamsToolResourcesFileSearch) IsPresent ¶
func (f BetaThreadUpdateParamsToolResourcesFileSearch) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (BetaThreadUpdateParamsToolResourcesFileSearch) MarshalJSON ¶
func (r BetaThreadUpdateParamsToolResourcesFileSearch) MarshalJSON() (data []byte, err error)
type ChatCompletion ¶
type ChatCompletion struct { // A unique identifier for the chat completion. ID string `json:"id,required"` // A list of chat completion choices. Can be more than one if `n` is greater // than 1. Choices []ChatCompletionChoice `json:"choices,required"` // The Unix timestamp (in seconds) of when the chat completion was created. Created int64 `json:"created,required"` // The model used for the chat completion. Model string `json:"model,required"` // The object type, which is always `chat.completion`. Object constant.ChatCompletion `json:"object,required"` // The service tier used for processing the request. // // Any of "scale", "default". ServiceTier ChatCompletionServiceTier `json:"service_tier,nullable"` // This fingerprint represents the backend configuration that the model runs with. // // Can be used in conjunction with the `seed` request parameter to understand when // backend changes have been made that might impact determinism. SystemFingerprint string `json:"system_fingerprint"` // Usage statistics for the completion request. Usage CompletionUsage `json:"usage"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Choices resp.Field Created resp.Field Model resp.Field Object resp.Field ServiceTier resp.Field SystemFingerprint resp.Field Usage resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a chat completion response returned by model, based on the provided input.
func (ChatCompletion) RawJSON ¶
func (r ChatCompletion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletion) UnmarshalJSON ¶
func (r *ChatCompletion) UnmarshalJSON(data []byte) error
type ChatCompletionAccumulator ¶
type ChatCompletionAccumulator struct { // The up-to-date accumulation of model's responses ChatCompletion // contains filtered or unexported fields }
Helper to accumulate chunks from a stream
func (*ChatCompletionAccumulator) AddChunk ¶
func (acc *ChatCompletionAccumulator) AddChunk(chunk ChatCompletionChunk) bool
AddChunk incorporates a chunk into the accumulation. Chunks must be added in order. Returns false if the chunk could not be successfully accumulated.
The ChatCompletion field JSON does not get accumulated.
func (*ChatCompletionAccumulator) JustFinishedContent ¶
func (acc *ChatCompletionAccumulator) JustFinishedContent() (content string, ok bool)
JustFinishedRefusal retrieves the chat completion refusal when it is known to have just been completed. The content is "just completed" when the last added chunk no longer contains a content delta. If the content is just completed, the content is returned and the boolean is true. Otherwise, an empty string is returned and the boolean will be false.
func (*ChatCompletionAccumulator) JustFinishedRefusal ¶
func (acc *ChatCompletionAccumulator) JustFinishedRefusal() (refusal string, ok bool)
JustFinishedRefusal retrieves the chat completion refusal when it is known to have just been completed. The refusal is "just completed" when the last added chunk no longer contains a refusal delta. If the refusal is just completed, the refusal is returned and the boolean is true. Otherwise, an empty string is returned and the boolean will be false.
func (*ChatCompletionAccumulator) JustFinishedToolCall ¶
func (acc *ChatCompletionAccumulator) JustFinishedToolCall() (toolcall FinishedChatCompletionToolCall, ok bool)
JustFinishedToolCall retrieves a tool call when it is known to have just been completed. A tool call is "just completed" when the last added chunk no longer contains a tool call delta or contains a delta for a different tool call. If the tool call is just completed, a FinishedChatCompletionToolCall is returned and the boolean is true. Otherwise, an empty tool call is returned and the boolean will be false.
You cannot rely on this with a stream that has ParallelToolCalls enabled.
type ChatCompletionAssistantMessageParam ¶
type ChatCompletionAssistantMessageParam struct { // The refusal message by the assistant. Refusal param.Opt[string] `json:"refusal,omitzero"` // An optional name for the participant. Provides the model information to // differentiate between participants of the same role. Name param.Opt[string] `json:"name,omitzero"` // Data about a previous audio response from the model. // [Learn more](https://platform.openai.com/docs/guides/audio). Audio ChatCompletionAssistantMessageParamAudio `json:"audio,omitzero"` // The contents of the assistant message. Required unless `tool_calls` or // `function_call` is specified. Content ChatCompletionAssistantMessageParamContentUnion `json:"content,omitzero"` // Deprecated and replaced by `tool_calls`. The name and arguments of a function // that should be called, as generated by the model. // // Deprecated: deprecated FunctionCall ChatCompletionAssistantMessageParamFunctionCall `json:"function_call,omitzero"` // The tool calls generated by the model, such as function calls. ToolCalls []ChatCompletionMessageToolCallParam `json:"tool_calls,omitzero"` // The role of the messages author, in this case `assistant`. // // This field can be elided, and will marshal its zero value as "assistant". Role constant.Assistant `json:"role,required"` // contains filtered or unexported fields }
Messages sent by the model in response to user messages.
The property Role is required.
func (ChatCompletionAssistantMessageParam) IsPresent ¶
func (f ChatCompletionAssistantMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionAssistantMessageParam) MarshalJSON ¶
func (r ChatCompletionAssistantMessageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionAssistantMessageParamAudio ¶
type ChatCompletionAssistantMessageParamAudio struct { // Unique identifier for a previous audio response from the model. ID string `json:"id,required"` // contains filtered or unexported fields }
Data about a previous audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).
The property ID is required.
func (ChatCompletionAssistantMessageParamAudio) IsPresent ¶
func (f ChatCompletionAssistantMessageParamAudio) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionAssistantMessageParamAudio) MarshalJSON ¶
func (r ChatCompletionAssistantMessageParamAudio) MarshalJSON() (data []byte, err error)
type ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion ¶
type ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion struct { OfText *ChatCompletionContentPartTextParam `json:",omitzero,inline"` OfRefusal *ChatCompletionContentPartRefusalParam `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 (ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetRefusal ¶
func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetRefusal() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetText ¶
func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetType ¶
func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) IsPresent ¶
func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) MarshalJSON ¶
func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) MarshalJSON() ([]byte, error)
type ChatCompletionAssistantMessageParamContentUnion ¶
type ChatCompletionAssistantMessageParamContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion `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 (ChatCompletionAssistantMessageParamContentUnion) IsPresent ¶
func (u ChatCompletionAssistantMessageParamContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionAssistantMessageParamContentUnion) MarshalJSON ¶
func (u ChatCompletionAssistantMessageParamContentUnion) MarshalJSON() ([]byte, error)
type ChatCompletionAssistantMessageParamFunctionCall
deprecated
type ChatCompletionAssistantMessageParamFunctionCall struct { // The arguments to call the function with, as generated by the model in JSON // format. Note that the model does not always generate valid JSON, and may // hallucinate parameters not defined by your function schema. Validate the // arguments in your code before calling your function. Arguments string `json:"arguments,required"` // The name of the function to call. Name string `json:"name,required"` // contains filtered or unexported fields }
Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
Deprecated: deprecated
The properties Arguments, Name are required.
func (ChatCompletionAssistantMessageParamFunctionCall) IsPresent ¶
func (f ChatCompletionAssistantMessageParamFunctionCall) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionAssistantMessageParamFunctionCall) MarshalJSON ¶
func (r ChatCompletionAssistantMessageParamFunctionCall) MarshalJSON() (data []byte, err error)
type ChatCompletionAudio ¶
type ChatCompletionAudio struct { // Unique identifier for this audio response. ID string `json:"id,required"` // Base64 encoded audio bytes generated by the model, in the format specified in // the request. Data string `json:"data,required"` // The Unix timestamp (in seconds) for when this audio response will no longer be // accessible on the server for use in multi-turn conversations. ExpiresAt int64 `json:"expires_at,required"` // Transcript of the audio generated by the model. Transcript string `json:"transcript,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Data resp.Field ExpiresAt resp.Field Transcript resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
If the audio output modality is requested, this object contains data about the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).
func (ChatCompletionAudio) RawJSON ¶
func (r ChatCompletionAudio) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionAudio) UnmarshalJSON ¶
func (r *ChatCompletionAudio) UnmarshalJSON(data []byte) error
type ChatCompletionAudioParam ¶
type ChatCompletionAudioParam struct { // Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, // or `pcm16`. // // Any of "wav", "mp3", "flac", "opus", "pcm16". Format ChatCompletionAudioParamFormat `json:"format,omitzero,required"` // The voice the model uses to respond. Supported voices are `alloy`, `ash`, // `ballad`, `coral`, `echo`, `sage`, and `shimmer`. Voice ChatCompletionAudioParamVoice `json:"voice,omitzero,required"` // contains filtered or unexported fields }
Parameters for audio output. Required when audio output is requested with `modalities: ["audio"]`. [Learn more](https://platform.openai.com/docs/guides/audio).
The properties Format, Voice are required.
func (ChatCompletionAudioParam) IsPresent ¶
func (f ChatCompletionAudioParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionAudioParam) MarshalJSON ¶
func (r ChatCompletionAudioParam) MarshalJSON() (data []byte, err error)
type ChatCompletionAudioParamFormat ¶
type ChatCompletionAudioParamFormat string
Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, or `pcm16`.
const ( ChatCompletionAudioParamFormatWAV ChatCompletionAudioParamFormat = "wav" ChatCompletionAudioParamFormatMP3 ChatCompletionAudioParamFormat = "mp3" ChatCompletionAudioParamFormatFLAC ChatCompletionAudioParamFormat = "flac" ChatCompletionAudioParamFormatOpus ChatCompletionAudioParamFormat = "opus" ChatCompletionAudioParamFormatPcm16 ChatCompletionAudioParamFormat = "pcm16" )
type ChatCompletionAudioParamVoice ¶
type ChatCompletionAudioParamVoice string
The voice the model uses to respond. Supported voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, and `shimmer`.
const ( ChatCompletionAudioParamVoiceAlloy ChatCompletionAudioParamVoice = "alloy" ChatCompletionAudioParamVoiceAsh ChatCompletionAudioParamVoice = "ash" ChatCompletionAudioParamVoiceBallad ChatCompletionAudioParamVoice = "ballad" ChatCompletionAudioParamVoiceCoral ChatCompletionAudioParamVoice = "coral" ChatCompletionAudioParamVoiceEcho ChatCompletionAudioParamVoice = "echo" ChatCompletionAudioParamVoiceFable ChatCompletionAudioParamVoice = "fable" ChatCompletionAudioParamVoiceOnyx ChatCompletionAudioParamVoice = "onyx" ChatCompletionAudioParamVoiceNova ChatCompletionAudioParamVoice = "nova" ChatCompletionAudioParamVoiceSage ChatCompletionAudioParamVoice = "sage" ChatCompletionAudioParamVoiceShimmer ChatCompletionAudioParamVoice = "shimmer" ChatCompletionAudioParamVoiceVerse ChatCompletionAudioParamVoice = "verse" )
type ChatCompletionChoice ¶
type ChatCompletionChoice struct { // The reason the model stopped generating tokens. This will be `stop` if the model // hit a natural stop point or a provided stop sequence, `length` if the maximum // number of tokens specified in the request was reached, `content_filter` if // content was omitted due to a flag from our content filters, `tool_calls` if the // model called a tool, or `function_call` (deprecated) if the model called a // function. // // Any of "stop", "length", "tool_calls", "content_filter", "function_call". FinishReason string `json:"finish_reason,required"` // The index of the choice in the list of choices. Index int64 `json:"index,required"` // Log probability information for the choice. Logprobs ChatCompletionChoiceLogprobs `json:"logprobs,required"` // A chat completion message generated by the model. Message ChatCompletionMessage `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FinishReason resp.Field Index resp.Field Logprobs resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionChoice) RawJSON ¶
func (r ChatCompletionChoice) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChoice) UnmarshalJSON ¶
func (r *ChatCompletionChoice) UnmarshalJSON(data []byte) error
type ChatCompletionChoiceLogprobs ¶
type ChatCompletionChoiceLogprobs struct { // A list of message content tokens with log probability information. Content []ChatCompletionTokenLogprob `json:"content,required"` // A list of message refusal tokens with log probability information. Refusal []ChatCompletionTokenLogprob `json:"refusal,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Content resp.Field Refusal resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Log probability information for the choice.
func (ChatCompletionChoiceLogprobs) RawJSON ¶
func (r ChatCompletionChoiceLogprobs) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChoiceLogprobs) UnmarshalJSON ¶
func (r *ChatCompletionChoiceLogprobs) UnmarshalJSON(data []byte) error
type ChatCompletionChunk ¶
type ChatCompletionChunk struct { // A unique identifier for the chat completion. Each chunk has the same ID. ID string `json:"id,required"` // A list of chat completion choices. Can contain more than one elements if `n` is // greater than 1. Can also be empty for the last chunk if you set // `stream_options: {"include_usage": true}`. Choices []ChatCompletionChunkChoice `json:"choices,required"` // The Unix timestamp (in seconds) of when the chat completion was created. Each // chunk has the same timestamp. Created int64 `json:"created,required"` // The model to generate the completion. Model string `json:"model,required"` // The object type, which is always `chat.completion.chunk`. Object constant.ChatCompletionChunk `json:"object,required"` // The service tier used for processing the request. // // Any of "scale", "default". ServiceTier ChatCompletionChunkServiceTier `json:"service_tier,nullable"` // This fingerprint represents the backend configuration that the model runs with. // Can be used in conjunction with the `seed` request parameter to understand when // backend changes have been made that might impact determinism. SystemFingerprint string `json:"system_fingerprint"` // An optional field that will only be present when you set // `stream_options: {"include_usage": true}` in your request. When present, it // contains a null value **except for the last chunk** which contains the token // usage statistics for the entire request. // // **NOTE:** If the stream is interrupted or cancelled, you may not receive the // final usage chunk which contains the total token usage for the request. Usage CompletionUsage `json:"usage,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Choices resp.Field Created resp.Field Model resp.Field Object resp.Field ServiceTier resp.Field SystemFingerprint resp.Field Usage resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. [Learn more](https://platform.openai.com/docs/guides/streaming-responses).
func (ChatCompletionChunk) RawJSON ¶
func (r ChatCompletionChunk) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunk) UnmarshalJSON ¶
func (r *ChatCompletionChunk) UnmarshalJSON(data []byte) error
type ChatCompletionChunkChoice ¶
type ChatCompletionChunkChoice struct { // A chat completion delta generated by streamed model responses. Delta ChatCompletionChunkChoiceDelta `json:"delta,required"` // The reason the model stopped generating tokens. This will be `stop` if the model // hit a natural stop point or a provided stop sequence, `length` if the maximum // number of tokens specified in the request was reached, `content_filter` if // content was omitted due to a flag from our content filters, `tool_calls` if the // model called a tool, or `function_call` (deprecated) if the model called a // function. // // Any of "stop", "length", "tool_calls", "content_filter", "function_call". FinishReason string `json:"finish_reason,required"` // The index of the choice in the list of choices. Index int64 `json:"index,required"` // Log probability information for the choice. Logprobs ChatCompletionChunkChoiceLogprobs `json:"logprobs,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Delta resp.Field FinishReason resp.Field Index resp.Field Logprobs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionChunkChoice) RawJSON ¶
func (r ChatCompletionChunkChoice) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunkChoice) UnmarshalJSON ¶
func (r *ChatCompletionChunkChoice) UnmarshalJSON(data []byte) error
type ChatCompletionChunkChoiceDelta ¶
type ChatCompletionChunkChoiceDelta struct { // The contents of the chunk message. Content string `json:"content,nullable"` // Deprecated and replaced by `tool_calls`. The name and arguments of a function // that should be called, as generated by the model. // // Deprecated: deprecated FunctionCall ChatCompletionChunkChoiceDeltaFunctionCall `json:"function_call"` // The refusal message generated by the model. Refusal string `json:"refusal,nullable"` // The role of the author of this message. // // Any of "developer", "system", "user", "assistant", "tool". Role string `json:"role"` ToolCalls []ChatCompletionChunkChoiceDeltaToolCall `json:"tool_calls"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Content resp.Field FunctionCall resp.Field Refusal resp.Field Role resp.Field ToolCalls resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A chat completion delta generated by streamed model responses.
func (ChatCompletionChunkChoiceDelta) RawJSON ¶
func (r ChatCompletionChunkChoiceDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunkChoiceDelta) UnmarshalJSON ¶
func (r *ChatCompletionChunkChoiceDelta) UnmarshalJSON(data []byte) error
type ChatCompletionChunkChoiceDeltaFunctionCall
deprecated
type ChatCompletionChunkChoiceDeltaFunctionCall struct { // The arguments to call the function with, as generated by the model in JSON // format. Note that the model does not always generate valid JSON, and may // hallucinate parameters not defined by your function schema. Validate the // arguments in your code before calling your function. Arguments string `json:"arguments"` // The name of the function to call. Name string `json:"name"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
Deprecated: deprecated
func (ChatCompletionChunkChoiceDeltaFunctionCall) RawJSON ¶
func (r ChatCompletionChunkChoiceDeltaFunctionCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON ¶
func (r *ChatCompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON(data []byte) error
type ChatCompletionChunkChoiceDeltaToolCall ¶
type ChatCompletionChunkChoiceDeltaToolCall struct { Index int64 `json:"index,required"` // The ID of the tool call. ID string `json:"id"` Function ChatCompletionChunkChoiceDeltaToolCallFunction `json:"function"` // The type of the tool. Currently, only `function` is supported. // // Any of "function". Type string `json:"type"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field ID resp.Field Function resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionChunkChoiceDeltaToolCall) RawJSON ¶
func (r ChatCompletionChunkChoiceDeltaToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunkChoiceDeltaToolCall) UnmarshalJSON ¶
func (r *ChatCompletionChunkChoiceDeltaToolCall) UnmarshalJSON(data []byte) error
type ChatCompletionChunkChoiceDeltaToolCallFunction ¶
type ChatCompletionChunkChoiceDeltaToolCallFunction struct { // The arguments to call the function with, as generated by the model in JSON // format. Note that the model does not always generate valid JSON, and may // hallucinate parameters not defined by your function schema. Validate the // arguments in your code before calling your function. Arguments string `json:"arguments"` // The name of the function to call. Name string `json:"name"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionChunkChoiceDeltaToolCallFunction) RawJSON ¶
func (r ChatCompletionChunkChoiceDeltaToolCallFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunkChoiceDeltaToolCallFunction) UnmarshalJSON ¶
func (r *ChatCompletionChunkChoiceDeltaToolCallFunction) UnmarshalJSON(data []byte) error
type ChatCompletionChunkChoiceLogprobs ¶
type ChatCompletionChunkChoiceLogprobs struct { // A list of message content tokens with log probability information. Content []ChatCompletionTokenLogprob `json:"content,required"` // A list of message refusal tokens with log probability information. Refusal []ChatCompletionTokenLogprob `json:"refusal,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Content resp.Field Refusal resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Log probability information for the choice.
func (ChatCompletionChunkChoiceLogprobs) RawJSON ¶
func (r ChatCompletionChunkChoiceLogprobs) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionChunkChoiceLogprobs) UnmarshalJSON ¶
func (r *ChatCompletionChunkChoiceLogprobs) UnmarshalJSON(data []byte) error
type ChatCompletionChunkServiceTier ¶
type ChatCompletionChunkServiceTier string
The service tier used for processing the request.
const ( ChatCompletionChunkServiceTierScale ChatCompletionChunkServiceTier = "scale" ChatCompletionChunkServiceTierDefault ChatCompletionChunkServiceTier = "default" )
type ChatCompletionContentPartFileFileParam ¶
type ChatCompletionContentPartFileFileParam struct { // The base64 encoded file data, used when passing the file to the model as a // string. FileData param.Opt[string] `json:"file_data,omitzero"` // The ID of an uploaded file to use as input. FileID param.Opt[string] `json:"file_id,omitzero"` // The name of the file, used when passing the file to the model as a string. Filename param.Opt[string] `json:"filename,omitzero"` // contains filtered or unexported fields }
func (ChatCompletionContentPartFileFileParam) IsPresent ¶
func (f ChatCompletionContentPartFileFileParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartFileFileParam) MarshalJSON ¶
func (r ChatCompletionContentPartFileFileParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartFileParam ¶
type ChatCompletionContentPartFileParam struct { File ChatCompletionContentPartFileFileParam `json:"file,omitzero,required"` // The type of the content part. Always `file`. // // This field can be elided, and will marshal its zero value as "file". Type constant.File `json:"type,required"` // contains filtered or unexported fields }
Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text generation.
The properties File, Type are required.
func (ChatCompletionContentPartFileParam) IsPresent ¶
func (f ChatCompletionContentPartFileParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartFileParam) MarshalJSON ¶
func (r ChatCompletionContentPartFileParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartImageImageURLParam ¶
type ChatCompletionContentPartImageImageURLParam struct { // Either a URL of the image or the base64 encoded image data. URL string `json:"url,required" format:"uri"` // Specifies the detail level of the image. Learn more in the // [Vision guide](https://platform.openai.com/docs/guides/vision#low-or-high-fidelity-image-understanding). // // Any of "auto", "low", "high". Detail string `json:"detail,omitzero"` // contains filtered or unexported fields }
The property URL is required.
func (ChatCompletionContentPartImageImageURLParam) IsPresent ¶
func (f ChatCompletionContentPartImageImageURLParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartImageImageURLParam) MarshalJSON ¶
func (r ChatCompletionContentPartImageImageURLParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartImageParam ¶
type ChatCompletionContentPartImageParam struct { ImageURL ChatCompletionContentPartImageImageURLParam `json:"image_url,omitzero,required"` // The type of the content part. // // This field can be elided, and will marshal its zero value as "image_url". Type constant.ImageURL `json:"type,required"` // contains filtered or unexported fields }
Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
The properties ImageURL, Type are required.
func (ChatCompletionContentPartImageParam) IsPresent ¶
func (f ChatCompletionContentPartImageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartImageParam) MarshalJSON ¶
func (r ChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartInputAudioInputAudioParam ¶
type ChatCompletionContentPartInputAudioInputAudioParam struct { // Base64 encoded audio data. Data string `json:"data,required"` // The format of the encoded audio data. Currently supports "wav" and "mp3". // // Any of "wav", "mp3". Format string `json:"format,omitzero,required"` // contains filtered or unexported fields }
The properties Data, Format are required.
func (ChatCompletionContentPartInputAudioInputAudioParam) IsPresent ¶
func (f ChatCompletionContentPartInputAudioInputAudioParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartInputAudioInputAudioParam) MarshalJSON ¶
func (r ChatCompletionContentPartInputAudioInputAudioParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartInputAudioParam ¶
type ChatCompletionContentPartInputAudioParam struct { InputAudio ChatCompletionContentPartInputAudioInputAudioParam `json:"input_audio,omitzero,required"` // The type of the content part. Always `input_audio`. // // This field can be elided, and will marshal its zero value as "input_audio". Type constant.InputAudio `json:"type,required"` // contains filtered or unexported fields }
Learn about [audio inputs](https://platform.openai.com/docs/guides/audio).
The properties InputAudio, Type are required.
func (ChatCompletionContentPartInputAudioParam) IsPresent ¶
func (f ChatCompletionContentPartInputAudioParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartInputAudioParam) MarshalJSON ¶
func (r ChatCompletionContentPartInputAudioParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartRefusalParam ¶
type ChatCompletionContentPartRefusalParam struct { // The refusal message generated by the model. Refusal string `json:"refusal,required"` // The type of the content part. // // This field can be elided, and will marshal its zero value as "refusal". Type constant.Refusal `json:"type,required"` // contains filtered or unexported fields }
The properties Refusal, Type are required.
func (ChatCompletionContentPartRefusalParam) IsPresent ¶
func (f ChatCompletionContentPartRefusalParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartRefusalParam) MarshalJSON ¶
func (r ChatCompletionContentPartRefusalParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartTextParam ¶
type ChatCompletionContentPartTextParam struct { // The text content. Text string `json:"text,required"` // The type of the content part. // // This field can be elided, and will marshal its zero value as "text". Type constant.Text `json:"type,required"` // contains filtered or unexported fields }
Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).
The properties Text, Type are required.
func (ChatCompletionContentPartTextParam) IsPresent ¶
func (f ChatCompletionContentPartTextParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartTextParam) MarshalJSON ¶
func (r ChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error)
type ChatCompletionContentPartUnionParam ¶
type ChatCompletionContentPartUnionParam struct { OfText *ChatCompletionContentPartTextParam `json:",omitzero,inline"` OfImageURL *ChatCompletionContentPartImageParam `json:",omitzero,inline"` OfInputAudio *ChatCompletionContentPartInputAudioParam `json:",omitzero,inline"` OfFile *ChatCompletionContentPartFileParam `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 FileContentPart ¶
func FileContentPart(file ChatCompletionContentPartFileFileParam) ChatCompletionContentPartUnionParam
func ImageContentPart ¶
func ImageContentPart(imageURL ChatCompletionContentPartImageImageURLParam) ChatCompletionContentPartUnionParam
func InputAudioContentPart ¶
func InputAudioContentPart(inputAudio ChatCompletionContentPartInputAudioInputAudioParam) ChatCompletionContentPartUnionParam
func TextContentPart ¶
func TextContentPart(text string) ChatCompletionContentPartUnionParam
func (ChatCompletionContentPartUnionParam) GetFile ¶
func (u ChatCompletionContentPartUnionParam) GetFile() *ChatCompletionContentPartFileFileParam
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionContentPartUnionParam) GetImageURL ¶
func (u ChatCompletionContentPartUnionParam) GetImageURL() *ChatCompletionContentPartImageImageURLParam
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionContentPartUnionParam) GetInputAudio ¶
func (u ChatCompletionContentPartUnionParam) GetInputAudio() *ChatCompletionContentPartInputAudioInputAudioParam
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionContentPartUnionParam) GetText ¶
func (u ChatCompletionContentPartUnionParam) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionContentPartUnionParam) GetType ¶
func (u ChatCompletionContentPartUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionContentPartUnionParam) IsPresent ¶
func (u ChatCompletionContentPartUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionContentPartUnionParam) MarshalJSON ¶
func (u ChatCompletionContentPartUnionParam) MarshalJSON() ([]byte, error)
type ChatCompletionDeleted ¶
type ChatCompletionDeleted struct { // The ID of the chat completion that was deleted. ID string `json:"id,required"` // Whether the chat completion was deleted. Deleted bool `json:"deleted,required"` // The type of object being deleted. Object constant.ChatCompletionDeleted `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionDeleted) RawJSON ¶
func (r ChatCompletionDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionDeleted) UnmarshalJSON ¶
func (r *ChatCompletionDeleted) UnmarshalJSON(data []byte) error
type ChatCompletionDeveloperMessageParam ¶
type ChatCompletionDeveloperMessageParam struct { // The contents of the developer message. Content ChatCompletionDeveloperMessageParamContentUnion `json:"content,omitzero,required"` // An optional name for the participant. Provides the model information to // differentiate between participants of the same role. Name param.Opt[string] `json:"name,omitzero"` // The role of the messages author, in this case `developer`. // // This field can be elided, and will marshal its zero value as "developer". Role constant.Developer `json:"role,required"` // contains filtered or unexported fields }
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, `developer` messages replace the previous `system` messages.
The properties Content, Role are required.
func (ChatCompletionDeveloperMessageParam) IsPresent ¶
func (f ChatCompletionDeveloperMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionDeveloperMessageParam) MarshalJSON ¶
func (r ChatCompletionDeveloperMessageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionDeveloperMessageParamContentUnion ¶
type ChatCompletionDeveloperMessageParamContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []ChatCompletionContentPartTextParam `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 (ChatCompletionDeveloperMessageParamContentUnion) IsPresent ¶
func (u ChatCompletionDeveloperMessageParamContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionDeveloperMessageParamContentUnion) MarshalJSON ¶
func (u ChatCompletionDeveloperMessageParamContentUnion) MarshalJSON() ([]byte, error)
type ChatCompletionFunctionCallOptionParam ¶
type ChatCompletionFunctionCallOptionParam struct { // The name of the function to call. Name string `json:"name,required"` // contains filtered or unexported fields }
Specifying a particular function via `{"name": "my_function"}` forces the model to call that function.
The property Name is required.
func (ChatCompletionFunctionCallOptionParam) IsPresent ¶
func (f ChatCompletionFunctionCallOptionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionFunctionCallOptionParam) MarshalJSON ¶
func (r ChatCompletionFunctionCallOptionParam) MarshalJSON() (data []byte, err error)
type ChatCompletionFunctionMessageParam
deprecated
type ChatCompletionFunctionMessageParam struct { // The contents of the function message. Content param.Opt[string] `json:"content,omitzero,required"` // The name of the function to call. Name string `json:"name,required"` // The role of the messages author, in this case `function`. // // This field can be elided, and will marshal its zero value as "function". Role constant.Function `json:"role,required"` // contains filtered or unexported fields }
Deprecated: deprecated
The properties Content, Name, Role are required.
func (ChatCompletionFunctionMessageParam) IsPresent ¶
func (f ChatCompletionFunctionMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionFunctionMessageParam) MarshalJSON ¶
func (r ChatCompletionFunctionMessageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionListParams ¶
type ChatCompletionListParams struct { // Identifier for the last chat completion from the previous pagination request. After param.Opt[string] `query:"after,omitzero" json:"-"` // Number of Chat Completions to retrieve. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // The model used to generate the Chat Completions. Model param.Opt[string] `query:"model,omitzero" json:"-"` // A list of metadata keys to filter the Chat Completions by. Example: // // `metadata[key1]=value1&metadata[key2]=value2` Metadata shared.MetadataParam `query:"metadata,omitzero" json:"-"` // Sort order for Chat Completions by timestamp. Use `asc` for ascending order or // `desc` for descending order. Defaults to `asc`. // // Any of "asc", "desc". Order ChatCompletionListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (ChatCompletionListParams) IsPresent ¶
func (f ChatCompletionListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionListParams) URLQuery ¶
func (r ChatCompletionListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatCompletionListParams's query parameters as `url.Values`.
type ChatCompletionListParamsOrder ¶
type ChatCompletionListParamsOrder string
Sort order for Chat Completions by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.
const ( ChatCompletionListParamsOrderAsc ChatCompletionListParamsOrder = "asc" ChatCompletionListParamsOrderDesc ChatCompletionListParamsOrder = "desc" )
type ChatCompletionMessage ¶
type ChatCompletionMessage struct { // The contents of the message. Content string `json:"content,required"` // The refusal message generated by the model. Refusal string `json:"refusal,required"` // The role of the author of this message. Role constant.Assistant `json:"role,required"` // Annotations for the message, when applicable, as when using the // [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). Annotations []ChatCompletionMessageAnnotation `json:"annotations"` // If the audio output modality is requested, this object contains data about the // audio response from the model. // [Learn more](https://platform.openai.com/docs/guides/audio). Audio ChatCompletionAudio `json:"audio,nullable"` // Deprecated and replaced by `tool_calls`. The name and arguments of a function // that should be called, as generated by the model. // // Deprecated: deprecated FunctionCall ChatCompletionMessageFunctionCall `json:"function_call"` // The tool calls generated by the model, such as function calls. ToolCalls []ChatCompletionMessageToolCall `json:"tool_calls"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Content resp.Field Refusal resp.Field Role resp.Field Annotations resp.Field Audio resp.Field FunctionCall resp.Field ToolCalls resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A chat completion message generated by the model.
func (ChatCompletionMessage) RawJSON ¶
func (r ChatCompletionMessage) RawJSON() string
Returns the unmodified JSON received from the API
func (ChatCompletionMessage) ToAssistantMessageParam ¶
func (r ChatCompletionMessage) ToAssistantMessageParam() ChatCompletionAssistantMessageParam
func (ChatCompletionMessage) ToParam ¶
func (r ChatCompletionMessage) ToParam() ChatCompletionMessageParamUnion
func (*ChatCompletionMessage) UnmarshalJSON ¶
func (r *ChatCompletionMessage) UnmarshalJSON(data []byte) error
type ChatCompletionMessageAnnotation ¶
type ChatCompletionMessageAnnotation struct { // The type of the URL citation. Always `url_citation`. Type constant.URLCitation `json:"type,required"` // A URL citation when using web search. URLCitation ChatCompletionMessageAnnotationURLCitation `json:"url_citation,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field URLCitation resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A URL citation when using web search.
func (ChatCompletionMessageAnnotation) RawJSON ¶
func (r ChatCompletionMessageAnnotation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionMessageAnnotation) UnmarshalJSON ¶
func (r *ChatCompletionMessageAnnotation) UnmarshalJSON(data []byte) error
type ChatCompletionMessageAnnotationURLCitation ¶
type ChatCompletionMessageAnnotationURLCitation struct { // The index of the last character of the URL citation in the message. EndIndex int64 `json:"end_index,required"` // The index of the first character of the URL citation in the message. StartIndex int64 `json:"start_index,required"` // The title of the web resource. Title string `json:"title,required"` // The URL of the web resource. URL string `json:"url,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { EndIndex resp.Field StartIndex resp.Field Title resp.Field URL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A URL citation when using web search.
func (ChatCompletionMessageAnnotationURLCitation) RawJSON ¶
func (r ChatCompletionMessageAnnotationURLCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionMessageAnnotationURLCitation) UnmarshalJSON ¶
func (r *ChatCompletionMessageAnnotationURLCitation) UnmarshalJSON(data []byte) error
type ChatCompletionMessageFunctionCall
deprecated
type ChatCompletionMessageFunctionCall struct { // The arguments to call the function with, as generated by the model in JSON // format. Note that the model does not always generate valid JSON, and may // hallucinate parameters not defined by your function schema. Validate the // arguments in your code before calling your function. Arguments string `json:"arguments,required"` // The name of the function to call. Name string `json:"name,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
Deprecated: deprecated
func (ChatCompletionMessageFunctionCall) RawJSON ¶
func (r ChatCompletionMessageFunctionCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionMessageFunctionCall) UnmarshalJSON ¶
func (r *ChatCompletionMessageFunctionCall) UnmarshalJSON(data []byte) error
type ChatCompletionMessageListParams ¶
type ChatCompletionMessageListParams struct { // Identifier for the last message from the previous pagination request. After param.Opt[string] `query:"after,omitzero" json:"-"` // Number of messages to retrieve. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Sort order for messages by timestamp. Use `asc` for ascending order or `desc` // for descending order. Defaults to `asc`. // // Any of "asc", "desc". Order ChatCompletionMessageListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (ChatCompletionMessageListParams) IsPresent ¶
func (f ChatCompletionMessageListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionMessageListParams) URLQuery ¶
func (r ChatCompletionMessageListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChatCompletionMessageListParams's query parameters as `url.Values`.
type ChatCompletionMessageListParamsOrder ¶
type ChatCompletionMessageListParamsOrder string
Sort order for messages by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.
const ( ChatCompletionMessageListParamsOrderAsc ChatCompletionMessageListParamsOrder = "asc" ChatCompletionMessageListParamsOrderDesc ChatCompletionMessageListParamsOrder = "desc" )
type ChatCompletionMessageParamUnion ¶
type ChatCompletionMessageParamUnion struct { OfDeveloper *ChatCompletionDeveloperMessageParam `json:",omitzero,inline"` OfSystem *ChatCompletionSystemMessageParam `json:",omitzero,inline"` OfUser *ChatCompletionUserMessageParam `json:",omitzero,inline"` OfAssistant *ChatCompletionAssistantMessageParam `json:",omitzero,inline"` OfTool *ChatCompletionToolMessageParam `json:",omitzero,inline"` OfFunction *ChatCompletionFunctionMessageParam `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 AssistantMessage ¶
func AssistantMessage[T string | []ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion](content T) ChatCompletionMessageParamUnion
func ChatCompletionMessageParamOfFunction ¶
func ChatCompletionMessageParamOfFunction(content string, name string) ChatCompletionMessageParamUnion
func DeveloperMessage ¶
func DeveloperMessage[T string | []ChatCompletionContentPartTextParam](content T) ChatCompletionMessageParamUnion
func SystemMessage ¶
func SystemMessage[T string | []ChatCompletionContentPartTextParam](content T) ChatCompletionMessageParamUnion
func ToolMessage ¶
func ToolMessage[T string | []ChatCompletionContentPartTextParam](content T, toolCallID string) ChatCompletionMessageParamUnion
func UserMessage ¶
func UserMessage[T string | []ChatCompletionContentPartUnionParam](content T) ChatCompletionMessageParamUnion
func (ChatCompletionMessageParamUnion) GetAudio ¶
func (u ChatCompletionMessageParamUnion) GetAudio() *ChatCompletionAssistantMessageParamAudio
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) GetContent ¶
func (u ChatCompletionMessageParamUnion) GetContent() (res chatCompletionMessageParamUnionContent)
Returns a subunion which exports methods to access subproperties
Or use AsAny() to get the underlying value
func (ChatCompletionMessageParamUnion) GetFunctionCall ¶
func (u ChatCompletionMessageParamUnion) GetFunctionCall() *ChatCompletionAssistantMessageParamFunctionCall
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) GetName ¶
func (u ChatCompletionMessageParamUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) GetRefusal ¶
func (u ChatCompletionMessageParamUnion) GetRefusal() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) GetRole ¶
func (u ChatCompletionMessageParamUnion) GetRole() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) GetToolCallID ¶
func (u ChatCompletionMessageParamUnion) GetToolCallID() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) GetToolCalls ¶
func (u ChatCompletionMessageParamUnion) GetToolCalls() []ChatCompletionMessageToolCallParam
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionMessageParamUnion) IsPresent ¶
func (u ChatCompletionMessageParamUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionMessageParamUnion) MarshalJSON ¶
func (u ChatCompletionMessageParamUnion) MarshalJSON() ([]byte, error)
type ChatCompletionMessageService ¶
type ChatCompletionMessageService struct {
Options []option.RequestOption
}
ChatCompletionMessageService 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 NewChatCompletionMessageService method instead.
func NewChatCompletionMessageService ¶
func NewChatCompletionMessageService(opts ...option.RequestOption) (r ChatCompletionMessageService)
NewChatCompletionMessageService 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 (*ChatCompletionMessageService) List ¶
func (r *ChatCompletionMessageService) List(ctx context.Context, completionID string, query ChatCompletionMessageListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ChatCompletionStoreMessage], err error)
Get the messages in a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` will be returned.
func (*ChatCompletionMessageService) ListAutoPaging ¶
func (r *ChatCompletionMessageService) ListAutoPaging(ctx context.Context, completionID string, query ChatCompletionMessageListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[ChatCompletionStoreMessage]
Get the messages in a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` will be returned.
type ChatCompletionMessageToolCall ¶
type ChatCompletionMessageToolCall struct { // The ID of the tool call. ID string `json:"id,required"` // The function that the model called. Function ChatCompletionMessageToolCallFunction `json:"function,required"` // The type of the tool. Currently, only `function` is supported. Type constant.Function `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Function resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionMessageToolCall) RawJSON ¶
func (r ChatCompletionMessageToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (ChatCompletionMessageToolCall) ToParam ¶
func (r ChatCompletionMessageToolCall) ToParam() ChatCompletionMessageToolCallParam
ToParam converts this ChatCompletionMessageToolCall to a ChatCompletionMessageToolCallParam.
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 ChatCompletionMessageToolCallParam.IsOverridden()
func (*ChatCompletionMessageToolCall) UnmarshalJSON ¶
func (r *ChatCompletionMessageToolCall) UnmarshalJSON(data []byte) error
type ChatCompletionMessageToolCallFunction ¶
type ChatCompletionMessageToolCallFunction struct { // The arguments to call the function with, as generated by the model in JSON // format. Note that the model does not always generate valid JSON, and may // hallucinate parameters not defined by your function schema. Validate the // arguments in your code before calling your function. Arguments string `json:"arguments,required"` // The name of the function to call. Name string `json:"name,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The function that the model called.
func (ChatCompletionMessageToolCallFunction) RawJSON ¶
func (r ChatCompletionMessageToolCallFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionMessageToolCallFunction) UnmarshalJSON ¶
func (r *ChatCompletionMessageToolCallFunction) UnmarshalJSON(data []byte) error
type ChatCompletionMessageToolCallFunctionParam ¶
type ChatCompletionMessageToolCallFunctionParam struct { // The arguments to call the function with, as generated by the model in JSON // format. Note that the model does not always generate valid JSON, and may // hallucinate parameters not defined by your function schema. Validate the // arguments in your code before calling your function. Arguments string `json:"arguments,required"` // The name of the function to call. Name string `json:"name,required"` // contains filtered or unexported fields }
The function that the model called.
The properties Arguments, Name are required.
func (ChatCompletionMessageToolCallFunctionParam) IsPresent ¶
func (f ChatCompletionMessageToolCallFunctionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionMessageToolCallFunctionParam) MarshalJSON ¶
func (r ChatCompletionMessageToolCallFunctionParam) MarshalJSON() (data []byte, err error)
type ChatCompletionMessageToolCallParam ¶
type ChatCompletionMessageToolCallParam struct { // The ID of the tool call. ID string `json:"id,required"` // The function that the model called. Function ChatCompletionMessageToolCallFunctionParam `json:"function,omitzero,required"` // The type of the tool. Currently, only `function` is supported. // // This field can be elided, and will marshal its zero value as "function". Type constant.Function `json:"type,required"` // contains filtered or unexported fields }
The properties ID, Function, Type are required.
func (ChatCompletionMessageToolCallParam) IsPresent ¶
func (f ChatCompletionMessageToolCallParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionMessageToolCallParam) MarshalJSON ¶
func (r ChatCompletionMessageToolCallParam) MarshalJSON() (data []byte, err error)
type ChatCompletionNamedToolChoiceFunctionParam ¶
type ChatCompletionNamedToolChoiceFunctionParam struct { // The name of the function to call. Name string `json:"name,required"` // contains filtered or unexported fields }
The property Name is required.
func (ChatCompletionNamedToolChoiceFunctionParam) IsPresent ¶
func (f ChatCompletionNamedToolChoiceFunctionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNamedToolChoiceFunctionParam) MarshalJSON ¶
func (r ChatCompletionNamedToolChoiceFunctionParam) MarshalJSON() (data []byte, err error)
type ChatCompletionNamedToolChoiceParam ¶
type ChatCompletionNamedToolChoiceParam struct { Function ChatCompletionNamedToolChoiceFunctionParam `json:"function,omitzero,required"` // The type of the tool. Currently, only `function` is supported. // // This field can be elided, and will marshal its zero value as "function". Type constant.Function `json:"type,required"` // contains filtered or unexported fields }
Specifies a tool the model should use. Use to force the model to call a specific function.
The properties Function, Type are required.
func (ChatCompletionNamedToolChoiceParam) IsPresent ¶
func (f ChatCompletionNamedToolChoiceParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNamedToolChoiceParam) MarshalJSON ¶
func (r ChatCompletionNamedToolChoiceParam) MarshalJSON() (data []byte, err error)
type ChatCompletionNewParams ¶
type ChatCompletionNewParams struct { // A list of messages comprising the conversation so far. Depending on the // [model](https://platform.openai.com/docs/models) you use, different message // types (modalities) are supported, like // [text](https://platform.openai.com/docs/guides/text-generation), // [images](https://platform.openai.com/docs/guides/vision), and // [audio](https://platform.openai.com/docs/guides/audio). Messages []ChatCompletionMessageParamUnion `json:"messages,omitzero,required"` // Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a // wide range of models with different capabilities, performance characteristics, // and price points. Refer to the // [model guide](https://platform.openai.com/docs/models) to browse and compare // available models. Model shared.ChatModel `json:"model,omitzero,required"` // Number between -2.0 and 2.0. Positive values penalize new tokens based on their // existing frequency in the text so far, decreasing the model's likelihood to // repeat the same line verbatim. FrequencyPenalty param.Opt[float64] `json:"frequency_penalty,omitzero"` // Whether to return log probabilities of the output tokens or not. If true, // returns the log probabilities of each output token returned in the `content` of // `message`. Logprobs param.Opt[bool] `json:"logprobs,omitzero"` // An upper bound for the number of tokens that can be generated for a completion, // including visible output tokens and // [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). MaxCompletionTokens param.Opt[int64] `json:"max_completion_tokens,omitzero"` // The maximum number of [tokens](/tokenizer) that can be generated in the chat // completion. This value can be used to control // [costs](https://openai.com/api/pricing/) for text generated via API. // // This value is now deprecated in favor of `max_completion_tokens`, and is not // compatible with // [o1 series models](https://platform.openai.com/docs/guides/reasoning). MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"` // How many chat completion choices to generate for each input message. Note that // you will be charged based on the number of generated tokens across all of the // choices. Keep `n` as `1` to minimize costs. N param.Opt[int64] `json:"n,omitzero"` // Number between -2.0 and 2.0. Positive values penalize new tokens based on // whether they appear in the text so far, increasing the model's likelihood to // talk about new topics. PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"` // This feature is in Beta. If specified, our system will make a best effort to // sample deterministically, such that repeated requests with the same `seed` and // parameters should return the same result. Determinism is not guaranteed, and you // should refer to the `system_fingerprint` response parameter to monitor changes // in the backend. Seed param.Opt[int64] `json:"seed,omitzero"` // Whether or not to store the output of this chat completion request for use in // our [model distillation](https://platform.openai.com/docs/guides/distillation) // or [evals](https://platform.openai.com/docs/guides/evals) products. Store param.Opt[bool] `json:"store,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. We generally recommend altering this or `top_p` but // not both. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An integer between 0 and 20 specifying the number of most likely tokens to // return at each token position, each with an associated log probability. // `logprobs` must be set to `true` if this parameter is used. TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or `temperature` but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // Whether to enable // [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) // during tool use. ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // Parameters for audio output. Required when audio output is requested with // `modalities: ["audio"]`. // [Learn more](https://platform.openai.com/docs/guides/audio). Audio ChatCompletionAudioParam `json:"audio,omitzero"` // Modify the likelihood of specified tokens appearing in the completion. // // Accepts a JSON object that maps tokens (specified by their token ID in the // tokenizer) to an associated bias value from -100 to 100. Mathematically, the // bias is added to the logits generated by the model prior to sampling. The exact // effect will vary per model, but values between -1 and 1 should decrease or // increase likelihood of selection; values like -100 or 100 should result in a ban // or exclusive selection of the relevant token. LogitBias map[string]int64 `json:"logit_bias,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // Output types that you would like the model to generate. Most models are capable // of generating text, which is the default: // // `["text"]` // // The `gpt-4o-audio-preview` model can also be used to // [generate audio](https://platform.openai.com/docs/guides/audio). To request that // this model generate both text and audio responses, you can use: // // `["text", "audio"]` // // Any of "text", "audio". Modalities []string `json:"modalities,omitzero"` // **o-series models only** // // Constrains effort on reasoning for // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently // supported values are `low`, `medium`, and `high`. Reducing reasoning effort can // result in faster responses and fewer tokens used on reasoning in a response. // // Any of "low", "medium", "high". ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"` // Specifies the latency tier to use for processing the request. This parameter is // relevant for customers subscribed to the scale tier service: // // - If set to 'auto', and the Project is Scale tier enabled, the system will // utilize scale tier credits until they are exhausted. // - If set to 'auto', and the Project is not Scale tier enabled, the request will // be processed using the default service tier with a lower uptime SLA and no // latency guarentee. // - If set to 'default', the request will be processed using the default service // tier with a lower uptime SLA and no latency guarentee. // - When not set, the default behavior is 'auto'. // // When this parameter is set, the response body will include the `service_tier` // utilized. // // Any of "auto", "default". ServiceTier ChatCompletionNewParamsServiceTier `json:"service_tier,omitzero"` // Up to 4 sequences where the API will stop generating further tokens. The // returned text will not contain the stop sequence. Stop ChatCompletionNewParamsStopUnion `json:"stop,omitzero"` // Options for streaming response. Only set this when you set `stream: true`. StreamOptions ChatCompletionStreamOptionsParam `json:"stream_options,omitzero"` // Deprecated in favor of `tool_choice`. // // Controls which (if any) function is called by the model. // // `none` means the model will not call a function and instead generates a message. // // `auto` means the model can pick between generating a message or calling a // function. // // Specifying a particular function via `{"name": "my_function"}` forces the model // to call that function. // // `none` is the default when no functions are present. `auto` is the default if // functions are present. FunctionCall ChatCompletionNewParamsFunctionCallUnion `json:"function_call,omitzero"` // Deprecated in favor of `tools`. // // A list of functions the model may generate JSON inputs for. Functions []ChatCompletionNewParamsFunction `json:"functions,omitzero"` // Static predicted output content, such as the content of a text file that is // being regenerated. Prediction ChatCompletionPredictionContentParam `json:"prediction,omitzero"` // An object specifying the format that the model must output. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables the older JSON mode, which // ensures the message the model generates is valid JSON. Using `json_schema` is // preferred for models that support it. ResponseFormat ChatCompletionNewParamsResponseFormatUnion `json:"response_format,omitzero"` // Controls which (if any) tool is called by the model. `none` means the model will // not call any tool and instead generates a message. `auto` means the model can // pick between generating a message or calling one or more tools. `required` means // the model must call one or more tools. Specifying a particular tool via // `{"type": "function", "function": {"name": "my_function"}}` forces the model to // call that tool. // // `none` is the default when no tools are present. `auto` is the default if tools // are present. ToolChoice ChatCompletionToolChoiceOptionUnionParam `json:"tool_choice,omitzero"` // A list of tools the model may call. Currently, only functions are supported as a // tool. Use this to provide a list of functions the model may generate JSON inputs // for. A max of 128 functions are supported. Tools []ChatCompletionToolParam `json:"tools,omitzero"` // This tool searches the web for relevant results to use in a response. Learn more // about the // [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). WebSearchOptions ChatCompletionNewParamsWebSearchOptions `json:"web_search_options,omitzero"` // contains filtered or unexported fields }
func (ChatCompletionNewParams) IsPresent ¶
func (f ChatCompletionNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParams) MarshalJSON ¶
func (r ChatCompletionNewParams) MarshalJSON() (data []byte, err error)
type ChatCompletionNewParamsFunction
deprecated
type ChatCompletionNewParamsFunction struct { // The name of the function to be called. Must be a-z, A-Z, 0-9, or contain // underscores and dashes, with a maximum length of 64. Name string `json:"name,required"` // A description of what the function does, used by the model to choose when and // how to call the function. Description param.Opt[string] `json:"description,omitzero"` // 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. Parameters shared.FunctionParameters `json:"parameters,omitzero"` // contains filtered or unexported fields }
Deprecated: deprecated
The property Name is required.
func (ChatCompletionNewParamsFunction) IsPresent ¶
func (f ChatCompletionNewParamsFunction) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsFunction) MarshalJSON ¶
func (r ChatCompletionNewParamsFunction) MarshalJSON() (data []byte, err error)
type ChatCompletionNewParamsFunctionCallFunctionCallMode ¶
type ChatCompletionNewParamsFunctionCallFunctionCallMode string
`none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.
const ( ChatCompletionNewParamsFunctionCallFunctionCallModeNone ChatCompletionNewParamsFunctionCallFunctionCallMode = "none" ChatCompletionNewParamsFunctionCallFunctionCallModeAuto ChatCompletionNewParamsFunctionCallFunctionCallMode = "auto" )
type ChatCompletionNewParamsFunctionCallUnion ¶
type ChatCompletionNewParamsFunctionCallUnion struct { // Check if union is this variant with !param.IsOmitted(union.OfFunctionCallMode) OfFunctionCallMode param.Opt[string] `json:",omitzero,inline"` OfFunctionCallOption *ChatCompletionFunctionCallOptionParam `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 (ChatCompletionNewParamsFunctionCallUnion) GetName ¶
func (u ChatCompletionNewParamsFunctionCallUnion) GetName() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionNewParamsFunctionCallUnion) IsPresent ¶
func (u ChatCompletionNewParamsFunctionCallUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsFunctionCallUnion) MarshalJSON ¶
func (u ChatCompletionNewParamsFunctionCallUnion) MarshalJSON() ([]byte, error)
type ChatCompletionNewParamsResponseFormatUnion ¶
type ChatCompletionNewParamsResponseFormatUnion struct { OfText *shared.ResponseFormatTextParam `json:",omitzero,inline"` OfJSONSchema *shared.ResponseFormatJSONSchemaParam `json:",omitzero,inline"` OfJSONObject *shared.ResponseFormatJSONObjectParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (ChatCompletionNewParamsResponseFormatUnion) GetJSONSchema ¶
func (u ChatCompletionNewParamsResponseFormatUnion) GetJSONSchema() *shared.ResponseFormatJSONSchemaJSONSchemaParam
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionNewParamsResponseFormatUnion) GetType ¶
func (u ChatCompletionNewParamsResponseFormatUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionNewParamsResponseFormatUnion) IsPresent ¶
func (u ChatCompletionNewParamsResponseFormatUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsResponseFormatUnion) MarshalJSON ¶
func (u ChatCompletionNewParamsResponseFormatUnion) MarshalJSON() ([]byte, error)
type ChatCompletionNewParamsServiceTier ¶
type ChatCompletionNewParamsServiceTier string
Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:
- If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted.
- If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.
- If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee.
- When not set, the default behavior is 'auto'.
When this parameter is set, the response body will include the `service_tier` utilized.
const ( ChatCompletionNewParamsServiceTierAuto ChatCompletionNewParamsServiceTier = "auto" ChatCompletionNewParamsServiceTierDefault ChatCompletionNewParamsServiceTier = "default" )
type ChatCompletionNewParamsStopUnion ¶
type ChatCompletionNewParamsStopUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfChatCompletionNewsStopArray []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 (ChatCompletionNewParamsStopUnion) IsPresent ¶
func (u ChatCompletionNewParamsStopUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsStopUnion) MarshalJSON ¶
func (u ChatCompletionNewParamsStopUnion) MarshalJSON() ([]byte, error)
type ChatCompletionNewParamsWebSearchOptions ¶
type ChatCompletionNewParamsWebSearchOptions struct { // Approximate location parameters for the search. UserLocation ChatCompletionNewParamsWebSearchOptionsUserLocation `json:"user_location,omitzero"` // High level guidance for the amount of context window space to use for the // search. One of `low`, `medium`, or `high`. `medium` is the default. // // Any of "low", "medium", "high". SearchContextSize string `json:"search_context_size,omitzero"` // contains filtered or unexported fields }
This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat).
func (ChatCompletionNewParamsWebSearchOptions) IsPresent ¶
func (f ChatCompletionNewParamsWebSearchOptions) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsWebSearchOptions) MarshalJSON ¶
func (r ChatCompletionNewParamsWebSearchOptions) MarshalJSON() (data []byte, err error)
type ChatCompletionNewParamsWebSearchOptionsUserLocation ¶
type ChatCompletionNewParamsWebSearchOptionsUserLocation struct { // Approximate location parameters for the search. Approximate ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate `json:"approximate,omitzero,required"` // The type of location approximation. Always `approximate`. // // This field can be elided, and will marshal its zero value as "approximate". Type constant.Approximate `json:"type,required"` // contains filtered or unexported fields }
Approximate location parameters for the search.
The properties Approximate, Type are required.
func (ChatCompletionNewParamsWebSearchOptionsUserLocation) IsPresent ¶
func (f ChatCompletionNewParamsWebSearchOptionsUserLocation) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsWebSearchOptionsUserLocation) MarshalJSON ¶
func (r ChatCompletionNewParamsWebSearchOptionsUserLocation) MarshalJSON() (data []byte, err error)
type ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate ¶
type ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate struct { // Free text input for the city of the user, e.g. `San Francisco`. City param.Opt[string] `json:"city,omitzero"` // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of // the user, e.g. `US`. Country param.Opt[string] `json:"country,omitzero"` // Free text input for the region of the user, e.g. `California`. Region param.Opt[string] `json:"region,omitzero"` // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the // user, e.g. `America/Los_Angeles`. Timezone param.Opt[string] `json:"timezone,omitzero"` // contains filtered or unexported fields }
Approximate location parameters for the search.
func (ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate) IsPresent ¶
func (f ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate) MarshalJSON ¶
func (r ChatCompletionNewParamsWebSearchOptionsUserLocationApproximate) MarshalJSON() (data []byte, err error)
type ChatCompletionPredictionContentContentUnionParam ¶
type ChatCompletionPredictionContentContentUnionParam struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []ChatCompletionContentPartTextParam `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 (ChatCompletionPredictionContentContentUnionParam) IsPresent ¶
func (u ChatCompletionPredictionContentContentUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionPredictionContentContentUnionParam) MarshalJSON ¶
func (u ChatCompletionPredictionContentContentUnionParam) MarshalJSON() ([]byte, error)
type ChatCompletionPredictionContentParam ¶
type ChatCompletionPredictionContentParam struct { // The content that should be matched when generating a model response. If // generated tokens would match this content, the entire model response can be // returned much more quickly. Content ChatCompletionPredictionContentContentUnionParam `json:"content,omitzero,required"` // The type of the predicted content you want to provide. This type is currently // always `content`. // // This field can be elided, and will marshal its zero value as "content". Type constant.Content `json:"type,required"` // contains filtered or unexported fields }
Static predicted output content, such as the content of a text file that is being regenerated.
The properties Content, Type are required.
func (ChatCompletionPredictionContentParam) IsPresent ¶
func (f ChatCompletionPredictionContentParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionPredictionContentParam) MarshalJSON ¶
func (r ChatCompletionPredictionContentParam) MarshalJSON() (data []byte, err error)
type ChatCompletionService ¶
type ChatCompletionService struct { Options []option.RequestOption Messages ChatCompletionMessageService }
ChatCompletionService 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 NewChatCompletionService method instead.
func NewChatCompletionService ¶
func NewChatCompletionService(opts ...option.RequestOption) (r ChatCompletionService)
NewChatCompletionService 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 (*ChatCompletionService) Delete ¶
func (r *ChatCompletionService) Delete(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletionDeleted, err error)
Delete a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` can be deleted.
func (*ChatCompletionService) Get ¶
func (r *ChatCompletionService) Get(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletion, err error)
Get a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` will be returned.
func (*ChatCompletionService) List ¶
func (r *ChatCompletionService) List(ctx context.Context, query ChatCompletionListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ChatCompletion], err error)
List stored Chat Completions. Only Chat Completions that have been stored with the `store` parameter set to `true` will be returned.
func (*ChatCompletionService) ListAutoPaging ¶
func (r *ChatCompletionService) ListAutoPaging(ctx context.Context, query ChatCompletionListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[ChatCompletion]
List stored Chat Completions. Only Chat Completions that have been stored with the `store` parameter set to `true` will be returned.
func (*ChatCompletionService) New ¶
func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewParams, opts ...option.RequestOption) (res *ChatCompletion, err error)
**Starting a new project?** We recommend trying [Responses](https://platform.openai.com/docs/api-reference/responses) to take advantage of the latest OpenAI platform features. Compare [Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses).
---
Creates a model response for the given chat conversation. Learn more in the [text generation](https://platform.openai.com/docs/guides/text-generation), [vision](https://platform.openai.com/docs/guides/vision), and [audio](https://platform.openai.com/docs/guides/audio) guides.
Parameter support can differ depending on the model used to generate the response, particularly for newer reasoning models. Parameters that are only supported for reasoning models are noted below. For the current state of unsupported parameters in reasoning models, [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
func (*ChatCompletionService) NewStreaming ¶
func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompletionNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[ChatCompletionChunk])
**Starting a new project?** We recommend trying [Responses](https://platform.openai.com/docs/api-reference/responses) to take advantage of the latest OpenAI platform features. Compare [Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses).
---
Creates a model response for the given chat conversation. Learn more in the [text generation](https://platform.openai.com/docs/guides/text-generation), [vision](https://platform.openai.com/docs/guides/vision), and [audio](https://platform.openai.com/docs/guides/audio) guides.
Parameter support can differ depending on the model used to generate the response, particularly for newer reasoning models. Parameters that are only supported for reasoning models are noted below. For the current state of unsupported parameters in reasoning models, [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
func (*ChatCompletionService) Update ¶
func (r *ChatCompletionService) Update(ctx context.Context, completionID string, body ChatCompletionUpdateParams, opts ...option.RequestOption) (res *ChatCompletion, err error)
Modify a stored chat completion. Only Chat Completions that have been created with the `store` parameter set to `true` can be modified. Currently, the only supported modification is to update the `metadata` field.
type ChatCompletionServiceTier ¶
type ChatCompletionServiceTier string
The service tier used for processing the request.
const ( ChatCompletionServiceTierScale ChatCompletionServiceTier = "scale" ChatCompletionServiceTierDefault ChatCompletionServiceTier = "default" )
type ChatCompletionStoreMessage ¶
type ChatCompletionStoreMessage struct { // The identifier of the chat message. ID string `json:"id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` ChatCompletionMessage }
A chat completion message generated by the model.
func (ChatCompletionStoreMessage) RawJSON ¶
func (r ChatCompletionStoreMessage) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionStoreMessage) UnmarshalJSON ¶
func (r *ChatCompletionStoreMessage) UnmarshalJSON(data []byte) error
type ChatCompletionStreamOptionsParam ¶
type ChatCompletionStreamOptionsParam struct { // If set, an additional chunk will be streamed before the `data: [DONE]` message. // The `usage` field on this chunk shows the token usage statistics for the entire // request, and the `choices` field will always be an empty array. // // All other chunks will also include a `usage` field, but with a null value. // **NOTE:** If the stream is interrupted, you may not receive the final usage // chunk which contains the total token usage for the request. IncludeUsage param.Opt[bool] `json:"include_usage,omitzero"` // contains filtered or unexported fields }
Options for streaming response. Only set this when you set `stream: true`.
func (ChatCompletionStreamOptionsParam) IsPresent ¶
func (f ChatCompletionStreamOptionsParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionStreamOptionsParam) MarshalJSON ¶
func (r ChatCompletionStreamOptionsParam) MarshalJSON() (data []byte, err error)
type ChatCompletionSystemMessageParam ¶
type ChatCompletionSystemMessageParam struct { // The contents of the system message. Content ChatCompletionSystemMessageParamContentUnion `json:"content,omitzero,required"` // An optional name for the participant. Provides the model information to // differentiate between participants of the same role. Name param.Opt[string] `json:"name,omitzero"` // The role of the messages author, in this case `system`. // // This field can be elided, and will marshal its zero value as "system". Role constant.System `json:"role,required"` // contains filtered or unexported fields }
Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use `developer` messages for this purpose instead.
The properties Content, Role are required.
func (ChatCompletionSystemMessageParam) IsPresent ¶
func (f ChatCompletionSystemMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionSystemMessageParam) MarshalJSON ¶
func (r ChatCompletionSystemMessageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionSystemMessageParamContentUnion ¶
type ChatCompletionSystemMessageParamContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []ChatCompletionContentPartTextParam `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 (ChatCompletionSystemMessageParamContentUnion) IsPresent ¶
func (u ChatCompletionSystemMessageParamContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionSystemMessageParamContentUnion) MarshalJSON ¶
func (u ChatCompletionSystemMessageParamContentUnion) MarshalJSON() ([]byte, error)
type ChatCompletionTokenLogprob ¶
type ChatCompletionTokenLogprob struct { // The token. Token string `json:"token,required"` // A list of integers representing the UTF-8 bytes representation of the token. // Useful in instances where characters are represented by multiple tokens and // their byte representations must be combined to generate the correct text // representation. Can be `null` if there is no bytes representation for the token. Bytes []int64 `json:"bytes,required"` // The log probability of this token, if it is within the top 20 most likely // tokens. Otherwise, the value `-9999.0` is used to signify that the token is very // unlikely. Logprob float64 `json:"logprob,required"` // List of the most likely tokens and their log probability, at this token // position. In rare cases, there may be fewer than the number of requested // `top_logprobs` returned. TopLogprobs []ChatCompletionTokenLogprobTopLogprob `json:"top_logprobs,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Token resp.Field Bytes resp.Field Logprob resp.Field TopLogprobs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionTokenLogprob) RawJSON ¶
func (r ChatCompletionTokenLogprob) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionTokenLogprob) UnmarshalJSON ¶
func (r *ChatCompletionTokenLogprob) UnmarshalJSON(data []byte) error
type ChatCompletionTokenLogprobTopLogprob ¶
type ChatCompletionTokenLogprobTopLogprob struct { // The token. Token string `json:"token,required"` // A list of integers representing the UTF-8 bytes representation of the token. // Useful in instances where characters are represented by multiple tokens and // their byte representations must be combined to generate the correct text // representation. Can be `null` if there is no bytes representation for the token. Bytes []int64 `json:"bytes,required"` // The log probability of this token, if it is within the top 20 most likely // tokens. Otherwise, the value `-9999.0` is used to signify that the token is very // unlikely. Logprob float64 `json:"logprob,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Token resp.Field Bytes resp.Field Logprob resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ChatCompletionTokenLogprobTopLogprob) RawJSON ¶
func (r ChatCompletionTokenLogprobTopLogprob) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChatCompletionTokenLogprobTopLogprob) UnmarshalJSON ¶
func (r *ChatCompletionTokenLogprobTopLogprob) UnmarshalJSON(data []byte) error
type ChatCompletionToolChoiceOptionAuto ¶
type ChatCompletionToolChoiceOptionAuto string
`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.
const ( ChatCompletionToolChoiceOptionAutoNone ChatCompletionToolChoiceOptionAuto = "none" ChatCompletionToolChoiceOptionAutoAuto ChatCompletionToolChoiceOptionAuto = "auto" ChatCompletionToolChoiceOptionAutoRequired ChatCompletionToolChoiceOptionAuto = "required" )
type ChatCompletionToolChoiceOptionUnionParam ¶
type ChatCompletionToolChoiceOptionUnionParam struct { // Check if union is this variant with !param.IsOmitted(union.OfAuto) OfAuto param.Opt[string] `json:",omitzero,inline"` OfChatCompletionNamedToolChoice *ChatCompletionNamedToolChoiceParam `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 ChatCompletionToolChoiceOptionParamOfChatCompletionNamedToolChoice ¶
func ChatCompletionToolChoiceOptionParamOfChatCompletionNamedToolChoice(function ChatCompletionNamedToolChoiceFunctionParam) ChatCompletionToolChoiceOptionUnionParam
func (ChatCompletionToolChoiceOptionUnionParam) GetFunction ¶
func (u ChatCompletionToolChoiceOptionUnionParam) GetFunction() *ChatCompletionNamedToolChoiceFunctionParam
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionToolChoiceOptionUnionParam) GetType ¶
func (u ChatCompletionToolChoiceOptionUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ChatCompletionToolChoiceOptionUnionParam) IsPresent ¶
func (u ChatCompletionToolChoiceOptionUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionToolChoiceOptionUnionParam) MarshalJSON ¶
func (u ChatCompletionToolChoiceOptionUnionParam) MarshalJSON() ([]byte, error)
type ChatCompletionToolMessageParam ¶
type ChatCompletionToolMessageParam struct { // The contents of the tool message. Content ChatCompletionToolMessageParamContentUnion `json:"content,omitzero,required"` // Tool call that this message is responding to. ToolCallID string `json:"tool_call_id,required"` // The role of the messages author, in this case `tool`. // // This field can be elided, and will marshal its zero value as "tool". Role constant.Tool `json:"role,required"` // contains filtered or unexported fields }
The properties Content, Role, ToolCallID are required.
func (ChatCompletionToolMessageParam) IsPresent ¶
func (f ChatCompletionToolMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionToolMessageParam) MarshalJSON ¶
func (r ChatCompletionToolMessageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionToolMessageParamContentUnion ¶
type ChatCompletionToolMessageParamContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []ChatCompletionContentPartTextParam `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 (ChatCompletionToolMessageParamContentUnion) IsPresent ¶
func (u ChatCompletionToolMessageParamContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionToolMessageParamContentUnion) MarshalJSON ¶
func (u ChatCompletionToolMessageParamContentUnion) MarshalJSON() ([]byte, error)
type ChatCompletionToolParam ¶
type ChatCompletionToolParam struct { Function shared.FunctionDefinitionParam `json:"function,omitzero,required"` // The type of the tool. Currently, only `function` is supported. // // This field can be elided, and will marshal its zero value as "function". Type constant.Function `json:"type,required"` // contains filtered or unexported fields }
The properties Function, Type are required.
func (ChatCompletionToolParam) IsPresent ¶
func (f ChatCompletionToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionToolParam) MarshalJSON ¶
func (r ChatCompletionToolParam) MarshalJSON() (data []byte, err error)
type ChatCompletionUpdateParams ¶
type ChatCompletionUpdateParams 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.MetadataParam `json:"metadata,omitzero,required"` // contains filtered or unexported fields }
func (ChatCompletionUpdateParams) IsPresent ¶
func (f ChatCompletionUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionUpdateParams) MarshalJSON ¶
func (r ChatCompletionUpdateParams) MarshalJSON() (data []byte, err error)
type ChatCompletionUserMessageParam ¶
type ChatCompletionUserMessageParam struct { // The contents of the user message. Content ChatCompletionUserMessageParamContentUnion `json:"content,omitzero,required"` // An optional name for the participant. Provides the model information to // differentiate between participants of the same role. Name param.Opt[string] `json:"name,omitzero"` // The role of the messages author, in this case `user`. // // This field can be elided, and will marshal its zero value as "user". Role constant.User `json:"role,required"` // contains filtered or unexported fields }
Messages sent by an end user, containing prompts or additional context information.
The properties Content, Role are required.
func (ChatCompletionUserMessageParam) IsPresent ¶
func (f ChatCompletionUserMessageParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionUserMessageParam) MarshalJSON ¶
func (r ChatCompletionUserMessageParam) MarshalJSON() (data []byte, err error)
type ChatCompletionUserMessageParamContentUnion ¶
type ChatCompletionUserMessageParamContentUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfContentParts []ChatCompletionContentPartUnionParam `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 (ChatCompletionUserMessageParamContentUnion) IsPresent ¶
func (u ChatCompletionUserMessageParamContentUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ChatCompletionUserMessageParamContentUnion) MarshalJSON ¶
func (u ChatCompletionUserMessageParamContentUnion) MarshalJSON() ([]byte, error)
type ChatService ¶
type ChatService struct { Options []option.RequestOption Completions ChatCompletionService }
ChatService 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 NewChatService method instead.
func NewChatService ¶
func NewChatService(opts ...option.RequestOption) (r ChatService)
NewChatService 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 Client ¶
type Client struct { Options []option.RequestOption Completions CompletionService Chat ChatService Embeddings EmbeddingService Files FileService Images ImageService Audio AudioService Moderations ModerationService Models ModelService FineTuning FineTuningService VectorStores VectorStoreService Beta BetaService Batches BatchService Uploads UploadService Responses responses.ResponseService }
Client creates a struct with services and top level methods that help with interacting with the openai API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Post ¶
func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error
Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type CodeInterpreterLogs ¶
type CodeInterpreterLogs struct { // The index of the output in the outputs array. Index int64 `json:"index,required"` // Always `logs`. Type constant.Logs `json:"type,required"` // The text output from the Code Interpreter tool call. Logs string `json:"logs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field Logs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Text output from the Code Interpreter tool call as part of a run step.
func (CodeInterpreterLogs) RawJSON ¶
func (r CodeInterpreterLogs) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterLogs) UnmarshalJSON ¶
func (r *CodeInterpreterLogs) UnmarshalJSON(data []byte) error
type CodeInterpreterOutputImage ¶
type CodeInterpreterOutputImage struct { // The index of the output in the outputs array. Index int64 `json:"index,required"` // Always `image`. Type constant.Image `json:"type,required"` Image CodeInterpreterOutputImageImage `json:"image"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field Image resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CodeInterpreterOutputImage) RawJSON ¶
func (r CodeInterpreterOutputImage) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterOutputImage) UnmarshalJSON ¶
func (r *CodeInterpreterOutputImage) UnmarshalJSON(data []byte) error
type CodeInterpreterOutputImageImage ¶
type CodeInterpreterOutputImageImage struct { // The [file](https://platform.openai.com/docs/api-reference/files) ID of the // image. FileID string `json:"file_id"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CodeInterpreterOutputImageImage) RawJSON ¶
func (r CodeInterpreterOutputImageImage) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterOutputImageImage) UnmarshalJSON ¶
func (r *CodeInterpreterOutputImageImage) UnmarshalJSON(data []byte) error
type CodeInterpreterTool ¶
type CodeInterpreterTool struct { // The type of tool being defined: `code_interpreter` Type constant.CodeInterpreter `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CodeInterpreterTool) RawJSON ¶
func (r CodeInterpreterTool) RawJSON() string
Returns the unmodified JSON received from the API
func (CodeInterpreterTool) ToParam ¶
func (r CodeInterpreterTool) ToParam() CodeInterpreterToolParam
ToParam converts this CodeInterpreterTool to a CodeInterpreterToolParam.
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 CodeInterpreterToolParam.IsOverridden()
func (*CodeInterpreterTool) UnmarshalJSON ¶
func (r *CodeInterpreterTool) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCall ¶
type CodeInterpreterToolCall struct { // The ID of the tool call. ID string `json:"id,required"` // The Code Interpreter tool call definition. CodeInterpreter CodeInterpreterToolCallCodeInterpreter `json:"code_interpreter,required"` // The type of tool call. This is always going to be `code_interpreter` for this // type of tool call. Type constant.CodeInterpreter `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CodeInterpreter resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details of the Code Interpreter tool call the run step was involved in.
func (CodeInterpreterToolCall) RawJSON ¶
func (r CodeInterpreterToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCall) UnmarshalJSON ¶
func (r *CodeInterpreterToolCall) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallCodeInterpreter ¶
type CodeInterpreterToolCallCodeInterpreter struct { // The input to the Code Interpreter tool call. Input string `json:"input,required"` // The outputs from the Code Interpreter tool call. Code Interpreter can output one // or more items, including text (`logs`) or images (`image`). Each of these are // represented by a different object type. Outputs []CodeInterpreterToolCallCodeInterpreterOutputUnion `json:"outputs,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Input resp.Field Outputs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The Code Interpreter tool call definition.
func (CodeInterpreterToolCallCodeInterpreter) RawJSON ¶
func (r CodeInterpreterToolCallCodeInterpreter) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallCodeInterpreter) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallCodeInterpreter) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallCodeInterpreterOutputImage ¶
type CodeInterpreterToolCallCodeInterpreterOutputImage struct { Image CodeInterpreterToolCallCodeInterpreterOutputImageImage `json:"image,required"` // Always `image`. Type constant.Image `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Image resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CodeInterpreterToolCallCodeInterpreterOutputImage) RawJSON ¶
func (r CodeInterpreterToolCallCodeInterpreterOutputImage) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallCodeInterpreterOutputImage) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallCodeInterpreterOutputImage) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallCodeInterpreterOutputImageImage ¶
type CodeInterpreterToolCallCodeInterpreterOutputImageImage struct { // The [file](https://platform.openai.com/docs/api-reference/files) ID of the // image. FileID string `json:"file_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CodeInterpreterToolCallCodeInterpreterOutputImageImage) RawJSON ¶
func (r CodeInterpreterToolCallCodeInterpreterOutputImageImage) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallCodeInterpreterOutputImageImage) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallCodeInterpreterOutputImageImage) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallCodeInterpreterOutputLogs ¶
type CodeInterpreterToolCallCodeInterpreterOutputLogs struct { // The text output from the Code Interpreter tool call. Logs string `json:"logs,required"` // Always `logs`. Type constant.Logs `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Logs resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Text output from the Code Interpreter tool call as part of a run step.
func (CodeInterpreterToolCallCodeInterpreterOutputLogs) RawJSON ¶
func (r CodeInterpreterToolCallCodeInterpreterOutputLogs) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallCodeInterpreterOutputLogs) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallCodeInterpreterOutputLogs) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallCodeInterpreterOutputUnion ¶
type CodeInterpreterToolCallCodeInterpreterOutputUnion struct { // This field is from variant [CodeInterpreterToolCallCodeInterpreterOutputLogs]. Logs string `json:"logs"` // Any of "logs", "image". Type string `json:"type"` // This field is from variant [CodeInterpreterToolCallCodeInterpreterOutputImage]. Image CodeInterpreterToolCallCodeInterpreterOutputImageImage `json:"image"` JSON struct { Logs resp.Field Type resp.Field Image resp.Field // contains filtered or unexported fields } `json:"-"` }
CodeInterpreterToolCallCodeInterpreterOutputUnion contains all possible properties and values from CodeInterpreterToolCallCodeInterpreterOutputLogs, CodeInterpreterToolCallCodeInterpreterOutputImage.
Use the CodeInterpreterToolCallCodeInterpreterOutputUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (CodeInterpreterToolCallCodeInterpreterOutputUnion) AsAny ¶
func (u CodeInterpreterToolCallCodeInterpreterOutputUnion) AsAny() anyCodeInterpreterToolCallCodeInterpreterOutput
Use the following switch statement to find the correct variant
switch variant := CodeInterpreterToolCallCodeInterpreterOutputUnion.AsAny().(type) { case CodeInterpreterToolCallCodeInterpreterOutputLogs: case CodeInterpreterToolCallCodeInterpreterOutputImage: default: fmt.Errorf("no variant present") }
func (CodeInterpreterToolCallCodeInterpreterOutputUnion) RawJSON ¶
func (u CodeInterpreterToolCallCodeInterpreterOutputUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallCodeInterpreterOutputUnion) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallCodeInterpreterOutputUnion) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallDelta ¶
type CodeInterpreterToolCallDelta struct { // The index of the tool call in the tool calls array. Index int64 `json:"index,required"` // The type of tool call. This is always going to be `code_interpreter` for this // type of tool call. Type constant.CodeInterpreter `json:"type,required"` // The ID of the tool call. ID string `json:"id"` // The Code Interpreter tool call definition. CodeInterpreter CodeInterpreterToolCallDeltaCodeInterpreter `json:"code_interpreter"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field ID resp.Field CodeInterpreter resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details of the Code Interpreter tool call the run step was involved in.
func (CodeInterpreterToolCallDelta) RawJSON ¶
func (r CodeInterpreterToolCallDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallDelta) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallDelta) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallDeltaCodeInterpreter ¶
type CodeInterpreterToolCallDeltaCodeInterpreter struct { // The input to the Code Interpreter tool call. Input string `json:"input"` // The outputs from the Code Interpreter tool call. Code Interpreter can output one // or more items, including text (`logs`) or images (`image`). Each of these are // represented by a different object type. Outputs []CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion `json:"outputs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Input resp.Field Outputs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The Code Interpreter tool call definition.
func (CodeInterpreterToolCallDeltaCodeInterpreter) RawJSON ¶
func (r CodeInterpreterToolCallDeltaCodeInterpreter) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallDeltaCodeInterpreter) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallDeltaCodeInterpreter) UnmarshalJSON(data []byte) error
type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion ¶
type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion struct { Index int64 `json:"index"` // Any of "logs", "image". Type string `json:"type"` // This field is from variant [CodeInterpreterLogs]. Logs string `json:"logs"` // This field is from variant [CodeInterpreterOutputImage]. Image CodeInterpreterOutputImageImage `json:"image"` JSON struct { Index resp.Field Type resp.Field Logs resp.Field Image resp.Field // contains filtered or unexported fields } `json:"-"` }
CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion contains all possible properties and values from CodeInterpreterLogs, CodeInterpreterOutputImage.
Use the CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsAny ¶
func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsAny() anyCodeInterpreterToolCallDeltaCodeInterpreterOutput
Use the following switch statement to find the correct variant
switch variant := CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion.AsAny().(type) { case CodeInterpreterLogs: case CodeInterpreterOutputImage: default: fmt.Errorf("no variant present") }
func (CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsImage ¶
func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsImage() (v CodeInterpreterOutputImage)
func (CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsLogs ¶
func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) AsLogs() (v CodeInterpreterLogs)
func (CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) RawJSON ¶
func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) UnmarshalJSON ¶
func (r *CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion) UnmarshalJSON(data []byte) error
type CodeInterpreterToolParam ¶
type CodeInterpreterToolParam struct { // The type of tool being defined: `code_interpreter` // // This field can be elided, and will marshal its zero value as "code_interpreter". Type constant.CodeInterpreter `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (CodeInterpreterToolParam) IsPresent ¶
func (f CodeInterpreterToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (CodeInterpreterToolParam) MarshalJSON ¶
func (r CodeInterpreterToolParam) MarshalJSON() (data []byte, err error)
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 Completion ¶
type Completion struct { // A unique identifier for the completion. ID string `json:"id,required"` // The list of completion choices the model generated for the input prompt. Choices []CompletionChoice `json:"choices,required"` // The Unix timestamp (in seconds) of when the completion was created. Created int64 `json:"created,required"` // The model used for completion. Model string `json:"model,required"` // The object type, which is always "text_completion" Object constant.TextCompletion `json:"object,required"` // This fingerprint represents the backend configuration that the model runs with. // // Can be used in conjunction with the `seed` request parameter to understand when // backend changes have been made that might impact determinism. SystemFingerprint string `json:"system_fingerprint"` // Usage statistics for the completion request. Usage CompletionUsage `json:"usage"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Choices resp.Field Created resp.Field Model resp.Field Object resp.Field SystemFingerprint resp.Field Usage resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).
func (Completion) RawJSON ¶
func (r Completion) RawJSON() string
Returns the unmodified JSON received from the API
func (*Completion) UnmarshalJSON ¶
func (r *Completion) UnmarshalJSON(data []byte) error
type CompletionChoice ¶
type CompletionChoice struct { // The reason the model stopped generating tokens. This will be `stop` if the model // hit a natural stop point or a provided stop sequence, `length` if the maximum // number of tokens specified in the request was reached, or `content_filter` if // content was omitted due to a flag from our content filters. // // Any of "stop", "length", "content_filter". FinishReason CompletionChoiceFinishReason `json:"finish_reason,required"` Index int64 `json:"index,required"` Logprobs CompletionChoiceLogprobs `json:"logprobs,required"` Text string `json:"text,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FinishReason resp.Field Index resp.Field Logprobs resp.Field Text resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CompletionChoice) RawJSON ¶
func (r CompletionChoice) RawJSON() string
Returns the unmodified JSON received from the API
func (*CompletionChoice) UnmarshalJSON ¶
func (r *CompletionChoice) UnmarshalJSON(data []byte) error
type CompletionChoiceFinishReason ¶
type CompletionChoiceFinishReason string
The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, or `content_filter` if content was omitted due to a flag from our content filters.
const ( CompletionChoiceFinishReasonStop CompletionChoiceFinishReason = "stop" CompletionChoiceFinishReasonLength CompletionChoiceFinishReason = "length" CompletionChoiceFinishReasonContentFilter CompletionChoiceFinishReason = "content_filter" )
type CompletionChoiceLogprobs ¶
type CompletionChoiceLogprobs struct { TextOffset []int64 `json:"text_offset"` TokenLogprobs []float64 `json:"token_logprobs"` Tokens []string `json:"tokens"` TopLogprobs []map[string]float64 `json:"top_logprobs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { TextOffset resp.Field TokenLogprobs resp.Field Tokens resp.Field TopLogprobs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CompletionChoiceLogprobs) RawJSON ¶
func (r CompletionChoiceLogprobs) RawJSON() string
Returns the unmodified JSON received from the API
func (*CompletionChoiceLogprobs) UnmarshalJSON ¶
func (r *CompletionChoiceLogprobs) UnmarshalJSON(data []byte) error
type CompletionNewParams ¶
type CompletionNewParams struct { // The prompt(s) to generate completions for, encoded as a string, array of // strings, array of tokens, or array of token arrays. // // Note that <|endoftext|> is the document separator that the model sees during // training, so if a prompt is not specified the model will generate as if from the // beginning of a new document. Prompt CompletionNewParamsPromptUnion `json:"prompt,omitzero,required"` // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our // [Model overview](https://platform.openai.com/docs/models) for descriptions of // them. Model CompletionNewParamsModel `json:"model,omitzero,required"` // Generates `best_of` completions server-side and returns the "best" (the one with // the highest log probability per token). Results cannot be streamed. // // When used with `n`, `best_of` controls the number of candidate completions and // `n` specifies how many to return – `best_of` must be greater than `n`. // // **Note:** Because this parameter generates many completions, it can quickly // consume your token quota. Use carefully and ensure that you have reasonable // settings for `max_tokens` and `stop`. BestOf param.Opt[int64] `json:"best_of,omitzero"` // Echo back the prompt in addition to the completion Echo param.Opt[bool] `json:"echo,omitzero"` // Number between -2.0 and 2.0. Positive values penalize new tokens based on their // existing frequency in the text so far, decreasing the model's likelihood to // repeat the same line verbatim. // // [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) FrequencyPenalty param.Opt[float64] `json:"frequency_penalty,omitzero"` // Include the log probabilities on the `logprobs` most likely output tokens, as // well the chosen tokens. For example, if `logprobs` is 5, the API will return a // list of the 5 most likely tokens. The API will always return the `logprob` of // the sampled token, so there may be up to `logprobs+1` elements in the response. // // The maximum value for `logprobs` is 5. Logprobs param.Opt[int64] `json:"logprobs,omitzero"` // The maximum number of [tokens](/tokenizer) that can be generated in the // completion. // // The token count of your prompt plus `max_tokens` cannot exceed the model's // context length. // [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) // for counting tokens. MaxTokens param.Opt[int64] `json:"max_tokens,omitzero"` // How many completions to generate for each prompt. // // **Note:** Because this parameter generates many completions, it can quickly // consume your token quota. Use carefully and ensure that you have reasonable // settings for `max_tokens` and `stop`. N param.Opt[int64] `json:"n,omitzero"` // Number between -2.0 and 2.0. Positive values penalize new tokens based on // whether they appear in the text so far, increasing the model's likelihood to // talk about new topics. // // [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"` // If specified, our system will make a best effort to sample deterministically, // such that repeated requests with the same `seed` and parameters should return // the same result. // // Determinism is not guaranteed, and you should refer to the `system_fingerprint` // response parameter to monitor changes in the backend. Seed param.Opt[int64] `json:"seed,omitzero"` // The suffix that comes after a completion of inserted text. // // This parameter is only supported for `gpt-3.5-turbo-instruct`. Suffix param.Opt[string] `json:"suffix,omitzero"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. // // We generally recommend altering this or `top_p` but not both. Temperature param.Opt[float64] `json:"temperature,omitzero"` // An alternative to sampling with temperature, called nucleus sampling, where the // model considers the results of the tokens with top_p probability mass. So 0.1 // means only the tokens comprising the top 10% probability mass are considered. // // We generally recommend altering this or `temperature` but not both. TopP param.Opt[float64] `json:"top_p,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // Modify the likelihood of specified tokens appearing in the completion. // // Accepts a JSON object that maps tokens (specified by their token ID in the GPT // tokenizer) to an associated bias value from -100 to 100. You can use this // [tokenizer tool](/tokenizer?view=bpe) to convert text to token IDs. // Mathematically, the bias is added to the logits generated by the model prior to // sampling. The exact effect will vary per model, but values between -1 and 1 // should decrease or increase likelihood of selection; values like -100 or 100 // should result in a ban or exclusive selection of the relevant token. // // As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token // from being generated. LogitBias map[string]int64 `json:"logit_bias,omitzero"` // Up to 4 sequences where the API will stop generating further tokens. The // returned text will not contain the stop sequence. Stop CompletionNewParamsStopUnion `json:"stop,omitzero"` // Options for streaming response. Only set this when you set `stream: true`. StreamOptions ChatCompletionStreamOptionsParam `json:"stream_options,omitzero"` // contains filtered or unexported fields }
func (CompletionNewParams) IsPresent ¶
func (f CompletionNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (CompletionNewParams) MarshalJSON ¶
func (r CompletionNewParams) MarshalJSON() (data []byte, err error)
type CompletionNewParamsModel ¶
type CompletionNewParamsModel string
ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.
const ( CompletionNewParamsModelGPT3_5TurboInstruct CompletionNewParamsModel = "gpt-3.5-turbo-instruct" CompletionNewParamsModelDavinci002 CompletionNewParamsModel = "davinci-002" CompletionNewParamsModelBabbage002 CompletionNewParamsModel = "babbage-002" )
type CompletionNewParamsPromptUnion ¶
type CompletionNewParamsPromptUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfStrings []string `json:",omitzero,inline"` OfArrayOfTokens []int64 `json:",omitzero,inline"` OfArrayOfTokenArrays [][]int64 `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 (CompletionNewParamsPromptUnion) IsPresent ¶
func (u CompletionNewParamsPromptUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (CompletionNewParamsPromptUnion) MarshalJSON ¶
func (u CompletionNewParamsPromptUnion) MarshalJSON() ([]byte, error)
type CompletionNewParamsStopUnion ¶
type CompletionNewParamsStopUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfCompletionNewsStopArray []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 (CompletionNewParamsStopUnion) IsPresent ¶
func (u CompletionNewParamsStopUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (CompletionNewParamsStopUnion) MarshalJSON ¶
func (u CompletionNewParamsStopUnion) MarshalJSON() ([]byte, error)
type CompletionService ¶
type CompletionService struct {
Options []option.RequestOption
}
CompletionService 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 NewCompletionService method instead.
func NewCompletionService ¶
func NewCompletionService(opts ...option.RequestOption) (r CompletionService)
NewCompletionService 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 (*CompletionService) New ¶
func (r *CompletionService) New(ctx context.Context, body CompletionNewParams, opts ...option.RequestOption) (res *Completion, err error)
Creates a completion for the provided prompt and parameters.
func (*CompletionService) NewStreaming ¶
func (r *CompletionService) NewStreaming(ctx context.Context, body CompletionNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[Completion])
Creates a completion for the provided prompt and parameters.
type CompletionUsage ¶
type CompletionUsage struct { // Number of tokens in the generated completion. CompletionTokens int64 `json:"completion_tokens,required"` // Number of tokens in the prompt. PromptTokens int64 `json:"prompt_tokens,required"` // Total number of tokens used in the request (prompt + completion). TotalTokens int64 `json:"total_tokens,required"` // Breakdown of tokens used in a completion. CompletionTokensDetails CompletionUsageCompletionTokensDetails `json:"completion_tokens_details"` // Breakdown of tokens used in the prompt. PromptTokensDetails CompletionUsagePromptTokensDetails `json:"prompt_tokens_details"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CompletionTokens resp.Field PromptTokens resp.Field TotalTokens resp.Field CompletionTokensDetails resp.Field PromptTokensDetails resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Usage statistics for the completion request.
func (CompletionUsage) RawJSON ¶
func (r CompletionUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*CompletionUsage) UnmarshalJSON ¶
func (r *CompletionUsage) UnmarshalJSON(data []byte) error
type CompletionUsageCompletionTokensDetails ¶
type CompletionUsageCompletionTokensDetails struct { // When using Predicted Outputs, the number of tokens in the prediction that // appeared in the completion. AcceptedPredictionTokens int64 `json:"accepted_prediction_tokens"` // Audio input tokens generated by the model. AudioTokens int64 `json:"audio_tokens"` // Tokens generated by the model for reasoning. ReasoningTokens int64 `json:"reasoning_tokens"` // When using Predicted Outputs, the number of tokens in the prediction that did // not appear in the completion. However, like reasoning tokens, these tokens are // still counted in the total completion tokens for purposes of billing, output, // and context window limits. RejectedPredictionTokens int64 `json:"rejected_prediction_tokens"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { AcceptedPredictionTokens resp.Field AudioTokens resp.Field ReasoningTokens resp.Field RejectedPredictionTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Breakdown of tokens used in a completion.
func (CompletionUsageCompletionTokensDetails) RawJSON ¶
func (r CompletionUsageCompletionTokensDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*CompletionUsageCompletionTokensDetails) UnmarshalJSON ¶
func (r *CompletionUsageCompletionTokensDetails) UnmarshalJSON(data []byte) error
type CompletionUsagePromptTokensDetails ¶
type CompletionUsagePromptTokensDetails struct { // Audio input tokens present in the prompt. AudioTokens int64 `json:"audio_tokens"` // Cached tokens present in the prompt. CachedTokens int64 `json:"cached_tokens"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { AudioTokens resp.Field CachedTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Breakdown of tokens used in the prompt.
func (CompletionUsagePromptTokensDetails) RawJSON ¶
func (r CompletionUsagePromptTokensDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*CompletionUsagePromptTokensDetails) UnmarshalJSON ¶
func (r *CompletionUsagePromptTokensDetails) UnmarshalJSON(data []byte) error
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 CreateEmbeddingResponse ¶
type CreateEmbeddingResponse struct { // The list of embeddings generated by the model. Data []Embedding `json:"data,required"` // The name of the model used to generate the embedding. Model string `json:"model,required"` // The object type, which is always "list". Object constant.List `json:"object,required"` // The usage information for the request. Usage CreateEmbeddingResponseUsage `json:"usage,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field Model resp.Field Object resp.Field Usage resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (CreateEmbeddingResponse) RawJSON ¶
func (r CreateEmbeddingResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*CreateEmbeddingResponse) UnmarshalJSON ¶
func (r *CreateEmbeddingResponse) UnmarshalJSON(data []byte) error
type CreateEmbeddingResponseUsage ¶
type CreateEmbeddingResponseUsage struct { // The number of tokens used by the prompt. PromptTokens int64 `json:"prompt_tokens,required"` // The total number of tokens used by the request. TotalTokens int64 `json:"total_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { PromptTokens resp.Field TotalTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The usage information for the request.
func (CreateEmbeddingResponseUsage) RawJSON ¶
func (r CreateEmbeddingResponseUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*CreateEmbeddingResponseUsage) UnmarshalJSON ¶
func (r *CreateEmbeddingResponseUsage) UnmarshalJSON(data []byte) error
type Embedding ¶
type Embedding struct { // The embedding vector, which is a list of floats. The length of vector depends on // the model as listed in the // [embedding guide](https://platform.openai.com/docs/guides/embeddings). Embedding []float64 `json:"embedding,required"` // The index of the embedding in the list of embeddings. Index int64 `json:"index,required"` // The object type, which is always "embedding". Object constant.Embedding `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Embedding resp.Field Index resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents an embedding vector returned by embedding endpoint.
func (*Embedding) UnmarshalJSON ¶
type EmbeddingModel ¶
type EmbeddingModel = string
const ( EmbeddingModelTextEmbeddingAda002 EmbeddingModel = "text-embedding-ada-002" EmbeddingModelTextEmbedding3Small EmbeddingModel = "text-embedding-3-small" EmbeddingModelTextEmbedding3Large EmbeddingModel = "text-embedding-3-large" )
type EmbeddingNewParams ¶
type EmbeddingNewParams struct { // Input text to embed, encoded as a string or array of tokens. To embed multiple // inputs in a single request, pass an array of strings or array of token arrays. // The input must not exceed the max input tokens for the model (8192 tokens for // `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 // dimensions or less. // [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) // for counting tokens. Some models may also impose a limit on total number of // tokens summed across inputs. Input EmbeddingNewParamsInputUnion `json:"input,omitzero,required"` // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our // [Model overview](https://platform.openai.com/docs/models) for descriptions of // them. Model EmbeddingModel `json:"model,omitzero,required"` // The number of dimensions the resulting output embeddings should have. Only // supported in `text-embedding-3` and later models. Dimensions param.Opt[int64] `json:"dimensions,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // The format to return the embeddings in. Can be either `float` or // [`base64`](https://pypi.org/project/pybase64/). // // Any of "float", "base64". EncodingFormat EmbeddingNewParamsEncodingFormat `json:"encoding_format,omitzero"` // contains filtered or unexported fields }
func (EmbeddingNewParams) IsPresent ¶
func (f EmbeddingNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (EmbeddingNewParams) MarshalJSON ¶
func (r EmbeddingNewParams) MarshalJSON() (data []byte, err error)
type EmbeddingNewParamsEncodingFormat ¶
type EmbeddingNewParamsEncodingFormat string
The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
const ( EmbeddingNewParamsEncodingFormatFloat EmbeddingNewParamsEncodingFormat = "float" EmbeddingNewParamsEncodingFormatBase64 EmbeddingNewParamsEncodingFormat = "base64" )
type EmbeddingNewParamsInputUnion ¶
type EmbeddingNewParamsInputUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfArrayOfStrings []string `json:",omitzero,inline"` OfArrayOfTokens []int64 `json:",omitzero,inline"` OfArrayOfTokenArrays [][]int64 `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 (EmbeddingNewParamsInputUnion) IsPresent ¶
func (u EmbeddingNewParamsInputUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (EmbeddingNewParamsInputUnion) MarshalJSON ¶
func (u EmbeddingNewParamsInputUnion) MarshalJSON() ([]byte, error)
type EmbeddingService ¶
type EmbeddingService struct {
Options []option.RequestOption
}
EmbeddingService 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 NewEmbeddingService method instead.
func NewEmbeddingService ¶
func NewEmbeddingService(opts ...option.RequestOption) (r EmbeddingService)
NewEmbeddingService 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 (*EmbeddingService) New ¶
func (r *EmbeddingService) New(ctx context.Context, body EmbeddingNewParams, opts ...option.RequestOption) (res *CreateEmbeddingResponse, err error)
Creates an embedding vector representing the input text.
type FileChunkingStrategyParamUnion ¶
type FileChunkingStrategyParamUnion struct { OfAuto *AutoFileChunkingStrategyParam `json:",omitzero,inline"` OfStatic *StaticFileChunkingStrategyObjectParam `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 FileChunkingStrategyParamOfStatic ¶
func FileChunkingStrategyParamOfStatic(static StaticFileChunkingStrategyParam) FileChunkingStrategyParamUnion
func (FileChunkingStrategyParamUnion) GetStatic ¶
func (u FileChunkingStrategyParamUnion) GetStatic() *StaticFileChunkingStrategyParam
Returns a pointer to the underlying variant's property, if present.
func (FileChunkingStrategyParamUnion) GetType ¶
func (u FileChunkingStrategyParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (FileChunkingStrategyParamUnion) IsPresent ¶
func (u FileChunkingStrategyParamUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileChunkingStrategyParamUnion) MarshalJSON ¶
func (u FileChunkingStrategyParamUnion) MarshalJSON() ([]byte, error)
type FileChunkingStrategyUnion ¶
type FileChunkingStrategyUnion struct { // This field is from variant [StaticFileChunkingStrategyObject]. Static StaticFileChunkingStrategy `json:"static"` // Any of "static", "other". Type string `json:"type"` JSON struct { Static resp.Field Type resp.Field // contains filtered or unexported fields } `json:"-"` }
FileChunkingStrategyUnion contains all possible properties and values from StaticFileChunkingStrategyObject, OtherFileChunkingStrategyObject.
Use the FileChunkingStrategyUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (FileChunkingStrategyUnion) AsAny ¶
func (u FileChunkingStrategyUnion) AsAny() anyFileChunkingStrategy
Use the following switch statement to find the correct variant
switch variant := FileChunkingStrategyUnion.AsAny().(type) { case StaticFileChunkingStrategyObject: case OtherFileChunkingStrategyObject: default: fmt.Errorf("no variant present") }
func (FileChunkingStrategyUnion) AsOther ¶
func (u FileChunkingStrategyUnion) AsOther() (v OtherFileChunkingStrategyObject)
func (FileChunkingStrategyUnion) AsStatic ¶
func (u FileChunkingStrategyUnion) AsStatic() (v StaticFileChunkingStrategyObject)
func (FileChunkingStrategyUnion) RawJSON ¶
func (u FileChunkingStrategyUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileChunkingStrategyUnion) UnmarshalJSON ¶
func (r *FileChunkingStrategyUnion) UnmarshalJSON(data []byte) error
type FileCitationAnnotation ¶
type FileCitationAnnotation struct { EndIndex int64 `json:"end_index,required"` FileCitation FileCitationAnnotationFileCitation `json:"file_citation,required"` StartIndex int64 `json:"start_index,required"` // The text in the message content that needs to be replaced. Text string `json:"text,required"` // Always `file_citation`. Type constant.FileCitation `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { EndIndex resp.Field FileCitation resp.Field StartIndex resp.Field Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.
func (FileCitationAnnotation) RawJSON ¶
func (r FileCitationAnnotation) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileCitationAnnotation) UnmarshalJSON ¶
func (r *FileCitationAnnotation) UnmarshalJSON(data []byte) error
type FileCitationAnnotationFileCitation ¶
type FileCitationAnnotationFileCitation struct { // The ID of the specific File the citation is from. FileID string `json:"file_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileCitationAnnotationFileCitation) RawJSON ¶
func (r FileCitationAnnotationFileCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileCitationAnnotationFileCitation) UnmarshalJSON ¶
func (r *FileCitationAnnotationFileCitation) UnmarshalJSON(data []byte) error
type FileCitationDeltaAnnotation ¶
type FileCitationDeltaAnnotation struct { // The index of the annotation in the text content part. Index int64 `json:"index,required"` // Always `file_citation`. Type constant.FileCitation `json:"type,required"` EndIndex int64 `json:"end_index"` FileCitation FileCitationDeltaAnnotationFileCitation `json:"file_citation"` StartIndex int64 `json:"start_index"` // The text in the message content that needs to be replaced. Text string `json:"text"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field EndIndex resp.Field FileCitation resp.Field StartIndex resp.Field Text resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.
func (FileCitationDeltaAnnotation) RawJSON ¶
func (r FileCitationDeltaAnnotation) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileCitationDeltaAnnotation) UnmarshalJSON ¶
func (r *FileCitationDeltaAnnotation) UnmarshalJSON(data []byte) error
type FileCitationDeltaAnnotationFileCitation ¶
type FileCitationDeltaAnnotationFileCitation struct { // The ID of the specific File the citation is from. FileID string `json:"file_id"` // The specific quote in the file. Quote string `json:"quote"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Quote resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileCitationDeltaAnnotationFileCitation) RawJSON ¶
func (r FileCitationDeltaAnnotationFileCitation) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileCitationDeltaAnnotationFileCitation) UnmarshalJSON ¶
func (r *FileCitationDeltaAnnotationFileCitation) UnmarshalJSON(data []byte) error
type FileDeleted ¶
type FileDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object constant.File `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileDeleted) RawJSON ¶
func (r FileDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileDeleted) UnmarshalJSON ¶
func (r *FileDeleted) UnmarshalJSON(data []byte) error
type FileListParams ¶
type FileListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 10,000, and the default is 10,000. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Only return files with the given purpose. Purpose param.Opt[string] `query:"purpose,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order FileListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (FileListParams) IsPresent ¶
func (f FileListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileListParams) URLQuery ¶
func (r FileListParams) URLQuery() (v url.Values, err error)
URLQuery serializes FileListParams's query parameters as `url.Values`.
type FileListParamsOrder ¶
type FileListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( FileListParamsOrderAsc FileListParamsOrder = "asc" FileListParamsOrderDesc FileListParamsOrder = "desc" )
type FileNewParams ¶
type FileNewParams struct { // The File object (not file name) to be uploaded. File io.Reader `json:"file,required" format:"binary"` // The intended purpose of the uploaded file. One of: - `assistants`: Used in the // Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for // fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: // Flexible file type for any purpose - `evals`: Used for eval data sets // // Any of "assistants", "batch", "fine-tune", "vision", "user_data", "evals". Purpose FilePurpose `json:"purpose,omitzero,required"` // contains filtered or unexported fields }
func (FileNewParams) IsPresent ¶
func (f FileNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileNewParams) MarshalMultipart ¶
func (r FileNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type FileObject ¶
type FileObject struct { // The file identifier, which can be referenced in the API endpoints. ID string `json:"id,required"` // The size of the file, in bytes. Bytes int64 `json:"bytes,required"` // The Unix timestamp (in seconds) for when the file was created. CreatedAt int64 `json:"created_at,required"` // The name of the file. Filename string `json:"filename,required"` // The object type, which is always `file`. Object constant.File `json:"object,required"` // The intended purpose of the file. Supported values are `assistants`, // `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results` // and `vision`. // // Any of "assistants", "assistants_output", "batch", "batch_output", "fine-tune", // "fine-tune-results", "vision". Purpose FileObjectPurpose `json:"purpose,required"` // Deprecated. The current status of the file, which can be either `uploaded`, // `processed`, or `error`. // // Any of "uploaded", "processed", "error". // // Deprecated: deprecated Status FileObjectStatus `json:"status,required"` // The Unix timestamp (in seconds) for when the file will expire. ExpiresAt int64 `json:"expires_at"` // Deprecated. For details on why a fine-tuning training file failed validation, // see the `error` field on `fine_tuning.job`. // // Deprecated: deprecated StatusDetails string `json:"status_details"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Bytes resp.Field CreatedAt resp.Field Filename resp.Field Object resp.Field Purpose resp.Field Status resp.Field ExpiresAt resp.Field StatusDetails resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The `File` object represents a document that has been uploaded to OpenAI.
func (FileObject) RawJSON ¶
func (r FileObject) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileObject) UnmarshalJSON ¶
func (r *FileObject) UnmarshalJSON(data []byte) error
type FileObjectPurpose ¶
type FileObjectPurpose string
The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results` and `vision`.
const ( FileObjectPurposeAssistants FileObjectPurpose = "assistants" FileObjectPurposeAssistantsOutput FileObjectPurpose = "assistants_output" FileObjectPurposeBatch FileObjectPurpose = "batch" FileObjectPurposeBatchOutput FileObjectPurpose = "batch_output" FileObjectPurposeFineTune FileObjectPurpose = "fine-tune" FileObjectPurposeFineTuneResults FileObjectPurpose = "fine-tune-results" FileObjectPurposeVision FileObjectPurpose = "vision" )
type FileObjectStatus ¶
type FileObjectStatus string
Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
const ( FileObjectStatusUploaded FileObjectStatus = "uploaded" FileObjectStatusProcessed FileObjectStatus = "processed" FileObjectStatusError FileObjectStatus = "error" )
type FilePathAnnotation ¶
type FilePathAnnotation struct { EndIndex int64 `json:"end_index,required"` FilePath FilePathAnnotationFilePath `json:"file_path,required"` StartIndex int64 `json:"start_index,required"` // The text in the message content that needs to be replaced. Text string `json:"text,required"` // Always `file_path`. Type constant.FilePath `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { EndIndex resp.Field FilePath resp.Field StartIndex resp.Field Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
func (FilePathAnnotation) RawJSON ¶
func (r FilePathAnnotation) RawJSON() string
Returns the unmodified JSON received from the API
func (*FilePathAnnotation) UnmarshalJSON ¶
func (r *FilePathAnnotation) UnmarshalJSON(data []byte) error
type FilePathAnnotationFilePath ¶
type FilePathAnnotationFilePath struct { // The ID of the file that was generated. FileID string `json:"file_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FilePathAnnotationFilePath) RawJSON ¶
func (r FilePathAnnotationFilePath) RawJSON() string
Returns the unmodified JSON received from the API
func (*FilePathAnnotationFilePath) UnmarshalJSON ¶
func (r *FilePathAnnotationFilePath) UnmarshalJSON(data []byte) error
type FilePathDeltaAnnotation ¶
type FilePathDeltaAnnotation struct { // The index of the annotation in the text content part. Index int64 `json:"index,required"` // Always `file_path`. Type constant.FilePath `json:"type,required"` EndIndex int64 `json:"end_index"` FilePath FilePathDeltaAnnotationFilePath `json:"file_path"` StartIndex int64 `json:"start_index"` // The text in the message content that needs to be replaced. Text string `json:"text"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field EndIndex resp.Field FilePath resp.Field StartIndex resp.Field Text resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.
func (FilePathDeltaAnnotation) RawJSON ¶
func (r FilePathDeltaAnnotation) RawJSON() string
Returns the unmodified JSON received from the API
func (*FilePathDeltaAnnotation) UnmarshalJSON ¶
func (r *FilePathDeltaAnnotation) UnmarshalJSON(data []byte) error
type FilePathDeltaAnnotationFilePath ¶
type FilePathDeltaAnnotationFilePath struct { // The ID of the file that was generated. FileID string `json:"file_id"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FilePathDeltaAnnotationFilePath) RawJSON ¶
func (r FilePathDeltaAnnotationFilePath) RawJSON() string
Returns the unmodified JSON received from the API
func (*FilePathDeltaAnnotationFilePath) UnmarshalJSON ¶
func (r *FilePathDeltaAnnotationFilePath) UnmarshalJSON(data []byte) error
type FilePurpose ¶
type FilePurpose string
The intended purpose of the uploaded file. One of: - `assistants`: Used in the Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: Flexible file type for any purpose - `evals`: Used for eval data sets
const ( FilePurposeAssistants FilePurpose = "assistants" FilePurposeBatch FilePurpose = "batch" FilePurposeFineTune FilePurpose = "fine-tune" FilePurposeVision FilePurpose = "vision" FilePurposeUserData FilePurpose = "user_data" FilePurposeEvals FilePurpose = "evals" )
type FileSearchTool ¶
type FileSearchTool struct { // The type of tool being defined: `file_search` Type constant.FileSearch `json:"type,required"` // Overrides for the file search tool. FileSearch FileSearchToolFileSearch `json:"file_search"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field FileSearch resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileSearchTool) RawJSON ¶
func (r FileSearchTool) RawJSON() string
Returns the unmodified JSON received from the API
func (FileSearchTool) ToParam ¶
func (r FileSearchTool) ToParam() FileSearchToolParam
ToParam converts this FileSearchTool to a FileSearchToolParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FileSearchToolParam.IsOverridden()
func (*FileSearchTool) UnmarshalJSON ¶
func (r *FileSearchTool) UnmarshalJSON(data []byte) error
type FileSearchToolCall ¶
type FileSearchToolCall struct { // The ID of the tool call object. ID string `json:"id,required"` // For now, this is always going to be an empty object. FileSearch FileSearchToolCallFileSearch `json:"file_search,required"` // The type of tool call. This is always going to be `file_search` for this type of // tool call. Type constant.FileSearch `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field FileSearch resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileSearchToolCall) RawJSON ¶
func (r FileSearchToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolCall) UnmarshalJSON ¶
func (r *FileSearchToolCall) UnmarshalJSON(data []byte) error
type FileSearchToolCallDelta ¶
type FileSearchToolCallDelta struct { // For now, this is always going to be an empty object. FileSearch interface{} `json:"file_search,required"` // The index of the tool call in the tool calls array. Index int64 `json:"index,required"` // The type of tool call. This is always going to be `file_search` for this type of // tool call. Type constant.FileSearch `json:"type,required"` // The ID of the tool call object. ID string `json:"id"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileSearch resp.Field Index resp.Field Type resp.Field ID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileSearchToolCallDelta) RawJSON ¶
func (r FileSearchToolCallDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolCallDelta) UnmarshalJSON ¶
func (r *FileSearchToolCallDelta) UnmarshalJSON(data []byte) error
type FileSearchToolCallFileSearch ¶
type FileSearchToolCallFileSearch struct { // The ranking options for the file search. RankingOptions FileSearchToolCallFileSearchRankingOptions `json:"ranking_options"` // The results of the file search. Results []FileSearchToolCallFileSearchResult `json:"results"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { RankingOptions resp.Field Results resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
For now, this is always going to be an empty object.
func (FileSearchToolCallFileSearch) RawJSON ¶
func (r FileSearchToolCallFileSearch) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolCallFileSearch) UnmarshalJSON ¶
func (r *FileSearchToolCallFileSearch) UnmarshalJSON(data []byte) error
type FileSearchToolCallFileSearchRankingOptions ¶
type FileSearchToolCallFileSearchRankingOptions struct { // The ranker to use for the file search. If not specified will use the `auto` // ranker. // // Any of "auto", "default_2024_08_21". Ranker string `json:"ranker,required"` // The score threshold for the file search. All values must be a floating point // number between 0 and 1. ScoreThreshold float64 `json:"score_threshold,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Ranker resp.Field ScoreThreshold resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The ranking options for the file search.
func (FileSearchToolCallFileSearchRankingOptions) RawJSON ¶
func (r FileSearchToolCallFileSearchRankingOptions) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolCallFileSearchRankingOptions) UnmarshalJSON ¶
func (r *FileSearchToolCallFileSearchRankingOptions) UnmarshalJSON(data []byte) error
type FileSearchToolCallFileSearchResult ¶
type FileSearchToolCallFileSearchResult struct { // The ID of the file that result was found in. FileID string `json:"file_id,required"` // The name of the file that result was found in. FileName string `json:"file_name,required"` // The score of the result. All values must be a floating point number between 0 // and 1. Score float64 `json:"score,required"` // The content of the result that was found. The content is only included if // requested via the include query parameter. Content []FileSearchToolCallFileSearchResultContent `json:"content"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field FileName resp.Field Score resp.Field Content resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A result instance of the file search.
func (FileSearchToolCallFileSearchResult) RawJSON ¶
func (r FileSearchToolCallFileSearchResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolCallFileSearchResult) UnmarshalJSON ¶
func (r *FileSearchToolCallFileSearchResult) UnmarshalJSON(data []byte) error
type FileSearchToolCallFileSearchResultContent ¶
type FileSearchToolCallFileSearchResultContent struct { // The text content of the file. Text string `json:"text"` // The type of the content. // // Any of "text". Type string `json:"type"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FileSearchToolCallFileSearchResultContent) RawJSON ¶
func (r FileSearchToolCallFileSearchResultContent) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolCallFileSearchResultContent) UnmarshalJSON ¶
func (r *FileSearchToolCallFileSearchResultContent) UnmarshalJSON(data []byte) error
type FileSearchToolFileSearch ¶
type FileSearchToolFileSearch struct { // The maximum number of results the file search tool should output. The default is // 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between // 1 and 50 inclusive. // // Note that the file search tool may output fewer than `max_num_results` results. // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. MaxNumResults int64 `json:"max_num_results"` // The ranking options for the file search. If not specified, the file search tool // will use the `auto` ranker and a score_threshold of 0. // // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. RankingOptions FileSearchToolFileSearchRankingOptions `json:"ranking_options"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { MaxNumResults resp.Field RankingOptions resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Overrides for the file search tool.
func (FileSearchToolFileSearch) RawJSON ¶
func (r FileSearchToolFileSearch) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolFileSearch) UnmarshalJSON ¶
func (r *FileSearchToolFileSearch) UnmarshalJSON(data []byte) error
type FileSearchToolFileSearchParam ¶
type FileSearchToolFileSearchParam struct { // The maximum number of results the file search tool should output. The default is // 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between // 1 and 50 inclusive. // // Note that the file search tool may output fewer than `max_num_results` results. // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"` // The ranking options for the file search. If not specified, the file search tool // will use the `auto` ranker and a score_threshold of 0. // // See the // [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) // for more information. RankingOptions FileSearchToolFileSearchRankingOptionsParam `json:"ranking_options,omitzero"` // contains filtered or unexported fields }
Overrides for the file search tool.
func (FileSearchToolFileSearchParam) IsPresent ¶
func (f FileSearchToolFileSearchParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileSearchToolFileSearchParam) MarshalJSON ¶
func (r FileSearchToolFileSearchParam) MarshalJSON() (data []byte, err error)
type FileSearchToolFileSearchRankingOptions ¶
type FileSearchToolFileSearchRankingOptions struct { // The score threshold for the file search. All values must be a floating point // number between 0 and 1. ScoreThreshold float64 `json:"score_threshold,required"` // The ranker to use for the file search. If not specified will use the `auto` // ranker. // // Any of "auto", "default_2024_08_21". Ranker string `json:"ranker"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ScoreThreshold resp.Field Ranker resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.
See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
func (FileSearchToolFileSearchRankingOptions) RawJSON ¶
func (r FileSearchToolFileSearchRankingOptions) RawJSON() string
Returns the unmodified JSON received from the API
func (*FileSearchToolFileSearchRankingOptions) UnmarshalJSON ¶
func (r *FileSearchToolFileSearchRankingOptions) UnmarshalJSON(data []byte) error
type FileSearchToolFileSearchRankingOptionsParam ¶
type FileSearchToolFileSearchRankingOptionsParam struct { // The score threshold for the file search. All values must be a floating point // number between 0 and 1. ScoreThreshold float64 `json:"score_threshold,required"` // The ranker to use for the file search. If not specified will use the `auto` // ranker. // // Any of "auto", "default_2024_08_21". Ranker string `json:"ranker,omitzero"` // contains filtered or unexported fields }
The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.
See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.
The property ScoreThreshold is required.
func (FileSearchToolFileSearchRankingOptionsParam) IsPresent ¶
func (f FileSearchToolFileSearchRankingOptionsParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileSearchToolFileSearchRankingOptionsParam) MarshalJSON ¶
func (r FileSearchToolFileSearchRankingOptionsParam) MarshalJSON() (data []byte, err error)
type FileSearchToolParam ¶
type FileSearchToolParam struct { // Overrides for the file search tool. FileSearch FileSearchToolFileSearchParam `json:"file_search,omitzero"` // The type of tool being defined: `file_search` // // This field can be elided, and will marshal its zero value as "file_search". Type constant.FileSearch `json:"type,required"` // contains filtered or unexported fields }
The property Type is required.
func (FileSearchToolParam) IsPresent ¶
func (f FileSearchToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FileSearchToolParam) MarshalJSON ¶
func (r FileSearchToolParam) MarshalJSON() (data []byte, err error)
type FileService ¶
type FileService struct {
Options []option.RequestOption
}
FileService 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 NewFileService method instead.
func NewFileService ¶
func NewFileService(opts ...option.RequestOption) (r FileService)
NewFileService 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 (*FileService) Content ¶
func (r *FileService) Content(ctx context.Context, fileID string, opts ...option.RequestOption) (res *http.Response, err error)
Returns the contents of the specified file.
func (*FileService) Delete ¶
func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileDeleted, err error)
Delete a file.
func (*FileService) Get ¶
func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileObject, err error)
Returns information about a specific file.
func (*FileService) List ¶
func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FileObject], err error)
Returns a list of files.
func (*FileService) ListAutoPaging ¶
func (r *FileService) ListAutoPaging(ctx context.Context, query FileListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[FileObject]
Returns a list of files.
func (*FileService) New ¶
func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...option.RequestOption) (res *FileObject, err error)
Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.
The Assistants API supports files up to 2 million tokens and of specific file types. See the [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for details.
The Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) models.
The Batch API only supports `.jsonl` files up to 200 MB in size. The input also has a specific required [format](https://platform.openai.com/docs/api-reference/batch/request-input).
Please [contact us](https://help.openai.com/) if you need to increase these storage limits.
type FineTuningCheckpointPermissionDeleteResponse ¶
type FineTuningCheckpointPermissionDeleteResponse struct { // The ID of the fine-tuned model checkpoint permission that was deleted. ID string `json:"id,required"` // Whether the fine-tuned model checkpoint permission was successfully deleted. Deleted bool `json:"deleted,required"` // The object type, which is always "checkpoint.permission". Object constant.CheckpointPermission `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FineTuningCheckpointPermissionDeleteResponse) RawJSON ¶
func (r FineTuningCheckpointPermissionDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningCheckpointPermissionDeleteResponse) UnmarshalJSON ¶
func (r *FineTuningCheckpointPermissionDeleteResponse) UnmarshalJSON(data []byte) error
type FineTuningCheckpointPermissionGetParams ¶
type FineTuningCheckpointPermissionGetParams struct { // Identifier for the last permission ID from the previous pagination request. After param.Opt[string] `query:"after,omitzero" json:"-"` // Number of permissions to retrieve. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // The ID of the project to get permissions for. ProjectID param.Opt[string] `query:"project_id,omitzero" json:"-"` // The order in which to retrieve permissions. // // Any of "ascending", "descending". Order FineTuningCheckpointPermissionGetParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (FineTuningCheckpointPermissionGetParams) IsPresent ¶
func (f FineTuningCheckpointPermissionGetParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningCheckpointPermissionGetParams) URLQuery ¶
func (r FineTuningCheckpointPermissionGetParams) URLQuery() (v url.Values, err error)
URLQuery serializes FineTuningCheckpointPermissionGetParams's query parameters as `url.Values`.
type FineTuningCheckpointPermissionGetParamsOrder ¶
type FineTuningCheckpointPermissionGetParamsOrder string
The order in which to retrieve permissions.
const ( FineTuningCheckpointPermissionGetParamsOrderAscending FineTuningCheckpointPermissionGetParamsOrder = "ascending" FineTuningCheckpointPermissionGetParamsOrderDescending FineTuningCheckpointPermissionGetParamsOrder = "descending" )
type FineTuningCheckpointPermissionGetResponse ¶
type FineTuningCheckpointPermissionGetResponse struct { Data []FineTuningCheckpointPermissionGetResponseData `json:"data,required"` HasMore bool `json:"has_more,required"` Object constant.List `json:"object,required"` FirstID string `json:"first_id,nullable"` LastID string `json:"last_id,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Data resp.Field HasMore resp.Field Object resp.Field FirstID resp.Field LastID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FineTuningCheckpointPermissionGetResponse) RawJSON ¶
func (r FineTuningCheckpointPermissionGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningCheckpointPermissionGetResponse) UnmarshalJSON ¶
func (r *FineTuningCheckpointPermissionGetResponse) UnmarshalJSON(data []byte) error
type FineTuningCheckpointPermissionGetResponseData ¶
type FineTuningCheckpointPermissionGetResponseData struct { // The permission identifier, which can be referenced in the API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the permission was created. CreatedAt int64 `json:"created_at,required"` // The object type, which is always "checkpoint.permission". Object constant.CheckpointPermission `json:"object,required"` // The project identifier that the permission is for. ProjectID string `json:"project_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Object resp.Field ProjectID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.
func (FineTuningCheckpointPermissionGetResponseData) RawJSON ¶
func (r FineTuningCheckpointPermissionGetResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningCheckpointPermissionGetResponseData) UnmarshalJSON ¶
func (r *FineTuningCheckpointPermissionGetResponseData) UnmarshalJSON(data []byte) error
type FineTuningCheckpointPermissionNewParams ¶
type FineTuningCheckpointPermissionNewParams struct { // The project identifiers to grant access to. ProjectIDs []string `json:"project_ids,omitzero,required"` // contains filtered or unexported fields }
func (FineTuningCheckpointPermissionNewParams) IsPresent ¶
func (f FineTuningCheckpointPermissionNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningCheckpointPermissionNewParams) MarshalJSON ¶
func (r FineTuningCheckpointPermissionNewParams) MarshalJSON() (data []byte, err error)
type FineTuningCheckpointPermissionNewResponse ¶
type FineTuningCheckpointPermissionNewResponse struct { // The permission identifier, which can be referenced in the API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the permission was created. CreatedAt int64 `json:"created_at,required"` // The object type, which is always "checkpoint.permission". Object constant.CheckpointPermission `json:"object,required"` // The project identifier that the permission is for. ProjectID string `json:"project_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Object resp.Field ProjectID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.
func (FineTuningCheckpointPermissionNewResponse) RawJSON ¶
func (r FineTuningCheckpointPermissionNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningCheckpointPermissionNewResponse) UnmarshalJSON ¶
func (r *FineTuningCheckpointPermissionNewResponse) UnmarshalJSON(data []byte) error
type FineTuningCheckpointPermissionService ¶
type FineTuningCheckpointPermissionService struct {
Options []option.RequestOption
}
FineTuningCheckpointPermissionService 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 NewFineTuningCheckpointPermissionService method instead.
func NewFineTuningCheckpointPermissionService ¶
func NewFineTuningCheckpointPermissionService(opts ...option.RequestOption) (r FineTuningCheckpointPermissionService)
NewFineTuningCheckpointPermissionService 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 (*FineTuningCheckpointPermissionService) Delete ¶
func (r *FineTuningCheckpointPermissionService) Delete(ctx context.Context, fineTunedModelCheckpoint string, opts ...option.RequestOption) (res *FineTuningCheckpointPermissionDeleteResponse, err error)
**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.
func (*FineTuningCheckpointPermissionService) Get ¶
func (r *FineTuningCheckpointPermissionService) Get(ctx context.Context, fineTunedModelCheckpoint string, query FineTuningCheckpointPermissionGetParams, opts ...option.RequestOption) (res *FineTuningCheckpointPermissionGetResponse, err error)
**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.
func (*FineTuningCheckpointPermissionService) New ¶
func (r *FineTuningCheckpointPermissionService) New(ctx context.Context, fineTunedModelCheckpoint string, body FineTuningCheckpointPermissionNewParams, opts ...option.RequestOption) (res *pagination.Page[FineTuningCheckpointPermissionNewResponse], err error)
**NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
This enables organization owners to share fine-tuned models with other projects in their organization.
func (*FineTuningCheckpointPermissionService) NewAutoPaging ¶
func (r *FineTuningCheckpointPermissionService) NewAutoPaging(ctx context.Context, fineTunedModelCheckpoint string, body FineTuningCheckpointPermissionNewParams, opts ...option.RequestOption) *pagination.PageAutoPager[FineTuningCheckpointPermissionNewResponse]
**NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
This enables organization owners to share fine-tuned models with other projects in their organization.
type FineTuningCheckpointService ¶
type FineTuningCheckpointService struct { Options []option.RequestOption Permissions FineTuningCheckpointPermissionService }
FineTuningCheckpointService 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 NewFineTuningCheckpointService method instead.
func NewFineTuningCheckpointService ¶
func NewFineTuningCheckpointService(opts ...option.RequestOption) (r FineTuningCheckpointService)
NewFineTuningCheckpointService 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 FineTuningJob ¶
type FineTuningJob struct { // The object identifier, which can be referenced in the API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the fine-tuning job was created. CreatedAt int64 `json:"created_at,required"` // For fine-tuning jobs that have `failed`, this will contain more information on // the cause of the failure. Error FineTuningJobError `json:"error,required"` // The name of the fine-tuned model that is being created. The value will be null // if the fine-tuning job is still running. FineTunedModel string `json:"fine_tuned_model,required"` // The Unix timestamp (in seconds) for when the fine-tuning job was finished. The // value will be null if the fine-tuning job is still running. FinishedAt int64 `json:"finished_at,required"` // The hyperparameters used for the fine-tuning job. This value will only be // returned when running `supervised` jobs. Hyperparameters FineTuningJobHyperparameters `json:"hyperparameters,required"` // The base model that is being fine-tuned. Model string `json:"model,required"` // The object type, which is always "fine_tuning.job". Object constant.FineTuningJob `json:"object,required"` // The organization that owns the fine-tuning job. OrganizationID string `json:"organization_id,required"` // The compiled results file ID(s) for the fine-tuning job. You can retrieve the // results with the // [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents). ResultFiles []string `json:"result_files,required"` // The seed used for the fine-tuning job. Seed int64 `json:"seed,required"` // The current status of the fine-tuning job, which can be either // `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. // // Any of "validating_files", "queued", "running", "succeeded", "failed", // "cancelled". Status FineTuningJobStatus `json:"status,required"` // The total number of billable tokens processed by this fine-tuning job. The value // will be null if the fine-tuning job is still running. TrainedTokens int64 `json:"trained_tokens,required"` // The file ID used for training. You can retrieve the training data with the // [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents). TrainingFile string `json:"training_file,required"` // The file ID used for validation. You can retrieve the validation results with // the // [Files API](https://platform.openai.com/docs/api-reference/files/retrieve-contents). ValidationFile string `json:"validation_file,required"` // The Unix timestamp (in seconds) for when the fine-tuning job is estimated to // finish. The value will be null if the fine-tuning job is not running. EstimatedFinish int64 `json:"estimated_finish,nullable"` // A list of integrations to enable for this fine-tuning job. Integrations []FineTuningJobWandbIntegrationObject `json:"integrations,nullable"` // 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,nullable"` // The method used for fine-tuning. Method FineTuningJobMethod `json:"method"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Error resp.Field FineTunedModel resp.Field FinishedAt resp.Field Hyperparameters resp.Field Model resp.Field Object resp.Field OrganizationID resp.Field ResultFiles resp.Field Seed resp.Field Status resp.Field TrainedTokens resp.Field TrainingFile resp.Field ValidationFile resp.Field EstimatedFinish resp.Field Integrations resp.Field Metadata resp.Field Method resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.
func (FineTuningJob) RawJSON ¶
func (r FineTuningJob) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJob) UnmarshalJSON ¶
func (r *FineTuningJob) UnmarshalJSON(data []byte) error
type FineTuningJobCheckpoint ¶
type FineTuningJobCheckpoint struct { // The checkpoint identifier, which can be referenced in the API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the checkpoint was created. CreatedAt int64 `json:"created_at,required"` // The name of the fine-tuned checkpoint model that is created. FineTunedModelCheckpoint string `json:"fine_tuned_model_checkpoint,required"` // The name of the fine-tuning job that this checkpoint was created from. FineTuningJobID string `json:"fine_tuning_job_id,required"` // Metrics at the step number during the fine-tuning job. Metrics FineTuningJobCheckpointMetrics `json:"metrics,required"` // The object type, which is always "fine_tuning.job.checkpoint". Object constant.FineTuningJobCheckpoint `json:"object,required"` // The step number that the checkpoint was created at. StepNumber int64 `json:"step_number,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field FineTunedModelCheckpoint resp.Field FineTuningJobID resp.Field Metrics resp.Field Object resp.Field StepNumber resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.
func (FineTuningJobCheckpoint) RawJSON ¶
func (r FineTuningJobCheckpoint) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobCheckpoint) UnmarshalJSON ¶
func (r *FineTuningJobCheckpoint) UnmarshalJSON(data []byte) error
type FineTuningJobCheckpointListParams ¶
type FineTuningJobCheckpointListParams struct { // Identifier for the last checkpoint ID from the previous pagination request. After param.Opt[string] `query:"after,omitzero" json:"-"` // Number of checkpoints to retrieve. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // contains filtered or unexported fields }
func (FineTuningJobCheckpointListParams) IsPresent ¶
func (f FineTuningJobCheckpointListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobCheckpointListParams) URLQuery ¶
func (r FineTuningJobCheckpointListParams) URLQuery() (v url.Values, err error)
URLQuery serializes FineTuningJobCheckpointListParams's query parameters as `url.Values`.
type FineTuningJobCheckpointMetrics ¶
type FineTuningJobCheckpointMetrics struct { FullValidLoss float64 `json:"full_valid_loss"` FullValidMeanTokenAccuracy float64 `json:"full_valid_mean_token_accuracy"` Step float64 `json:"step"` TrainLoss float64 `json:"train_loss"` TrainMeanTokenAccuracy float64 `json:"train_mean_token_accuracy"` ValidLoss float64 `json:"valid_loss"` ValidMeanTokenAccuracy float64 `json:"valid_mean_token_accuracy"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FullValidLoss resp.Field FullValidMeanTokenAccuracy resp.Field Step resp.Field TrainLoss resp.Field TrainMeanTokenAccuracy resp.Field ValidLoss resp.Field ValidMeanTokenAccuracy resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Metrics at the step number during the fine-tuning job.
func (FineTuningJobCheckpointMetrics) RawJSON ¶
func (r FineTuningJobCheckpointMetrics) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobCheckpointMetrics) UnmarshalJSON ¶
func (r *FineTuningJobCheckpointMetrics) UnmarshalJSON(data []byte) error
type FineTuningJobCheckpointService ¶
type FineTuningJobCheckpointService struct {
Options []option.RequestOption
}
FineTuningJobCheckpointService 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 NewFineTuningJobCheckpointService method instead.
func NewFineTuningJobCheckpointService ¶
func NewFineTuningJobCheckpointService(opts ...option.RequestOption) (r FineTuningJobCheckpointService)
NewFineTuningJobCheckpointService 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 (*FineTuningJobCheckpointService) List ¶
func (r *FineTuningJobCheckpointService) List(ctx context.Context, fineTuningJobID string, query FineTuningJobCheckpointListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FineTuningJobCheckpoint], err error)
List checkpoints for a fine-tuning job.
func (*FineTuningJobCheckpointService) ListAutoPaging ¶
func (r *FineTuningJobCheckpointService) ListAutoPaging(ctx context.Context, fineTuningJobID string, query FineTuningJobCheckpointListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[FineTuningJobCheckpoint]
List checkpoints for a fine-tuning job.
type FineTuningJobError ¶
type FineTuningJobError struct { // A machine-readable error code. Code string `json:"code,required"` // A human-readable error message. Message string `json:"message,required"` // The parameter that was invalid, usually `training_file` or `validation_file`. // This field will be null if the failure was not parameter-specific. Param string `json:"param,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Message resp.Field Param resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure.
func (FineTuningJobError) RawJSON ¶
func (r FineTuningJobError) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobError) UnmarshalJSON ¶
func (r *FineTuningJobError) UnmarshalJSON(data []byte) error
type FineTuningJobEvent ¶
type FineTuningJobEvent struct { // The object identifier. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the fine-tuning job was created. CreatedAt int64 `json:"created_at,required"` // The log level of the event. // // Any of "info", "warn", "error". Level FineTuningJobEventLevel `json:"level,required"` // The message of the event. Message string `json:"message,required"` // The object type, which is always "fine_tuning.job.event". Object constant.FineTuningJobEvent `json:"object,required"` // The data associated with the event. Data interface{} `json:"data"` // The type of event. // // Any of "message", "metrics". Type FineTuningJobEventType `json:"type"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Level resp.Field Message resp.Field Object resp.Field Data resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Fine-tuning job event object
func (FineTuningJobEvent) RawJSON ¶
func (r FineTuningJobEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobEvent) UnmarshalJSON ¶
func (r *FineTuningJobEvent) UnmarshalJSON(data []byte) error
type FineTuningJobEventLevel ¶
type FineTuningJobEventLevel string
The log level of the event.
const ( FineTuningJobEventLevelInfo FineTuningJobEventLevel = "info" FineTuningJobEventLevelWarn FineTuningJobEventLevel = "warn" FineTuningJobEventLevelError FineTuningJobEventLevel = "error" )
type FineTuningJobEventType ¶
type FineTuningJobEventType string
The type of event.
const ( FineTuningJobEventTypeMessage FineTuningJobEventType = "message" FineTuningJobEventTypeMetrics FineTuningJobEventType = "metrics" )
type FineTuningJobHyperparameters ¶
type FineTuningJobHyperparameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize FineTuningJobHyperparametersBatchSizeUnion `json:"batch_size"` // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. LearningRateMultiplier FineTuningJobHyperparametersLearningRateMultiplierUnion `json:"learning_rate_multiplier"` // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. NEpochs FineTuningJobHyperparametersNEpochsUnion `json:"n_epochs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { BatchSize resp.Field LearningRateMultiplier resp.Field NEpochs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs.
func (FineTuningJobHyperparameters) RawJSON ¶
func (r FineTuningJobHyperparameters) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobHyperparameters) UnmarshalJSON ¶
func (r *FineTuningJobHyperparameters) UnmarshalJSON(data []byte) error
type FineTuningJobHyperparametersBatchSizeUnion ¶
type FineTuningJobHyperparametersBatchSizeUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [int64] instead of an object. OfInt int64 `json:",inline"` JSON struct { OfAuto resp.Field OfInt resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobHyperparametersBatchSizeUnion contains all possible properties and values from constant.Auto, [int64].
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 OfInt]
func (FineTuningJobHyperparametersBatchSizeUnion) AsAuto ¶
func (u FineTuningJobHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto)
func (FineTuningJobHyperparametersBatchSizeUnion) AsInt ¶
func (u FineTuningJobHyperparametersBatchSizeUnion) AsInt() (v int64)
func (FineTuningJobHyperparametersBatchSizeUnion) RawJSON ¶
func (u FineTuningJobHyperparametersBatchSizeUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobHyperparametersBatchSizeUnion) UnmarshalJSON ¶
func (r *FineTuningJobHyperparametersBatchSizeUnion) UnmarshalJSON(data []byte) error
type FineTuningJobHyperparametersLearningRateMultiplierUnion ¶
type FineTuningJobHyperparametersLearningRateMultiplierUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` JSON struct { OfAuto resp.Field OfFloat resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobHyperparametersLearningRateMultiplierUnion contains all possible properties and values from constant.Auto, [float64].
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 OfFloat]
func (FineTuningJobHyperparametersLearningRateMultiplierUnion) AsAuto ¶
func (u FineTuningJobHyperparametersLearningRateMultiplierUnion) AsAuto() (v constant.Auto)
func (FineTuningJobHyperparametersLearningRateMultiplierUnion) AsFloat ¶
func (u FineTuningJobHyperparametersLearningRateMultiplierUnion) AsFloat() (v float64)
func (FineTuningJobHyperparametersLearningRateMultiplierUnion) RawJSON ¶
func (u FineTuningJobHyperparametersLearningRateMultiplierUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobHyperparametersLearningRateMultiplierUnion) UnmarshalJSON ¶
func (r *FineTuningJobHyperparametersLearningRateMultiplierUnion) UnmarshalJSON(data []byte) error
type FineTuningJobHyperparametersNEpochsUnion ¶
type FineTuningJobHyperparametersNEpochsUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [int64] instead of an object. OfInt int64 `json:",inline"` JSON struct { OfAuto resp.Field OfInt resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobHyperparametersNEpochsUnion contains all possible properties and values from constant.Auto, [int64].
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 OfInt]
func (FineTuningJobHyperparametersNEpochsUnion) AsAuto ¶
func (u FineTuningJobHyperparametersNEpochsUnion) AsAuto() (v constant.Auto)
func (FineTuningJobHyperparametersNEpochsUnion) AsInt ¶
func (u FineTuningJobHyperparametersNEpochsUnion) AsInt() (v int64)
func (FineTuningJobHyperparametersNEpochsUnion) RawJSON ¶
func (u FineTuningJobHyperparametersNEpochsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobHyperparametersNEpochsUnion) UnmarshalJSON ¶
func (r *FineTuningJobHyperparametersNEpochsUnion) UnmarshalJSON(data []byte) error
type FineTuningJobListEventsParams ¶
type FineTuningJobListEventsParams struct { // Identifier for the last event from the previous pagination request. After param.Opt[string] `query:"after,omitzero" json:"-"` // Number of events to retrieve. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // contains filtered or unexported fields }
func (FineTuningJobListEventsParams) IsPresent ¶
func (f FineTuningJobListEventsParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobListEventsParams) URLQuery ¶
func (r FineTuningJobListEventsParams) URLQuery() (v url.Values, err error)
URLQuery serializes FineTuningJobListEventsParams's query parameters as `url.Values`.
type FineTuningJobListParams ¶
type FineTuningJobListParams struct { // Identifier for the last job from the previous pagination request. After param.Opt[string] `query:"after,omitzero" json:"-"` // Number of fine-tuning jobs to retrieve. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Optional metadata filter. To filter, use the syntax `metadata[k]=v`. // Alternatively, set `metadata=null` to indicate no metadata. Metadata map[string]string `query:"metadata,omitzero" json:"-"` // contains filtered or unexported fields }
func (FineTuningJobListParams) IsPresent ¶
func (f FineTuningJobListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobListParams) URLQuery ¶
func (r FineTuningJobListParams) URLQuery() (v url.Values, err error)
URLQuery serializes FineTuningJobListParams's query parameters as `url.Values`.
type FineTuningJobMethod ¶
type FineTuningJobMethod struct { // Configuration for the DPO fine-tuning method. Dpo FineTuningJobMethodDpo `json:"dpo"` // Configuration for the supervised fine-tuning method. Supervised FineTuningJobMethodSupervised `json:"supervised"` // The type of method. Is either `supervised` or `dpo`. // // Any of "supervised", "dpo". Type string `json:"type"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Dpo resp.Field Supervised resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The method used for fine-tuning.
func (FineTuningJobMethod) RawJSON ¶
func (r FineTuningJobMethod) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethod) UnmarshalJSON ¶
func (r *FineTuningJobMethod) UnmarshalJSON(data []byte) error
type FineTuningJobMethodDpo ¶
type FineTuningJobMethodDpo struct { // The hyperparameters used for the fine-tuning job. Hyperparameters FineTuningJobMethodDpoHyperparameters `json:"hyperparameters"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Hyperparameters resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Configuration for the DPO fine-tuning method.
func (FineTuningJobMethodDpo) RawJSON ¶
func (r FineTuningJobMethodDpo) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodDpo) UnmarshalJSON ¶
func (r *FineTuningJobMethodDpo) UnmarshalJSON(data []byte) error
type FineTuningJobMethodDpoHyperparameters ¶
type FineTuningJobMethodDpoHyperparameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize FineTuningJobMethodDpoHyperparametersBatchSizeUnion `json:"batch_size"` // The beta value for the DPO method. A higher beta value will increase the weight // of the penalty between the policy and reference model. Beta FineTuningJobMethodDpoHyperparametersBetaUnion `json:"beta"` // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. LearningRateMultiplier FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion `json:"learning_rate_multiplier"` // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. NEpochs FineTuningJobMethodDpoHyperparametersNEpochsUnion `json:"n_epochs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { BatchSize resp.Field Beta resp.Field LearningRateMultiplier resp.Field NEpochs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The hyperparameters used for the fine-tuning job.
func (FineTuningJobMethodDpoHyperparameters) RawJSON ¶
func (r FineTuningJobMethodDpoHyperparameters) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodDpoHyperparameters) UnmarshalJSON ¶
func (r *FineTuningJobMethodDpoHyperparameters) UnmarshalJSON(data []byte) error
type FineTuningJobMethodDpoHyperparametersBatchSizeUnion ¶
type FineTuningJobMethodDpoHyperparametersBatchSizeUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [int64] instead of an object. OfInt int64 `json:",inline"` JSON struct { OfAuto resp.Field OfInt resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodDpoHyperparametersBatchSizeUnion contains all possible properties and values from constant.Auto, [int64].
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 OfInt]
func (FineTuningJobMethodDpoHyperparametersBatchSizeUnion) AsAuto ¶
func (u FineTuningJobMethodDpoHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodDpoHyperparametersBatchSizeUnion) AsInt ¶
func (u FineTuningJobMethodDpoHyperparametersBatchSizeUnion) AsInt() (v int64)
func (FineTuningJobMethodDpoHyperparametersBatchSizeUnion) RawJSON ¶
func (u FineTuningJobMethodDpoHyperparametersBatchSizeUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodDpoHyperparametersBatchSizeUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodDpoHyperparametersBatchSizeUnion) UnmarshalJSON(data []byte) error
type FineTuningJobMethodDpoHyperparametersBetaUnion ¶
type FineTuningJobMethodDpoHyperparametersBetaUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` JSON struct { OfAuto resp.Field OfFloat resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodDpoHyperparametersBetaUnion contains all possible properties and values from constant.Auto, [float64].
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 OfFloat]
func (FineTuningJobMethodDpoHyperparametersBetaUnion) AsAuto ¶
func (u FineTuningJobMethodDpoHyperparametersBetaUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodDpoHyperparametersBetaUnion) AsFloat ¶
func (u FineTuningJobMethodDpoHyperparametersBetaUnion) AsFloat() (v float64)
func (FineTuningJobMethodDpoHyperparametersBetaUnion) RawJSON ¶
func (u FineTuningJobMethodDpoHyperparametersBetaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodDpoHyperparametersBetaUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodDpoHyperparametersBetaUnion) UnmarshalJSON(data []byte) error
type FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion ¶
type FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` JSON struct { OfAuto resp.Field OfFloat resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion contains all possible properties and values from constant.Auto, [float64].
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 OfFloat]
func (FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) AsAuto ¶
func (u FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) AsFloat ¶
func (u FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) AsFloat() (v float64)
func (FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) RawJSON ¶
func (u FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodDpoHyperparametersLearningRateMultiplierUnion) UnmarshalJSON(data []byte) error
type FineTuningJobMethodDpoHyperparametersNEpochsUnion ¶
type FineTuningJobMethodDpoHyperparametersNEpochsUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [int64] instead of an object. OfInt int64 `json:",inline"` JSON struct { OfAuto resp.Field OfInt resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodDpoHyperparametersNEpochsUnion contains all possible properties and values from constant.Auto, [int64].
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 OfInt]
func (FineTuningJobMethodDpoHyperparametersNEpochsUnion) AsAuto ¶
func (u FineTuningJobMethodDpoHyperparametersNEpochsUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodDpoHyperparametersNEpochsUnion) AsInt ¶
func (u FineTuningJobMethodDpoHyperparametersNEpochsUnion) AsInt() (v int64)
func (FineTuningJobMethodDpoHyperparametersNEpochsUnion) RawJSON ¶
func (u FineTuningJobMethodDpoHyperparametersNEpochsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodDpoHyperparametersNEpochsUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodDpoHyperparametersNEpochsUnion) UnmarshalJSON(data []byte) error
type FineTuningJobMethodSupervised ¶
type FineTuningJobMethodSupervised struct { // The hyperparameters used for the fine-tuning job. Hyperparameters FineTuningJobMethodSupervisedHyperparameters `json:"hyperparameters"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Hyperparameters resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Configuration for the supervised fine-tuning method.
func (FineTuningJobMethodSupervised) RawJSON ¶
func (r FineTuningJobMethodSupervised) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodSupervised) UnmarshalJSON ¶
func (r *FineTuningJobMethodSupervised) UnmarshalJSON(data []byte) error
type FineTuningJobMethodSupervisedHyperparameters ¶
type FineTuningJobMethodSupervisedHyperparameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion `json:"batch_size"` // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. LearningRateMultiplier FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion `json:"learning_rate_multiplier"` // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. NEpochs FineTuningJobMethodSupervisedHyperparametersNEpochsUnion `json:"n_epochs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { BatchSize resp.Field LearningRateMultiplier resp.Field NEpochs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The hyperparameters used for the fine-tuning job.
func (FineTuningJobMethodSupervisedHyperparameters) RawJSON ¶
func (r FineTuningJobMethodSupervisedHyperparameters) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodSupervisedHyperparameters) UnmarshalJSON ¶
func (r *FineTuningJobMethodSupervisedHyperparameters) UnmarshalJSON(data []byte) error
type FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion ¶
type FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [int64] instead of an object. OfInt int64 `json:",inline"` JSON struct { OfAuto resp.Field OfInt resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion contains all possible properties and values from constant.Auto, [int64].
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 OfInt]
func (FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) AsAuto ¶
func (u FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) AsInt ¶
func (u FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) AsInt() (v int64)
func (FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) RawJSON ¶
func (u FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodSupervisedHyperparametersBatchSizeUnion) UnmarshalJSON(data []byte) error
type FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion ¶
type FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` JSON struct { OfAuto resp.Field OfFloat resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion contains all possible properties and values from constant.Auto, [float64].
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 OfFloat]
func (FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) AsAuto ¶
func (u FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) AsFloat ¶
func (u FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) AsFloat() (v float64)
func (FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) RawJSON ¶
func (u FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodSupervisedHyperparametersLearningRateMultiplierUnion) UnmarshalJSON(data []byte) error
type FineTuningJobMethodSupervisedHyperparametersNEpochsUnion ¶
type FineTuningJobMethodSupervisedHyperparametersNEpochsUnion struct { // This field will be present if the value is a [constant.Auto] instead of an // object. OfAuto constant.Auto `json:",inline"` // This field will be present if the value is a [int64] instead of an object. OfInt int64 `json:",inline"` JSON struct { OfAuto resp.Field OfInt resp.Field // contains filtered or unexported fields } `json:"-"` }
FineTuningJobMethodSupervisedHyperparametersNEpochsUnion contains all possible properties and values from constant.Auto, [int64].
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 OfInt]
func (FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) AsAuto ¶
func (u FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) AsAuto() (v constant.Auto)
func (FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) AsInt ¶
func (u FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) AsInt() (v int64)
func (FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) RawJSON ¶
func (u FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) UnmarshalJSON ¶
func (r *FineTuningJobMethodSupervisedHyperparametersNEpochsUnion) UnmarshalJSON(data []byte) error
type FineTuningJobNewParams ¶
type FineTuningJobNewParams struct { // The name of the model to fine-tune. You can select one of the // [supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned). Model FineTuningJobNewParamsModel `json:"model,omitzero,required"` // The ID of an uploaded file that contains training data. // // See [upload file](https://platform.openai.com/docs/api-reference/files/create) // for how to upload a file. // // Your dataset must be formatted as a JSONL file. Additionally, you must upload // your file with the purpose `fine-tune`. // // The contents of the file should differ depending on if the model uses the // [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input), // [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) // format, or if the fine-tuning method uses the // [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input) // format. // // See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) // for more details. TrainingFile string `json:"training_file,required"` // The seed controls the reproducibility of the job. Passing in the same seed and // job parameters should produce the same results, but may differ in rare cases. If // a seed is not specified, one will be generated for you. Seed param.Opt[int64] `json:"seed,omitzero"` // A string of up to 64 characters that will be added to your fine-tuned model // name. // // For example, a `suffix` of "custom-model-name" would produce a model name like // `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. Suffix param.Opt[string] `json:"suffix,omitzero"` // The ID of an uploaded file that contains validation data. // // If you provide this file, the data is used to generate validation metrics // periodically during fine-tuning. These metrics can be viewed in the fine-tuning // results file. The same data should not be present in both train and validation // files. // // Your dataset must be formatted as a JSONL file. You must upload your file with // the purpose `fine-tune`. // // See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) // for more details. ValidationFile param.Opt[string] `json:"validation_file,omitzero"` // A list of integrations to enable for your fine-tuning job. Integrations []FineTuningJobNewParamsIntegration `json:"integrations,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // The hyperparameters used for the fine-tuning job. This value is now deprecated // in favor of `method`, and should be passed in under the `method` parameter. Hyperparameters FineTuningJobNewParamsHyperparameters `json:"hyperparameters,omitzero"` // The method used for fine-tuning. Method FineTuningJobNewParamsMethod `json:"method,omitzero"` // contains filtered or unexported fields }
func (FineTuningJobNewParams) IsPresent ¶
func (f FineTuningJobNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParams) MarshalJSON ¶
func (r FineTuningJobNewParams) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsHyperparameters
deprecated
type FineTuningJobNewParamsHyperparameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize FineTuningJobNewParamsHyperparametersBatchSizeUnion `json:"batch_size,omitzero"` // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. LearningRateMultiplier FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion `json:"learning_rate_multiplier,omitzero"` // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. NEpochs FineTuningJobNewParamsHyperparametersNEpochsUnion `json:"n_epochs,omitzero"` // contains filtered or unexported fields }
The hyperparameters used for the fine-tuning job. This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.
Deprecated: deprecated
func (FineTuningJobNewParamsHyperparameters) IsPresent ¶
func (f FineTuningJobNewParamsHyperparameters) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsHyperparameters) MarshalJSON ¶
func (r FineTuningJobNewParamsHyperparameters) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsHyperparametersBatchSizeUnion ¶
type FineTuningJobNewParamsHyperparametersBatchSizeUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfInt param.Opt[int64] `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 (FineTuningJobNewParamsHyperparametersBatchSizeUnion) IsPresent ¶
func (u FineTuningJobNewParamsHyperparametersBatchSizeUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsHyperparametersBatchSizeUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsHyperparametersBatchSizeUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion ¶
type FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfFloat param.Opt[float64] `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 (FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion) IsPresent ¶
func (u FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsHyperparametersNEpochsUnion ¶
type FineTuningJobNewParamsHyperparametersNEpochsUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfInt param.Opt[int64] `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 (FineTuningJobNewParamsHyperparametersNEpochsUnion) IsPresent ¶
func (u FineTuningJobNewParamsHyperparametersNEpochsUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsHyperparametersNEpochsUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsHyperparametersNEpochsUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsIntegration ¶
type FineTuningJobNewParamsIntegration struct { // The settings for your integration with Weights and Biases. This payload // specifies the project that metrics will be sent to. Optionally, you can set an // explicit display name for your run, add tags to your run, and set a default // entity (team, username, etc) to be associated with your run. Wandb FineTuningJobNewParamsIntegrationWandb `json:"wandb,omitzero,required"` // The type of integration to enable. Currently, only "wandb" (Weights and Biases) // is supported. // // This field can be elided, and will marshal its zero value as "wandb". Type constant.Wandb `json:"type,required"` // contains filtered or unexported fields }
The properties Type, Wandb are required.
func (FineTuningJobNewParamsIntegration) IsPresent ¶
func (f FineTuningJobNewParamsIntegration) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsIntegration) MarshalJSON ¶
func (r FineTuningJobNewParamsIntegration) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsIntegrationWandb ¶
type FineTuningJobNewParamsIntegrationWandb struct { // The name of the project that the new run will be created under. Project string `json:"project,required"` // The entity to use for the run. This allows you to set the team or username of // the WandB user that you would like associated with the run. If not set, the // default entity for the registered WandB API key is used. Entity param.Opt[string] `json:"entity,omitzero"` // A display name to set for the run. If not set, we will use the Job ID as the // name. Name param.Opt[string] `json:"name,omitzero"` // A list of tags to be attached to the newly created run. These tags are passed // through directly to WandB. Some default tags are generated by OpenAI: // "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". Tags []string `json:"tags,omitzero"` // contains filtered or unexported fields }
The settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
The property Project is required.
func (FineTuningJobNewParamsIntegrationWandb) IsPresent ¶
func (f FineTuningJobNewParamsIntegrationWandb) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsIntegrationWandb) MarshalJSON ¶
func (r FineTuningJobNewParamsIntegrationWandb) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsMethod ¶
type FineTuningJobNewParamsMethod struct { // Configuration for the DPO fine-tuning method. Dpo FineTuningJobNewParamsMethodDpo `json:"dpo,omitzero"` // Configuration for the supervised fine-tuning method. Supervised FineTuningJobNewParamsMethodSupervised `json:"supervised,omitzero"` // The type of method. Is either `supervised` or `dpo`. // // Any of "supervised", "dpo". Type string `json:"type,omitzero"` // contains filtered or unexported fields }
The method used for fine-tuning.
func (FineTuningJobNewParamsMethod) IsPresent ¶
func (f FineTuningJobNewParamsMethod) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethod) MarshalJSON ¶
func (r FineTuningJobNewParamsMethod) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsMethodDpo ¶
type FineTuningJobNewParamsMethodDpo struct { // The hyperparameters used for the fine-tuning job. Hyperparameters FineTuningJobNewParamsMethodDpoHyperparameters `json:"hyperparameters,omitzero"` // contains filtered or unexported fields }
Configuration for the DPO fine-tuning method.
func (FineTuningJobNewParamsMethodDpo) IsPresent ¶
func (f FineTuningJobNewParamsMethodDpo) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodDpo) MarshalJSON ¶
func (r FineTuningJobNewParamsMethodDpo) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsMethodDpoHyperparameters ¶
type FineTuningJobNewParamsMethodDpoHyperparameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion `json:"batch_size,omitzero"` // The beta value for the DPO method. A higher beta value will increase the weight // of the penalty between the policy and reference model. Beta FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion `json:"beta,omitzero"` // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. LearningRateMultiplier FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion `json:"learning_rate_multiplier,omitzero"` // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. NEpochs FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion `json:"n_epochs,omitzero"` // contains filtered or unexported fields }
The hyperparameters used for the fine-tuning job.
func (FineTuningJobNewParamsMethodDpoHyperparameters) IsPresent ¶
func (f FineTuningJobNewParamsMethodDpoHyperparameters) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodDpoHyperparameters) MarshalJSON ¶
func (r FineTuningJobNewParamsMethodDpoHyperparameters) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion ¶
type FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfInt param.Opt[int64] `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 (FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersBatchSizeUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion ¶
type FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfFloat param.Opt[float64] `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 (FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersBetaUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion ¶
type FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfFloat param.Opt[float64] `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 (FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersLearningRateMultiplierUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion ¶
type FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfInt param.Opt[int64] `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 (FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodDpoHyperparametersNEpochsUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsMethodSupervised ¶
type FineTuningJobNewParamsMethodSupervised struct { // The hyperparameters used for the fine-tuning job. Hyperparameters FineTuningJobNewParamsMethodSupervisedHyperparameters `json:"hyperparameters,omitzero"` // contains filtered or unexported fields }
Configuration for the supervised fine-tuning method.
func (FineTuningJobNewParamsMethodSupervised) IsPresent ¶
func (f FineTuningJobNewParamsMethodSupervised) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodSupervised) MarshalJSON ¶
func (r FineTuningJobNewParamsMethodSupervised) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsMethodSupervisedHyperparameters ¶
type FineTuningJobNewParamsMethodSupervisedHyperparameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion `json:"batch_size,omitzero"` // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. LearningRateMultiplier FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion `json:"learning_rate_multiplier,omitzero"` // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. NEpochs FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion `json:"n_epochs,omitzero"` // contains filtered or unexported fields }
The hyperparameters used for the fine-tuning job.
func (FineTuningJobNewParamsMethodSupervisedHyperparameters) IsPresent ¶
func (f FineTuningJobNewParamsMethodSupervisedHyperparameters) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodSupervisedHyperparameters) MarshalJSON ¶
func (r FineTuningJobNewParamsMethodSupervisedHyperparameters) MarshalJSON() (data []byte, err error)
type FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion ¶
type FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfInt param.Opt[int64] `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 (FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodSupervisedHyperparametersBatchSizeUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion ¶
type FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfFloat param.Opt[float64] `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 (FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodSupervisedHyperparametersLearningRateMultiplierUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion ¶
type FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion struct { // Construct this variant with constant.New[constant.Auto]() Check if union is this // variant with !param.IsOmitted(union.OfAuto) OfAuto constant.Auto `json:",omitzero,inline"` OfInt param.Opt[int64] `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 (FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion) IsPresent ¶
func (u FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion) MarshalJSON ¶
func (u FineTuningJobNewParamsMethodSupervisedHyperparametersNEpochsUnion) MarshalJSON() ([]byte, error)
type FineTuningJobNewParamsModel ¶
type FineTuningJobNewParamsModel string
The name of the model to fine-tune. You can select one of the [supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned).
const ( FineTuningJobNewParamsModelBabbage002 FineTuningJobNewParamsModel = "babbage-002" FineTuningJobNewParamsModelDavinci002 FineTuningJobNewParamsModel = "davinci-002" FineTuningJobNewParamsModelGPT3_5Turbo FineTuningJobNewParamsModel = "gpt-3.5-turbo" FineTuningJobNewParamsModelGPT4oMini FineTuningJobNewParamsModel = "gpt-4o-mini" )
type FineTuningJobService ¶
type FineTuningJobService struct { Options []option.RequestOption Checkpoints FineTuningJobCheckpointService }
FineTuningJobService 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 NewFineTuningJobService method instead.
func NewFineTuningJobService ¶
func NewFineTuningJobService(opts ...option.RequestOption) (r FineTuningJobService)
NewFineTuningJobService 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 (*FineTuningJobService) Cancel ¶
func (r *FineTuningJobService) Cancel(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error)
Immediately cancel a fine-tune job.
func (*FineTuningJobService) Get ¶
func (r *FineTuningJobService) Get(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error)
Get info about a fine-tuning job.
[Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
func (*FineTuningJobService) List ¶
func (r *FineTuningJobService) List(ctx context.Context, query FineTuningJobListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FineTuningJob], err error)
List your organization's fine-tuning jobs
func (*FineTuningJobService) ListAutoPaging ¶
func (r *FineTuningJobService) ListAutoPaging(ctx context.Context, query FineTuningJobListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[FineTuningJob]
List your organization's fine-tuning jobs
func (*FineTuningJobService) ListEvents ¶
func (r *FineTuningJobService) ListEvents(ctx context.Context, fineTuningJobID string, query FineTuningJobListEventsParams, opts ...option.RequestOption) (res *pagination.CursorPage[FineTuningJobEvent], err error)
Get status updates for a fine-tuning job.
func (*FineTuningJobService) ListEventsAutoPaging ¶
func (r *FineTuningJobService) ListEventsAutoPaging(ctx context.Context, fineTuningJobID string, query FineTuningJobListEventsParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[FineTuningJobEvent]
Get status updates for a fine-tuning job.
func (*FineTuningJobService) New ¶
func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewParams, opts ...option.RequestOption) (res *FineTuningJob, err error)
Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
[Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
type FineTuningJobStatus ¶
type FineTuningJobStatus string
The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`.
const ( FineTuningJobStatusValidatingFiles FineTuningJobStatus = "validating_files" FineTuningJobStatusQueued FineTuningJobStatus = "queued" FineTuningJobStatusRunning FineTuningJobStatus = "running" FineTuningJobStatusSucceeded FineTuningJobStatus = "succeeded" FineTuningJobStatusFailed FineTuningJobStatus = "failed" FineTuningJobStatusCancelled FineTuningJobStatus = "cancelled" )
type FineTuningJobWandbIntegration ¶
type FineTuningJobWandbIntegration struct { // The name of the project that the new run will be created under. Project string `json:"project,required"` // The entity to use for the run. This allows you to set the team or username of // the WandB user that you would like associated with the run. If not set, the // default entity for the registered WandB API key is used. Entity string `json:"entity,nullable"` // A display name to set for the run. If not set, we will use the Job ID as the // name. Name string `json:"name,nullable"` // A list of tags to be attached to the newly created run. These tags are passed // through directly to WandB. Some default tags are generated by OpenAI: // "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". Tags []string `json:"tags"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Project resp.Field Entity resp.Field Name resp.Field Tags resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.
func (FineTuningJobWandbIntegration) RawJSON ¶
func (r FineTuningJobWandbIntegration) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobWandbIntegration) UnmarshalJSON ¶
func (r *FineTuningJobWandbIntegration) UnmarshalJSON(data []byte) error
type FineTuningJobWandbIntegrationObject ¶
type FineTuningJobWandbIntegrationObject struct { // The type of the integration being enabled for the fine-tuning job Type constant.Wandb `json:"type,required"` // The settings for your integration with Weights and Biases. This payload // specifies the project that metrics will be sent to. Optionally, you can set an // explicit display name for your run, add tags to your run, and set a default // entity (team, username, etc) to be associated with your run. Wandb FineTuningJobWandbIntegration `json:"wandb,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field Wandb resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FineTuningJobWandbIntegrationObject) RawJSON ¶
func (r FineTuningJobWandbIntegrationObject) RawJSON() string
Returns the unmodified JSON received from the API
func (*FineTuningJobWandbIntegrationObject) UnmarshalJSON ¶
func (r *FineTuningJobWandbIntegrationObject) UnmarshalJSON(data []byte) error
type FineTuningService ¶
type FineTuningService struct { Options []option.RequestOption Jobs FineTuningJobService Checkpoints FineTuningCheckpointService }
FineTuningService 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 NewFineTuningService method instead.
func NewFineTuningService ¶
func NewFineTuningService(opts ...option.RequestOption) (r FineTuningService)
NewFineTuningService 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 FinishedChatCompletionToolCall ¶
type FinishedChatCompletionToolCall struct { ChatCompletionMessageToolCallFunction Index int Id string }
type FunctionDefinition ¶
type FunctionDefinition = shared.FunctionDefinition
This is an alias to an internal type.
type FunctionDefinitionParam ¶
type FunctionDefinitionParam = shared.FunctionDefinitionParam
This is an alias to an internal type.
type FunctionParameters ¶
type FunctionParameters = shared.FunctionParameters
The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.
Omitting `parameters` defines a function with an empty parameter list.
This is an alias to an internal type.
type FunctionTool ¶
type FunctionTool struct { Function shared.FunctionDefinition `json:"function,required"` // The type of tool being defined: `function` Type constant.Function `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Function resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FunctionTool) RawJSON ¶
func (r FunctionTool) RawJSON() string
Returns the unmodified JSON received from the API
func (FunctionTool) ToParam ¶
func (r FunctionTool) ToParam() FunctionToolParam
ToParam converts this FunctionTool to a FunctionToolParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FunctionToolParam.IsOverridden()
func (*FunctionTool) UnmarshalJSON ¶
func (r *FunctionTool) UnmarshalJSON(data []byte) error
type FunctionToolCall ¶
type FunctionToolCall struct { // The ID of the tool call object. ID string `json:"id,required"` // The definition of the function that was called. Function FunctionToolCallFunction `json:"function,required"` // The type of tool call. This is always going to be `function` for this type of // tool call. Type constant.Function `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Function resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FunctionToolCall) RawJSON ¶
func (r FunctionToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*FunctionToolCall) UnmarshalJSON ¶
func (r *FunctionToolCall) UnmarshalJSON(data []byte) error
type FunctionToolCallDelta ¶
type FunctionToolCallDelta struct { // The index of the tool call in the tool calls array. Index int64 `json:"index,required"` // The type of tool call. This is always going to be `function` for this type of // tool call. Type constant.Function `json:"type,required"` // The ID of the tool call object. ID string `json:"id"` // The definition of the function that was called. Function FunctionToolCallDeltaFunction `json:"function"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field ID resp.Field Function resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (FunctionToolCallDelta) RawJSON ¶
func (r FunctionToolCallDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*FunctionToolCallDelta) UnmarshalJSON ¶
func (r *FunctionToolCallDelta) UnmarshalJSON(data []byte) error
type FunctionToolCallDeltaFunction ¶
type FunctionToolCallDeltaFunction struct { // The arguments passed to the function. Arguments string `json:"arguments"` // The name of the function. Name string `json:"name"` // The output of the function. This will be `null` if the outputs have not been // [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) // yet. Output string `json:"output,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field Output resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The definition of the function that was called.
func (FunctionToolCallDeltaFunction) RawJSON ¶
func (r FunctionToolCallDeltaFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (*FunctionToolCallDeltaFunction) UnmarshalJSON ¶
func (r *FunctionToolCallDeltaFunction) UnmarshalJSON(data []byte) error
type FunctionToolCallFunction ¶
type FunctionToolCallFunction struct { // The arguments passed to the function. Arguments string `json:"arguments,required"` // The name of the function. Name string `json:"name,required"` // The output of the function. This will be `null` if the outputs have not been // [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) // yet. Output string `json:"output,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field Output resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The definition of the function that was called.
func (FunctionToolCallFunction) RawJSON ¶
func (r FunctionToolCallFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (*FunctionToolCallFunction) UnmarshalJSON ¶
func (r *FunctionToolCallFunction) UnmarshalJSON(data []byte) error
type FunctionToolParam ¶
type FunctionToolParam struct { Function shared.FunctionDefinitionParam `json:"function,omitzero,required"` // The type of tool being defined: `function` // // This field can be elided, and will marshal its zero value as "function". Type constant.Function `json:"type,required"` // contains filtered or unexported fields }
The properties Function, Type are required.
func (FunctionToolParam) IsPresent ¶
func (f FunctionToolParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (FunctionToolParam) MarshalJSON ¶
func (r FunctionToolParam) MarshalJSON() (data []byte, err error)
type Image ¶
type Image struct { // The base64-encoded JSON of the generated image, if `response_format` is // `b64_json`. B64JSON string `json:"b64_json"` // The prompt that was used to generate the image, if there was any revision to the // prompt. RevisedPrompt string `json:"revised_prompt"` // The URL of the generated image, if `response_format` is `url` (default). URL string `json:"url"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { B64JSON resp.Field RevisedPrompt resp.Field URL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents the url or the content of an image generated by the OpenAI API.
func (*Image) UnmarshalJSON ¶
type ImageEditParams ¶
type ImageEditParams struct { // The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask // is not provided, image must have transparency, which will be used as the mask. Image io.Reader `json:"image,required" format:"binary"` // A text description of the desired image(s). The maximum length is 1000 // characters. Prompt string `json:"prompt,required"` // The number of images to generate. Must be between 1 and 10. N param.Opt[int64] `json:"n,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // The model to use for image generation. Only `dall-e-2` is supported at this // time. Model ImageModel `json:"model,omitzero"` // The format in which the generated images are returned. Must be one of `url` or // `b64_json`. URLs are only valid for 60 minutes after the image has been // generated. // // Any of "url", "b64_json". ResponseFormat ImageEditParamsResponseFormat `json:"response_format,omitzero"` // The size of the generated images. Must be one of `256x256`, `512x512`, or // `1024x1024`. // // Any of "256x256", "512x512", "1024x1024". Size ImageEditParamsSize `json:"size,omitzero"` // An additional image whose fully transparent areas (e.g. where alpha is zero) // indicate where `image` should be edited. Must be a valid PNG file, less than // 4MB, and have the same dimensions as `image`. Mask io.Reader `json:"mask" format:"binary"` // contains filtered or unexported fields }
func (ImageEditParams) IsPresent ¶
func (f ImageEditParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageEditParams) MarshalMultipart ¶
func (r ImageEditParams) MarshalMultipart() (data []byte, contentType string, err error)
type ImageEditParamsResponseFormat ¶
type ImageEditParamsResponseFormat string
The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
const ( ImageEditParamsResponseFormatURL ImageEditParamsResponseFormat = "url" ImageEditParamsResponseFormatB64JSON ImageEditParamsResponseFormat = "b64_json" )
type ImageEditParamsSize ¶
type ImageEditParamsSize string
The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
const ( ImageEditParamsSize256x256 ImageEditParamsSize = "256x256" ImageEditParamsSize512x512 ImageEditParamsSize = "512x512" ImageEditParamsSize1024x1024 ImageEditParamsSize = "1024x1024" )
type ImageFile ¶
type ImageFile struct { // The [File](https://platform.openai.com/docs/api-reference/files) ID of the image // in the message content. Set `purpose="vision"` when uploading the File if you // need to later display the file content. FileID string `json:"file_id,required"` // Specifies the detail level of the image if specified by the user. `low` uses // fewer tokens, you can opt in to high resolution using `high`. // // Any of "auto", "low", "high". Detail ImageFileDetail `json:"detail"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Detail resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ImageFile) ToParam ¶
func (r ImageFile) ToParam() ImageFileParam
ToParam converts this ImageFile to a ImageFileParam.
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 ImageFileParam.IsOverridden()
func (*ImageFile) UnmarshalJSON ¶
type ImageFileContentBlock ¶
type ImageFileContentBlock struct { ImageFile ImageFile `json:"image_file,required"` // Always `image_file`. Type constant.ImageFile `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ImageFile resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
References an image File(https://platform.openai.com/docs/api-reference/files) in the content of a message.
func (ImageFileContentBlock) RawJSON ¶
func (r ImageFileContentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ImageFileContentBlock) ToParam ¶
func (r ImageFileContentBlock) ToParam() ImageFileContentBlockParam
ToParam converts this ImageFileContentBlock to a ImageFileContentBlockParam.
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 ImageFileContentBlockParam.IsOverridden()
func (*ImageFileContentBlock) UnmarshalJSON ¶
func (r *ImageFileContentBlock) UnmarshalJSON(data []byte) error
type ImageFileContentBlockParam ¶
type ImageFileContentBlockParam struct { ImageFile ImageFileParam `json:"image_file,omitzero,required"` // Always `image_file`. // // This field can be elided, and will marshal its zero value as "image_file". Type constant.ImageFile `json:"type,required"` // contains filtered or unexported fields }
References an image File(https://platform.openai.com/docs/api-reference/files) in the content of a message.
The properties ImageFile, Type are required.
func (ImageFileContentBlockParam) IsPresent ¶
func (f ImageFileContentBlockParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageFileContentBlockParam) MarshalJSON ¶
func (r ImageFileContentBlockParam) MarshalJSON() (data []byte, err error)
type ImageFileDelta ¶
type ImageFileDelta struct { // Specifies the detail level of the image if specified by the user. `low` uses // fewer tokens, you can opt in to high resolution using `high`. // // Any of "auto", "low", "high". Detail ImageFileDeltaDetail `json:"detail"` // The [File](https://platform.openai.com/docs/api-reference/files) ID of the image // in the message content. Set `purpose="vision"` when uploading the File if you // need to later display the file content. FileID string `json:"file_id"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Detail resp.Field FileID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ImageFileDelta) RawJSON ¶
func (r ImageFileDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*ImageFileDelta) UnmarshalJSON ¶
func (r *ImageFileDelta) UnmarshalJSON(data []byte) error
type ImageFileDeltaBlock ¶
type ImageFileDeltaBlock struct { // The index of the content part in the message. Index int64 `json:"index,required"` // Always `image_file`. Type constant.ImageFile `json:"type,required"` ImageFile ImageFileDelta `json:"image_file"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field ImageFile resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
References an image File(https://platform.openai.com/docs/api-reference/files) in the content of a message.
func (ImageFileDeltaBlock) RawJSON ¶
func (r ImageFileDeltaBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*ImageFileDeltaBlock) UnmarshalJSON ¶
func (r *ImageFileDeltaBlock) UnmarshalJSON(data []byte) error
type ImageFileDeltaDetail ¶
type ImageFileDeltaDetail string
Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.
const ( ImageFileDeltaDetailAuto ImageFileDeltaDetail = "auto" ImageFileDeltaDetailLow ImageFileDeltaDetail = "low" ImageFileDeltaDetailHigh ImageFileDeltaDetail = "high" )
type ImageFileDetail ¶
type ImageFileDetail string
Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`.
const ( ImageFileDetailAuto ImageFileDetail = "auto" ImageFileDetailLow ImageFileDetail = "low" ImageFileDetailHigh ImageFileDetail = "high" )
type ImageFileParam ¶
type ImageFileParam struct { // The [File](https://platform.openai.com/docs/api-reference/files) ID of the image // in the message content. Set `purpose="vision"` when uploading the File if you // need to later display the file content. FileID string `json:"file_id,required"` // Specifies the detail level of the image if specified by the user. `low` uses // fewer tokens, you can opt in to high resolution using `high`. // // Any of "auto", "low", "high". Detail ImageFileDetail `json:"detail,omitzero"` // contains filtered or unexported fields }
The property FileID is required.
func (ImageFileParam) IsPresent ¶
func (f ImageFileParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageFileParam) MarshalJSON ¶
func (r ImageFileParam) MarshalJSON() (data []byte, err error)
type ImageGenerateParams ¶
type ImageGenerateParams struct { // A text description of the desired image(s). The maximum length is 1000 // characters for `dall-e-2` and 4000 characters for `dall-e-3`. Prompt string `json:"prompt,required"` // The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only // `n=1` is supported. N param.Opt[int64] `json:"n,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // The model to use for image generation. Model ImageModel `json:"model,omitzero"` // The format in which the generated images are returned. Must be one of `url` or // `b64_json`. URLs are only valid for 60 minutes after the image has been // generated. // // Any of "url", "b64_json". ResponseFormat ImageGenerateParamsResponseFormat `json:"response_format,omitzero"` // The size of the generated images. Must be one of `256x256`, `512x512`, or // `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or // `1024x1792` for `dall-e-3` models. // // Any of "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792". Size ImageGenerateParamsSize `json:"size,omitzero"` // The style of the generated images. Must be one of `vivid` or `natural`. Vivid // causes the model to lean towards generating hyper-real and dramatic images. // Natural causes the model to produce more natural, less hyper-real looking // images. This param is only supported for `dall-e-3`. // // Any of "vivid", "natural". Style ImageGenerateParamsStyle `json:"style,omitzero"` // The quality of the image that will be generated. `hd` creates images with finer // details and greater consistency across the image. This param is only supported // for `dall-e-3`. // // Any of "standard", "hd". Quality ImageGenerateParamsQuality `json:"quality,omitzero"` // contains filtered or unexported fields }
func (ImageGenerateParams) IsPresent ¶
func (f ImageGenerateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageGenerateParams) MarshalJSON ¶
func (r ImageGenerateParams) MarshalJSON() (data []byte, err error)
type ImageGenerateParamsQuality ¶
type ImageGenerateParamsQuality string
The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`.
const ( ImageGenerateParamsQualityStandard ImageGenerateParamsQuality = "standard" ImageGenerateParamsQualityHD ImageGenerateParamsQuality = "hd" )
type ImageGenerateParamsResponseFormat ¶
type ImageGenerateParamsResponseFormat string
The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
const ( ImageGenerateParamsResponseFormatURL ImageGenerateParamsResponseFormat = "url" ImageGenerateParamsResponseFormatB64JSON ImageGenerateParamsResponseFormat = "b64_json" )
type ImageGenerateParamsSize ¶
type ImageGenerateParamsSize string
The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models.
const ( ImageGenerateParamsSize256x256 ImageGenerateParamsSize = "256x256" ImageGenerateParamsSize512x512 ImageGenerateParamsSize = "512x512" ImageGenerateParamsSize1024x1024 ImageGenerateParamsSize = "1024x1024" ImageGenerateParamsSize1792x1024 ImageGenerateParamsSize = "1792x1024" ImageGenerateParamsSize1024x1792 ImageGenerateParamsSize = "1024x1792" )
type ImageGenerateParamsStyle ¶
type ImageGenerateParamsStyle string
The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`.
const ( ImageGenerateParamsStyleVivid ImageGenerateParamsStyle = "vivid" ImageGenerateParamsStyleNatural ImageGenerateParamsStyle = "natural" )
type ImageModel ¶
type ImageModel = string
const ( ImageModelDallE2 ImageModel = "dall-e-2" ImageModelDallE3 ImageModel = "dall-e-3" )
type ImageNewVariationParams ¶
type ImageNewVariationParams struct { // The image to use as the basis for the variation(s). Must be a valid PNG file, // less than 4MB, and square. Image io.Reader `json:"image,required" format:"binary"` // The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only // `n=1` is supported. N param.Opt[int64] `json:"n,omitzero"` // A unique identifier representing your end-user, which can help OpenAI to monitor // and detect abuse. // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). User param.Opt[string] `json:"user,omitzero"` // The model to use for image generation. Only `dall-e-2` is supported at this // time. Model ImageModel `json:"model,omitzero"` // The format in which the generated images are returned. Must be one of `url` or // `b64_json`. URLs are only valid for 60 minutes after the image has been // generated. // // Any of "url", "b64_json". ResponseFormat ImageNewVariationParamsResponseFormat `json:"response_format,omitzero"` // The size of the generated images. Must be one of `256x256`, `512x512`, or // `1024x1024`. // // Any of "256x256", "512x512", "1024x1024". Size ImageNewVariationParamsSize `json:"size,omitzero"` // contains filtered or unexported fields }
func (ImageNewVariationParams) IsPresent ¶
func (f ImageNewVariationParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageNewVariationParams) MarshalMultipart ¶
func (r ImageNewVariationParams) MarshalMultipart() (data []byte, contentType string, err error)
type ImageNewVariationParamsResponseFormat ¶
type ImageNewVariationParamsResponseFormat string
The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
const ( ImageNewVariationParamsResponseFormatURL ImageNewVariationParamsResponseFormat = "url" ImageNewVariationParamsResponseFormatB64JSON ImageNewVariationParamsResponseFormat = "b64_json" )
type ImageNewVariationParamsSize ¶
type ImageNewVariationParamsSize string
The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
const ( ImageNewVariationParamsSize256x256 ImageNewVariationParamsSize = "256x256" ImageNewVariationParamsSize512x512 ImageNewVariationParamsSize = "512x512" ImageNewVariationParamsSize1024x1024 ImageNewVariationParamsSize = "1024x1024" )
type ImageService ¶
type ImageService struct {
Options []option.RequestOption
}
ImageService 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 NewImageService method instead.
func NewImageService ¶
func NewImageService(opts ...option.RequestOption) (r ImageService)
NewImageService 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 (*ImageService) Edit ¶
func (r *ImageService) Edit(ctx context.Context, body ImageEditParams, opts ...option.RequestOption) (res *ImagesResponse, err error)
Creates an edited or extended image given an original image and a prompt.
func (*ImageService) Generate ¶
func (r *ImageService) Generate(ctx context.Context, body ImageGenerateParams, opts ...option.RequestOption) (res *ImagesResponse, err error)
Creates an image given a prompt.
func (*ImageService) NewVariation ¶
func (r *ImageService) NewVariation(ctx context.Context, body ImageNewVariationParams, opts ...option.RequestOption) (res *ImagesResponse, err error)
Creates a variation of a given image.
type ImageURL ¶
type ImageURL struct { // The external URL of the image, must be a supported image types: jpeg, jpg, png, // gif, webp. URL string `json:"url,required" format:"uri"` // Specifies the detail level of the image. `low` uses fewer tokens, you can opt in // to high resolution using `high`. Default value is `auto` // // Any of "auto", "low", "high". Detail ImageURLDetail `json:"detail"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { URL resp.Field Detail resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ImageURL) ToParam ¶
func (r ImageURL) ToParam() ImageURLParam
ToParam converts this ImageURL to a ImageURLParam.
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 ImageURLParam.IsOverridden()
func (*ImageURL) UnmarshalJSON ¶
type ImageURLContentBlock ¶
type ImageURLContentBlock struct { ImageURL ImageURL `json:"image_url,required"` // The type of the content part. Type constant.ImageURL `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ImageURL resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
References an image URL in the content of a message.
func (ImageURLContentBlock) RawJSON ¶
func (r ImageURLContentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (ImageURLContentBlock) ToParam ¶
func (r ImageURLContentBlock) ToParam() ImageURLContentBlockParam
ToParam converts this ImageURLContentBlock to a ImageURLContentBlockParam.
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 ImageURLContentBlockParam.IsOverridden()
func (*ImageURLContentBlock) UnmarshalJSON ¶
func (r *ImageURLContentBlock) UnmarshalJSON(data []byte) error
type ImageURLContentBlockParam ¶
type ImageURLContentBlockParam struct { ImageURL ImageURLParam `json:"image_url,omitzero,required"` // The type of the content part. // // This field can be elided, and will marshal its zero value as "image_url". Type constant.ImageURL `json:"type,required"` // contains filtered or unexported fields }
References an image URL in the content of a message.
The properties ImageURL, Type are required.
func (ImageURLContentBlockParam) IsPresent ¶
func (f ImageURLContentBlockParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageURLContentBlockParam) MarshalJSON ¶
func (r ImageURLContentBlockParam) MarshalJSON() (data []byte, err error)
type ImageURLDelta ¶
type ImageURLDelta struct { // Specifies the detail level of the image. `low` uses fewer tokens, you can opt in // to high resolution using `high`. // // Any of "auto", "low", "high". Detail ImageURLDeltaDetail `json:"detail"` // The URL of the image, must be a supported image types: jpeg, jpg, png, gif, // webp. URL string `json:"url"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Detail resp.Field URL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ImageURLDelta) RawJSON ¶
func (r ImageURLDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*ImageURLDelta) UnmarshalJSON ¶
func (r *ImageURLDelta) UnmarshalJSON(data []byte) error
type ImageURLDeltaBlock ¶
type ImageURLDeltaBlock struct { // The index of the content part in the message. Index int64 `json:"index,required"` // Always `image_url`. Type constant.ImageURL `json:"type,required"` ImageURL ImageURLDelta `json:"image_url"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field ImageURL resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
References an image URL in the content of a message.
func (ImageURLDeltaBlock) RawJSON ¶
func (r ImageURLDeltaBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*ImageURLDeltaBlock) UnmarshalJSON ¶
func (r *ImageURLDeltaBlock) UnmarshalJSON(data []byte) error
type ImageURLDeltaDetail ¶
type ImageURLDeltaDetail string
Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`.
const ( ImageURLDeltaDetailAuto ImageURLDeltaDetail = "auto" ImageURLDeltaDetailLow ImageURLDeltaDetail = "low" ImageURLDeltaDetailHigh ImageURLDeltaDetail = "high" )
type ImageURLDetail ¶
type ImageURLDetail string
Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`
const ( ImageURLDetailAuto ImageURLDetail = "auto" ImageURLDetailLow ImageURLDetail = "low" ImageURLDetailHigh ImageURLDetail = "high" )
type ImageURLParam ¶
type ImageURLParam struct { // The external URL of the image, must be a supported image types: jpeg, jpg, png, // gif, webp. URL string `json:"url,required" format:"uri"` // Specifies the detail level of the image. `low` uses fewer tokens, you can opt in // to high resolution using `high`. Default value is `auto` // // Any of "auto", "low", "high". Detail ImageURLDetail `json:"detail,omitzero"` // contains filtered or unexported fields }
The property URL is required.
func (ImageURLParam) IsPresent ¶
func (f ImageURLParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ImageURLParam) MarshalJSON ¶
func (r ImageURLParam) MarshalJSON() (data []byte, err error)
type ImagesResponse ¶
type ImagesResponse struct { Created int64 `json:"created,required"` Data []Image `json:"data,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Created resp.Field Data resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ImagesResponse) RawJSON ¶
func (r ImagesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ImagesResponse) UnmarshalJSON ¶
func (r *ImagesResponse) UnmarshalJSON(data []byte) error
type Message ¶
type Message struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // If applicable, the ID of the // [assistant](https://platform.openai.com/docs/api-reference/assistants) that // authored this message. AssistantID string `json:"assistant_id,required"` // A list of files attached to the message, and the tools they were added to. Attachments []MessageAttachment `json:"attachments,required"` // The Unix timestamp (in seconds) for when the message was completed. CompletedAt int64 `json:"completed_at,required"` // The content of the message in array of text and/or images. Content []MessageContentUnion `json:"content,required"` // The Unix timestamp (in seconds) for when the message was created. CreatedAt int64 `json:"created_at,required"` // The Unix timestamp (in seconds) for when the message was marked as incomplete. IncompleteAt int64 `json:"incomplete_at,required"` // On an incomplete message, details about why the message is incomplete. IncompleteDetails MessageIncompleteDetails `json:"incomplete_details,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.Metadata `json:"metadata,required"` // The object type, which is always `thread.message`. Object constant.ThreadMessage `json:"object,required"` // The entity that produced the message. One of `user` or `assistant`. // // Any of "user", "assistant". Role MessageRole `json:"role,required"` // The ID of the [run](https://platform.openai.com/docs/api-reference/runs) // associated with the creation of this message. Value is `null` when messages are // created manually using the create message or create thread endpoints. RunID string `json:"run_id,required"` // The status of the message, which can be either `in_progress`, `incomplete`, or // `completed`. // // Any of "in_progress", "incomplete", "completed". Status MessageStatus `json:"status,required"` // The [thread](https://platform.openai.com/docs/api-reference/threads) ID that // this message belongs to. ThreadID string `json:"thread_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field AssistantID resp.Field Attachments resp.Field CompletedAt resp.Field Content resp.Field CreatedAt resp.Field IncompleteAt resp.Field IncompleteDetails resp.Field Metadata resp.Field Object resp.Field Role resp.Field RunID resp.Field Status resp.Field ThreadID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads).
func (*Message) UnmarshalJSON ¶
type MessageAttachment ¶
type MessageAttachment struct { // The ID of the file to attach to the message. FileID string `json:"file_id"` // The tools to add this file to. Tools []MessageAttachmentToolUnion `json:"tools"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileID resp.Field Tools resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (MessageAttachment) RawJSON ¶
func (r MessageAttachment) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageAttachment) UnmarshalJSON ¶
func (r *MessageAttachment) UnmarshalJSON(data []byte) error
type MessageAttachmentToolAssistantToolsFileSearchTypeOnly ¶
type MessageAttachmentToolAssistantToolsFileSearchTypeOnly struct { // The type of tool being defined: `file_search` Type constant.FileSearch `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (MessageAttachmentToolAssistantToolsFileSearchTypeOnly) RawJSON ¶
func (r MessageAttachmentToolAssistantToolsFileSearchTypeOnly) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageAttachmentToolAssistantToolsFileSearchTypeOnly) UnmarshalJSON ¶
func (r *MessageAttachmentToolAssistantToolsFileSearchTypeOnly) UnmarshalJSON(data []byte) error
type MessageAttachmentToolUnion ¶
type MessageAttachmentToolUnion struct { Type string `json:"type"` JSON struct { Type resp.Field // contains filtered or unexported fields } `json:"-"` }
MessageAttachmentToolUnion contains all possible properties and values from CodeInterpreterTool, MessageAttachmentToolAssistantToolsFileSearchTypeOnly.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessageAttachmentToolUnion) AsCodeInterpreterTool ¶
func (u MessageAttachmentToolUnion) AsCodeInterpreterTool() (v CodeInterpreterTool)
func (MessageAttachmentToolUnion) AsFileSearchTool ¶
func (u MessageAttachmentToolUnion) AsFileSearchTool() (v MessageAttachmentToolAssistantToolsFileSearchTypeOnly)
func (MessageAttachmentToolUnion) RawJSON ¶
func (u MessageAttachmentToolUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageAttachmentToolUnion) UnmarshalJSON ¶
func (r *MessageAttachmentToolUnion) UnmarshalJSON(data []byte) error
type MessageContentDeltaUnion ¶
type MessageContentDeltaUnion struct { Index int64 `json:"index"` // Any of "image_file", "text", "refusal", "image_url". Type string `json:"type"` // This field is from variant [ImageFileDeltaBlock]. ImageFile ImageFileDelta `json:"image_file"` // This field is from variant [TextDeltaBlock]. Text TextDelta `json:"text"` // This field is from variant [RefusalDeltaBlock]. Refusal string `json:"refusal"` // This field is from variant [ImageURLDeltaBlock]. ImageURL ImageURLDelta `json:"image_url"` JSON struct { Index resp.Field Type resp.Field ImageFile resp.Field Text resp.Field Refusal resp.Field ImageURL resp.Field // contains filtered or unexported fields } `json:"-"` }
MessageContentDeltaUnion contains all possible properties and values from ImageFileDeltaBlock, TextDeltaBlock, RefusalDeltaBlock, ImageURLDeltaBlock.
Use the MessageContentDeltaUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MessageContentDeltaUnion) AsAny ¶
func (u MessageContentDeltaUnion) AsAny() anyMessageContentDelta
Use the following switch statement to find the correct variant
switch variant := MessageContentDeltaUnion.AsAny().(type) { case ImageFileDeltaBlock: case TextDeltaBlock: case RefusalDeltaBlock: case ImageURLDeltaBlock: default: fmt.Errorf("no variant present") }
func (MessageContentDeltaUnion) AsImageFile ¶
func (u MessageContentDeltaUnion) AsImageFile() (v ImageFileDeltaBlock)
func (MessageContentDeltaUnion) AsImageURL ¶
func (u MessageContentDeltaUnion) AsImageURL() (v ImageURLDeltaBlock)
func (MessageContentDeltaUnion) AsRefusal ¶
func (u MessageContentDeltaUnion) AsRefusal() (v RefusalDeltaBlock)
func (MessageContentDeltaUnion) AsText ¶
func (u MessageContentDeltaUnion) AsText() (v TextDeltaBlock)
func (MessageContentDeltaUnion) RawJSON ¶
func (u MessageContentDeltaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageContentDeltaUnion) UnmarshalJSON ¶
func (r *MessageContentDeltaUnion) UnmarshalJSON(data []byte) error
type MessageContentPartParamUnion ¶
type MessageContentPartParamUnion struct { OfImageFile *ImageFileContentBlockParam `json:",omitzero,inline"` OfImageURL *ImageURLContentBlockParam `json:",omitzero,inline"` OfText *TextContentBlockParam `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 MessageContentPartParamOfImageFile ¶
func MessageContentPartParamOfImageFile(imageFile ImageFileParam) MessageContentPartParamUnion
func MessageContentPartParamOfImageURL ¶
func MessageContentPartParamOfImageURL(imageURL ImageURLParam) MessageContentPartParamUnion
func MessageContentPartParamOfText ¶
func MessageContentPartParamOfText(text string) MessageContentPartParamUnion
func (MessageContentPartParamUnion) GetImageFile ¶
func (u MessageContentPartParamUnion) GetImageFile() *ImageFileParam
Returns a pointer to the underlying variant's property, if present.
func (MessageContentPartParamUnion) GetImageURL ¶
func (u MessageContentPartParamUnion) GetImageURL() *ImageURLParam
Returns a pointer to the underlying variant's property, if present.
func (MessageContentPartParamUnion) GetText ¶
func (u MessageContentPartParamUnion) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (MessageContentPartParamUnion) GetType ¶
func (u MessageContentPartParamUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (MessageContentPartParamUnion) IsPresent ¶
func (u MessageContentPartParamUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (MessageContentPartParamUnion) MarshalJSON ¶
func (u MessageContentPartParamUnion) MarshalJSON() ([]byte, error)
type MessageContentUnion ¶
type MessageContentUnion struct { // This field is from variant [ImageFileContentBlock]. ImageFile ImageFile `json:"image_file"` // Any of "image_file", "image_url", "text", "refusal". Type string `json:"type"` // This field is from variant [ImageURLContentBlock]. ImageURL ImageURL `json:"image_url"` // This field is from variant [TextContentBlock]. Text Text `json:"text"` // This field is from variant [RefusalContentBlock]. Refusal string `json:"refusal"` JSON struct { ImageFile resp.Field Type resp.Field ImageURL resp.Field Text resp.Field Refusal resp.Field // contains filtered or unexported fields } `json:"-"` }
MessageContentUnion contains all possible properties and values from ImageFileContentBlock, ImageURLContentBlock, TextContentBlock, RefusalContentBlock.
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 ImageFileContentBlock: case ImageURLContentBlock: case TextContentBlock: case RefusalContentBlock: default: fmt.Errorf("no variant present") }
func (MessageContentUnion) AsImageFile ¶
func (u MessageContentUnion) AsImageFile() (v ImageFileContentBlock)
func (MessageContentUnion) AsImageURL ¶
func (u MessageContentUnion) AsImageURL() (v ImageURLContentBlock)
func (MessageContentUnion) AsRefusal ¶
func (u MessageContentUnion) AsRefusal() (v RefusalContentBlock)
func (MessageContentUnion) AsText ¶
func (u MessageContentUnion) AsText() (v TextContentBlock)
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 MessageCreationStepDetails ¶
type MessageCreationStepDetails struct { MessageCreation MessageCreationStepDetailsMessageCreation `json:"message_creation,required"` // Always `message_creation`. Type constant.MessageCreation `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { MessageCreation resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details of the message creation by the run step.
func (MessageCreationStepDetails) RawJSON ¶
func (r MessageCreationStepDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageCreationStepDetails) UnmarshalJSON ¶
func (r *MessageCreationStepDetails) UnmarshalJSON(data []byte) error
type MessageCreationStepDetailsMessageCreation ¶
type MessageCreationStepDetailsMessageCreation struct { // The ID of the message that was created by this run step. MessageID string `json:"message_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { MessageID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (MessageCreationStepDetailsMessageCreation) RawJSON ¶
func (r MessageCreationStepDetailsMessageCreation) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageCreationStepDetailsMessageCreation) UnmarshalJSON ¶
func (r *MessageCreationStepDetailsMessageCreation) UnmarshalJSON(data []byte) error
type MessageDeleted ¶
type MessageDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object constant.ThreadMessageDeleted `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (MessageDeleted) RawJSON ¶
func (r MessageDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDeleted) UnmarshalJSON ¶
func (r *MessageDeleted) UnmarshalJSON(data []byte) error
type MessageDelta ¶
type MessageDelta struct { // The content of the message in array of text and/or images. Content []MessageContentDeltaUnion `json:"content"` // The entity that produced the message. One of `user` or `assistant`. // // Any of "user", "assistant". Role MessageDeltaRole `json:"role"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Content resp.Field Role resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The delta containing the fields that have changed on the Message.
func (MessageDelta) RawJSON ¶
func (r MessageDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDelta) UnmarshalJSON ¶
func (r *MessageDelta) UnmarshalJSON(data []byte) error
type MessageDeltaEvent ¶
type MessageDeltaEvent struct { // The identifier of the message, which can be referenced in API endpoints. ID string `json:"id,required"` // The delta containing the fields that have changed on the Message. Delta MessageDelta `json:"delta,required"` // The object type, which is always `thread.message.delta`. Object constant.ThreadMessageDelta `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Delta resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a message delta i.e. any changed fields on a message during streaming.
func (MessageDeltaEvent) RawJSON ¶
func (r MessageDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageDeltaEvent) UnmarshalJSON ¶
func (r *MessageDeltaEvent) UnmarshalJSON(data []byte) error
type MessageDeltaRole ¶
type MessageDeltaRole string
The entity that produced the message. One of `user` or `assistant`.
const ( MessageDeltaRoleUser MessageDeltaRole = "user" MessageDeltaRoleAssistant MessageDeltaRole = "assistant" )
type MessageIncompleteDetails ¶
type MessageIncompleteDetails struct { // The reason the message is incomplete. // // Any of "content_filter", "max_tokens", "run_cancelled", "run_expired", // "run_failed". Reason string `json:"reason,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Reason resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
On an incomplete message, details about why the message is incomplete.
func (MessageIncompleteDetails) RawJSON ¶
func (r MessageIncompleteDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*MessageIncompleteDetails) UnmarshalJSON ¶
func (r *MessageIncompleteDetails) UnmarshalJSON(data []byte) error
type MessageRole ¶
type MessageRole string
The entity that produced the message. One of `user` or `assistant`.
const ( MessageRoleUser MessageRole = "user" MessageRoleAssistant MessageRole = "assistant" )
type MessageStatus ¶
type MessageStatus string
The status of the message, which can be either `in_progress`, `incomplete`, or `completed`.
const ( MessageStatusInProgress MessageStatus = "in_progress" MessageStatusIncomplete MessageStatus = "incomplete" MessageStatusCompleted MessageStatus = "completed" )
type Metadata ¶
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
This is an alias to an internal type.
type MetadataParam ¶
type MetadataParam = shared.MetadataParam
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
This is an alias to an internal type.
type Model ¶
type Model struct { // The model identifier, which can be referenced in the API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) when the model was created. Created int64 `json:"created,required"` // The object type, which is always "model". Object constant.Model `json:"object,required"` // The organization that owns the model. OwnedBy string `json:"owned_by,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Created resp.Field Object resp.Field OwnedBy resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Describes an OpenAI model offering that can be used with the API.
func (*Model) UnmarshalJSON ¶
type ModelDeleted ¶
type ModelDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object string `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ModelDeleted) RawJSON ¶
func (r ModelDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*ModelDeleted) UnmarshalJSON ¶
func (r *ModelDeleted) UnmarshalJSON(data []byte) error
type ModelService ¶
type ModelService struct {
Options []option.RequestOption
}
ModelService 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 NewModelService method instead.
func NewModelService ¶
func NewModelService(opts ...option.RequestOption) (r ModelService)
NewModelService 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 (*ModelService) Delete ¶
func (r *ModelService) Delete(ctx context.Context, model string, opts ...option.RequestOption) (res *ModelDeleted, err error)
Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
func (*ModelService) Get ¶
func (r *ModelService) Get(ctx context.Context, model string, opts ...option.RequestOption) (res *Model, err error)
Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
func (*ModelService) List ¶
func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *pagination.Page[Model], err error)
Lists the currently available models, and provides basic information about each one such as the owner and availability.
func (*ModelService) ListAutoPaging ¶
func (r *ModelService) ListAutoPaging(ctx context.Context, opts ...option.RequestOption) *pagination.PageAutoPager[Model]
Lists the currently available models, and provides basic information about each one such as the owner and availability.
type Moderation ¶
type Moderation struct { // A list of the categories, and whether they are flagged or not. Categories ModerationCategories `json:"categories,required"` // A list of the categories along with the input type(s) that the score applies to. CategoryAppliedInputTypes ModerationCategoryAppliedInputTypes `json:"category_applied_input_types,required"` // A list of the categories along with their scores as predicted by model. CategoryScores ModerationCategoryScores `json:"category_scores,required"` // Whether any of the below categories are flagged. Flagged bool `json:"flagged,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Categories resp.Field CategoryAppliedInputTypes resp.Field CategoryScores resp.Field Flagged resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (Moderation) RawJSON ¶
func (r Moderation) RawJSON() string
Returns the unmodified JSON received from the API
func (*Moderation) UnmarshalJSON ¶
func (r *Moderation) UnmarshalJSON(data []byte) error
type ModerationCategories ¶
type ModerationCategories struct { // Content that expresses, incites, or promotes harassing language towards any // target. Harassment bool `json:"harassment,required"` // Harassment content that also includes violence or serious harm towards any // target. HarassmentThreatening bool `json:"harassment/threatening,required"` // Content that expresses, incites, or promotes hate based on race, gender, // ethnicity, religion, nationality, sexual orientation, disability status, or // caste. Hateful content aimed at non-protected groups (e.g., chess players) is // harassment. Hate bool `json:"hate,required"` // Hateful content that also includes violence or serious harm towards the targeted // group based on race, gender, ethnicity, religion, nationality, sexual // orientation, disability status, or caste. HateThreatening bool `json:"hate/threatening,required"` // Content that includes instructions or advice that facilitate the planning or // execution of wrongdoing, or that gives advice or instruction on how to commit // illicit acts. For example, "how to shoplift" would fit this category. Illicit bool `json:"illicit,required"` // Content that includes instructions or advice that facilitate the planning or // execution of wrongdoing that also includes violence, or that gives advice or // instruction on the procurement of any weapon. IllicitViolent bool `json:"illicit/violent,required"` // Content that promotes, encourages, or depicts acts of self-harm, such as // suicide, cutting, and eating disorders. SelfHarm bool `json:"self-harm,required"` // Content that encourages performing acts of self-harm, such as suicide, cutting, // and eating disorders, or that gives instructions or advice on how to commit such // acts. SelfHarmInstructions bool `json:"self-harm/instructions,required"` // Content where the speaker expresses that they are engaging or intend to engage // in acts of self-harm, such as suicide, cutting, and eating disorders. SelfHarmIntent bool `json:"self-harm/intent,required"` // Content meant to arouse sexual excitement, such as the description of sexual // activity, or that promotes sexual services (excluding sex education and // wellness). Sexual bool `json:"sexual,required"` // Sexual content that includes an individual who is under 18 years old. SexualMinors bool `json:"sexual/minors,required"` // Content that depicts death, violence, or physical injury. Violence bool `json:"violence,required"` // Content that depicts death, violence, or physical injury in graphic detail. ViolenceGraphic bool `json:"violence/graphic,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Harassment resp.Field HarassmentThreatening resp.Field Hate resp.Field HateThreatening resp.Field Illicit resp.Field IllicitViolent resp.Field SelfHarm resp.Field SelfHarmInstructions resp.Field SelfHarmIntent resp.Field Sexual resp.Field SexualMinors resp.Field Violence resp.Field ViolenceGraphic resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A list of the categories, and whether they are flagged or not.
func (ModerationCategories) RawJSON ¶
func (r ModerationCategories) RawJSON() string
Returns the unmodified JSON received from the API
func (*ModerationCategories) UnmarshalJSON ¶
func (r *ModerationCategories) UnmarshalJSON(data []byte) error
type ModerationCategoryAppliedInputTypes ¶
type ModerationCategoryAppliedInputTypes struct { // The applied input type(s) for the category 'harassment'. // // Any of "text". Harassment []string `json:"harassment,required"` // The applied input type(s) for the category 'harassment/threatening'. // // Any of "text". HarassmentThreatening []string `json:"harassment/threatening,required"` // The applied input type(s) for the category 'hate'. // // Any of "text". Hate []string `json:"hate,required"` // The applied input type(s) for the category 'hate/threatening'. // // Any of "text". HateThreatening []string `json:"hate/threatening,required"` // The applied input type(s) for the category 'illicit'. // // Any of "text". Illicit []string `json:"illicit,required"` // The applied input type(s) for the category 'illicit/violent'. // // Any of "text". IllicitViolent []string `json:"illicit/violent,required"` // The applied input type(s) for the category 'self-harm'. // // Any of "text", "image". SelfHarm []string `json:"self-harm,required"` // The applied input type(s) for the category 'self-harm/instructions'. // // Any of "text", "image". SelfHarmInstructions []string `json:"self-harm/instructions,required"` // The applied input type(s) for the category 'self-harm/intent'. // // Any of "text", "image". SelfHarmIntent []string `json:"self-harm/intent,required"` // The applied input type(s) for the category 'sexual'. // // Any of "text", "image". Sexual []string `json:"sexual,required"` // The applied input type(s) for the category 'sexual/minors'. // // Any of "text". SexualMinors []string `json:"sexual/minors,required"` // The applied input type(s) for the category 'violence'. // // Any of "text", "image". Violence []string `json:"violence,required"` // The applied input type(s) for the category 'violence/graphic'. // // Any of "text", "image". ViolenceGraphic []string `json:"violence/graphic,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Harassment resp.Field HarassmentThreatening resp.Field Hate resp.Field HateThreatening resp.Field Illicit resp.Field IllicitViolent resp.Field SelfHarm resp.Field SelfHarmInstructions resp.Field SelfHarmIntent resp.Field Sexual resp.Field SexualMinors resp.Field Violence resp.Field ViolenceGraphic resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A list of the categories along with the input type(s) that the score applies to.
func (ModerationCategoryAppliedInputTypes) RawJSON ¶
func (r ModerationCategoryAppliedInputTypes) RawJSON() string
Returns the unmodified JSON received from the API
func (*ModerationCategoryAppliedInputTypes) UnmarshalJSON ¶
func (r *ModerationCategoryAppliedInputTypes) UnmarshalJSON(data []byte) error
type ModerationCategoryScores ¶
type ModerationCategoryScores struct { // The score for the category 'harassment'. Harassment float64 `json:"harassment,required"` // The score for the category 'harassment/threatening'. HarassmentThreatening float64 `json:"harassment/threatening,required"` // The score for the category 'hate'. Hate float64 `json:"hate,required"` // The score for the category 'hate/threatening'. HateThreatening float64 `json:"hate/threatening,required"` // The score for the category 'illicit'. Illicit float64 `json:"illicit,required"` // The score for the category 'illicit/violent'. IllicitViolent float64 `json:"illicit/violent,required"` // The score for the category 'self-harm'. SelfHarm float64 `json:"self-harm,required"` // The score for the category 'self-harm/instructions'. SelfHarmInstructions float64 `json:"self-harm/instructions,required"` // The score for the category 'self-harm/intent'. SelfHarmIntent float64 `json:"self-harm/intent,required"` // The score for the category 'sexual'. Sexual float64 `json:"sexual,required"` // The score for the category 'sexual/minors'. SexualMinors float64 `json:"sexual/minors,required"` // The score for the category 'violence'. Violence float64 `json:"violence,required"` // The score for the category 'violence/graphic'. ViolenceGraphic float64 `json:"violence/graphic,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Harassment resp.Field HarassmentThreatening resp.Field Hate resp.Field HateThreatening resp.Field Illicit resp.Field IllicitViolent resp.Field SelfHarm resp.Field SelfHarmInstructions resp.Field SelfHarmIntent resp.Field Sexual resp.Field SexualMinors resp.Field Violence resp.Field ViolenceGraphic resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A list of the categories along with their scores as predicted by model.
func (ModerationCategoryScores) RawJSON ¶
func (r ModerationCategoryScores) RawJSON() string
Returns the unmodified JSON received from the API
func (*ModerationCategoryScores) UnmarshalJSON ¶
func (r *ModerationCategoryScores) UnmarshalJSON(data []byte) error
type ModerationImageURLInputImageURLParam ¶
type ModerationImageURLInputImageURLParam struct { // Either a URL of the image or the base64 encoded image data. URL string `json:"url,required" format:"uri"` // contains filtered or unexported fields }
Contains either an image URL or a data URL for a base64 encoded image.
The property URL is required.
func (ModerationImageURLInputImageURLParam) IsPresent ¶
func (f ModerationImageURLInputImageURLParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ModerationImageURLInputImageURLParam) MarshalJSON ¶
func (r ModerationImageURLInputImageURLParam) MarshalJSON() (data []byte, err error)
type ModerationImageURLInputParam ¶
type ModerationImageURLInputParam struct { // Contains either an image URL or a data URL for a base64 encoded image. ImageURL ModerationImageURLInputImageURLParam `json:"image_url,omitzero,required"` // Always `image_url`. // // This field can be elided, and will marshal its zero value as "image_url". Type constant.ImageURL `json:"type,required"` // contains filtered or unexported fields }
An object describing an image to classify.
The properties ImageURL, Type are required.
func (ModerationImageURLInputParam) IsPresent ¶
func (f ModerationImageURLInputParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ModerationImageURLInputParam) MarshalJSON ¶
func (r ModerationImageURLInputParam) MarshalJSON() (data []byte, err error)
type ModerationModel ¶
type ModerationModel = string
const ( ModerationModelOmniModerationLatest ModerationModel = "omni-moderation-latest" ModerationModelOmniModeration2024_09_26 ModerationModel = "omni-moderation-2024-09-26" ModerationModelTextModerationLatest ModerationModel = "text-moderation-latest" ModerationModelTextModerationStable ModerationModel = "text-moderation-stable" )
type ModerationMultiModalInputUnionParam ¶
type ModerationMultiModalInputUnionParam struct { OfImageURL *ModerationImageURLInputParam `json:",omitzero,inline"` OfText *ModerationTextInputParam `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 ModerationMultiModalInputParamOfImageURL ¶
func ModerationMultiModalInputParamOfImageURL(imageURL ModerationImageURLInputImageURLParam) ModerationMultiModalInputUnionParam
func ModerationMultiModalInputParamOfText ¶
func ModerationMultiModalInputParamOfText(text string) ModerationMultiModalInputUnionParam
func (ModerationMultiModalInputUnionParam) GetImageURL ¶
func (u ModerationMultiModalInputUnionParam) GetImageURL() *ModerationImageURLInputImageURLParam
Returns a pointer to the underlying variant's property, if present.
func (ModerationMultiModalInputUnionParam) GetText ¶
func (u ModerationMultiModalInputUnionParam) GetText() *string
Returns a pointer to the underlying variant's property, if present.
func (ModerationMultiModalInputUnionParam) GetType ¶
func (u ModerationMultiModalInputUnionParam) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (ModerationMultiModalInputUnionParam) IsPresent ¶
func (u ModerationMultiModalInputUnionParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ModerationMultiModalInputUnionParam) MarshalJSON ¶
func (u ModerationMultiModalInputUnionParam) MarshalJSON() ([]byte, error)
type ModerationNewParams ¶
type ModerationNewParams struct { // Input (or inputs) to classify. Can be a single string, an array of strings, or // an array of multi-modal input objects similar to other models. Input ModerationNewParamsInputUnion `json:"input,omitzero,required"` // The content moderation model you would like to use. Learn more in // [the moderation guide](https://platform.openai.com/docs/guides/moderation), and // learn about available models // [here](https://platform.openai.com/docs/models#moderation). Model ModerationModel `json:"model,omitzero"` // contains filtered or unexported fields }
func (ModerationNewParams) IsPresent ¶
func (f ModerationNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ModerationNewParams) MarshalJSON ¶
func (r ModerationNewParams) MarshalJSON() (data []byte, err error)
type ModerationNewParamsInputUnion ¶
type ModerationNewParamsInputUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfModerationNewsInputArray []string `json:",omitzero,inline"` OfModerationMultiModalArray []ModerationMultiModalInputUnionParam `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 (ModerationNewParamsInputUnion) IsPresent ¶
func (u ModerationNewParamsInputUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ModerationNewParamsInputUnion) MarshalJSON ¶
func (u ModerationNewParamsInputUnion) MarshalJSON() ([]byte, error)
type ModerationNewResponse ¶
type ModerationNewResponse struct { // The unique identifier for the moderation request. ID string `json:"id,required"` // The model used to generate the moderation results. Model string `json:"model,required"` // A list of moderation objects. Results []Moderation `json:"results,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Model resp.Field Results resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents if a given text input is potentially harmful.
func (ModerationNewResponse) RawJSON ¶
func (r ModerationNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ModerationNewResponse) UnmarshalJSON ¶
func (r *ModerationNewResponse) UnmarshalJSON(data []byte) error
type ModerationService ¶
type ModerationService struct {
Options []option.RequestOption
}
ModerationService 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 NewModerationService method instead.
func NewModerationService ¶
func NewModerationService(opts ...option.RequestOption) (r ModerationService)
NewModerationService 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 (*ModerationService) New ¶
func (r *ModerationService) New(ctx context.Context, body ModerationNewParams, opts ...option.RequestOption) (res *ModerationNewResponse, err error)
Classifies if text and/or image inputs are potentially harmful. Learn more in the [moderation guide](https://platform.openai.com/docs/guides/moderation).
type ModerationTextInputParam ¶
type ModerationTextInputParam struct { // A string of text to classify. Text string `json:"text,required"` // Always `text`. // // This field can be elided, and will marshal its zero value as "text". Type constant.Text `json:"type,required"` // contains filtered or unexported fields }
An object describing text to classify.
The properties Text, Type are required.
func (ModerationTextInputParam) IsPresent ¶
func (f ModerationTextInputParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (ModerationTextInputParam) MarshalJSON ¶
func (r ModerationTextInputParam) MarshalJSON() (data []byte, err error)
type OtherFileChunkingStrategyObject ¶
type OtherFileChunkingStrategyObject struct { // Always `other`. Type constant.Other `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.
func (OtherFileChunkingStrategyObject) RawJSON ¶
func (r OtherFileChunkingStrategyObject) RawJSON() string
Returns the unmodified JSON received from the API
func (*OtherFileChunkingStrategyObject) UnmarshalJSON ¶
func (r *OtherFileChunkingStrategyObject) UnmarshalJSON(data []byte) error
type Reasoning ¶
**o-series models only**
Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
This is an alias to an internal type.
type ReasoningEffort ¶
type ReasoningEffort = shared.ReasoningEffort
**o-series models only**
Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
This is an alias to an internal type.
type ReasoningGenerateSummary ¶
type ReasoningGenerateSummary = shared.ReasoningGenerateSummary
**computer_use_preview only**
A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `concise` or `detailed`.
This is an alias to an internal type.
type ReasoningParam ¶
type ReasoningParam = shared.ReasoningParam
**o-series models only**
Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).
This is an alias to an internal type.
type RefusalContentBlock ¶
type RefusalContentBlock struct { Refusal string `json:"refusal,required"` // Always `refusal`. Type constant.Refusal `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Refusal resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The refusal content generated by the assistant.
func (RefusalContentBlock) RawJSON ¶
func (r RefusalContentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*RefusalContentBlock) UnmarshalJSON ¶
func (r *RefusalContentBlock) UnmarshalJSON(data []byte) error
type RefusalDeltaBlock ¶
type RefusalDeltaBlock struct { // The index of the refusal part in the message. Index int64 `json:"index,required"` // Always `refusal`. Type constant.Refusal `json:"type,required"` Refusal string `json:"refusal"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field Refusal resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The refusal content that is part of a message.
func (RefusalDeltaBlock) RawJSON ¶
func (r RefusalDeltaBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*RefusalDeltaBlock) UnmarshalJSON ¶
func (r *RefusalDeltaBlock) UnmarshalJSON(data []byte) error
type RequiredActionFunctionToolCall ¶
type RequiredActionFunctionToolCall struct { // The ID of the tool call. This ID must be referenced when you submit the tool // outputs in using the // [Submit tool outputs to run](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) // endpoint. ID string `json:"id,required"` // The function definition. Function RequiredActionFunctionToolCallFunction `json:"function,required"` // The type of tool call the output is required for. For now, this is always // `function`. Type constant.Function `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Function resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Tool call objects
func (RequiredActionFunctionToolCall) RawJSON ¶
func (r RequiredActionFunctionToolCall) RawJSON() string
Returns the unmodified JSON received from the API
func (*RequiredActionFunctionToolCall) UnmarshalJSON ¶
func (r *RequiredActionFunctionToolCall) UnmarshalJSON(data []byte) error
type RequiredActionFunctionToolCallFunction ¶
type RequiredActionFunctionToolCallFunction struct { // The arguments that the model expects you to pass to the function. Arguments string `json:"arguments,required"` // The name of the function. Name string `json:"name,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Arguments resp.Field Name resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The function definition.
func (RequiredActionFunctionToolCallFunction) RawJSON ¶
func (r RequiredActionFunctionToolCallFunction) RawJSON() string
Returns the unmodified JSON received from the API
func (*RequiredActionFunctionToolCallFunction) UnmarshalJSON ¶
func (r *RequiredActionFunctionToolCallFunction) UnmarshalJSON(data []byte) error
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 Run ¶
type Run struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The ID of the // [assistant](https://platform.openai.com/docs/api-reference/assistants) used for // execution of this run. AssistantID string `json:"assistant_id,required"` // The Unix timestamp (in seconds) for when the run was cancelled. CancelledAt int64 `json:"cancelled_at,required"` // The Unix timestamp (in seconds) for when the run was completed. CompletedAt int64 `json:"completed_at,required"` // The Unix timestamp (in seconds) for when the run was created. CreatedAt int64 `json:"created_at,required"` // The Unix timestamp (in seconds) for when the run will expire. ExpiresAt int64 `json:"expires_at,required"` // The Unix timestamp (in seconds) for when the run failed. FailedAt int64 `json:"failed_at,required"` // Details on why the run is incomplete. Will be `null` if the run is not // incomplete. IncompleteDetails RunIncompleteDetails `json:"incomplete_details,required"` // The instructions that the // [assistant](https://platform.openai.com/docs/api-reference/assistants) used for // this run. Instructions string `json:"instructions,required"` // The last error associated with this run. Will be `null` if there are no errors. LastError RunLastError `json:"last_error,required"` // The maximum number of completion tokens specified to have been used over the // course of the run. MaxCompletionTokens int64 `json:"max_completion_tokens,required"` // The maximum number of prompt tokens specified to have been used over the course // of the run. MaxPromptTokens int64 `json:"max_prompt_tokens,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.Metadata `json:"metadata,required"` // The model that the // [assistant](https://platform.openai.com/docs/api-reference/assistants) used for // this run. Model string `json:"model,required"` // The object type, which is always `thread.run`. Object constant.ThreadRun `json:"object,required"` // Whether to enable // [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) // during tool use. ParallelToolCalls bool `json:"parallel_tool_calls,required"` // Details on the action required to continue the run. Will be `null` if no action // is required. RequiredAction RunRequiredAction `json:"required_action,required"` // Specifies the format that the model must output. Compatible with // [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), // [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), // and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. // // Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured // Outputs which ensures the model will match your supplied JSON schema. Learn more // in the // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). // // Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the // message the model generates is valid JSON. // // **Important:** when using JSON mode, you **must** also instruct the model to // produce JSON yourself via a system or user message. Without this, the model may // generate an unending stream of whitespace until the generation reaches the token // limit, resulting in a long-running and seemingly "stuck" request. Also note that // the message content may be partially cut off if `finish_reason="length"`, which // indicates the generation exceeded `max_tokens` or the conversation exceeded the // max context length. ResponseFormat AssistantResponseFormatOptionUnion `json:"response_format,required"` // The Unix timestamp (in seconds) for when the run was started. StartedAt int64 `json:"started_at,required"` // The status of the run, which can be either `queued`, `in_progress`, // `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, // `incomplete`, or `expired`. // // Any of "queued", "in_progress", "requires_action", "cancelling", "cancelled", // "failed", "completed", "incomplete", "expired". Status RunStatus `json:"status,required"` // The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) // that was executed on as a part of this run. ThreadID string `json:"thread_id,required"` // Controls which (if any) tool is called by the model. `none` means the model will // not call any tools and instead generates a message. `auto` is the default value // and means the model can pick between generating a message or calling one or more // tools. `required` means the model must call one or more tools before responding // to the user. Specifying a particular tool like `{"type": "file_search"}` or // `{"type": "function", "function": {"name": "my_function"}}` forces the model to // call that tool. ToolChoice AssistantToolChoiceOptionUnion `json:"tool_choice,required"` // The list of tools that the // [assistant](https://platform.openai.com/docs/api-reference/assistants) used for // this run. Tools []AssistantToolUnion `json:"tools,required"` // Controls for how a thread will be truncated prior to the run. Use this to // control the intial context window of the run. TruncationStrategy RunTruncationStrategy `json:"truncation_strategy,required"` // Usage statistics related to the run. This value will be `null` if the run is not // in a terminal state (i.e. `in_progress`, `queued`, etc.). Usage RunUsage `json:"usage,required"` // The sampling temperature used for this run. If not set, defaults to 1. Temperature float64 `json:"temperature,nullable"` // The nucleus sampling value used for this run. If not set, defaults to 1. TopP float64 `json:"top_p,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field AssistantID resp.Field CancelledAt resp.Field CompletedAt resp.Field CreatedAt resp.Field ExpiresAt resp.Field FailedAt resp.Field IncompleteDetails resp.Field Instructions resp.Field LastError resp.Field MaxCompletionTokens resp.Field MaxPromptTokens resp.Field Metadata resp.Field Model resp.Field Object resp.Field ParallelToolCalls resp.Field RequiredAction resp.Field ResponseFormat resp.Field StartedAt resp.Field Status resp.Field ThreadID resp.Field ToolChoice resp.Field Tools resp.Field TruncationStrategy resp.Field Usage resp.Field Temperature resp.Field TopP resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents an execution run on a [thread](https://platform.openai.com/docs/api-reference/threads).
func (*Run) UnmarshalJSON ¶
type RunIncompleteDetails ¶
type RunIncompleteDetails struct { // The reason why the run is incomplete. This will point to which specific token // limit was reached over the course of the run. // // Any of "max_completion_tokens", "max_prompt_tokens". Reason string `json:"reason"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Reason resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details on why the run is incomplete. Will be `null` if the run is not incomplete.
func (RunIncompleteDetails) RawJSON ¶
func (r RunIncompleteDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunIncompleteDetails) UnmarshalJSON ¶
func (r *RunIncompleteDetails) UnmarshalJSON(data []byte) error
type RunLastError ¶
type RunLastError struct { // One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. // // Any of "server_error", "rate_limit_exceeded", "invalid_prompt". Code string `json:"code,required"` // A human-readable description of the error. Message string `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The last error associated with this run. Will be `null` if there are no errors.
func (RunLastError) RawJSON ¶
func (r RunLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunLastError) UnmarshalJSON ¶
func (r *RunLastError) UnmarshalJSON(data []byte) error
type RunRequiredAction ¶
type RunRequiredAction struct { // Details on the tool outputs needed for this run to continue. SubmitToolOutputs RunRequiredActionSubmitToolOutputs `json:"submit_tool_outputs,required"` // For now, this is always `submit_tool_outputs`. Type constant.SubmitToolOutputs `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { SubmitToolOutputs resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details on the action required to continue the run. Will be `null` if no action is required.
func (RunRequiredAction) RawJSON ¶
func (r RunRequiredAction) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunRequiredAction) UnmarshalJSON ¶
func (r *RunRequiredAction) UnmarshalJSON(data []byte) error
type RunRequiredActionSubmitToolOutputs ¶
type RunRequiredActionSubmitToolOutputs struct { // A list of the relevant tool calls. ToolCalls []RequiredActionFunctionToolCall `json:"tool_calls,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ToolCalls resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details on the tool outputs needed for this run to continue.
func (RunRequiredActionSubmitToolOutputs) RawJSON ¶
func (r RunRequiredActionSubmitToolOutputs) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunRequiredActionSubmitToolOutputs) UnmarshalJSON ¶
func (r *RunRequiredActionSubmitToolOutputs) UnmarshalJSON(data []byte) error
type RunStatus ¶
type RunStatus string
The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.
const ( RunStatusQueued RunStatus = "queued" RunStatusInProgress RunStatus = "in_progress" RunStatusRequiresAction RunStatus = "requires_action" RunStatusCancelling RunStatus = "cancelling" RunStatusCancelled RunStatus = "cancelled" RunStatusFailed RunStatus = "failed" RunStatusCompleted RunStatus = "completed" RunStatusIncomplete RunStatus = "incomplete" RunStatusExpired RunStatus = "expired" )
type RunStep ¶
type RunStep struct { // The identifier of the run step, which can be referenced in API endpoints. ID string `json:"id,required"` // The ID of the // [assistant](https://platform.openai.com/docs/api-reference/assistants) // associated with the run step. AssistantID string `json:"assistant_id,required"` // The Unix timestamp (in seconds) for when the run step was cancelled. CancelledAt int64 `json:"cancelled_at,required"` // The Unix timestamp (in seconds) for when the run step completed. CompletedAt int64 `json:"completed_at,required"` // The Unix timestamp (in seconds) for when the run step was created. CreatedAt int64 `json:"created_at,required"` // The Unix timestamp (in seconds) for when the run step expired. A step is // considered expired if the parent run is expired. ExpiredAt int64 `json:"expired_at,required"` // The Unix timestamp (in seconds) for when the run step failed. FailedAt int64 `json:"failed_at,required"` // The last error associated with this run step. Will be `null` if there are no // errors. LastError RunStepLastError `json:"last_error,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.Metadata `json:"metadata,required"` // The object type, which is always `thread.run.step`. Object constant.ThreadRunStep `json:"object,required"` // The ID of the [run](https://platform.openai.com/docs/api-reference/runs) that // this run step is a part of. RunID string `json:"run_id,required"` // The status of the run step, which can be either `in_progress`, `cancelled`, // `failed`, `completed`, or `expired`. // // Any of "in_progress", "cancelled", "failed", "completed", "expired". Status RunStepStatus `json:"status,required"` // The details of the run step. StepDetails RunStepStepDetailsUnion `json:"step_details,required"` // The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) // that was run. ThreadID string `json:"thread_id,required"` // The type of run step, which can be either `message_creation` or `tool_calls`. // // Any of "message_creation", "tool_calls". Type RunStepType `json:"type,required"` // Usage statistics related to the run step. This value will be `null` while the // run step's status is `in_progress`. Usage RunStepUsage `json:"usage,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field AssistantID resp.Field CancelledAt resp.Field CompletedAt resp.Field CreatedAt resp.Field ExpiredAt resp.Field FailedAt resp.Field LastError resp.Field Metadata resp.Field Object resp.Field RunID resp.Field Status resp.Field StepDetails resp.Field ThreadID resp.Field Type resp.Field Usage resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a step in execution of a run.
func (*RunStep) UnmarshalJSON ¶
type RunStepDelta ¶
type RunStepDelta struct { // The details of the run step. StepDetails RunStepDeltaStepDetailsUnion `json:"step_details"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { StepDetails resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The delta containing the fields that have changed on the run step.
func (RunStepDelta) RawJSON ¶
func (r RunStepDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepDelta) UnmarshalJSON ¶
func (r *RunStepDelta) UnmarshalJSON(data []byte) error
type RunStepDeltaEvent ¶
type RunStepDeltaEvent struct { // The identifier of the run step, which can be referenced in API endpoints. ID string `json:"id,required"` // The delta containing the fields that have changed on the run step. Delta RunStepDelta `json:"delta,required"` // The object type, which is always `thread.run.step.delta`. Object constant.ThreadRunStepDelta `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Delta resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a run step delta i.e. any changed fields on a run step during streaming.
func (RunStepDeltaEvent) RawJSON ¶
func (r RunStepDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepDeltaEvent) UnmarshalJSON ¶
func (r *RunStepDeltaEvent) UnmarshalJSON(data []byte) error
type RunStepDeltaMessageDelta ¶
type RunStepDeltaMessageDelta struct { // Always `message_creation`. Type constant.MessageCreation `json:"type,required"` MessageCreation RunStepDeltaMessageDeltaMessageCreation `json:"message_creation"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field MessageCreation resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details of the message creation by the run step.
func (RunStepDeltaMessageDelta) RawJSON ¶
func (r RunStepDeltaMessageDelta) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepDeltaMessageDelta) UnmarshalJSON ¶
func (r *RunStepDeltaMessageDelta) UnmarshalJSON(data []byte) error
type RunStepDeltaMessageDeltaMessageCreation ¶
type RunStepDeltaMessageDeltaMessageCreation struct { // The ID of the message that was created by this run step. MessageID string `json:"message_id"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { MessageID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (RunStepDeltaMessageDeltaMessageCreation) RawJSON ¶
func (r RunStepDeltaMessageDeltaMessageCreation) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepDeltaMessageDeltaMessageCreation) UnmarshalJSON ¶
func (r *RunStepDeltaMessageDeltaMessageCreation) UnmarshalJSON(data []byte) error
type RunStepDeltaStepDetailsUnion ¶
type RunStepDeltaStepDetailsUnion struct { // Any of "message_creation", "tool_calls". Type string `json:"type"` // This field is from variant [RunStepDeltaMessageDelta]. MessageCreation RunStepDeltaMessageDeltaMessageCreation `json:"message_creation"` // This field is from variant [ToolCallDeltaObject]. ToolCalls []ToolCallDeltaUnion `json:"tool_calls"` JSON struct { Type resp.Field MessageCreation resp.Field ToolCalls resp.Field // contains filtered or unexported fields } `json:"-"` }
RunStepDeltaStepDetailsUnion contains all possible properties and values from RunStepDeltaMessageDelta, ToolCallDeltaObject.
Use the RunStepDeltaStepDetailsUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (RunStepDeltaStepDetailsUnion) AsAny ¶
func (u RunStepDeltaStepDetailsUnion) AsAny() anyRunStepDeltaStepDetails
Use the following switch statement to find the correct variant
switch variant := RunStepDeltaStepDetailsUnion.AsAny().(type) { case RunStepDeltaMessageDelta: case ToolCallDeltaObject: default: fmt.Errorf("no variant present") }
func (RunStepDeltaStepDetailsUnion) AsMessageCreation ¶
func (u RunStepDeltaStepDetailsUnion) AsMessageCreation() (v RunStepDeltaMessageDelta)
func (RunStepDeltaStepDetailsUnion) AsToolCalls ¶
func (u RunStepDeltaStepDetailsUnion) AsToolCalls() (v ToolCallDeltaObject)
func (RunStepDeltaStepDetailsUnion) RawJSON ¶
func (u RunStepDeltaStepDetailsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepDeltaStepDetailsUnion) UnmarshalJSON ¶
func (r *RunStepDeltaStepDetailsUnion) UnmarshalJSON(data []byte) error
type RunStepInclude ¶
type RunStepInclude string
const (
RunStepIncludeStepDetailsToolCallsFileSearchResultsContent RunStepInclude = "step_details.tool_calls[*].file_search.results[*].content"
)
type RunStepLastError ¶
type RunStepLastError struct { // One of `server_error` or `rate_limit_exceeded`. // // Any of "server_error", "rate_limit_exceeded". Code string `json:"code,required"` // A human-readable description of the error. Message string `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The last error associated with this run step. Will be `null` if there are no errors.
func (RunStepLastError) RawJSON ¶
func (r RunStepLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepLastError) UnmarshalJSON ¶
func (r *RunStepLastError) UnmarshalJSON(data []byte) error
type RunStepStatus ¶
type RunStepStatus string
The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`.
const ( RunStepStatusInProgress RunStepStatus = "in_progress" RunStepStatusCancelled RunStepStatus = "cancelled" RunStepStatusFailed RunStepStatus = "failed" RunStepStatusCompleted RunStepStatus = "completed" RunStepStatusExpired RunStepStatus = "expired" )
type RunStepStepDetailsUnion ¶
type RunStepStepDetailsUnion struct { // This field is from variant [MessageCreationStepDetails]. MessageCreation MessageCreationStepDetailsMessageCreation `json:"message_creation"` // Any of "message_creation", "tool_calls". Type string `json:"type"` // This field is from variant [ToolCallsStepDetails]. ToolCalls []ToolCallUnion `json:"tool_calls"` JSON struct { MessageCreation resp.Field Type resp.Field ToolCalls resp.Field // contains filtered or unexported fields } `json:"-"` }
RunStepStepDetailsUnion contains all possible properties and values from MessageCreationStepDetails, ToolCallsStepDetails.
Use the RunStepStepDetailsUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (RunStepStepDetailsUnion) AsAny ¶
func (u RunStepStepDetailsUnion) AsAny() anyRunStepStepDetails
Use the following switch statement to find the correct variant
switch variant := RunStepStepDetailsUnion.AsAny().(type) { case MessageCreationStepDetails: case ToolCallsStepDetails: default: fmt.Errorf("no variant present") }
func (RunStepStepDetailsUnion) AsMessageCreation ¶
func (u RunStepStepDetailsUnion) AsMessageCreation() (v MessageCreationStepDetails)
func (RunStepStepDetailsUnion) AsToolCalls ¶
func (u RunStepStepDetailsUnion) AsToolCalls() (v ToolCallsStepDetails)
func (RunStepStepDetailsUnion) RawJSON ¶
func (u RunStepStepDetailsUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepStepDetailsUnion) UnmarshalJSON ¶
func (r *RunStepStepDetailsUnion) UnmarshalJSON(data []byte) error
type RunStepType ¶
type RunStepType string
The type of run step, which can be either `message_creation` or `tool_calls`.
const ( RunStepTypeMessageCreation RunStepType = "message_creation" RunStepTypeToolCalls RunStepType = "tool_calls" )
type RunStepUsage ¶
type RunStepUsage struct { // Number of completion tokens used over the course of the run step. CompletionTokens int64 `json:"completion_tokens,required"` // Number of prompt tokens used over the course of the run step. PromptTokens int64 `json:"prompt_tokens,required"` // Total number of tokens used (prompt + completion). TotalTokens int64 `json:"total_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CompletionTokens resp.Field PromptTokens resp.Field TotalTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`.
func (RunStepUsage) RawJSON ¶
func (r RunStepUsage) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunStepUsage) UnmarshalJSON ¶
func (r *RunStepUsage) UnmarshalJSON(data []byte) error
type RunTruncationStrategy ¶
type RunTruncationStrategy struct { // The truncation strategy to use for the thread. The default is `auto`. If set to // `last_messages`, the thread will be truncated to the n most recent messages in // the thread. When set to `auto`, messages in the middle of the thread will be // dropped to fit the context length of the model, `max_prompt_tokens`. // // Any of "auto", "last_messages". Type string `json:"type,required"` // The number of most recent messages from the thread when constructing the context // for the run. LastMessages int64 `json:"last_messages,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field LastMessages resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
func (RunTruncationStrategy) RawJSON ¶
func (r RunTruncationStrategy) RawJSON() string
Returns the unmodified JSON received from the API
func (*RunTruncationStrategy) UnmarshalJSON ¶
func (r *RunTruncationStrategy) UnmarshalJSON(data []byte) error
type RunUsage ¶
type RunUsage struct { // Number of completion tokens used over the course of the run. CompletionTokens int64 `json:"completion_tokens,required"` // Number of prompt tokens used over the course of the run. PromptTokens int64 `json:"prompt_tokens,required"` // Total number of tokens used (prompt + completion). TotalTokens int64 `json:"total_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CompletionTokens resp.Field PromptTokens resp.Field TotalTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
func (*RunUsage) UnmarshalJSON ¶
type SpeechModel ¶
type SpeechModel = string
const ( SpeechModelTTS1 SpeechModel = "tts-1" SpeechModelTTS1HD SpeechModel = "tts-1-hd" SpeechModelGPT4oMiniTTS SpeechModel = "gpt-4o-mini-tts" )
type StaticFileChunkingStrategy ¶
type StaticFileChunkingStrategy struct { // The number of tokens that overlap between chunks. The default value is `400`. // // Note that the overlap must not exceed half of `max_chunk_size_tokens`. ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"` // The maximum number of tokens in each chunk. The default value is `800`. The // minimum value is `100` and the maximum value is `4096`. MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ChunkOverlapTokens resp.Field MaxChunkSizeTokens resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (StaticFileChunkingStrategy) RawJSON ¶
func (r StaticFileChunkingStrategy) RawJSON() string
Returns the unmodified JSON received from the API
func (StaticFileChunkingStrategy) ToParam ¶
func (r StaticFileChunkingStrategy) ToParam() StaticFileChunkingStrategyParam
ToParam converts this StaticFileChunkingStrategy to a StaticFileChunkingStrategyParam.
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 StaticFileChunkingStrategyParam.IsOverridden()
func (*StaticFileChunkingStrategy) UnmarshalJSON ¶
func (r *StaticFileChunkingStrategy) UnmarshalJSON(data []byte) error
type StaticFileChunkingStrategyObject ¶
type StaticFileChunkingStrategyObject struct { Static StaticFileChunkingStrategy `json:"static,required"` // Always `static`. Type constant.Static `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Static resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (StaticFileChunkingStrategyObject) RawJSON ¶
func (r StaticFileChunkingStrategyObject) RawJSON() string
Returns the unmodified JSON received from the API
func (*StaticFileChunkingStrategyObject) UnmarshalJSON ¶
func (r *StaticFileChunkingStrategyObject) UnmarshalJSON(data []byte) error
type StaticFileChunkingStrategyObjectParam ¶
type StaticFileChunkingStrategyObjectParam struct { Static StaticFileChunkingStrategyParam `json:"static,omitzero,required"` // Always `static`. // // This field can be elided, and will marshal its zero value as "static". Type constant.Static `json:"type,required"` // contains filtered or unexported fields }
Customize your own chunking strategy by setting chunk size and chunk overlap.
The properties Static, Type are required.
func (StaticFileChunkingStrategyObjectParam) IsPresent ¶
func (f StaticFileChunkingStrategyObjectParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (StaticFileChunkingStrategyObjectParam) MarshalJSON ¶
func (r StaticFileChunkingStrategyObjectParam) MarshalJSON() (data []byte, err error)
type StaticFileChunkingStrategyParam ¶
type StaticFileChunkingStrategyParam struct { // The number of tokens that overlap between chunks. The default value is `400`. // // Note that the overlap must not exceed half of `max_chunk_size_tokens`. ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"` // The maximum number of tokens in each chunk. The default value is `800`. The // minimum value is `100` and the maximum value is `4096`. MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"` // contains filtered or unexported fields }
The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.
func (StaticFileChunkingStrategyParam) IsPresent ¶
func (f StaticFileChunkingStrategyParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (StaticFileChunkingStrategyParam) MarshalJSON ¶
func (r StaticFileChunkingStrategyParam) MarshalJSON() (data []byte, err error)
type Text ¶
type Text struct { Annotations []AnnotationUnion `json:"annotations,required"` // The data that makes up the text. Value string `json:"value,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Annotations resp.Field Value resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (*Text) UnmarshalJSON ¶
type TextContentBlock ¶
type TextContentBlock struct { Text Text `json:"text,required"` // Always `text`. Type constant.Text `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The text content that is part of a message.
func (TextContentBlock) RawJSON ¶
func (r TextContentBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextContentBlock) UnmarshalJSON ¶
func (r *TextContentBlock) UnmarshalJSON(data []byte) error
type TextContentBlockParam ¶
type TextContentBlockParam struct { // Text content to be sent to the model Text string `json:"text,required"` // Always `text`. // // This field can be elided, and will marshal its zero value as "text". Type constant.Text `json:"type,required"` // contains filtered or unexported fields }
The text content that is part of a message.
The properties Text, Type are required.
func (TextContentBlockParam) IsPresent ¶
func (f TextContentBlockParam) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (TextContentBlockParam) MarshalJSON ¶
func (r TextContentBlockParam) MarshalJSON() (data []byte, err error)
type TextDelta ¶
type TextDelta struct { Annotations []AnnotationDeltaUnion `json:"annotations"` // The data that makes up the text. Value string `json:"value"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Annotations resp.Field Value resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (*TextDelta) UnmarshalJSON ¶
type TextDeltaBlock ¶
type TextDeltaBlock struct { // The index of the content part in the message. Index int64 `json:"index,required"` // Always `text`. Type constant.Text `json:"type,required"` Text TextDelta `json:"text"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Index resp.Field Type resp.Field Text resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The text content that is part of a message.
func (TextDeltaBlock) RawJSON ¶
func (r TextDeltaBlock) RawJSON() string
Returns the unmodified JSON received from the API
func (*TextDeltaBlock) UnmarshalJSON ¶
func (r *TextDeltaBlock) UnmarshalJSON(data []byte) error
type Thread ¶
type Thread struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the thread was created. 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 shared.Metadata `json:"metadata,required"` // The object type, which is always `thread`. Object constant.Thread `json:"object,required"` // A set of resources that are made available to the assistant's tools in this // thread. The resources are specific to the type of tool. For example, the // `code_interpreter` tool requires a list of file IDs, while the `file_search` // tool requires a list of vector store IDs. ToolResources ThreadToolResources `json:"tool_resources,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Metadata resp.Field Object resp.Field ToolResources resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a thread that contains [messages](https://platform.openai.com/docs/api-reference/messages).
func (*Thread) UnmarshalJSON ¶
type ThreadDeleted ¶
type ThreadDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object constant.ThreadDeleted `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ThreadDeleted) RawJSON ¶
func (r ThreadDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThreadDeleted) UnmarshalJSON ¶
func (r *ThreadDeleted) UnmarshalJSON(data []byte) error
type ThreadToolResources ¶
type ThreadToolResources struct { CodeInterpreter ThreadToolResourcesCodeInterpreter `json:"code_interpreter"` FileSearch ThreadToolResourcesFileSearch `json:"file_search"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { CodeInterpreter resp.Field FileSearch resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.
func (ThreadToolResources) RawJSON ¶
func (r ThreadToolResources) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThreadToolResources) UnmarshalJSON ¶
func (r *ThreadToolResources) UnmarshalJSON(data []byte) error
type ThreadToolResourcesCodeInterpreter ¶
type ThreadToolResourcesCodeInterpreter struct { // A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made // available to the `code_interpreter` tool. There can be a maximum of 20 files // associated with the tool. FileIDs []string `json:"file_ids"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { FileIDs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ThreadToolResourcesCodeInterpreter) RawJSON ¶
func (r ThreadToolResourcesCodeInterpreter) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThreadToolResourcesCodeInterpreter) UnmarshalJSON ¶
func (r *ThreadToolResourcesCodeInterpreter) UnmarshalJSON(data []byte) error
type ThreadToolResourcesFileSearch ¶
type ThreadToolResourcesFileSearch struct { // The // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // attached to this thread. There can be a maximum of 1 vector store attached to // the thread. VectorStoreIDs []string `json:"vector_store_ids"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { VectorStoreIDs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (ThreadToolResourcesFileSearch) RawJSON ¶
func (r ThreadToolResourcesFileSearch) RawJSON() string
Returns the unmodified JSON received from the API
func (*ThreadToolResourcesFileSearch) UnmarshalJSON ¶
func (r *ThreadToolResourcesFileSearch) UnmarshalJSON(data []byte) error
type ToolCallDeltaObject ¶
type ToolCallDeltaObject struct { // Always `tool_calls`. Type constant.ToolCalls `json:"type,required"` // An array of tool calls the run step was involved in. These can be associated // with one of three types of tools: `code_interpreter`, `file_search`, or // `function`. ToolCalls []ToolCallDeltaUnion `json:"tool_calls"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Type resp.Field ToolCalls resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details of the tool call.
func (ToolCallDeltaObject) RawJSON ¶
func (r ToolCallDeltaObject) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolCallDeltaObject) UnmarshalJSON ¶
func (r *ToolCallDeltaObject) UnmarshalJSON(data []byte) error
type ToolCallDeltaUnion ¶
type ToolCallDeltaUnion struct { Index int64 `json:"index"` // Any of "code_interpreter", "file_search", "function". Type string `json:"type"` ID string `json:"id"` // This field is from variant [CodeInterpreterToolCallDelta]. CodeInterpreter CodeInterpreterToolCallDeltaCodeInterpreter `json:"code_interpreter"` // This field is from variant [FileSearchToolCallDelta]. FileSearch interface{} `json:"file_search"` // This field is from variant [FunctionToolCallDelta]. Function FunctionToolCallDeltaFunction `json:"function"` JSON struct { Index resp.Field Type resp.Field ID resp.Field CodeInterpreter resp.Field FileSearch resp.Field Function resp.Field // contains filtered or unexported fields } `json:"-"` }
ToolCallDeltaUnion contains all possible properties and values from CodeInterpreterToolCallDelta, FileSearchToolCallDelta, FunctionToolCallDelta.
Use the ToolCallDeltaUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ToolCallDeltaUnion) AsAny ¶
func (u ToolCallDeltaUnion) AsAny() anyToolCallDelta
Use the following switch statement to find the correct variant
switch variant := ToolCallDeltaUnion.AsAny().(type) { case CodeInterpreterToolCallDelta: case FileSearchToolCallDelta: case FunctionToolCallDelta: default: fmt.Errorf("no variant present") }
func (ToolCallDeltaUnion) AsCodeInterpreter ¶
func (u ToolCallDeltaUnion) AsCodeInterpreter() (v CodeInterpreterToolCallDelta)
func (ToolCallDeltaUnion) AsFileSearch ¶
func (u ToolCallDeltaUnion) AsFileSearch() (v FileSearchToolCallDelta)
func (ToolCallDeltaUnion) AsFunction ¶
func (u ToolCallDeltaUnion) AsFunction() (v FunctionToolCallDelta)
func (ToolCallDeltaUnion) RawJSON ¶
func (u ToolCallDeltaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolCallDeltaUnion) UnmarshalJSON ¶
func (r *ToolCallDeltaUnion) UnmarshalJSON(data []byte) error
type ToolCallUnion ¶
type ToolCallUnion struct { ID string `json:"id"` // This field is from variant [CodeInterpreterToolCall]. CodeInterpreter CodeInterpreterToolCallCodeInterpreter `json:"code_interpreter"` // Any of "code_interpreter", "file_search", "function". Type string `json:"type"` // This field is from variant [FileSearchToolCall]. FileSearch FileSearchToolCallFileSearch `json:"file_search"` // This field is from variant [FunctionToolCall]. Function FunctionToolCallFunction `json:"function"` JSON struct { ID resp.Field CodeInterpreter resp.Field Type resp.Field FileSearch resp.Field Function resp.Field // contains filtered or unexported fields } `json:"-"` }
ToolCallUnion contains all possible properties and values from CodeInterpreterToolCall, FileSearchToolCall, FunctionToolCall.
Use the ToolCallUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (ToolCallUnion) AsAny ¶
func (u ToolCallUnion) AsAny() anyToolCall
Use the following switch statement to find the correct variant
switch variant := ToolCallUnion.AsAny().(type) { case CodeInterpreterToolCall: case FileSearchToolCall: case FunctionToolCall: default: fmt.Errorf("no variant present") }
func (ToolCallUnion) AsCodeInterpreter ¶
func (u ToolCallUnion) AsCodeInterpreter() (v CodeInterpreterToolCall)
func (ToolCallUnion) AsFileSearch ¶
func (u ToolCallUnion) AsFileSearch() (v FileSearchToolCall)
func (ToolCallUnion) AsFunction ¶
func (u ToolCallUnion) AsFunction() (v FunctionToolCall)
func (ToolCallUnion) RawJSON ¶
func (u ToolCallUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolCallUnion) UnmarshalJSON ¶
func (r *ToolCallUnion) UnmarshalJSON(data []byte) error
type ToolCallsStepDetails ¶
type ToolCallsStepDetails struct { // An array of tool calls the run step was involved in. These can be associated // with one of three types of tools: `code_interpreter`, `file_search`, or // `function`. ToolCalls []ToolCallUnion `json:"tool_calls,required"` // Always `tool_calls`. Type constant.ToolCalls `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ToolCalls resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Details of the tool call.
func (ToolCallsStepDetails) RawJSON ¶
func (r ToolCallsStepDetails) RawJSON() string
Returns the unmodified JSON received from the API
func (*ToolCallsStepDetails) UnmarshalJSON ¶
func (r *ToolCallsStepDetails) UnmarshalJSON(data []byte) error
type Transcription ¶
type Transcription struct { // The transcribed text. Text string `json:"text,required"` // The log probabilities of the tokens in the transcription. Only returned with the // models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added // to the `include` array. Logprobs []TranscriptionLogprob `json:"logprobs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Logprobs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Represents a transcription response returned by model, based on the provided input.
func (Transcription) RawJSON ¶
func (r Transcription) RawJSON() string
Returns the unmodified JSON received from the API
func (*Transcription) UnmarshalJSON ¶
func (r *Transcription) UnmarshalJSON(data []byte) error
type TranscriptionInclude ¶
type TranscriptionInclude string
const (
TranscriptionIncludeLogprobs TranscriptionInclude = "logprobs"
)
type TranscriptionLogprob ¶
type TranscriptionLogprob struct { // The token in the transcription. Token string `json:"token"` // The bytes of the token. Bytes []float64 `json:"bytes"` // The log probability of the token. Logprob float64 `json:"logprob"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Token resp.Field Bytes resp.Field Logprob resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (TranscriptionLogprob) RawJSON ¶
func (r TranscriptionLogprob) RawJSON() string
Returns the unmodified JSON received from the API
func (*TranscriptionLogprob) UnmarshalJSON ¶
func (r *TranscriptionLogprob) UnmarshalJSON(data []byte) error
type TranscriptionStreamEventUnion ¶
type TranscriptionStreamEventUnion struct { // This field is from variant [TranscriptionTextDeltaEvent]. Delta string `json:"delta"` // Any of "transcript.text.delta", "transcript.text.done". Type string `json:"type"` // This field is a union of [[]TranscriptionTextDeltaEventLogprob], // [[]TranscriptionTextDoneEventLogprob] Logprobs TranscriptionStreamEventUnionLogprobs `json:"logprobs"` // This field is from variant [TranscriptionTextDoneEvent]. Text string `json:"text"` JSON struct { Delta resp.Field Type resp.Field Logprobs resp.Field Text resp.Field // contains filtered or unexported fields } `json:"-"` }
TranscriptionStreamEventUnion contains all possible properties and values from TranscriptionTextDeltaEvent, TranscriptionTextDoneEvent.
Use the TranscriptionStreamEventUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (TranscriptionStreamEventUnion) AsAny ¶
func (u TranscriptionStreamEventUnion) AsAny() anyTranscriptionStreamEvent
Use the following switch statement to find the correct variant
switch variant := TranscriptionStreamEventUnion.AsAny().(type) { case TranscriptionTextDeltaEvent: case TranscriptionTextDoneEvent: default: fmt.Errorf("no variant present") }
func (TranscriptionStreamEventUnion) AsTranscriptTextDelta ¶
func (u TranscriptionStreamEventUnion) AsTranscriptTextDelta() (v TranscriptionTextDeltaEvent)
func (TranscriptionStreamEventUnion) AsTranscriptTextDone ¶
func (u TranscriptionStreamEventUnion) AsTranscriptTextDone() (v TranscriptionTextDoneEvent)
func (TranscriptionStreamEventUnion) RawJSON ¶
func (u TranscriptionStreamEventUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*TranscriptionStreamEventUnion) UnmarshalJSON ¶
func (r *TranscriptionStreamEventUnion) UnmarshalJSON(data []byte) error
type TranscriptionStreamEventUnionLogprobs ¶
type TranscriptionStreamEventUnionLogprobs struct { // This field will be present if the value is a // [[]TranscriptionTextDeltaEventLogprob] instead of an object. OfTranscriptionTextDeltaEventLogprobs []TranscriptionTextDeltaEventLogprob `json:",inline"` // This field will be present if the value is a // [[]TranscriptionTextDoneEventLogprob] instead of an object. OfTranscriptionTextDoneEventLogprobs []TranscriptionTextDoneEventLogprob `json:",inline"` JSON struct { OfTranscriptionTextDeltaEventLogprobs resp.Field OfTranscriptionTextDoneEventLogprobs resp.Field // contains filtered or unexported fields } `json:"-"` }
TranscriptionStreamEventUnionLogprobs is an implicit subunion of TranscriptionStreamEventUnion. TranscriptionStreamEventUnionLogprobs provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the TranscriptionStreamEventUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfTranscriptionTextDeltaEventLogprobs OfTranscriptionTextDoneEventLogprobs]
func (*TranscriptionStreamEventUnionLogprobs) UnmarshalJSON ¶
func (r *TranscriptionStreamEventUnionLogprobs) UnmarshalJSON(data []byte) error
type TranscriptionTextDeltaEvent ¶
type TranscriptionTextDeltaEvent struct { // The text delta that was additionally transcribed. Delta string `json:"delta,required"` // The type of the event. Always `transcript.text.delta`. Type constant.TranscriptTextDelta `json:"type,required"` // The log probabilities of the delta. Only included if you // [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) // with the `include[]` parameter set to `logprobs`. Logprobs []TranscriptionTextDeltaEventLogprob `json:"logprobs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Delta resp.Field Type resp.Field Logprobs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`.
func (TranscriptionTextDeltaEvent) RawJSON ¶
func (r TranscriptionTextDeltaEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*TranscriptionTextDeltaEvent) UnmarshalJSON ¶
func (r *TranscriptionTextDeltaEvent) UnmarshalJSON(data []byte) error
type TranscriptionTextDeltaEventLogprob ¶
type TranscriptionTextDeltaEventLogprob struct { // The token that was used to generate the log probability. Token string `json:"token"` // The bytes that were used to generate the log probability. Bytes []interface{} `json:"bytes"` // The log probability of the token. Logprob float64 `json:"logprob"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Token resp.Field Bytes resp.Field Logprob resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (TranscriptionTextDeltaEventLogprob) RawJSON ¶
func (r TranscriptionTextDeltaEventLogprob) RawJSON() string
Returns the unmodified JSON received from the API
func (*TranscriptionTextDeltaEventLogprob) UnmarshalJSON ¶
func (r *TranscriptionTextDeltaEventLogprob) UnmarshalJSON(data []byte) error
type TranscriptionTextDoneEvent ¶
type TranscriptionTextDoneEvent struct { // The text that was transcribed. Text string `json:"text,required"` // The type of the event. Always `transcript.text.done`. Type constant.TranscriptTextDone `json:"type,required"` // The log probabilities of the individual tokens in the transcription. Only // included if you // [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) // with the `include[]` parameter set to `logprobs`. Logprobs []TranscriptionTextDoneEventLogprob `json:"logprobs"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field Logprobs resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`.
func (TranscriptionTextDoneEvent) RawJSON ¶
func (r TranscriptionTextDoneEvent) RawJSON() string
Returns the unmodified JSON received from the API
func (*TranscriptionTextDoneEvent) UnmarshalJSON ¶
func (r *TranscriptionTextDoneEvent) UnmarshalJSON(data []byte) error
type TranscriptionTextDoneEventLogprob ¶
type TranscriptionTextDoneEventLogprob struct { // The token that was used to generate the log probability. Token string `json:"token"` // The bytes that were used to generate the log probability. Bytes []interface{} `json:"bytes"` // The log probability of the token. Logprob float64 `json:"logprob"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Token resp.Field Bytes resp.Field Logprob resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (TranscriptionTextDoneEventLogprob) RawJSON ¶
func (r TranscriptionTextDoneEventLogprob) RawJSON() string
Returns the unmodified JSON received from the API
func (*TranscriptionTextDoneEventLogprob) UnmarshalJSON ¶
func (r *TranscriptionTextDoneEventLogprob) UnmarshalJSON(data []byte) error
type Translation ¶
type Translation struct { Text string `json:"text,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (Translation) RawJSON ¶
func (r Translation) RawJSON() string
Returns the unmodified JSON received from the API
func (*Translation) UnmarshalJSON ¶
func (r *Translation) UnmarshalJSON(data []byte) error
type Upload ¶
type Upload struct { // The Upload unique identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The intended number of bytes to be uploaded. Bytes int64 `json:"bytes,required"` // The Unix timestamp (in seconds) for when the Upload was created. CreatedAt int64 `json:"created_at,required"` // The Unix timestamp (in seconds) for when the Upload will expire. ExpiresAt int64 `json:"expires_at,required"` // The name of the file to be uploaded. Filename string `json:"filename,required"` // The object type, which is always "upload". Object constant.Upload `json:"object,required"` // The intended purpose of the file. // [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose) // for acceptable values. Purpose string `json:"purpose,required"` // The status of the Upload. // // Any of "pending", "completed", "cancelled", "expired". Status UploadStatus `json:"status,required"` // The `File` object represents a document that has been uploaded to OpenAI. File FileObject `json:"file,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Bytes resp.Field CreatedAt resp.Field ExpiresAt resp.Field Filename resp.Field Object resp.Field Purpose resp.Field Status resp.Field File resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The Upload object can accept byte chunks in the form of Parts.
func (*Upload) UnmarshalJSON ¶
type UploadCompleteParams ¶
type UploadCompleteParams struct { // The ordered list of Part IDs. PartIDs []string `json:"part_ids,omitzero,required"` // The optional md5 checksum for the file contents to verify if the bytes uploaded // matches what you expect. Md5 param.Opt[string] `json:"md5,omitzero"` // contains filtered or unexported fields }
func (UploadCompleteParams) IsPresent ¶
func (f UploadCompleteParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (UploadCompleteParams) MarshalJSON ¶
func (r UploadCompleteParams) MarshalJSON() (data []byte, err error)
type UploadNewParams ¶
type UploadNewParams struct { // The number of bytes in the file you are uploading. Bytes int64 `json:"bytes,required"` // The name of the file to upload. Filename string `json:"filename,required"` // The MIME type of the file. // // This must fall within the supported MIME types for your file purpose. See the // supported MIME types for assistants and vision. MimeType string `json:"mime_type,required"` // The intended purpose of the uploaded file. // // See the // [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose). // // Any of "assistants", "batch", "fine-tune", "vision", "user_data", "evals". Purpose FilePurpose `json:"purpose,omitzero,required"` // contains filtered or unexported fields }
func (UploadNewParams) IsPresent ¶
func (f UploadNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (UploadNewParams) MarshalJSON ¶
func (r UploadNewParams) MarshalJSON() (data []byte, err error)
type UploadPart ¶
type UploadPart struct { // The upload Part unique identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the Part was created. CreatedAt int64 `json:"created_at,required"` // The object type, which is always `upload.part`. Object constant.UploadPart `json:"object,required"` // The ID of the Upload object that this Part was added to. UploadID string `json:"upload_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field Object resp.Field UploadID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The upload Part represents a chunk of bytes we can add to an Upload object.
func (UploadPart) RawJSON ¶
func (r UploadPart) RawJSON() string
Returns the unmodified JSON received from the API
func (*UploadPart) UnmarshalJSON ¶
func (r *UploadPart) UnmarshalJSON(data []byte) error
type UploadPartNewParams ¶
type UploadPartNewParams struct { // The chunk of bytes for this Part. Data io.Reader `json:"data,required" format:"binary"` // contains filtered or unexported fields }
func (UploadPartNewParams) IsPresent ¶
func (f UploadPartNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (UploadPartNewParams) MarshalMultipart ¶
func (r UploadPartNewParams) MarshalMultipart() (data []byte, contentType string, err error)
type UploadPartService ¶
type UploadPartService struct {
Options []option.RequestOption
}
UploadPartService 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 NewUploadPartService method instead.
func NewUploadPartService ¶
func NewUploadPartService(opts ...option.RequestOption) (r UploadPartService)
NewUploadPartService 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 (*UploadPartService) New ¶
func (r *UploadPartService) New(ctx context.Context, uploadID string, body UploadPartNewParams, opts ...option.RequestOption) (res *UploadPart, err error)
Adds a [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an Upload(https://platform.openai.com/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
type UploadService ¶
type UploadService struct { Options []option.RequestOption Parts UploadPartService }
UploadService 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 NewUploadService method instead.
func NewUploadService ¶
func NewUploadService(opts ...option.RequestOption) (r UploadService)
NewUploadService 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 (*UploadService) Cancel ¶
func (r *UploadService) Cancel(ctx context.Context, uploadID string, opts ...option.RequestOption) (res *Upload, err error)
Cancels the Upload. No Parts may be added after an Upload is cancelled.
func (*UploadService) Complete ¶
func (r *UploadService) Complete(ctx context.Context, uploadID string, body UploadCompleteParams, opts ...option.RequestOption) (res *Upload, err error)
Completes the Upload(https://platform.openai.com/docs/api-reference/uploads/object).
Within the returned Upload object, there is a nested File(https://platform.openai.com/docs/api-reference/files/object) object that is ready to use in the rest of the platform.
You can specify the order of the Parts by passing in an ordered list of the Part IDs.
The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
func (*UploadService) New ¶
func (r *UploadService) New(ctx context.Context, body UploadNewParams, opts ...option.RequestOption) (res *Upload, err error)
Creates an intermediate Upload(https://platform.openai.com/docs/api-reference/uploads/object) object that you can add [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.
Once you complete the Upload, we will create a File(https://platform.openai.com/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.
For certain `purpose` values, the correct `mime_type` must be specified. Please refer to documentation for the [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).
For guidance on the proper filename extensions for each purpose, please follow the documentation on [creating a File](https://platform.openai.com/docs/api-reference/files/create).
type UploadStatus ¶
type UploadStatus string
The status of the Upload.
const ( UploadStatusPending UploadStatus = "pending" UploadStatusCompleted UploadStatus = "completed" UploadStatusCancelled UploadStatus = "cancelled" UploadStatusExpired UploadStatus = "expired" )
type VectorStore ¶
type VectorStore struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the vector store was created. CreatedAt int64 `json:"created_at,required"` FileCounts VectorStoreFileCounts `json:"file_counts,required"` // The Unix timestamp (in seconds) for when the vector store was last active. LastActiveAt int64 `json:"last_active_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 shared.Metadata `json:"metadata,required"` // The name of the vector store. Name string `json:"name,required"` // The object type, which is always `vector_store`. Object constant.VectorStore `json:"object,required"` // The status of the vector store, which can be either `expired`, `in_progress`, or // `completed`. A status of `completed` indicates that the vector store is ready // for use. // // Any of "expired", "in_progress", "completed". Status VectorStoreStatus `json:"status,required"` // The total number of bytes used by the files in the vector store. UsageBytes int64 `json:"usage_bytes,required"` // The expiration policy for a vector store. ExpiresAfter VectorStoreExpiresAfter `json:"expires_after"` // The Unix timestamp (in seconds) for when the vector store will expire. ExpiresAt int64 `json:"expires_at,nullable"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field FileCounts resp.Field LastActiveAt resp.Field Metadata resp.Field Name resp.Field Object resp.Field Status resp.Field UsageBytes resp.Field ExpiresAfter resp.Field ExpiresAt resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A vector store is a collection of processed files can be used by the `file_search` tool.
func (VectorStore) RawJSON ¶
func (r VectorStore) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStore) UnmarshalJSON ¶
func (r *VectorStore) UnmarshalJSON(data []byte) error
type VectorStoreDeleted ¶
type VectorStoreDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object constant.VectorStoreDeleted `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreDeleted) RawJSON ¶
func (r VectorStoreDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreDeleted) UnmarshalJSON ¶
func (r *VectorStoreDeleted) UnmarshalJSON(data []byte) error
type VectorStoreExpiresAfter ¶
type VectorStoreExpiresAfter struct { // Anchor timestamp after which the expiration policy applies. Supported anchors: // `last_active_at`. Anchor constant.LastActiveAt `json:"anchor,required"` // The number of days after the anchor time that the vector store will expire. Days int64 `json:"days,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Anchor resp.Field Days resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The expiration policy for a vector store.
func (VectorStoreExpiresAfter) RawJSON ¶
func (r VectorStoreExpiresAfter) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreExpiresAfter) UnmarshalJSON ¶
func (r *VectorStoreExpiresAfter) UnmarshalJSON(data []byte) error
type VectorStoreFile ¶
type VectorStoreFile struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the vector store file was created. CreatedAt int64 `json:"created_at,required"` // The last error associated with this vector store file. Will be `null` if there // are no errors. LastError VectorStoreFileLastError `json:"last_error,required"` // The object type, which is always `vector_store.file`. Object constant.VectorStoreFile `json:"object,required"` // The status of the vector store file, which can be either `in_progress`, // `completed`, `cancelled`, or `failed`. The status `completed` indicates that the // vector store file is ready for use. // // Any of "in_progress", "completed", "cancelled", "failed". Status VectorStoreFileStatus `json:"status,required"` // The total vector store usage in bytes. Note that this may be different from the // original file size. UsageBytes int64 `json:"usage_bytes,required"` // The ID of the // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // that the [File](https://platform.openai.com/docs/api-reference/files) is // attached to. VectorStoreID string `json:"vector_store_id,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, booleans, or numbers. Attributes map[string]VectorStoreFileAttributeUnion `json:"attributes,nullable"` // The strategy used to chunk the file. ChunkingStrategy FileChunkingStrategyUnion `json:"chunking_strategy"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field LastError resp.Field Object resp.Field Status resp.Field UsageBytes resp.Field VectorStoreID resp.Field Attributes resp.Field ChunkingStrategy resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A list of files attached to a vector store.
func (VectorStoreFile) RawJSON ¶
func (r VectorStoreFile) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFile) UnmarshalJSON ¶
func (r *VectorStoreFile) UnmarshalJSON(data []byte) error
type VectorStoreFileAttributeUnion ¶
type VectorStoreFileAttributeUnion struct { // This field will be present if the value is a [string] instead of an object. OfString string `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` // This field will be present if the value is a [bool] instead of an object. OfBool bool `json:",inline"` JSON struct { OfString resp.Field OfFloat resp.Field OfBool resp.Field // contains filtered or unexported fields } `json:"-"` }
VectorStoreFileAttributeUnion contains all possible properties and values from [string], [float64], [bool].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]
func (VectorStoreFileAttributeUnion) AsBool ¶
func (u VectorStoreFileAttributeUnion) AsBool() (v bool)
func (VectorStoreFileAttributeUnion) AsFloat ¶
func (u VectorStoreFileAttributeUnion) AsFloat() (v float64)
func (VectorStoreFileAttributeUnion) AsString ¶
func (u VectorStoreFileAttributeUnion) AsString() (v string)
func (VectorStoreFileAttributeUnion) RawJSON ¶
func (u VectorStoreFileAttributeUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileAttributeUnion) UnmarshalJSON ¶
func (r *VectorStoreFileAttributeUnion) UnmarshalJSON(data []byte) error
type VectorStoreFileBatch ¶
type VectorStoreFileBatch struct { // The identifier, which can be referenced in API endpoints. ID string `json:"id,required"` // The Unix timestamp (in seconds) for when the vector store files batch was // created. CreatedAt int64 `json:"created_at,required"` FileCounts VectorStoreFileBatchFileCounts `json:"file_counts,required"` // The object type, which is always `vector_store.file_batch`. Object constant.VectorStoreFilesBatch `json:"object,required"` // The status of the vector store files batch, which can be either `in_progress`, // `completed`, `cancelled` or `failed`. // // Any of "in_progress", "completed", "cancelled", "failed". Status VectorStoreFileBatchStatus `json:"status,required"` // The ID of the // [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) // that the [File](https://platform.openai.com/docs/api-reference/files) is // attached to. VectorStoreID string `json:"vector_store_id,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field CreatedAt resp.Field FileCounts resp.Field Object resp.Field Status resp.Field VectorStoreID resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
A batch of files attached to a vector store.
func (VectorStoreFileBatch) RawJSON ¶
func (r VectorStoreFileBatch) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileBatch) UnmarshalJSON ¶
func (r *VectorStoreFileBatch) UnmarshalJSON(data []byte) error
type VectorStoreFileBatchFileCounts ¶
type VectorStoreFileBatchFileCounts struct { // The number of files that where cancelled. Cancelled int64 `json:"cancelled,required"` // The number of files that have been processed. Completed int64 `json:"completed,required"` // The number of files that have failed to process. Failed int64 `json:"failed,required"` // The number of files that are currently being processed. InProgress int64 `json:"in_progress,required"` // The total number of files. Total int64 `json:"total,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Cancelled resp.Field Completed resp.Field Failed resp.Field InProgress resp.Field Total resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreFileBatchFileCounts) RawJSON ¶
func (r VectorStoreFileBatchFileCounts) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileBatchFileCounts) UnmarshalJSON ¶
func (r *VectorStoreFileBatchFileCounts) UnmarshalJSON(data []byte) error
type VectorStoreFileBatchListFilesParams ¶
type VectorStoreFileBatchListFilesParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. // // Any of "in_progress", "completed", "failed", "cancelled". Filter VectorStoreFileBatchListFilesParamsFilter `query:"filter,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order VectorStoreFileBatchListFilesParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (VectorStoreFileBatchListFilesParams) IsPresent ¶
func (f VectorStoreFileBatchListFilesParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileBatchListFilesParams) URLQuery ¶
func (r VectorStoreFileBatchListFilesParams) URLQuery() (v url.Values, err error)
URLQuery serializes VectorStoreFileBatchListFilesParams's query parameters as `url.Values`.
type VectorStoreFileBatchListFilesParamsFilter ¶
type VectorStoreFileBatchListFilesParamsFilter string
Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
const ( VectorStoreFileBatchListFilesParamsFilterInProgress VectorStoreFileBatchListFilesParamsFilter = "in_progress" VectorStoreFileBatchListFilesParamsFilterCompleted VectorStoreFileBatchListFilesParamsFilter = "completed" VectorStoreFileBatchListFilesParamsFilterFailed VectorStoreFileBatchListFilesParamsFilter = "failed" VectorStoreFileBatchListFilesParamsFilterCancelled VectorStoreFileBatchListFilesParamsFilter = "cancelled" )
type VectorStoreFileBatchListFilesParamsOrder ¶
type VectorStoreFileBatchListFilesParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( VectorStoreFileBatchListFilesParamsOrderAsc VectorStoreFileBatchListFilesParamsOrder = "asc" VectorStoreFileBatchListFilesParamsOrderDesc VectorStoreFileBatchListFilesParamsOrder = "desc" )
type VectorStoreFileBatchNewParams ¶
type VectorStoreFileBatchNewParams struct { // A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that // the vector store should use. Useful for tools like `file_search` that can access // files. FileIDs []string `json:"file_ids,omitzero,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, booleans, or numbers. Attributes map[string]VectorStoreFileBatchNewParamsAttributeUnion `json:"attributes,omitzero"` // The chunking strategy used to chunk the file(s). If not set, will use the `auto` // strategy. Only applicable if `file_ids` is non-empty. ChunkingStrategy FileChunkingStrategyParamUnion `json:"chunking_strategy,omitzero"` // contains filtered or unexported fields }
func (VectorStoreFileBatchNewParams) IsPresent ¶
func (f VectorStoreFileBatchNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileBatchNewParams) MarshalJSON ¶
func (r VectorStoreFileBatchNewParams) MarshalJSON() (data []byte, err error)
type VectorStoreFileBatchNewParamsAttributeUnion ¶
type VectorStoreFileBatchNewParamsAttributeUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfFloat param.Opt[float64] `json:",omitzero,inline"` OfBool param.Opt[bool] `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (VectorStoreFileBatchNewParamsAttributeUnion) IsPresent ¶
func (u VectorStoreFileBatchNewParamsAttributeUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileBatchNewParamsAttributeUnion) MarshalJSON ¶
func (u VectorStoreFileBatchNewParamsAttributeUnion) MarshalJSON() ([]byte, error)
type VectorStoreFileBatchService ¶
type VectorStoreFileBatchService struct {
Options []option.RequestOption
}
VectorStoreFileBatchService 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 NewVectorStoreFileBatchService method instead.
func NewVectorStoreFileBatchService ¶
func NewVectorStoreFileBatchService(opts ...option.RequestOption) (r VectorStoreFileBatchService)
NewVectorStoreFileBatchService 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 (*VectorStoreFileBatchService) Cancel ¶
func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, vectorStoreID string, batchID string, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error)
Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
func (*VectorStoreFileBatchService) Get ¶
func (r *VectorStoreFileBatchService) Get(ctx context.Context, vectorStoreID string, batchID string, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error)
Retrieves a vector store file batch.
func (*VectorStoreFileBatchService) ListFiles ¶
func (r *VectorStoreFileBatchService) ListFiles(ctx context.Context, vectorStoreID string, batchID string, query VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStoreFile], err error)
Returns a list of vector store files in a batch.
func (*VectorStoreFileBatchService) ListFilesAutoPaging ¶
func (r *VectorStoreFileBatchService) ListFilesAutoPaging(ctx context.Context, vectorStoreID string, batchID string, query VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[VectorStoreFile]
Returns a list of vector store files in a batch.
func (*VectorStoreFileBatchService) New ¶
func (r *VectorStoreFileBatchService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileBatchNewParams, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error)
Create a vector store file batch.
func (*VectorStoreFileBatchService) NewAndPoll ¶
func (r *VectorStoreFileBatchService) NewAndPoll(ctx context.Context, vectorStoreId string, body VectorStoreFileBatchNewParams, pollIntervalMs int, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error)
Create a vector store file batch and polls the API until the task is complete. Pass 0 for pollIntervalMs to enable default polling interval.
func (*VectorStoreFileBatchService) PollStatus ¶
func (r *VectorStoreFileBatchService) PollStatus(ctx context.Context, vectorStoreID string, batchID string, pollIntervalMs int, opts ...option.RequestOption) (*VectorStoreFileBatch, error)
PollStatus waits until a BetaVectorStoreFileBatch is no longer in an incomplete state and returns it. Pass 0 as pollIntervalMs to use the default polling interval of 1 second.
func (*VectorStoreFileBatchService) UploadAndPoll ¶
func (r *VectorStoreFileBatchService) UploadAndPoll(ctx context.Context, vectorStoreID string, files []FileNewParams, fileIDs []string, pollIntervalMs int, opts ...option.RequestOption) (*VectorStoreFileBatch, error)
Uploads the given files concurrently and then creates a vector store file batch.
If you've already uploaded certain files that you want to include in this batch then you can pass their IDs through the file_ids argument.
Pass 0 for pollIntervalMs to enable default polling interval.
By default, if any file upload fails then an exception will be eagerly raised.
type VectorStoreFileBatchStatus ¶
type VectorStoreFileBatchStatus string
The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
const ( VectorStoreFileBatchStatusInProgress VectorStoreFileBatchStatus = "in_progress" VectorStoreFileBatchStatusCompleted VectorStoreFileBatchStatus = "completed" VectorStoreFileBatchStatusCancelled VectorStoreFileBatchStatus = "cancelled" VectorStoreFileBatchStatusFailed VectorStoreFileBatchStatus = "failed" )
type VectorStoreFileContentResponse ¶
type VectorStoreFileContentResponse struct { // The text content Text string `json:"text"` // The content type (currently only `"text"`) Type string `json:"type"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreFileContentResponse) RawJSON ¶
func (r VectorStoreFileContentResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileContentResponse) UnmarshalJSON ¶
func (r *VectorStoreFileContentResponse) UnmarshalJSON(data []byte) error
type VectorStoreFileCounts ¶
type VectorStoreFileCounts struct { // The number of files that were cancelled. Cancelled int64 `json:"cancelled,required"` // The number of files that have been successfully processed. Completed int64 `json:"completed,required"` // The number of files that have failed to process. Failed int64 `json:"failed,required"` // The number of files that are currently being processed. InProgress int64 `json:"in_progress,required"` // The total number of files. Total int64 `json:"total,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Cancelled resp.Field Completed resp.Field Failed resp.Field InProgress resp.Field Total resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreFileCounts) RawJSON ¶
func (r VectorStoreFileCounts) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileCounts) UnmarshalJSON ¶
func (r *VectorStoreFileCounts) UnmarshalJSON(data []byte) error
type VectorStoreFileDeleted ¶
type VectorStoreFileDeleted struct { ID string `json:"id,required"` Deleted bool `json:"deleted,required"` Object constant.VectorStoreFileDeleted `json:"object,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { ID resp.Field Deleted resp.Field Object resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreFileDeleted) RawJSON ¶
func (r VectorStoreFileDeleted) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileDeleted) UnmarshalJSON ¶
func (r *VectorStoreFileDeleted) UnmarshalJSON(data []byte) error
type VectorStoreFileLastError ¶
type VectorStoreFileLastError struct { // One of `server_error` or `rate_limit_exceeded`. // // Any of "server_error", "unsupported_file", "invalid_file". Code string `json:"code,required"` // A human-readable description of the error. Message string `json:"message,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Code resp.Field Message resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
The last error associated with this vector store file. Will be `null` if there are no errors.
func (VectorStoreFileLastError) RawJSON ¶
func (r VectorStoreFileLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreFileLastError) UnmarshalJSON ¶
func (r *VectorStoreFileLastError) UnmarshalJSON(data []byte) error
type VectorStoreFileListParams ¶
type VectorStoreFileListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. // // Any of "in_progress", "completed", "failed", "cancelled". Filter VectorStoreFileListParamsFilter `query:"filter,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order VectorStoreFileListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (VectorStoreFileListParams) IsPresent ¶
func (f VectorStoreFileListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileListParams) URLQuery ¶
func (r VectorStoreFileListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VectorStoreFileListParams's query parameters as `url.Values`.
type VectorStoreFileListParamsFilter ¶
type VectorStoreFileListParamsFilter string
Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
const ( VectorStoreFileListParamsFilterInProgress VectorStoreFileListParamsFilter = "in_progress" VectorStoreFileListParamsFilterCompleted VectorStoreFileListParamsFilter = "completed" VectorStoreFileListParamsFilterFailed VectorStoreFileListParamsFilter = "failed" VectorStoreFileListParamsFilterCancelled VectorStoreFileListParamsFilter = "cancelled" )
type VectorStoreFileListParamsOrder ¶
type VectorStoreFileListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( VectorStoreFileListParamsOrderAsc VectorStoreFileListParamsOrder = "asc" VectorStoreFileListParamsOrderDesc VectorStoreFileListParamsOrder = "desc" )
type VectorStoreFileNewParams ¶
type VectorStoreFileNewParams struct { // A [File](https://platform.openai.com/docs/api-reference/files) ID that the // vector store should use. Useful for tools like `file_search` that can access // files. FileID string `json:"file_id,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, booleans, or numbers. Attributes map[string]VectorStoreFileNewParamsAttributeUnion `json:"attributes,omitzero"` // The chunking strategy used to chunk the file(s). If not set, will use the `auto` // strategy. Only applicable if `file_ids` is non-empty. ChunkingStrategy FileChunkingStrategyParamUnion `json:"chunking_strategy,omitzero"` // contains filtered or unexported fields }
func (VectorStoreFileNewParams) IsPresent ¶
func (f VectorStoreFileNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileNewParams) MarshalJSON ¶
func (r VectorStoreFileNewParams) MarshalJSON() (data []byte, err error)
type VectorStoreFileNewParamsAttributeUnion ¶
type VectorStoreFileNewParamsAttributeUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfFloat param.Opt[float64] `json:",omitzero,inline"` OfBool param.Opt[bool] `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (VectorStoreFileNewParamsAttributeUnion) IsPresent ¶
func (u VectorStoreFileNewParamsAttributeUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileNewParamsAttributeUnion) MarshalJSON ¶
func (u VectorStoreFileNewParamsAttributeUnion) MarshalJSON() ([]byte, error)
type VectorStoreFileService ¶
type VectorStoreFileService struct {
Options []option.RequestOption
}
VectorStoreFileService 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 NewVectorStoreFileService method instead.
func NewVectorStoreFileService ¶
func NewVectorStoreFileService(opts ...option.RequestOption) (r VectorStoreFileService)
NewVectorStoreFileService 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 (*VectorStoreFileService) Content ¶
func (r *VectorStoreFileService) Content(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) (res *pagination.Page[VectorStoreFileContentResponse], err error)
Retrieve the parsed contents of a vector store file.
func (*VectorStoreFileService) ContentAutoPaging ¶
func (r *VectorStoreFileService) ContentAutoPaging(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) *pagination.PageAutoPager[VectorStoreFileContentResponse]
Retrieve the parsed contents of a vector store file.
func (*VectorStoreFileService) Delete ¶
func (r *VectorStoreFileService) Delete(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) (res *VectorStoreFileDeleted, err error)
Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://platform.openai.com/docs/api-reference/files/delete) endpoint.
func (*VectorStoreFileService) Get ¶
func (r *VectorStoreFileService) Get(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) (res *VectorStoreFile, err error)
Retrieves a vector store file.
func (*VectorStoreFileService) List ¶
func (r *VectorStoreFileService) List(ctx context.Context, vectorStoreID string, query VectorStoreFileListParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStoreFile], err error)
Returns a list of vector store files.
func (*VectorStoreFileService) ListAutoPaging ¶
func (r *VectorStoreFileService) ListAutoPaging(ctx context.Context, vectorStoreID string, query VectorStoreFileListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[VectorStoreFile]
Returns a list of vector store files.
func (*VectorStoreFileService) New ¶
func (r *VectorStoreFileService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileNewParams, opts ...option.RequestOption) (res *VectorStoreFile, err error)
Create a vector store file by attaching a File(https://platform.openai.com/docs/api-reference/files) to a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
func (*VectorStoreFileService) NewAndPoll ¶
func (r *VectorStoreFileService) NewAndPoll(ctx context.Context, vectorStoreId string, body VectorStoreFileNewParams, pollIntervalMs int, opts ...option.RequestOption) (res *VectorStoreFile, err error)
Create a vector store file by attaching a File(https://platform.openai.com/docs/api-reference/files) to a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
Polls the API and blocks until the task is complete. Default polling interval is 1 second.
func (*VectorStoreFileService) PollStatus ¶
func (r *VectorStoreFileService) PollStatus(ctx context.Context, vectorStoreID string, fileID string, pollIntervalMs int, opts ...option.RequestOption) (*VectorStoreFile, error)
PollStatus waits until a VectorStoreFile is no longer in an incomplete state and returns it. Pass 0 as pollIntervalMs to use the default polling interval of 1 second.
func (*VectorStoreFileService) Update ¶
func (r *VectorStoreFileService) Update(ctx context.Context, vectorStoreID string, fileID string, body VectorStoreFileUpdateParams, opts ...option.RequestOption) (res *VectorStoreFile, err error)
Update attributes on a vector store file.
func (*VectorStoreFileService) Upload ¶
func (r *VectorStoreFileService) Upload(ctx context.Context, vectorStoreID string, body FileNewParams, opts ...option.RequestOption) (*VectorStoreFile, error)
Upload a file to the `files` API and then attach it to the given vector store.
Note the file will be asynchronously processed (you can use the alternative polling helper method to wait for processing to complete).
func (*VectorStoreFileService) UploadAndPoll ¶
func (r *VectorStoreFileService) UploadAndPoll(ctx context.Context, vectorStoreID string, body FileNewParams, pollIntervalMs int, opts ...option.RequestOption) (*VectorStoreFile, error)
Add a file to a vector store and poll until processing is complete. Default polling interval is 1 second.
type VectorStoreFileStatus ¶
type VectorStoreFileStatus string
The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use.
const ( VectorStoreFileStatusInProgress VectorStoreFileStatus = "in_progress" VectorStoreFileStatusCompleted VectorStoreFileStatus = "completed" VectorStoreFileStatusCancelled VectorStoreFileStatus = "cancelled" VectorStoreFileStatusFailed VectorStoreFileStatus = "failed" )
type VectorStoreFileUpdateParams ¶
type VectorStoreFileUpdateParams struct { // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. Keys are strings with a maximum // length of 64 characters. Values are strings with a maximum length of 512 // characters, booleans, or numbers. Attributes map[string]VectorStoreFileUpdateParamsAttributeUnion `json:"attributes,omitzero,required"` // contains filtered or unexported fields }
func (VectorStoreFileUpdateParams) IsPresent ¶
func (f VectorStoreFileUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileUpdateParams) MarshalJSON ¶
func (r VectorStoreFileUpdateParams) MarshalJSON() (data []byte, err error)
type VectorStoreFileUpdateParamsAttributeUnion ¶
type VectorStoreFileUpdateParamsAttributeUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfFloat param.Opt[float64] `json:",omitzero,inline"` OfBool param.Opt[bool] `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (VectorStoreFileUpdateParamsAttributeUnion) IsPresent ¶
func (u VectorStoreFileUpdateParamsAttributeUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreFileUpdateParamsAttributeUnion) MarshalJSON ¶
func (u VectorStoreFileUpdateParamsAttributeUnion) MarshalJSON() ([]byte, error)
type VectorStoreListParams ¶
type VectorStoreListParams struct { // A cursor for use in pagination. `after` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // ending with obj_foo, your subsequent call can include after=obj_foo in order to // fetch the next page of the list. After param.Opt[string] `query:"after,omitzero" json:"-"` // A cursor for use in pagination. `before` is an object ID that defines your place // in the list. For instance, if you make a list request and receive 100 objects, // starting with obj_foo, your subsequent call can include before=obj_foo in order // to fetch the previous page of the list. Before param.Opt[string] `query:"before,omitzero" json:"-"` // A limit on the number of objects to be returned. Limit can range between 1 and // 100, and the default is 20. Limit param.Opt[int64] `query:"limit,omitzero" json:"-"` // Sort order by the `created_at` timestamp of the objects. `asc` for ascending // order and `desc` for descending order. // // Any of "asc", "desc". Order VectorStoreListParamsOrder `query:"order,omitzero" json:"-"` // contains filtered or unexported fields }
func (VectorStoreListParams) IsPresent ¶
func (f VectorStoreListParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreListParams) URLQuery ¶
func (r VectorStoreListParams) URLQuery() (v url.Values, err error)
URLQuery serializes VectorStoreListParams's query parameters as `url.Values`.
type VectorStoreListParamsOrder ¶
type VectorStoreListParamsOrder string
Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
const ( VectorStoreListParamsOrderAsc VectorStoreListParamsOrder = "asc" VectorStoreListParamsOrderDesc VectorStoreListParamsOrder = "desc" )
type VectorStoreNewParams ¶
type VectorStoreNewParams struct { // The name of the vector store. Name param.Opt[string] `json:"name,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // The chunking strategy used to chunk the file(s). If not set, will use the `auto` // strategy. Only applicable if `file_ids` is non-empty. ChunkingStrategy FileChunkingStrategyParamUnion `json:"chunking_strategy,omitzero"` // The expiration policy for a vector store. ExpiresAfter VectorStoreNewParamsExpiresAfter `json:"expires_after,omitzero"` // A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that // the vector store should use. Useful for tools like `file_search` that can access // files. FileIDs []string `json:"file_ids,omitzero"` // contains filtered or unexported fields }
func (VectorStoreNewParams) IsPresent ¶
func (f VectorStoreNewParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreNewParams) MarshalJSON ¶
func (r VectorStoreNewParams) MarshalJSON() (data []byte, err error)
type VectorStoreNewParamsExpiresAfter ¶
type VectorStoreNewParamsExpiresAfter struct { // The number of days after the anchor time that the vector store will expire. Days int64 `json:"days,required"` // Anchor timestamp after which the expiration policy applies. Supported anchors: // `last_active_at`. // // This field can be elided, and will marshal its zero value as "last_active_at". Anchor constant.LastActiveAt `json:"anchor,required"` // contains filtered or unexported fields }
The expiration policy for a vector store.
The properties Anchor, Days are required.
func (VectorStoreNewParamsExpiresAfter) IsPresent ¶
func (f VectorStoreNewParamsExpiresAfter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreNewParamsExpiresAfter) MarshalJSON ¶
func (r VectorStoreNewParamsExpiresAfter) MarshalJSON() (data []byte, err error)
type VectorStoreSearchParams ¶
type VectorStoreSearchParams struct { // A query string for a search Query VectorStoreSearchParamsQueryUnion `json:"query,omitzero,required"` // The maximum number of results to return. This number should be between 1 and 50 // inclusive. MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"` // Whether to rewrite the natural language query for vector search. RewriteQuery param.Opt[bool] `json:"rewrite_query,omitzero"` // A filter to apply based on file attributes. Filters VectorStoreSearchParamsFiltersUnion `json:"filters,omitzero"` // Ranking options for search. RankingOptions VectorStoreSearchParamsRankingOptions `json:"ranking_options,omitzero"` // contains filtered or unexported fields }
func (VectorStoreSearchParams) IsPresent ¶
func (f VectorStoreSearchParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreSearchParams) MarshalJSON ¶
func (r VectorStoreSearchParams) MarshalJSON() (data []byte, err error)
type VectorStoreSearchParamsFiltersUnion ¶
type VectorStoreSearchParamsFiltersUnion struct { OfComparisonFilter *shared.ComparisonFilterParam `json:",omitzero,inline"` OfCompoundFilter *shared.CompoundFilterParam `json:",omitzero,inline"` // contains filtered or unexported fields }
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (VectorStoreSearchParamsFiltersUnion) GetFilters ¶
func (u VectorStoreSearchParamsFiltersUnion) GetFilters() []shared.ComparisonFilterParam
Returns a pointer to the underlying variant's property, if present.
func (VectorStoreSearchParamsFiltersUnion) GetKey ¶
func (u VectorStoreSearchParamsFiltersUnion) GetKey() *string
Returns a pointer to the underlying variant's property, if present.
func (VectorStoreSearchParamsFiltersUnion) GetType ¶
func (u VectorStoreSearchParamsFiltersUnion) GetType() *string
Returns a pointer to the underlying variant's property, if present.
func (VectorStoreSearchParamsFiltersUnion) GetValue ¶
func (u VectorStoreSearchParamsFiltersUnion) GetValue() *shared.ComparisonFilterValueUnionParam
Returns a pointer to the underlying variant's property, if present.
func (VectorStoreSearchParamsFiltersUnion) IsPresent ¶
func (u VectorStoreSearchParamsFiltersUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreSearchParamsFiltersUnion) MarshalJSON ¶
func (u VectorStoreSearchParamsFiltersUnion) MarshalJSON() ([]byte, error)
type VectorStoreSearchParamsQueryUnion ¶
type VectorStoreSearchParamsQueryUnion struct { OfString param.Opt[string] `json:",omitzero,inline"` OfVectorStoreSearchsQueryArray []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 (VectorStoreSearchParamsQueryUnion) IsPresent ¶
func (u VectorStoreSearchParamsQueryUnion) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreSearchParamsQueryUnion) MarshalJSON ¶
func (u VectorStoreSearchParamsQueryUnion) MarshalJSON() ([]byte, error)
type VectorStoreSearchParamsRankingOptions ¶
type VectorStoreSearchParamsRankingOptions struct { ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"` // Any of "auto", "default-2024-11-15". Ranker string `json:"ranker,omitzero"` // contains filtered or unexported fields }
Ranking options for search.
func (VectorStoreSearchParamsRankingOptions) IsPresent ¶
func (f VectorStoreSearchParamsRankingOptions) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreSearchParamsRankingOptions) MarshalJSON ¶
func (r VectorStoreSearchParamsRankingOptions) MarshalJSON() (data []byte, err error)
type VectorStoreSearchResponse ¶
type VectorStoreSearchResponse struct { // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. Keys are strings with a maximum // length of 64 characters. Values are strings with a maximum length of 512 // characters, booleans, or numbers. Attributes map[string]VectorStoreSearchResponseAttributeUnion `json:"attributes,required"` // Content chunks from the file. Content []VectorStoreSearchResponseContent `json:"content,required"` // The ID of the vector store file. FileID string `json:"file_id,required"` // The name of the vector store file. Filename string `json:"filename,required"` // The similarity score for the result. Score float64 `json:"score,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Attributes resp.Field Content resp.Field FileID resp.Field Filename resp.Field Score resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreSearchResponse) RawJSON ¶
func (r VectorStoreSearchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreSearchResponse) UnmarshalJSON ¶
func (r *VectorStoreSearchResponse) UnmarshalJSON(data []byte) error
type VectorStoreSearchResponseAttributeUnion ¶
type VectorStoreSearchResponseAttributeUnion struct { // This field will be present if the value is a [string] instead of an object. OfString string `json:",inline"` // This field will be present if the value is a [float64] instead of an object. OfFloat float64 `json:",inline"` // This field will be present if the value is a [bool] instead of an object. OfBool bool `json:",inline"` JSON struct { OfString resp.Field OfFloat resp.Field OfBool resp.Field // contains filtered or unexported fields } `json:"-"` }
VectorStoreSearchResponseAttributeUnion contains all possible properties and values from [string], [float64], [bool].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]
func (VectorStoreSearchResponseAttributeUnion) AsBool ¶
func (u VectorStoreSearchResponseAttributeUnion) AsBool() (v bool)
func (VectorStoreSearchResponseAttributeUnion) AsFloat ¶
func (u VectorStoreSearchResponseAttributeUnion) AsFloat() (v float64)
func (VectorStoreSearchResponseAttributeUnion) AsString ¶
func (u VectorStoreSearchResponseAttributeUnion) AsString() (v string)
func (VectorStoreSearchResponseAttributeUnion) RawJSON ¶
func (u VectorStoreSearchResponseAttributeUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreSearchResponseAttributeUnion) UnmarshalJSON ¶
func (r *VectorStoreSearchResponseAttributeUnion) UnmarshalJSON(data []byte) error
type VectorStoreSearchResponseContent ¶
type VectorStoreSearchResponseContent struct { // The text content returned from search. Text string `json:"text,required"` // The type of content. // // Any of "text". Type string `json:"type,required"` // Metadata for the response, check the presence of optional fields with the // [resp.Field.IsPresent] method. JSON struct { Text resp.Field Type resp.Field ExtraFields map[string]resp.Field // contains filtered or unexported fields } `json:"-"` }
func (VectorStoreSearchResponseContent) RawJSON ¶
func (r VectorStoreSearchResponseContent) RawJSON() string
Returns the unmodified JSON received from the API
func (*VectorStoreSearchResponseContent) UnmarshalJSON ¶
func (r *VectorStoreSearchResponseContent) UnmarshalJSON(data []byte) error
type VectorStoreService ¶
type VectorStoreService struct { Options []option.RequestOption Files VectorStoreFileService FileBatches VectorStoreFileBatchService }
VectorStoreService 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 NewVectorStoreService method instead.
func NewVectorStoreService ¶
func NewVectorStoreService(opts ...option.RequestOption) (r VectorStoreService)
NewVectorStoreService 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 (*VectorStoreService) Delete ¶
func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStoreDeleted, err error)
Delete a vector store.
func (*VectorStoreService) Get ¶
func (r *VectorStoreService) Get(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStore, err error)
Retrieves a vector store.
func (*VectorStoreService) List ¶
func (r *VectorStoreService) List(ctx context.Context, query VectorStoreListParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStore], err error)
Returns a list of vector stores.
func (*VectorStoreService) ListAutoPaging ¶
func (r *VectorStoreService) ListAutoPaging(ctx context.Context, query VectorStoreListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[VectorStore]
Returns a list of vector stores.
func (*VectorStoreService) New ¶
func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams, opts ...option.RequestOption) (res *VectorStore, err error)
Create a vector store.
func (*VectorStoreService) Search ¶
func (r *VectorStoreService) Search(ctx context.Context, vectorStoreID string, body VectorStoreSearchParams, opts ...option.RequestOption) (res *pagination.Page[VectorStoreSearchResponse], err error)
Search a vector store for relevant chunks based on a query and file attributes filter.
func (*VectorStoreService) SearchAutoPaging ¶
func (r *VectorStoreService) SearchAutoPaging(ctx context.Context, vectorStoreID string, body VectorStoreSearchParams, opts ...option.RequestOption) *pagination.PageAutoPager[VectorStoreSearchResponse]
Search a vector store for relevant chunks based on a query and file attributes filter.
func (*VectorStoreService) Update ¶
func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, body VectorStoreUpdateParams, opts ...option.RequestOption) (res *VectorStore, err error)
Modifies a vector store.
type VectorStoreStatus ¶
type VectorStoreStatus string
The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
const ( VectorStoreStatusExpired VectorStoreStatus = "expired" VectorStoreStatusInProgress VectorStoreStatus = "in_progress" VectorStoreStatusCompleted VectorStoreStatus = "completed" )
type VectorStoreUpdateParams ¶
type VectorStoreUpdateParams struct { // The name of the vector store. Name param.Opt[string] `json:"name,omitzero"` // The expiration policy for a vector store. ExpiresAfter VectorStoreUpdateParamsExpiresAfter `json:"expires_after,omitzero"` // Set of 16 key-value pairs that can be attached to an object. This can be useful // for storing additional information about the object in a structured format, and // querying for objects via API or the dashboard. // // Keys are strings with a maximum length of 64 characters. Values are strings with // a maximum length of 512 characters. Metadata shared.MetadataParam `json:"metadata,omitzero"` // contains filtered or unexported fields }
func (VectorStoreUpdateParams) IsPresent ¶
func (f VectorStoreUpdateParams) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreUpdateParams) MarshalJSON ¶
func (r VectorStoreUpdateParams) MarshalJSON() (data []byte, err error)
type VectorStoreUpdateParamsExpiresAfter ¶
type VectorStoreUpdateParamsExpiresAfter struct { // The number of days after the anchor time that the vector store will expire. Days int64 `json:"days,required"` // Anchor timestamp after which the expiration policy applies. Supported anchors: // `last_active_at`. // // This field can be elided, and will marshal its zero value as "last_active_at". Anchor constant.LastActiveAt `json:"anchor,required"` // contains filtered or unexported fields }
The expiration policy for a vector store.
The properties Anchor, Days are required.
func (VectorStoreUpdateParamsExpiresAfter) IsPresent ¶
func (f VectorStoreUpdateParamsExpiresAfter) IsPresent() bool
IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.
func (VectorStoreUpdateParamsExpiresAfter) MarshalJSON ¶
func (r VectorStoreUpdateParamsExpiresAfter) MarshalJSON() (data []byte, err error)
Source Files
¶
- aliases.go
- audio.go
- audiospeech.go
- audiotranscription.go
- audiotranslation.go
- batch.go
- beta.go
- betaassistant.go
- betathread.go
- betathreadmessage.go
- betathreadrun.go
- betathreadrunstep.go
- chat.go
- chatcompletion.go
- chatcompletionmessage.go
- client.go
- completion.go
- embedding.go
- field.go
- file.go
- finetuning.go
- finetuningcheckpoint.go
- finetuningcheckpointpermission.go
- finetuningjob.go
- finetuningjobcheckpoint.go
- image.go
- model.go
- moderation.go
- polling.go
- streamaccumulator.go
- upload.go
- uploadpart.go
- vectorstore.go
- vectorstorefile.go
- vectorstorefilebatch.go
Directories
¶
Path | Synopsis |
---|---|
Package azure provides configuration options so you can connect and use Azure OpenAI using the [openai.Client].
|
Package azure provides configuration options so you can connect and use Azure OpenAI using the [openai.Client]. |
examples
module
|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package. |
packages
|
|